Changeset 74677 in vbox for trunk/src/VBox
- Timestamp:
- Oct 8, 2018 12:51:19 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/details
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetails.cpp
r74674 r74677 5 5 6 6 /* 7 * Copyright (C) 2012-201 7Oracle Corporation7 * Copyright (C) 2012-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 35 35 UIDetails::UIDetails(QWidget *pParent /* = 0 */) 36 36 : QWidget(pParent) 37 , m_pMainLayout(0)38 37 , m_pDetailsModel(0) 39 38 , m_pDetailsView(0) 40 39 { 41 /* Prepare layout: */ 42 prepareLayout(); 43 44 /* Prepare model: */ 45 prepareModel(); 46 47 /* Prepare view: */ 48 prepareView(); 49 50 /* Prepare connections: */ 51 prepareConnections(); 40 /* Prepare: */ 41 prepare(); 52 42 } 53 43 … … 58 48 } 59 49 60 void UIDetails::prepare Layout()50 void UIDetails::prepare() 61 51 { 62 /* Setup main-layout: */ 63 m_pMainLayout = new QVBoxLayout(this); 64 const int iL = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 9; 65 m_pMainLayout->setContentsMargins(iL, 0, 0, 0); 66 m_pMainLayout->setSpacing(0); 67 } 52 /* Create main-layout: */ 53 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 54 if (pMainLayout) 55 { 56 const int iL = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 9; 57 pMainLayout->setContentsMargins(iL, 0, 0, 0); 58 pMainLayout->setSpacing(0); 68 59 69 void UIDetails::prepareModel() 70 { 71 /* Setup details-model: */ 72 m_pDetailsModel = new UIDetailsModel(this); 73 } 60 /* Create details-model: */ 61 m_pDetailsModel = new UIDetailsModel(this); 62 if (m_pDetailsModel) 63 { 64 /* Create details-view: */ 65 m_pDetailsView = new UIDetailsView(this); 66 if (m_pDetailsView) 67 { 68 m_pDetailsView->setScene(m_pDetailsModel->scene()); 69 m_pDetailsView->show(); 70 setFocusProxy(m_pDetailsView); 74 71 75 void UIDetails::prepareView() 76 { 77 /* Setup details-view: */ 78 m_pDetailsView = new UIDetailsView(this); 79 m_pDetailsView->setScene(m_pDetailsModel->scene()); 80 m_pDetailsView->show(); 81 setFocusProxy(m_pDetailsView); 82 m_pMainLayout->addWidget(m_pDetailsView); 83 } 72 /* Add into layout: */ 73 pMainLayout->addWidget(m_pDetailsView); 74 } 75 } 76 } 84 77 85 void UIDetails::prepareConnections()86 {87 78 /* Setup details-model connections: */ 88 connect(m_pDetailsModel, SIGNAL(sigRootItemMinimumWidthHintChanged(int)),89 m_pDetailsView, SLOT(sltMinimumWidthHintChanged(int)));90 connect(m_pDetailsModel, SIGNAL(sigRootItemMinimumHeightHintChanged(int)),91 m_pDetailsView, SLOT(sltMinimumHeightHintChanged(int)));92 connect(m_pDetailsModel, SIGNAL(sigLinkClicked(const QString&, const QString&, const QString&)),93 this, SIGNAL(sigLinkClicked(const QString&, const QString&, const QString&)));94 connect(this, SIGNAL(sigSlidingStarted()),95 m_pDetailsModel, SLOT(sltHandleSlidingStarted()));96 connect(this, SIGNAL(sigToggleStarted()),97 m_pDetailsModel, SLOT(sltHandleToggleStarted()));98 connect(this, SIGNAL(sigToggleFinished()),99 m_pDetailsModel, SLOT(sltHandleToggleFinished()));79 connect(m_pDetailsModel, &UIDetailsModel::sigRootItemMinimumWidthHintChanged, 80 m_pDetailsView, &UIDetailsView::sltMinimumWidthHintChanged); 81 connect(m_pDetailsModel, &UIDetailsModel::sigRootItemMinimumHeightHintChanged, 82 m_pDetailsView, &UIDetailsView::sltMinimumHeightHintChanged); 83 connect(m_pDetailsModel, &UIDetailsModel::sigLinkClicked, 84 this, &UIDetails::sigLinkClicked); 85 connect(this, &UIDetails::sigSlidingStarted, 86 m_pDetailsModel, &UIDetailsModel::sltHandleSlidingStarted); 87 connect(this, &UIDetails::sigToggleStarted, 88 m_pDetailsModel, &UIDetailsModel::sltHandleToggleStarted); 89 connect(this, &UIDetails::sigToggleFinished, 90 m_pDetailsModel, &UIDetailsModel::sltHandleToggleFinished); 100 91 101 92 /* Setup details-view connections: */ 102 connect(m_pDetailsView, SIGNAL(sigResized()),103 m_pDetailsModel, SLOT(sltHandleViewResize()));93 connect(m_pDetailsView, &UIDetailsView::sigResized, 94 m_pDetailsModel, &UIDetailsModel::sltHandleViewResize); 104 95 } 105 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetails.h
r74674 r74677 5 5 6 6 /* 7 * Copyright (C) 2012-201 7Oracle Corporation7 * Copyright (C) 2012-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 #ifndef __ UIDetails_h__19 #define __ UIDetails_h__18 #ifndef ___UIDetails_h___ 19 #define ___UIDetails_h___ 20 20 21 21 /* Qt includes: */ … … 24 24 /* Forward declartions: */ 25 25 class QVBoxLayout; 26 class QWidget; 26 27 class UIDetailsModel; 27 28 class UIDetailsView; 28 29 class UIVirtualMachineItem; 29 30 30 /* Details widget:*/31 /** QWidget-based Details pane container. */ 31 32 class UIDetails : public QWidget 32 33 { … … 35 36 signals: 36 37 37 /* Notifier: Link processing stuff: */ 38 void sigLinkClicked(const QString &strCategory, const QString &strControl, const QString &strId); 38 /** Notifies listeners about link click. 39 * @param strCategory Brings link category. 40 * @param strControl Brings control name. 41 * @param strId Brings machine ID. */ 42 void sigLinkClicked(const QString &strCategory, 43 const QString &strControl, 44 const QString &strId); 39 45 40 /* Notifier: Sliding stuff:*/46 /** Notifies listeners about sliding started. */ 41 47 void sigSlidingStarted(); 42 48 43 /* Notifiers: Toggle stuff:*/49 /** Notifies listeners about toggling started. */ 44 50 void sigToggleStarted(); 51 /** Notifies listeners about toggling finished. */ 45 52 void sigToggleFinished(); 46 53 47 54 public: 48 55 49 /* Constructor:*/56 /** Constructs Details pane passing @a pParent to the base-class. */ 50 57 UIDetails(QWidget *pParent = 0); 51 58 … … 55 62 UIDetailsView *view() const { return m_pDetailsView; } 56 63 57 /* API: Current item(s) stuff:*/64 /** Replaces current model @a items. */ 58 65 void setItems(const QList<UIVirtualMachineItem*> &items); 59 66 60 67 private: 61 68 62 /* Helpers: Prepare stuff: */ 63 void prepareLayout(); 64 void prepareModel(); 65 void prepareView(); 66 void prepareConnections(); 69 /** Prepares all. */ 70 void prepare(); 67 71 68 /* Variables: */ 69 QVBoxLayout *m_pMainLayout; 72 /** Holds the details model instance. */ 70 73 UIDetailsModel *m_pDetailsModel; 71 UIDetailsView *m_pDetailsView; 74 /** Holds the details view instance. */ 75 UIDetailsView *m_pDetailsView; 72 76 }; 73 77 74 #endif /* __UIDetails_h__ */ 75 78 #endif /* !___UIDetails_h___ */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsModel.cpp
r74110 r74677 117 117 /* Relayout: */ 118 118 updateLayout(); 119 } 120 121 void UIDetailsModel::sltHandleSlidingStarted() 122 { 123 m_pRoot->stopBuildingGroup(); 124 } 125 126 void UIDetailsModel::sltHandleToggleStarted() 127 { 128 m_pRoot->stopBuildingGroup(); 129 } 130 131 void UIDetailsModel::sltHandleToggleFinished() 132 { 133 m_pRoot->rebuildGroup(); 119 134 } 120 135 … … 197 212 } 198 213 199 void UIDetailsModel::sltHandleSlidingStarted()200 {201 m_pRoot->stopBuildingGroup();202 }203 204 void UIDetailsModel::sltHandleToggleStarted()205 {206 m_pRoot->stopBuildingGroup();207 }208 209 void UIDetailsModel::sltHandleToggleFinished()210 {211 m_pRoot->rebuildGroup();212 }213 214 214 QVariant UIDetailsModel::data(int iKey) const 215 215 { -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsModel.h
r73424 r74677 84 84 const QMap<DetailsElementType, bool>& settings() const { return m_settings; } 85 85 86 p rivateslots:86 public slots: 87 87 88 88 /* Handler: Details-view stuff: */ 89 89 void sltHandleViewResize(); 90 91 /* Handlers: Chooser stuff: */ 92 void sltHandleSlidingStarted(); 93 void sltHandleToggleStarted(); 94 void sltHandleToggleFinished(); 95 96 private slots: 90 97 91 98 /* Handlers: Element-items stuff: */ … … 93 100 void sltToggleAnimationFinished(DetailsElementType type, bool fToggled); 94 101 void sltElementTypeToggled(); 95 96 /* Handlers: Chooser stuff: */97 void sltHandleSlidingStarted();98 void sltHandleToggleStarted();99 void sltHandleToggleFinished();100 102 101 103 private: -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsView.h
r73424 r74677 45 45 UIDetails *details() const { return m_pDetails; } 46 46 47 p rivateslots:47 public slots: 48 48 49 49 /* Handlers: Size-hint stuff: */
Note:
See TracChangeset
for help on using the changeset viewer.