Changeset 25136 in vbox for trunk/src/VBox/Frontends/VirtualBox/include/VBoxBootTable.h
- Timestamp:
- Dec 1, 2009 6:36:30 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 55525
- File:
-
- 1 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
Note:
See TracChangeset
for help on using the changeset viewer.