Changeset 88508 in vbox for trunk/src/VBox
- Timestamp:
- Apr 14, 2021 2:00:09 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UITools.cpp
r88122 r88508 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 … … 20 20 21 21 /* GUI includes: */ 22 #include "UICommon.h" 22 23 #include "UITools.h" 23 24 #include "UIToolsModel.h" 24 25 #include "UIToolsView.h" 25 26 #include "UIVirtualBoxManagerWidget.h" 26 #include "UICommon.h"27 27 28 28 29 UITools::UITools(UIVirtualBoxManagerWidget *pParent )29 UITools::UITools(UIVirtualBoxManagerWidget *pParent /* = 0 */) 30 30 : QWidget(pParent, Qt::Popup) 31 31 , m_pManagerWidget(pParent) … … 34 34 , m_pToolsView(0) 35 35 { 36 /* Prepare: */37 36 prepare(); 38 }39 40 UITools::~UITools()41 {42 /* Cleanup: */43 cleanup();44 37 } 45 38 … … 106 99 void UITools::prepare() 107 100 { 108 /* Prepare palette: */101 /* Prepare everything: */ 109 102 preparePalette(); 110 /* Prepare layout: */ 111 prepareLayout(); 112 /* Prepare model: */ 113 prepareModel(); 114 /* Prepare view: */ 115 prepareView(); 116 /* Prepare connections: */ 103 prepareContents(); 117 104 prepareConnections(); 118 105 119 /* Load settings: */120 loadSettings();106 /* Init model finally: */ 107 initModel(); 121 108 } 122 109 123 110 void UITools::preparePalette() 124 111 { 125 /* Setup palette: */126 112 setAutoFillBackground(true); 127 113 QPalette pal = palette(); … … 131 117 } 132 118 133 void UITools::prepare Layout()119 void UITools::prepareContents() 134 120 { 135 121 /* Setup own layout rules: */ 136 122 setSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding); 137 123 138 /* Create main-layout: */124 /* Prepare main-layout: */ 139 125 m_pMainLayout = new QVBoxLayout(this); 140 126 if (m_pMainLayout) 141 127 { 142 /* Configure main-layout: */143 128 m_pMainLayout->setContentsMargins(1, 1, 1, 1); 144 129 m_pMainLayout->setSpacing(0); 130 131 /* Prepare model: */ 132 prepareModel(); 145 133 } 146 134 } … … 148 136 void UITools::prepareModel() 149 137 { 150 /* Create Tools-model: */138 /* Prepare model: */ 151 139 m_pToolsModel = new UIToolsModel(this); 140 if (m_pToolsModel) 141 prepareView(); 152 142 } 153 143 154 144 void UITools::prepareView() 155 145 { 156 /* Setup Tools-view: */ 146 AssertPtrReturnVoid(m_pToolsModel); 147 AssertPtrReturnVoid(m_pMainLayout); 148 149 /* Prepare view: */ 157 150 m_pToolsView = new UIToolsView(this); 158 151 if (m_pToolsView) 159 152 { 160 /* Configure Tools-view. */161 153 m_pToolsView->setScene(m_pToolsModel->scene()); 162 154 m_pToolsView->show(); … … 170 162 void UITools::prepareConnections() 171 163 { 172 /* Setup Tools-model connections: */164 /* Model connections: */ 173 165 connect(m_pToolsModel, &UIToolsModel::sigItemMinimumWidthHintChanged, 174 166 m_pToolsView, &UIToolsView::sltMinimumWidthHintChanged); … … 178 170 m_pToolsView, &UIToolsView::sltFocusChanged); 179 171 180 /* Setup Tools-view connections: */172 /* View connections: */ 181 173 connect(m_pToolsView, &UIToolsView::sigResized, 182 174 m_pToolsModel, &UIToolsModel::sltHandleViewResized); 183 175 } 184 176 185 void UITools:: loadSettings()177 void UITools::initModel() 186 178 { 187 /* Init model: */188 179 m_pToolsModel->init(); 189 180 } 190 191 void UITools::saveSettings()192 {193 /* Deinit model: */194 m_pToolsModel->deinit();195 }196 197 void UITools::cleanup()198 {199 /* Save settings: */200 saveSettings();201 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UITools.h
r88122 r88508 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 … … 57 57 58 58 /** Constructs Tools-pane passing @a pParent to the base-class. */ 59 UITools(UIVirtualBoxManagerWidget *pParent); 60 /** Destructs Tools-pane. */ 61 virtual ~UITools() /* override */; 59 UITools(UIVirtualBoxManagerWidget *pParent = 0); 62 60 63 61 /** @name General stuff. … … 114 112 /** Prepares palette. */ 115 113 void preparePalette(); 116 /** Prepares layout. */117 void prepare Layout();114 /** Prepares contents. */ 115 void prepareContents(); 118 116 /** Prepares model. */ 119 117 void prepareModel(); … … 122 120 /** Prepares connections. */ 123 121 void prepareConnections(); 124 /** Loads settings. */ 125 void loadSettings(); 126 127 /** Saves settings. */ 128 void saveSettings(); 129 /** Cleanups all. */ 130 void cleanup(); 122 /** Inits model. */ 123 void initModel(); 131 124 /** @} */ 132 125 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.cpp
r88252 r88508 84 84 } 85 85 86 void UIToolsModel::deinit()87 {88 /* Save last selected item: */89 saveLastSelectedItems();90 }91 92 86 UITools *UIToolsModel::tools() const 93 87 { … … 629 623 void UIToolsModel::cleanup() 630 624 { 625 /* Save last selected item: */ 626 saveLastSelectedItems(); 631 627 /* Cleanup connections: */ 632 628 cleanupConnections(); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.h
r88122 r88508 86 86 /** Inits model. */ 87 87 void init(); 88 /** Deinits model. */89 void deinit();90 88 91 89 /** Returns the Tools reference. */
Note:
See TracChangeset
for help on using the changeset viewer.