Changeset 71899 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Apr 18, 2018 2:16:02 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 122134
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r71898 r71899 556 556 src/widgets/UIApplianceExportEditorWidget.h \ 557 557 src/widgets/UIApplianceImportEditorWidget.h \ 558 src/widgets/UIBootTable.h \559 558 src/widgets/UIFilePathSelector.h \ 560 559 src/widgets/UIEmptyFilePathSelector.h \ … … 685 684 src/selector/UIActionPoolSelector.h \ 686 685 src/selector/UIVirtualBoxEventHandler.h \ 686 src/widgets/UIBootTable.h \ 687 687 src/widgets/UIHostComboEditor.h \ 688 688 src/widgets/UIPopupBox.h \ … … 773 773 src/selector/UIActionPoolSelector.h \ 774 774 src/selector/UIVirtualBoxEventHandler.h \ 775 src/widgets/UIBootTable.h \ 775 776 src/widgets/UIHostComboEditor.h \ 776 777 src/widgets/UIPopupBox.h \ … … 1039 1040 src/widgets/UIApplianceExportEditorWidget.cpp \ 1040 1041 src/widgets/UIApplianceImportEditorWidget.cpp \ 1041 src/widgets/UIBootTable.cpp \1042 1042 src/widgets/UIFilePathSelector.cpp \ 1043 1043 src/widgets/UIEmptyFilePathSelector.cpp \ … … 1208 1208 src/selector/UIVirtualBoxEventHandler.cpp \ 1209 1209 src/settings/UISettingsDefs.cpp \ 1210 src/widgets/UIBootTable.cpp \ 1210 1211 src/widgets/UIHostComboEditor.cpp \ 1211 1212 src/widgets/UIPopupBox.cpp \ … … 1322 1323 src/selector/UIVirtualBoxEventHandler.cpp \ 1323 1324 src/settings/UISettingsDefs.cpp \ 1325 src/widgets/UIBootTable.cpp \ 1324 1326 src/widgets/UIHostComboEditor.cpp \ 1325 1327 src/widgets/UIPopupBox.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.cpp
r71027 r71899 5 5 6 6 /* 7 * Copyright (C) 2009-201 7Oracle Corporation7 * Copyright (C) 2009-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 20 20 #else /* !VBOX_WITH_PRECOMPILED_HEADERS */ 21 21 22 /* Global include*/22 /* Qt includes: */ 23 23 # include <QScrollBar> 24 24 25 /* Local includes*/25 /* GUI includes: */ 26 26 # include "UIBootTable.h" 27 27 # include "UIConverter.h" … … 31 31 32 32 33 UIBootTableItem::UIBootTableItem(KDeviceType type) 34 : m_type(type) 33 /********************************************************************************************************************************* 34 * Class UIBootTableItem implementation. * 35 *********************************************************************************************************************************/ 36 37 UIBootTableItem::UIBootTableItem(KDeviceType enmType) 38 : m_enmType(enmType) 35 39 { 36 40 setCheckState(Qt::Unchecked); 37 switch( type)41 switch(enmType) 38 42 { 39 43 case KDeviceType_Floppy: setIcon(UIIconPool::iconSet(":/fd_16px.png")); break; … … 48 52 KDeviceType UIBootTableItem::type() const 49 53 { 50 return m_ type;54 return m_enmType; 51 55 } 52 56 53 57 void UIBootTableItem::retranslateUi() 54 58 { 55 setText(gpConverter->toString(m_ type));59 setText(gpConverter->toString(m_enmType)); 56 60 } 61 62 63 /********************************************************************************************************************************* 64 * Class UIBootTable implementation. * 65 *********************************************************************************************************************************/ 57 66 58 67 UIBootTable::UIBootTable(QWidget *pParent /* = 0 */) 59 68 : QIWithRetranslateUI<QListWidget>(pParent) 60 69 { 61 setDragDropMode(QAbstractItemView::InternalMove); 62 setSelectionMode(QAbstractItemView::SingleSelection); 63 setDropIndicatorShown(true); 64 setUniformItemSizes(true); 65 connect(this, SIGNAL(currentRowChanged(int)), 66 this, SIGNAL(sigRowChanged(int))); 70 prepare(); 67 71 } 68 72 69 73 void UIBootTable::adjustSizeToFitContent() 70 74 { 71 int h= 2 * frameWidth();72 int w = h;73 setFixedSize(sizeHintForColumn(0) + w,74 sizeHintForRow(0) * count() + h);75 const int iH = 2 * frameWidth(); 76 const int iW = iH; 77 setFixedSize(sizeHintForColumn(0) + iW, 78 sizeHintForRow(0) * count() + iH); 75 79 } 76 80 … … 97 101 void UIBootTable::dropEvent(QDropEvent *pEvent) 98 102 { 103 /* Call to base-class: */ 99 104 QListWidget::dropEvent(pEvent); 105 /* Separately notify listeners: */ 100 106 emit sigRowChanged(currentRow()); 101 107 } 102 108 103 QModelIndex UIBootTable::moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers)109 QModelIndex UIBootTable::moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers fModifiers) 104 110 { 105 if ( modifiers.testFlag(Qt::ControlModifier))111 if (fModifiers.testFlag(Qt::ControlModifier)) 106 112 { 107 113 switch (cursorAction) … … 135 141 } 136 142 } 137 return QListWidget::moveCursor(cursorAction, modifiers); 143 return QListWidget::moveCursor(cursorAction, fModifiers); 144 } 145 146 void UIBootTable::prepare() 147 { 148 setDragDropMode(QAbstractItemView::InternalMove); 149 setSelectionMode(QAbstractItemView::SingleSelection); 150 setDropIndicatorShown(true); 151 setUniformItemSizes(true); 152 connect(this, &UIBootTable::currentRowChanged, 153 this, &UIBootTable::sigRowChanged); 138 154 } 139 155 140 156 QModelIndex UIBootTable::moveItemTo(const QModelIndex &index, int row) 141 157 { 158 /* Check validity: */ 142 159 if (!index.isValid()) 143 160 return QModelIndex(); 144 161 162 /* Check sanity: */ 145 163 if (row < 0 || row > model()->rowCount()) 146 164 return QModelIndex(); … … 154 172 return QModelIndex(newIndex); 155 173 } 156 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.h
r71027 r71899 5 5 6 6 /* 7 * Copyright (C) 2009-201 7Oracle Corporation7 * Copyright (C) 2009-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 #ifndef __ UIBootTable_h__19 #define __ UIBootTable_h__18 #ifndef ___UIBootTable_h___ 19 #define ___UIBootTable_h___ 20 20 21 21 /* Qt includes: */ … … 24 24 /* GUI includes: */ 25 25 #include "QIWithRetranslateUI.h" 26 #include "UILibraryDefs.h" 26 27 27 28 /* COM includes: */ 28 29 #include "COMEnums.h" 29 30 30 class UIBootTableItem : public QListWidgetItem 31 32 /** QListWidgetItem extension for our UIBootTable. */ 33 class SHARED_LIBRARY_STUFF UIBootTableItem : public QListWidgetItem 31 34 { 32 35 public: 33 36 34 UIBootTableItem(KDeviceType type); 37 /** Constructs boot-table item of passed @a enmType. */ 38 UIBootTableItem(KDeviceType enmType); 35 39 40 /** Returns the item type. */ 36 41 KDeviceType type() const; 37 42 43 /** Performs item translation. */ 38 44 void retranslateUi(); 39 45 40 46 private: 41 47 42 /* Private member vars*/43 KDeviceType m_ type;48 /** Holds the item type. */ 49 KDeviceType m_enmType; 44 50 45 51 }; 46 52 47 class UIBootTable : public QIWithRetranslateUI<QListWidget> 53 54 /** QListWidget subclass used as system settings boot-table. */ 55 class SHARED_LIBRARY_STUFF UIBootTable : public QIWithRetranslateUI<QListWidget> 48 56 { 49 57 Q_OBJECT; 50 58 59 signals: 60 61 /** Notifies listeners about current table row changed. 62 * @note Same as base-class currentRowChanged but in wider cases. */ 63 void sigRowChanged(int iRow); 64 51 65 public: 52 66 67 /** Constructs boot-table passing @a pParent to the base-class. */ 53 68 UIBootTable(QWidget *pParent = 0); 54 69 70 /** Adjusts table size to fit contents. */ 55 71 void adjustSizeToFitContent(); 56 72 57 73 public slots: 58 74 75 /** Moves current item up. */ 59 76 void sltMoveItemUp(); 77 /** Moves current item down. */ 60 78 void sltMoveItemDown(); 61 62 signals:63 64 void sigRowChanged(int);65 79 66 80 protected: 67 81 68 void retranslateUi(); 69 void dropEvent(QDropEvent *pEvent); 70 QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers); 71 QModelIndex moveItemTo(const QModelIndex &index, int row); 82 /** Handles translation event. */ 83 virtual void retranslateUi() /* override */; 84 85 /** Handles drop @a pEvent. */ 86 virtual void dropEvent(QDropEvent *pEvent) /* override */; 87 88 /** Returns a QModelIndex object pointing to the next object in the view, 89 * based on the given @a cursorAction and keyboard @a fModifiers. */ 90 virtual QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction, 91 Qt::KeyboardModifiers fModifiers) /* override */; 92 93 private: 94 95 /** Prepares all. */ 96 void prepare(); 97 98 /** Moves item with passed @a index to specified @a iRow. */ 99 QModelIndex moveItemTo(const QModelIndex &index, int iRow); 72 100 }; 73 101 74 #endif // __UIBootTable_h__75 102 103 #endif /* !___UIBootTable_h___ */
Note:
See TracChangeset
for help on using the changeset viewer.