Changeset 76979 in vbox for trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSearchWidget.h
- Timestamp:
- Jan 24, 2019 3:59:56 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 128371
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSearchWidget.h
r76969 r76979 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UIMediumSe lectorclass declaration.3 * VBox Qt GUI - UIMediumSearchWidget class declaration. 4 4 */ 5 5 … … 16 16 */ 17 17 18 #ifndef FEQT_INCLUDED_SRC_medium_UIMediumSe lector_h19 #define FEQT_INCLUDED_SRC_medium_UIMediumSe lector_h18 #ifndef FEQT_INCLUDED_SRC_medium_UIMediumSearchWidget_h 19 #define FEQT_INCLUDED_SRC_medium_UIMediumSearchWidget_h 20 20 #ifndef RT_WITHOUT_PRAGMA_ONCE 21 21 # pragma once … … 23 23 24 24 /* GUI includes: */ 25 #include "QIMainDialog.h"26 25 #include "QIWithRetranslateUI.h" 27 #include "UIMedium.h"28 #include "UIMediumDefs.h"29 #include "UIMediumDetailsWidget.h"30 26 31 27 /* Forward declarations: */ 32 28 class QAction; 33 class QTreeWidgetItem; 34 class QITreeWidget; 35 class QITreeWidgetItem; 36 class QVBoxLayout; 29 class QLineEdit; 30 class QIComboBox; 37 31 class QIDialogButtonBox; 38 class UIMediumItem; 39 class UIMediumSearchWidget; 40 class UIToolBar; 32 class QIToolButton; 41 33 42 43 /** QIDialog extension providing GUI with a dialog to select an existing medium. */44 class SHARED_LIBRARY_STUFF UIMediumSelector : public QIWithRetranslateUI<QIMainDialog>34 /** QWidget extension providing a simple way to enter a earch term and search type for medium searching 35 * in virtual media manager, medium selection dialog, etc. */ 36 class SHARED_LIBRARY_STUFF UIMediumSearchWidget : public QIWithRetranslateUI<QWidget> 45 37 { 46 47 38 Q_OBJECT; 48 39 49 40 signals: 50 41 42 void sigPerformSearch(); 43 void sigShowNextMatchingItem(); 44 void sigShowPreviousMatchingItem(); 45 51 46 public: 52 47 53 UIMediumSelector(UIMediumDeviceType enmMediumType, const QString &machineName = QString(), 54 const QString &machineSettigFilePath = QString(), QWidget *pParent = 0); 55 QList<QUuid> selectedMediumIds() const; 48 enum SearchType 49 { 50 SearchByName, 51 SearchByUUID, 52 SearchByMax 53 }; 54 55 public: 56 57 UIMediumSearchWidget(QWidget *pParent = 0); 58 SearchType searchType() const; 59 QString searchTerm() const; 56 60 57 61 protected: 58 62 59 void showEvent(QShowEvent *pEvent);63 void retranslateUi() /* override */; 60 64 61 private slots:65 private: 62 66 63 void sltAddMedium(); 64 void sltCreateMedium(); 65 void sltHandleItemSelectionChanged(); 66 void sltHandleTreeWidgetDoubleClick(QTreeWidgetItem * item, int column); 67 void sltHandleMediumEnumerationStart(); 68 void sltHandleMediumEnumerated(); 69 void sltHandleMediumEnumerationFinish(); 70 void sltHandleRefresh(); 71 void sltHandlePerformSearch(); 72 void sltHandleShowNextMatchingItem(); 73 void sltHandleShowPreviousMatchingItem(); 74 void sltHandleTreeContextMenuRequest(const QPoint &point); 75 void sltHandleTreeExpandAllSignal(); 76 void sltHandleTreeCollapseAllSignal(); 77 78 private: 79 80 81 /** @name Event-handling stuff. 82 * @{ */ 83 /** Handles translation event. */ 84 virtual void retranslateUi() /* override */; 85 /** @} */ 86 87 /** @name Prepare/cleanup cascade. 88 * @{ */ 89 /** Configures all. */ 90 void configure(); 91 void prepareWidgets(); 92 void prepareActions(); 93 void prepareConnections(); 94 /** Perform final preparations. */ 95 void finalize(); 96 /** @} */ 97 98 void repopulateTreeWidget(); 99 /** Disable/enable 'ok' button on the basis of having a selected item */ 100 void updateOkButton(); 101 UIMediumItem* addTreeItem(const UIMedium &medium, QITreeWidgetItem *pParent); 102 void restoreSelection(const QList<QUuid> &selectedMediums, QVector<UIMediumItem*> &mediumList); 103 /** Recursively create the hard disk hierarchy under the tree widget */ 104 UIMediumItem* createHardDiskItem(const UIMedium &medium, QITreeWidgetItem *pParent); 105 UIMediumItem* searchItem(const QTreeWidgetItem *pParent, const QUuid &mediumId); 106 void performMediumSearch(); 107 /** Remember the default foreground brush of the tree so that we can reset tree items' foreground later */ 108 void saveDefaultForeground(); 109 void selectMedium(const QUuid &uMediumID); 110 void scrollToItem(UIMediumItem* pItem); 111 QWidget *m_pCentralWidget; 112 QVBoxLayout *m_pMainLayout; 113 QITreeWidget *m_pTreeWidget; 114 UIMediumDeviceType m_enmMediumType; 115 QIDialogButtonBox *m_pButtonBox; 116 QMenu *m_pMainMenu; 117 UIToolBar *m_pToolBar; 118 QAction *m_pActionAdd; 119 QAction *m_pActionCreate; 120 QAction *m_pActionRefresh; 121 /** All the known media that are already attached to some vm are added under the following top level tree item */ 122 QITreeWidgetItem *m_pAttachedSubTreeRoot; 123 /** All the known media that are not attached to any vm are added under the following top level tree item */ 124 QITreeWidgetItem *m_pNotAttachedSubTreeRoot; 125 QWidget *m_pParent; 126 UIMediumSearchWidget *m_pSearchWidget; 127 /** The list all items added to tree. kept in sync. with tree to make searching easier (faster). */ 128 QList<UIMediumItem*> m_mediumItemList; 129 /** List of items that are matching to the search. */ 130 QList<UIMediumItem*> m_mathingItemList; 131 /** Index of the currently shown (scrolled) item in the m_mathingItemList. */ 132 int m_iCurrentShownIndex; 133 QBrush m_defaultItemForeground; 134 QString m_strMachineSettingsFilePath; 135 QString m_strMachineName; 67 void prepareWidgets(); 68 QIComboBox *m_pSearchComboxBox; 69 QLineEdit *m_pSearchTermLineEdit; 70 QIToolButton *m_pShowNextMatchButton; 71 QIToolButton *m_pShowPreviousMatchButton; 136 72 }; 137 73 138 #endif /* !FEQT_INCLUDED_SRC_medium_UIMediumSe lector_h */74 #endif /* !FEQT_INCLUDED_SRC_medium_UIMediumSearchWidget_h */
Note:
See TracChangeset
for help on using the changeset viewer.