Changeset 85972 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Sep 1, 2020 8:54:56 AM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.cpp
r85710 r85972 144 144 , m_pActionPool(0) 145 145 , m_pCache(0) 146 , m_pStatusBarEditor(0) 147 , m_pMenuBarEditor(0) 146 , m_pEditorMenuBar(0) 147 , m_pLabelVisualState(0) 148 , m_pEditorVisualState(0) 149 , m_pLabelMiniToolBar(0) 148 150 , m_pCheckBoxShowMiniToolBar(0) 149 , m_pComboToolBarAlignment(0) 150 , m_pLabelVisualState(0) 151 , m_pVisualStateEditor(0) 152 , m_pLabelMiniToolBar(0) 151 , m_pCheckBoxToolBarAlignment(0) 152 , m_pEditorStatusBar(0) 153 153 { 154 154 /* Prepare: */ … … 217 217 218 218 /* Load old interface data from the cache: */ 219 m_p StatusBarEditor->setStatusBarEnabled(oldInterfaceData.m_fStatusBarEnabled);220 m_p StatusBarEditor->setStatusBarConfiguration(oldInterfaceData.m_statusBarRestrictions,219 m_pEditorStatusBar->setStatusBarEnabled(oldInterfaceData.m_fStatusBarEnabled); 220 m_pEditorStatusBar->setStatusBarConfiguration(oldInterfaceData.m_statusBarRestrictions, 221 221 oldInterfaceData.m_statusBarOrder); 222 222 #ifndef VBOX_WS_MAC 223 m_p MenuBarEditor->setMenuBarEnabled(oldInterfaceData.m_fMenuBarEnabled);224 #endif 225 m_p MenuBarEditor->setRestrictionsOfMenuBar(oldInterfaceData.m_restrictionsOfMenuBar);226 m_p MenuBarEditor->setRestrictionsOfMenuApplication(oldInterfaceData.m_restrictionsOfMenuApplication);227 m_p MenuBarEditor->setRestrictionsOfMenuMachine(oldInterfaceData.m_restrictionsOfMenuMachine);228 m_p MenuBarEditor->setRestrictionsOfMenuView(oldInterfaceData.m_restrictionsOfMenuView);229 m_p MenuBarEditor->setRestrictionsOfMenuInput(oldInterfaceData.m_restrictionsOfMenuInput);230 m_p MenuBarEditor->setRestrictionsOfMenuDevices(oldInterfaceData.m_restrictionsOfMenuDevices);231 #ifdef VBOX_WITH_DEBUGGER_GUI 232 m_p MenuBarEditor->setRestrictionsOfMenuDebug(oldInterfaceData.m_restrictionsOfMenuDebug);233 #endif 234 #ifdef VBOX_WS_MAC 235 m_p MenuBarEditor->setRestrictionsOfMenuWindow(oldInterfaceData.m_restrictionsOfMenuWindow);236 #endif 237 m_p MenuBarEditor->setRestrictionsOfMenuHelp(oldInterfaceData.m_restrictionsOfMenuHelp);223 m_pEditorMenuBar->setMenuBarEnabled(oldInterfaceData.m_fMenuBarEnabled); 224 #endif 225 m_pEditorMenuBar->setRestrictionsOfMenuBar(oldInterfaceData.m_restrictionsOfMenuBar); 226 m_pEditorMenuBar->setRestrictionsOfMenuApplication(oldInterfaceData.m_restrictionsOfMenuApplication); 227 m_pEditorMenuBar->setRestrictionsOfMenuMachine(oldInterfaceData.m_restrictionsOfMenuMachine); 228 m_pEditorMenuBar->setRestrictionsOfMenuView(oldInterfaceData.m_restrictionsOfMenuView); 229 m_pEditorMenuBar->setRestrictionsOfMenuInput(oldInterfaceData.m_restrictionsOfMenuInput); 230 m_pEditorMenuBar->setRestrictionsOfMenuDevices(oldInterfaceData.m_restrictionsOfMenuDevices); 231 #ifdef VBOX_WITH_DEBUGGER_GUI 232 m_pEditorMenuBar->setRestrictionsOfMenuDebug(oldInterfaceData.m_restrictionsOfMenuDebug); 233 #endif 234 #ifdef VBOX_WS_MAC 235 m_pEditorMenuBar->setRestrictionsOfMenuWindow(oldInterfaceData.m_restrictionsOfMenuWindow); 236 #endif 237 m_pEditorMenuBar->setRestrictionsOfMenuHelp(oldInterfaceData.m_restrictionsOfMenuHelp); 238 238 #ifndef VBOX_WS_MAC 239 239 m_pCheckBoxShowMiniToolBar->setChecked(oldInterfaceData.m_fShowMiniToolBar); 240 m_pC omboToolBarAlignment->setChecked(oldInterfaceData.m_fMiniToolBarAtTop);241 #endif 242 m_p VisualStateEditor->setMachineId(m_machine.GetId());243 m_p VisualStateEditor->setValue(oldInterfaceData.m_enmVisualState);240 m_pCheckBoxToolBarAlignment->setChecked(oldInterfaceData.m_fMiniToolBarAtTop); 241 #endif 242 m_pEditorVisualState->setMachineId(m_machine.GetId()); 243 m_pEditorVisualState->setValue(oldInterfaceData.m_enmVisualState); 244 244 245 245 /* Polish page finally: */ … … 256 256 257 257 /* Gather new interface data: */ 258 newInterfaceData.m_fStatusBarEnabled = m_p StatusBarEditor->isStatusBarEnabled();259 newInterfaceData.m_statusBarRestrictions = m_p StatusBarEditor->statusBarIndicatorRestrictions();260 newInterfaceData.m_statusBarOrder = m_p StatusBarEditor->statusBarIndicatorOrder();261 #ifndef VBOX_WS_MAC 262 newInterfaceData.m_fMenuBarEnabled = m_p MenuBarEditor->isMenuBarEnabled();263 #endif 264 newInterfaceData.m_restrictionsOfMenuBar = m_p MenuBarEditor->restrictionsOfMenuBar();265 newInterfaceData.m_restrictionsOfMenuApplication = m_p MenuBarEditor->restrictionsOfMenuApplication();266 newInterfaceData.m_restrictionsOfMenuMachine = m_p MenuBarEditor->restrictionsOfMenuMachine();267 newInterfaceData.m_restrictionsOfMenuView = m_p MenuBarEditor->restrictionsOfMenuView();268 newInterfaceData.m_restrictionsOfMenuInput = m_p MenuBarEditor->restrictionsOfMenuInput();269 newInterfaceData.m_restrictionsOfMenuDevices = m_p MenuBarEditor->restrictionsOfMenuDevices();270 #ifdef VBOX_WITH_DEBUGGER_GUI 271 newInterfaceData.m_restrictionsOfMenuDebug = m_p MenuBarEditor->restrictionsOfMenuDebug();272 #endif 273 #ifdef VBOX_WS_MAC 274 newInterfaceData.m_restrictionsOfMenuWindow = m_p MenuBarEditor->restrictionsOfMenuWindow();275 #endif 276 newInterfaceData.m_restrictionsOfMenuHelp = m_p MenuBarEditor->restrictionsOfMenuHelp();258 newInterfaceData.m_fStatusBarEnabled = m_pEditorStatusBar->isStatusBarEnabled(); 259 newInterfaceData.m_statusBarRestrictions = m_pEditorStatusBar->statusBarIndicatorRestrictions(); 260 newInterfaceData.m_statusBarOrder = m_pEditorStatusBar->statusBarIndicatorOrder(); 261 #ifndef VBOX_WS_MAC 262 newInterfaceData.m_fMenuBarEnabled = m_pEditorMenuBar->isMenuBarEnabled(); 263 #endif 264 newInterfaceData.m_restrictionsOfMenuBar = m_pEditorMenuBar->restrictionsOfMenuBar(); 265 newInterfaceData.m_restrictionsOfMenuApplication = m_pEditorMenuBar->restrictionsOfMenuApplication(); 266 newInterfaceData.m_restrictionsOfMenuMachine = m_pEditorMenuBar->restrictionsOfMenuMachine(); 267 newInterfaceData.m_restrictionsOfMenuView = m_pEditorMenuBar->restrictionsOfMenuView(); 268 newInterfaceData.m_restrictionsOfMenuInput = m_pEditorMenuBar->restrictionsOfMenuInput(); 269 newInterfaceData.m_restrictionsOfMenuDevices = m_pEditorMenuBar->restrictionsOfMenuDevices(); 270 #ifdef VBOX_WITH_DEBUGGER_GUI 271 newInterfaceData.m_restrictionsOfMenuDebug = m_pEditorMenuBar->restrictionsOfMenuDebug(); 272 #endif 273 #ifdef VBOX_WS_MAC 274 newInterfaceData.m_restrictionsOfMenuWindow = m_pEditorMenuBar->restrictionsOfMenuWindow(); 275 #endif 276 newInterfaceData.m_restrictionsOfMenuHelp = m_pEditorMenuBar->restrictionsOfMenuHelp(); 277 277 #ifndef VBOX_WS_MAC 278 278 newInterfaceData.m_fShowMiniToolBar = m_pCheckBoxShowMiniToolBar->isChecked(); 279 newInterfaceData.m_fMiniToolBarAtTop = m_pC omboToolBarAlignment->isChecked();280 #endif 281 newInterfaceData.m_enmVisualState = m_p VisualStateEditor->value();279 newInterfaceData.m_fMiniToolBarAtTop = m_pCheckBoxToolBarAlignment->isChecked(); 280 #endif 281 newInterfaceData.m_enmVisualState = m_pEditorVisualState->value(); 282 282 283 283 /* Cache new interface data: */ … … 299 299 void UIMachineSettingsInterface::retranslateUi() 300 300 { 301 m_p MenuBarEditor->setWhatsThis(tr("Allows to modify VM menu-bar contents."));301 m_pEditorMenuBar->setWhatsThis(tr("Allows to modify VM menu-bar contents.")); 302 302 m_pLabelVisualState->setText(tr("Visual State:")); 303 m_p VisualStateEditor->setWhatsThis(tr("Selects the visual state. If machine is running it will be applied as soon as possible,"303 m_pEditorVisualState->setWhatsThis(tr("Selects the visual state. If machine is running it will be applied as soon as possible," 304 304 "otherwise desired one will be defined.")); 305 305 m_pLabelMiniToolBar->setText(tr("Mini ToolBar:")); 306 306 m_pCheckBoxShowMiniToolBar->setWhatsThis(tr("When checked, show the Mini ToolBar in full-screen and seamless modes.")); 307 307 m_pCheckBoxShowMiniToolBar->setText(tr("Show in &Full-screen/Seamless")); 308 m_pC omboToolBarAlignment->setWhatsThis(tr("When checked, show the Mini ToolBar at the top of the screen, rather than in its"308 m_pCheckBoxToolBarAlignment->setWhatsThis(tr("When checked, show the Mini ToolBar at the top of the screen, rather than in its" 309 309 "default position at the bottom of the screen.")); 310 m_pC omboToolBarAlignment->setText(tr("Show at &Top of Screen"));311 m_p StatusBarEditor->setWhatsThis(tr("Allows to modify VM status-bar contents."));310 m_pCheckBoxToolBarAlignment->setText(tr("Show at &Top of Screen")); 311 m_pEditorStatusBar->setWhatsThis(tr("Allows to modify VM status-bar contents.")); 312 312 } 313 313 … … 315 315 { 316 316 /* Polish interface page availability: */ 317 m_p MenuBarEditor->setEnabled(isMachineInValidMode());317 m_pEditorMenuBar->setEnabled(isMachineInValidMode()); 318 318 #ifdef VBOX_WS_MAC 319 319 m_pLabelMiniToolBar->hide(); 320 320 m_pCheckBoxShowMiniToolBar->hide(); 321 m_pC omboToolBarAlignment->hide();321 m_pCheckBoxToolBarAlignment->hide(); 322 322 #else /* !VBOX_WS_MAC */ 323 323 m_pLabelMiniToolBar->setEnabled(isMachineInValidMode()); 324 324 m_pCheckBoxShowMiniToolBar->setEnabled(isMachineInValidMode()); 325 m_pComboToolBarAlignment->setEnabled(isMachineInValidMode() && m_pCheckBoxShowMiniToolBar->isChecked()); 326 #endif /* !VBOX_WS_MAC */ 327 m_pStatusBarEditor->setEnabled(isMachineInValidMode()); 328 } 329 330 void UIMachineSettingsInterface::prepareWidgets() 331 { 332 if (objectName().isEmpty()) 333 setObjectName(QStringLiteral("UIMachineSettingsInterface")); 334 resize(350, 300); 335 QGridLayout *pLayoutMain = new QGridLayout(this); 336 pLayoutMain->setObjectName(QStringLiteral("pLayoutMain")); 337 m_pMenuBarEditor = new UIMenuBarEditorWidget(this); 338 m_pMenuBarEditor->setObjectName(QStringLiteral("m_pMenuBarEditor")); 339 QSizePolicy sizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 340 sizePolicy.setHorizontalStretch(0); 341 sizePolicy.setVerticalStretch(0); 342 sizePolicy.setHeightForWidth(m_pMenuBarEditor->sizePolicy().hasHeightForWidth()); 343 m_pMenuBarEditor->setSizePolicy(sizePolicy); 344 pLayoutMain->addWidget(m_pMenuBarEditor, 0, 0, 1, 3); 345 346 m_pLabelVisualState = new QLabel; 347 m_pLabelVisualState->setObjectName(QStringLiteral("m_pLabelVisualState")); 348 m_pLabelVisualState->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 349 pLayoutMain->addWidget(m_pLabelVisualState, 1, 0, 1, 1); 350 351 m_pVisualStateEditor = new UIVisualStateEditor; 352 m_pVisualStateEditor->setObjectName(QStringLiteral("m_pVisualStateEditor")); 353 pLayoutMain->addWidget(m_pVisualStateEditor, 1, 1, 1, 2); 354 355 m_pLabelMiniToolBar = new QLabel; 356 m_pLabelMiniToolBar->setObjectName(QStringLiteral("m_pLabelMiniToolBar")); 357 m_pLabelMiniToolBar->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 358 pLayoutMain->addWidget(m_pLabelMiniToolBar, 2, 0, 1, 1); 359 360 m_pCheckBoxShowMiniToolBar = new QCheckBox; 361 m_pCheckBoxShowMiniToolBar->setObjectName(QStringLiteral("m_pCheckBoxShowMiniToolBar")); 362 sizePolicy.setHeightForWidth(m_pCheckBoxShowMiniToolBar->sizePolicy().hasHeightForWidth()); 363 m_pCheckBoxShowMiniToolBar->setSizePolicy(sizePolicy); 364 m_pCheckBoxShowMiniToolBar->setChecked(true); 365 pLayoutMain->addWidget(m_pCheckBoxShowMiniToolBar, 2, 1, 1, 2); 366 367 m_pComboToolBarAlignment = new QCheckBox; 368 m_pComboToolBarAlignment->setObjectName(QStringLiteral("m_pComboToolBarAlignment")); 369 sizePolicy.setHeightForWidth(m_pComboToolBarAlignment->sizePolicy().hasHeightForWidth()); 370 m_pComboToolBarAlignment->setSizePolicy(sizePolicy); 371 m_pComboToolBarAlignment->setChecked(false); 372 pLayoutMain->addWidget(m_pComboToolBarAlignment, 3, 1, 1, 2); 373 374 QSpacerItem *pSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); 375 pLayoutMain->addItem(pSpacer, 4, 0, 1, 3); 376 377 m_pStatusBarEditor = new UIStatusBarEditorWidget(this); 378 m_pStatusBarEditor->setObjectName(QStringLiteral("m_pStatusBarEditor")); 379 sizePolicy.setHeightForWidth(m_pStatusBarEditor->sizePolicy().hasHeightForWidth()); 380 m_pStatusBarEditor->setSizePolicy(sizePolicy); 381 pLayoutMain->addWidget(m_pStatusBarEditor, 5, 0, 1, 3); 382 383 QObject::connect(m_pCheckBoxShowMiniToolBar, &QCheckBox::toggled, 384 m_pComboToolBarAlignment, &UIMachineSettingsInterface::setEnabled); 325 m_pCheckBoxToolBarAlignment->setEnabled(isMachineInValidMode() && m_pCheckBoxShowMiniToolBar->isChecked()); 326 #endif /* !VBOX_WS_MAC */ 327 m_pEditorStatusBar->setEnabled(isMachineInValidMode()); 385 328 } 386 329 387 330 void UIMachineSettingsInterface::prepare() 388 331 { 389 prepareWidgets(); 332 /* Prepare action-pool: */ 333 m_pActionPool = UIActionPool::create(UIActionPoolType_Runtime); 390 334 391 335 /* Prepare cache: */ … … 393 337 AssertPtrReturnVoid(m_pCache); 394 338 395 /* Layout created in the .ui file. */ 396 { 397 /* Menu-bar editor created in the .ui file. */ 398 AssertPtrReturnVoid(m_pMenuBarEditor); 399 { 400 /* Configure editor: */ 401 m_pActionPool = UIActionPool::create(UIActionPoolType_Runtime); 402 m_pMenuBarEditor->setActionPool(m_pActionPool); 403 m_pMenuBarEditor->setMachineID(m_uMachineId); 404 } 405 406 /* Status-bar editor created in the .ui file. */ 407 AssertPtrReturnVoid(m_pStatusBarEditor); 408 { 409 /* Configure editor: */ 410 m_pStatusBarEditor->setMachineID(m_uMachineId); 411 } 412 } 339 /* Prepare everything: */ 340 prepareWidgets(); 341 prepareConnections(); 413 342 414 343 /* Apply language settings: */ … … 416 345 } 417 346 347 void UIMachineSettingsInterface::prepareWidgets() 348 { 349 /* Prepare main layout: */ 350 QGridLayout *pLayoutMain = new QGridLayout(this); 351 if (pLayoutMain) 352 { 353 pLayoutMain->setColumnStretch(1, 1); 354 pLayoutMain->setRowStretch(4, 1); 355 356 /* Prepare menu-bar editor: */ 357 m_pEditorMenuBar = new UIMenuBarEditorWidget(this); 358 if (m_pEditorMenuBar) 359 { 360 m_pEditorMenuBar->setActionPool(m_pActionPool); 361 m_pEditorMenuBar->setMachineID(m_uMachineId); 362 363 pLayoutMain->addWidget(m_pEditorMenuBar, 0, 0, 1, 2); 364 } 365 366 /* Prepare visual-state label: */ 367 m_pLabelVisualState = new QLabel(this); 368 if (m_pLabelVisualState) 369 { 370 m_pLabelVisualState->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 371 pLayoutMain->addWidget(m_pLabelVisualState, 1, 0); 372 } 373 /* Prepare visual-state editor: */ 374 m_pEditorVisualState = new UIVisualStateEditor(this); 375 if (m_pEditorVisualState) 376 pLayoutMain->addWidget(m_pEditorVisualState, 1, 1); 377 378 /* Prepare mini-toolbar label: */ 379 m_pLabelMiniToolBar = new QLabel(this); 380 if (m_pLabelMiniToolBar) 381 { 382 m_pLabelMiniToolBar->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 383 pLayoutMain->addWidget(m_pLabelMiniToolBar, 2, 0); 384 } 385 /* Prepare show mini-toolbar check-box: */ 386 m_pCheckBoxShowMiniToolBar = new QCheckBox(this); 387 if (m_pCheckBoxShowMiniToolBar) 388 pLayoutMain->addWidget(m_pCheckBoxShowMiniToolBar, 2, 1); 389 /* Prepare mini-toolbar alignment check-box: */ 390 m_pCheckBoxToolBarAlignment = new QCheckBox(this); 391 if (m_pCheckBoxToolBarAlignment) 392 pLayoutMain->addWidget(m_pCheckBoxToolBarAlignment, 3, 1); 393 394 /* Prepare status-bar editor: */ 395 m_pEditorStatusBar = new UIStatusBarEditorWidget(this); 396 if (m_pEditorStatusBar) 397 { 398 m_pEditorStatusBar->setMachineID(m_uMachineId); 399 pLayoutMain->addWidget(m_pEditorStatusBar, 5, 0, 1, 2); 400 } 401 } 402 } 403 404 void UIMachineSettingsInterface::prepareConnections() 405 { 406 connect(m_pCheckBoxShowMiniToolBar, &QCheckBox::toggled, 407 m_pCheckBoxToolBarAlignment, &UIMachineSettingsInterface::setEnabled); 408 } 409 418 410 void UIMachineSettingsInterface::cleanup() 419 411 { 420 /* Destroy personalaction-pool: */412 /* Cleanup action-pool: */ 421 413 UIActionPool::destroy(m_pActionPool); 422 414 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.h
r85679 r85972 78 78 /** Prepares widgets. */ 79 79 void prepareWidgets(); 80 /** Prepares connections. */ 81 void prepareConnections(); 80 82 /** Cleanups all. */ 81 83 void cleanup(); … … 102 104 /** @name Widgets 103 105 * @{ */ 104 UIStatusBarEditorWidget *m_pStatusBarEditor; 105 UIMenuBarEditorWidget *m_pMenuBarEditor; 106 QCheckBox *m_pCheckBoxShowMiniToolBar; 107 QCheckBox *m_pComboToolBarAlignment; 108 QLabel *m_pLabelVisualState; 109 UIVisualStateEditor *m_pVisualStateEditor; 110 QLabel *m_pLabelMiniToolBar; 106 /** Holds the menu-bar editor instance. */ 107 UIMenuBarEditorWidget *m_pEditorMenuBar; 108 /** Holds the visual state label instance. */ 109 QLabel *m_pLabelVisualState; 110 /** Holds the visual state label instance. */ 111 UIVisualStateEditor *m_pEditorVisualState; 112 /** Holds the mini-toolbar label instance. */ 113 QLabel *m_pLabelMiniToolBar; 114 /** Holds the show mini-toolbar check-box instance. */ 115 QCheckBox *m_pCheckBoxShowMiniToolBar; 116 /** Holds the mini-toolbar alignment check-box instance. */ 117 QCheckBox *m_pCheckBoxToolBarAlignment; 118 /** Holds the status-bar editor instance. */ 119 UIStatusBarEditorWidget *m_pEditorStatusBar; 111 120 /** @} */ 112 121 };
Note:
See TracChangeset
for help on using the changeset viewer.