Changeset 25136 in vbox for trunk/src/VBox/Frontends/VirtualBox/include
- Timestamp:
- Dec 1, 2009 6:36:30 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 55525
- Location:
- trunk/src/VBox/Frontends/VirtualBox/include
- Files:
-
- 1 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxBootTable.h
r25125 r25136 2 2 * 3 3 * VBox frontends: Qt4 GUI ("VirtualBox"): 4 * VBox SettingsUtilsclass declaration4 * VBoxBootTable class declaration 5 5 */ 6 6 7 7 /* 8 * Copyright (C) 200 6-2008Sun Microsystems, Inc.8 * Copyright (C) 2009 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 */ 22 22 23 #ifndef __VBox SettingsUtils_h__24 #define __VBox SettingsUtils_h__23 #ifndef __VBoxBootTable_h__ 24 #define __VBoxBootTable_h__ 25 25 26 #include <VBoxGlobal.h> 27 28 /* Qt includes */ 29 #ifdef Q_WS_WIN 30 #include <QDialog> 31 #include <QLineEdit> 32 #include <QPushButton> 33 #endif 34 #include <QHBoxLayout> 35 #include <QLabel> 26 /* Global includes */ 36 27 #include <QTreeWidget> 37 #include <QHeaderView>38 #include <QKeyEvent>39 #include <QTableView>40 41 enum42 {43 /* mTwUSBFilters column numbers */44 twUSBFilters_Name = 0,45 };46 28 47 29 /** … … 52 34 * Emits itemToggled() signal when the item changed. 53 35 */ 54 class BootItemsTable : public QTreeWidget36 class VBoxBootTable : public QTreeWidget 55 37 { 56 38 Q_OBJECT; … … 58 40 public: 59 41 60 BootItemsTable (QWidget *aParent) : QTreeWidget (aParent) 61 { 62 header()->hide(); 63 connect (this, SIGNAL (itemChanged (QTreeWidgetItem *, int)), 64 this, SLOT (onItemChanged())); 65 } 66 67 ~BootItemsTable() {} 42 VBoxBootTable(QWidget *pParent); 68 43 69 44 signals: … … 73 48 void itemToggled(); 74 49 50 protected: 51 52 void keyPressEvent(QKeyEvent *pEvent); 53 75 54 private slots: 76 55 77 void onItemChanged() 78 { 79 emit itemToggled(); 80 } 81 82 void keyPressEvent (QKeyEvent *aEvent) 83 { 84 if (aEvent->QInputEvent::modifiers () == Qt::ControlModifier) 85 { 86 switch (aEvent->key()) 87 { 88 case Qt::Key_Up: 89 emit moveItemUp(); 90 return; 91 case Qt::Key_Down: 92 emit moveItemDown(); 93 return; 94 default: 95 break; 96 } 97 } 98 QTreeWidget::keyPressEvent (aEvent); 99 } 56 void onItemChanged(); 100 57 }; 101 58 102 class USBListItem : public QTreeWidgetItem 103 { 104 public: 59 #endif // __VBoxBootTable_h__ 105 60 106 enum { USBListItemType = 1002 };107 108 USBListItem (QTreeWidget *aParent)109 : QTreeWidgetItem (aParent, QStringList (QString::null), USBListItemType)110 , mId (-1) {}111 112 USBListItem (QTreeWidget *aParent, QTreeWidgetItem *aPreceding)113 : QTreeWidgetItem (aParent, aPreceding, USBListItemType)114 , mId (-1) {}115 116 int mId;117 };118 119 /**120 * Table-View class reimplementation to extend standard QTableView.121 */122 class QITableView : public QTableView123 {124 Q_OBJECT;125 126 public:127 128 QITableView (QWidget *aParent) : QTableView (aParent) {}129 130 signals:131 132 void currentChanged (const QModelIndex &aCurrent);133 134 protected:135 136 void currentChanged (const QModelIndex &aCurrent,137 const QModelIndex &aPrevious)138 {139 QTableView::currentChanged (aCurrent, aPrevious);140 emit currentChanged (aCurrent);141 }142 143 void focusInEvent (QFocusEvent *aEvent)144 {145 /* Restore edit-mode on focus in. */146 QTableView::focusInEvent (aEvent);147 if (model()->flags (currentIndex()) & Qt::ItemIsEditable)148 edit (currentIndex());149 }150 };151 152 class VBoxWarnIconLabel: public QWidget153 {154 Q_OBJECT;155 156 public:157 158 VBoxWarnIconLabel (QWidget *aParent = NULL)159 : QWidget (aParent)160 {161 QHBoxLayout *layout = new QHBoxLayout (this);162 VBoxGlobal::setLayoutMargin (layout, 0);163 layout->addWidget (&mIcon);164 layout->addWidget (&mLabel);165 setVisible (false);166 }167 168 void setWarningPixmap (const QPixmap& aPixmap) { mIcon.setPixmap (aPixmap); }169 void setWarningText (const QString& aText) { mLabel.setText (aText); }170 171 private:172 173 QLabel mIcon;174 QLabel mLabel;175 };176 177 #endif // __VBoxSettingsUtils_h__178 -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxSettingsDialog.h
r21804 r25136 35 35 36 36 /* VBox forwards*/ 37 class VBoxWarn IconLabel;37 class VBoxWarningPane; 38 38 class VBoxSettingsSelector; 39 39 class VBoxSettingsPage; … … 106 106 QPixmap mErrorIcon; 107 107 QPixmap mWarnIcon; 108 VBoxWarn IconLabel*mIconLabel;108 VBoxWarningPane *mIconLabel; 109 109 110 110 /* WhatsThis Stuff */ -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxWarningPane.h
r25125 r25136 2 2 * 3 3 * VBox frontends: Qt4 GUI ("VirtualBox"): 4 * VBox SettingsUtilsclass declaration4 * VBoxWarningPane class declaration 5 5 */ 6 6 7 7 /* 8 * Copyright (C) 200 6-2008Sun Microsystems, Inc.8 * Copyright (C) 2009 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 */ 22 22 23 #ifndef __VBox SettingsUtils_h__24 #define __VBox SettingsUtils_h__23 #ifndef __VBoxWarningPane_h__ 24 #define __VBoxWarningPane_h__ 25 25 26 #include <VBoxGlobal.h> 26 /* Global includes */ 27 #include <QWidget> 28 #include <QLabel> 27 29 28 /* Qt includes */ 29 #ifdef Q_WS_WIN 30 #include <QDialog> 31 #include <QLineEdit> 32 #include <QPushButton> 33 #endif 34 #include <QHBoxLayout> 35 #include <QLabel> 36 #include <QTreeWidget> 37 #include <QHeaderView> 38 #include <QKeyEvent> 39 #include <QTableView> 40 41 enum 42 { 43 /* mTwUSBFilters column numbers */ 44 twUSBFilters_Name = 0, 45 }; 46 47 /** 48 * QTreeWidget class reimplementation to use as boot items table. 49 * It has one unsorted column without header. 50 * Keymapping handlers for ctrl-up & ctrl-down are translated into 51 * boot-items up/down moving signals. 52 * Emits itemToggled() signal when the item changed. 53 */ 54 class BootItemsTable : public QTreeWidget 30 class VBoxWarningPane: public QWidget 55 31 { 56 32 Q_OBJECT; … … 58 34 public: 59 35 60 BootItemsTable (QWidget *aParent) : QTreeWidget (aParent) 61 { 62 header()->hide(); 63 connect (this, SIGNAL (itemChanged (QTreeWidgetItem *, int)), 64 this, SLOT (onItemChanged())); 65 } 36 VBoxWarningPane(QWidget *pParent = 0); 66 37 67 ~BootItemsTable() {} 68 69 signals: 70 71 void moveItemUp(); 72 void moveItemDown(); 73 void itemToggled(); 74 75 private slots: 76 77 void onItemChanged() 78 { 79 emit itemToggled(); 80 } 81 82 void keyPressEvent (QKeyEvent *aEvent) 83 { 84 if (aEvent->QInputEvent::modifiers () == Qt::ControlModifier) 85 { 86 switch (aEvent->key()) 87 { 88 case Qt::Key_Up: 89 emit moveItemUp(); 90 return; 91 case Qt::Key_Down: 92 emit moveItemDown(); 93 return; 94 default: 95 break; 96 } 97 } 98 QTreeWidget::keyPressEvent (aEvent); 99 } 100 }; 101 102 class USBListItem : public QTreeWidgetItem 103 { 104 public: 105 106 enum { USBListItemType = 1002 }; 107 108 USBListItem (QTreeWidget *aParent) 109 : QTreeWidgetItem (aParent, QStringList (QString::null), USBListItemType) 110 , mId (-1) {} 111 112 USBListItem (QTreeWidget *aParent, QTreeWidgetItem *aPreceding) 113 : QTreeWidgetItem (aParent, aPreceding, USBListItemType) 114 , mId (-1) {} 115 116 int mId; 117 }; 118 119 /** 120 * Table-View class reimplementation to extend standard QTableView. 121 */ 122 class QITableView : public QTableView 123 { 124 Q_OBJECT; 125 126 public: 127 128 QITableView (QWidget *aParent) : QTableView (aParent) {} 129 130 signals: 131 132 void currentChanged (const QModelIndex &aCurrent); 133 134 protected: 135 136 void currentChanged (const QModelIndex &aCurrent, 137 const QModelIndex &aPrevious) 138 { 139 QTableView::currentChanged (aCurrent, aPrevious); 140 emit currentChanged (aCurrent); 141 } 142 143 void focusInEvent (QFocusEvent *aEvent) 144 { 145 /* Restore edit-mode on focus in. */ 146 QTableView::focusInEvent (aEvent); 147 if (model()->flags (currentIndex()) & Qt::ItemIsEditable) 148 edit (currentIndex()); 149 } 150 }; 151 152 class VBoxWarnIconLabel: public QWidget 153 { 154 Q_OBJECT; 155 156 public: 157 158 VBoxWarnIconLabel (QWidget *aParent = NULL) 159 : QWidget (aParent) 160 { 161 QHBoxLayout *layout = new QHBoxLayout (this); 162 VBoxGlobal::setLayoutMargin (layout, 0); 163 layout->addWidget (&mIcon); 164 layout->addWidget (&mLabel); 165 setVisible (false); 166 } 167 168 void setWarningPixmap (const QPixmap& aPixmap) { mIcon.setPixmap (aPixmap); } 169 void setWarningText (const QString& aText) { mLabel.setText (aText); } 38 void setWarningPixmap(const QPixmap &imgPixmap); 39 void setWarningText(const QString &strText); 170 40 171 41 private: 172 42 173 QLabel m Icon;174 QLabel m Label;43 QLabel m_icon; 44 QLabel m_label; 175 45 }; 176 46 177 #endif // __VBox SettingsUtils_h__47 #endif // __VBoxWarningPane_h__ 178 48
Note:
See TracChangeset
for help on using the changeset viewer.