Changeset 54527 in vbox
- Timestamp:
- Feb 26, 2015 1:01:00 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp
r54350 r54527 24 24 # include <QPaintEvent> 25 25 # include <QMetaEnum> 26 # include <QCheckBox> 26 27 # include <QMenuBar> 27 28 # include <QPainter> … … 54 55 , m_pToolBar(0) 55 56 , m_pButtonClose(0) 57 , m_pCheckBoxEnable(0) 56 58 { 57 59 /* Prepare: */ … … 81 83 return; 82 84 85 /* Update enable-checkbox: */ 86 updateEnableCheckbox(); 87 83 88 /* Update menus: */ 84 89 updateMenus(); 90 } 91 92 void UIMenuBarEditorWidget::sltHandleMenuBarEnableToggle(bool fEnabled) 93 { 94 /* Toggle enable-checkbox if necessary: */ 95 if (m_fStartedFromVMSettings && m_pCheckBoxEnable) 96 { 97 /* Check whether this value is really changed: */ 98 const bool fMenuBarEnabled = gEDataManager->menuBarEnabled(machineID()); 99 if (fMenuBarEnabled != fEnabled) 100 { 101 /* Set new value: */ 102 gEDataManager->setMenuBarEnabled(fEnabled, machineID()); 103 } 104 } 85 105 } 86 106 … … 236 256 { 237 257 /* Configure main-layout: */ 238 #ifdef Q_WS_MAC239 /* Standard margins on Mac OS X are too big: */240 m_pMainLayout->setContentsMargins(10, 5, 10, 10);241 #else /* !Q_WS_MAC */242 /* Standard margins on Windows/X11: */243 258 int iLeft, iTop, iRight, iBottom; 244 259 m_pMainLayout->getContentsMargins(&iLeft, &iTop, &iRight, &iBottom); 260 /* Standard margins should not be too big: */ 261 iLeft = qMin(iLeft, 10); 262 iTop = qMin(iTop, 10); 263 iRight = qMin(iRight, 10); 264 iBottom = qMin(iBottom, 10); 265 /* Top margin should be smaller for the common case: */ 245 266 if (iTop >= 5) 246 267 iTop -= 5; 268 /* Right margin should be bigger for the settings case: */ 269 if (m_fStartedFromVMSettings) 270 iRight += 5; 271 /* Apply margins/spacing finally: */ 247 272 m_pMainLayout->setContentsMargins(iLeft, iTop, iRight, iBottom); 248 #endif /* !Q_WS_MAC */249 273 m_pMainLayout->setSpacing(0); 250 274 /* Create tool-bar: */ … … 272 296 /* Add close-button into main-layout: */ 273 297 m_pMainLayout->addWidget(m_pButtonClose); 298 } 299 } 300 /* Create enable-checkbox if necessary: */ 301 else 302 { 303 m_pCheckBoxEnable = new QCheckBox; 304 AssertPtrReturnVoid(m_pCheckBoxEnable); 305 { 306 /* Configure enable-checkbox: */ 307 m_pCheckBoxEnable->setFocusPolicy(Qt::StrongFocus); 308 connect(m_pCheckBoxEnable, SIGNAL(toggled(bool)), this, SLOT(sltHandleMenuBarEnableToggle(bool))); 309 /* Add enable-checkbox into main-layout: */ 310 m_pMainLayout->addWidget(m_pCheckBoxEnable); 311 /* Update enable-checkbox: */ 312 updateEnableCheckbox(); 274 313 } 275 314 } … … 599 638 } 600 639 640 void UIMenuBarEditorWidget::updateEnableCheckbox() 641 { 642 /* Update enable-checkbox if necessary: */ 643 if (m_fStartedFromVMSettings && m_pCheckBoxEnable) 644 { 645 m_pCheckBoxEnable->blockSignals(true); 646 m_pCheckBoxEnable->setChecked(gEDataManager->menuBarEnabled(machineID())); 647 m_pCheckBoxEnable->blockSignals(false); 648 } 649 } 650 601 651 void UIMenuBarEditorWidget::updateMenus() 602 652 { … … 887 937 if (!m_fStartedFromVMSettings && m_pButtonClose) 888 938 m_pButtonClose->setToolTip(tr("Close")); 939 /* Translate enable-checkbox if necessary: */ 940 if (m_fStartedFromVMSettings && m_pCheckBoxEnable) 941 m_pCheckBoxEnable->setToolTip(tr("Enable Menu Bar")); 889 942 } 890 943 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.h
r54272 r54527 31 31 class UIAction; 32 32 class QIToolButton; 33 class QCheckBox; 33 34 class QHBoxLayout; 34 35 class QAction; … … 86 87 void sltHandleConfigurationChange(const QString &strMachineID); 87 88 89 /** Handles menu-bar enable toggle. */ 90 void sltHandleMenuBarEnableToggle(bool fEnabled); 88 91 /** Handles menu-bar menu click. */ 89 92 void sltHandleMenuBarMenuClick(); … … 135 138 void prepareMenuHelp(); 136 139 137 /** Updates menus routine. */ 140 /** Update enable-checkbox routine. */ 141 void updateEnableCheckbox(); 142 /** Update menus routine. */ 138 143 void updateMenus(); 139 144 #ifdef Q_WS_MAC 140 /** Mac OS X: Update s'Application' menu routine. */145 /** Mac OS X: Update 'Application' menu routine. */ 141 146 void updateMenuApplication(); 142 147 #endif /* Q_WS_MAC */ 143 /** Update s'Machine' menu routine. */148 /** Update 'Machine' menu routine. */ 144 149 void updateMenuMachine(); 145 /** Update s'View' menu routine. */150 /** Update 'View' menu routine. */ 146 151 void updateMenuView(); 147 /** Update s'Input' menu routine. */152 /** Update 'Input' menu routine. */ 148 153 void updateMenuInput(); 149 /** Update s'Devices' menu routine. */154 /** Update 'Devices' menu routine. */ 150 155 void updateMenuDevices(); 151 156 #ifdef VBOX_WITH_DEBUGGER_GUI 152 /** Update s'Debug' menu routine. */157 /** Update 'Debug' menu routine. */ 153 158 void updateMenuDebug(); 154 159 #endif /* VBOX_WITH_DEBUGGER_GUI */ 155 160 #ifdef Q_WS_MAC 156 /** Mac OS X: Update s'Window' menu routine. */161 /** Mac OS X: Update 'Window' menu routine. */ 157 162 void updateMenuWindow(); 158 163 #endif /* Q_WS_MAC */ 159 /** Update s'Help' menu routine. */164 /** Update 'Help' menu routine. */ 160 165 void updateMenuHelp(); 161 166 … … 186 191 /** Holds the close-button instance. */ 187 192 QIToolButton *m_pButtonClose; 193 /** Holds the enable-checkbox instance. */ 194 QCheckBox *m_pCheckBoxEnable; 188 195 /** Holds tool-bar action references. */ 189 196 QMap<QString, QAction*> m_actions;
Note:
See TracChangeset
for help on using the changeset viewer.