Changeset 88506 in vbox
- Timestamp:
- Apr 14, 2021 12:51:11 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/details
- Files:
-
- 2 edited
-
UIDetails.cpp (modified) (5 diffs)
-
UIDetails.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetails.cpp
r87103 r88506 5 5 6 6 /* 7 * Copyright (C) 2012-202 0Oracle Corporation7 * Copyright (C) 2012-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 29 29 UIDetails::UIDetails(QWidget *pParent /* = 0 */) 30 30 : QWidget(pParent) 31 , m_pMainLayout(0) 31 32 , m_pDetailsModel(0) 32 33 , m_pDetailsView(0) 33 34 { 34 /* Prepare: */35 35 prepare(); 36 36 } … … 44 44 void UIDetails::prepare() 45 45 { 46 /* Create main-layout: */ 47 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 48 if (pMainLayout) 46 /* Prepare everything: */ 47 prepareContents(); 48 prepareConnections(); 49 50 /* Configure context-sensitive help: */ 51 uiCommon().setHelpKeyword(this, "vm-details-tool"); 52 53 /* Init model finally: */ 54 initModel(); 55 } 56 57 void UIDetails::prepareContents() 58 { 59 /* Prepare main-layout: */ 60 m_pMainLayout = new QVBoxLayout(this); 61 if (m_pMainLayout) 49 62 { 50 pMainLayout->setContentsMargins(0, 0, 0, 0);51 pMainLayout->setSpacing(0);63 m_pMainLayout->setContentsMargins(0, 0, 0, 0); 64 m_pMainLayout->setSpacing(0); 52 65 53 /* Create details-model: */ 54 m_pDetailsModel = new UIDetailsModel(this); 55 if (m_pDetailsModel) 56 { 57 /* Create details-view: */ 58 m_pDetailsView = new UIDetailsView(this); 59 if (m_pDetailsView) 60 { 61 m_pDetailsView->setScene(m_pDetailsModel->scene()); 62 m_pDetailsView->show(); 63 setFocusProxy(m_pDetailsView); 66 /* Prepare model: */ 67 prepareModel(); 68 } 69 } 64 70 65 /* Add into layout: */ 66 pMainLayout->addWidget(m_pDetailsView); 67 } 71 void UIDetails::prepareModel() 72 { 73 /* Prepare model: */ 74 m_pDetailsModel = new UIDetailsModel(this); 75 if (m_pDetailsModel) 76 prepareView(); 77 } 68 78 69 /* Init model: */ 70 m_pDetailsModel->init(); 71 } 79 void UIDetails::prepareView() 80 { 81 AssertPtrReturnVoid(m_pDetailsModel); 82 AssertPtrReturnVoid(m_pMainLayout); 83 84 /* Prepare view: */ 85 m_pDetailsView = new UIDetailsView(this); 86 if (m_pDetailsView) 87 { 88 m_pDetailsView->setScene(m_pDetailsModel->scene()); 89 m_pDetailsView->show(); 90 setFocusProxy(m_pDetailsView); 91 92 /* Add into layout: */ 93 m_pMainLayout->addWidget(m_pDetailsView); 72 94 } 95 } 73 96 97 void UIDetails::prepareConnections() 98 { 74 99 /* Extra-data events connections: */ 75 100 connect(gEDataManager, &UIExtraDataManager::sigDetailsCategoriesChange, … … 78 103 m_pDetailsModel, &UIDetailsModel::sltHandleExtraDataOptionsChange); 79 104 80 /* Setup details-model connections: */105 /* Model connections: */ 81 106 connect(m_pDetailsModel, &UIDetailsModel::sigRootItemMinimumWidthHintChanged, 82 107 m_pDetailsView, &UIDetailsView::sltMinimumWidthHintChanged); … … 88 113 m_pDetailsModel, &UIDetailsModel::sltHandleToggleFinished); 89 114 90 /* Setup details-view connections: */115 /* View connections: */ 91 116 connect(m_pDetailsView, &UIDetailsView::sigResized, 92 117 m_pDetailsModel, &UIDetailsModel::sltHandleViewResize); 118 } 93 119 94 /* For context sensitive help: */ 95 uiCommon().setHelpKeyword(this, "vm-details-tool"); 120 void UIDetails::initModel() 121 { 122 m_pDetailsModel->init(); 96 123 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetails.h
r82968 r88506 5 5 6 6 /* 7 * Copyright (C) 2012-202 0Oracle Corporation7 * Copyright (C) 2012-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 27 27 /* Forward declartions: */ 28 28 class QString; 29 class QVBoxLayout; 29 30 class UIDetailsModel; 30 31 class UIDetailsView; … … 38 39 signals: 39 40 40 /** Notifies listeners about link click. 41 * @param strCategory Brings link category. 42 * @param strControl Brings control name. 43 * @param uId Brings machine ID. */ 44 void sigLinkClicked(const QString &strCategory, 45 const QString &strControl, 46 const QUuid &uId); 47 48 /** Notifies listeners about toggling started. */ 49 void sigToggleStarted(); 50 /** Notifies listeners about toggling finished. */ 51 void sigToggleFinished(); 41 /** @name General stuff. 42 * @{ */ 43 /** Notifies listeners about link click. 44 * @param strCategory Brings link category. 45 * @param strControl Brings control name. 46 * @param uId Brings machine ID. */ 47 void sigLinkClicked(const QString &strCategory, 48 const QString &strControl, 49 const QUuid &uId); 50 51 /** Notifies listeners about toggling started. */ 52 void sigToggleStarted(); 53 /** Notifies listeners about toggling finished. */ 54 void sigToggleFinished(); 55 /** @} */ 52 56 53 57 public: … … 55 59 /** Constructs Details pane passing @a pParent to the base-class. */ 56 60 UIDetails(QWidget *pParent = 0); 57 58 /** Return the Details-model instance. */ 59 UIDetailsModel *model() const { return m_pDetailsModel; } 60 /** Return the Details-view instance. */ 61 UIDetailsView *view() const { return m_pDetailsView; } 62 63 /** Replaces current model @a items. */ 64 void setItems(const QList<UIVirtualMachineItem*> &items); 61 62 /** @name General stuff. 63 * @{ */ 64 /** Return the Details-model instance. */ 65 UIDetailsModel *model() const { return m_pDetailsModel; } 66 /** Return the Details-view instance. */ 67 UIDetailsView *view() const { return m_pDetailsView; } 68 69 /** Replaces current model @a items. */ 70 void setItems(const QList<UIVirtualMachineItem*> &items); 71 /** @} */ 65 72 66 73 private: 67 74 68 /** Prepares all. */ 69 void prepare(); 75 /** @name Prepare/Cleanup cascade. 76 * @{ */ 77 /** Prepares all. */ 78 void prepare(); 79 /** Prepares contents. */ 80 void prepareContents(); 81 /** Prepares model. */ 82 void prepareModel(); 83 /** Prepares view. */ 84 void prepareView(); 85 /** Prepares connections. */ 86 void prepareConnections(); 87 /** Inits model. */ 88 void initModel(); 89 /** @} */ 70 90 71 /** Holds the details model instance. */ 72 UIDetailsModel *m_pDetailsModel; 73 /** Holds the details view instance. */ 74 UIDetailsView *m_pDetailsView; 91 /** @name General stuff. 92 * @{ */ 93 /** Holds the main layout instance. */ 94 QVBoxLayout *m_pMainLayout; 95 /** Holds the details model instance. */ 96 UIDetailsModel *m_pDetailsModel; 97 /** Holds the details view instance. */ 98 UIDetailsView *m_pDetailsView; 99 /** @} */ 75 100 }; 76 101
Note:
See TracChangeset
for help on using the changeset viewer.

