Changeset 36083 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Feb 25, 2011 12:33:58 PM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionsPool.cpp
r35635 r36083 223 223 }; 224 224 225 class PerformTakeSnapshotAction : public UISimpleAction 226 { 227 Q_OBJECT; 228 229 public: 230 231 PerformTakeSnapshotAction(QObject *pParent) 232 : UISimpleAction(pParent, 233 ":/take_snapshot_16px.png", ":/take_snapshot_dis_16px.png") 234 { 235 retranslateUi(); 236 } 237 238 protected: 239 240 void retranslateUi() 241 { 242 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "Take &Snapshot..."), gMS->shortcut(UIMachineShortcuts::TakeSnapshotShortcut))); 243 setStatusTip(QApplication::translate("UIActionsPool", "Take a snapshot of the virtual machine")); 244 } 245 }; 246 247 class ShowInformationDialogAction : public UISimpleAction 248 { 249 Q_OBJECT; 250 251 public: 252 253 ShowInformationDialogAction(QObject *pParent) 254 : UISimpleAction(pParent, 255 ":/session_info_16px.png", ":/session_info_disabled_16px.png") 256 { 257 retranslateUi(); 258 } 259 260 protected: 261 262 void retranslateUi() 263 { 264 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "Session I&nformation"), gMS->shortcut(UIMachineShortcuts::InformationDialogShortcut))); 265 setStatusTip(QApplication::translate("UIActionsPool", "Show Session Information Dialog")); 266 } 267 }; 268 269 class MenuMouseIntegrationAction : public UIMenuAction 270 { 271 Q_OBJECT; 272 273 public: 274 275 MenuMouseIntegrationAction(QObject *pParent) 276 : UIMenuAction(pParent) 277 { 278 retranslateUi(); 279 } 280 281 protected: 282 283 void retranslateUi() 284 { 285 } 286 }; 287 288 class ToggleMouseIntegrationAction : public UIToggleAction 289 { 290 Q_OBJECT; 291 292 public: 293 294 ToggleMouseIntegrationAction(QObject *pParent) 295 : UIToggleAction(pParent, 296 ":/mouse_can_seamless_on_16px.png", ":/mouse_can_seamless_16px.png", 297 ":/mouse_can_seamless_on_disabled_16px.png", ":/mouse_can_seamless_disabled_16px.png") 298 { 299 retranslateUi(); 300 } 301 302 protected: 303 304 void retranslateUi() 305 { 306 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "Disable &Mouse Integration"), gMS->shortcut(UIMachineShortcuts::MouseIntegrationShortcut))); 307 setStatusTip(QApplication::translate("UIActionsPool", "Temporarily disable host mouse pointer integration")); 308 } 309 }; 310 311 class PerformTypeCADAction : public UISimpleAction 312 { 313 Q_OBJECT; 314 315 public: 316 317 PerformTypeCADAction(QObject *pParent) 318 : UISimpleAction(pParent, 319 ":/hostkey_16px.png", ":/hostkey_disabled_16px.png") 320 { 321 retranslateUi(); 322 } 323 324 protected: 325 326 void retranslateUi() 327 { 328 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "&Insert Ctrl-Alt-Del"), gMS->shortcut(UIMachineShortcuts::TypeCADShortcut))); 329 setStatusTip(QApplication::translate("UIActionsPool", "Send the Ctrl-Alt-Del sequence to the virtual machine")); 330 } 331 }; 332 333 #ifdef Q_WS_X11 334 class PerformTypeCABSAction : public UISimpleAction 335 { 336 Q_OBJECT; 337 338 public: 339 340 PerformTypeCABSAction(QObject *pParent) 341 : UISimpleAction(pParent, 342 ":/hostkey_16px.png", ":/hostkey_disabled_16px.png") 343 { 344 retranslateUi(); 345 } 346 347 protected: 348 349 void retranslateUi() 350 { 351 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "&Insert Ctrl-Alt-Backspace"), gMS->shortcut(UIMachineShortcuts::TypeCABSShortcut))); 352 setStatusTip(QApplication::translate("UIActionsPool", "Send the Ctrl-Alt-Backspace sequence to the virtual machine")); 353 } 354 }; 355 #endif 356 357 class TogglePauseAction : public UIToggleAction 358 { 359 Q_OBJECT; 360 361 public: 362 363 TogglePauseAction(QObject *pParent) 364 : UIToggleAction(pParent, 365 ":/pause_16px.png", ":/pause_disabled_16px.png") 366 { 367 retranslateUi(); 368 } 369 370 protected: 371 372 void retranslateUi() 373 { 374 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "&Pause"), gMS->shortcut(UIMachineShortcuts::PauseShortcut))); 375 setStatusTip(QApplication::translate("UIActionsPool", "Suspend the execution of the virtual machine")); 376 } 377 }; 378 379 class PerformResetAction : public UISimpleAction 380 { 381 Q_OBJECT; 382 383 public: 384 385 PerformResetAction(QObject *pParent) 386 : UISimpleAction(pParent, 387 ":/reset_16px.png", ":/reset_disabled_16px.png") 388 { 389 retranslateUi(); 390 } 391 392 protected: 393 394 void retranslateUi() 395 { 396 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "&Reset"), gMS->shortcut(UIMachineShortcuts::ResetShortcut))); 397 setStatusTip(QApplication::translate("UIActionsPool", "Reset the virtual machine")); 398 } 399 }; 400 401 class PerformShutdownAction : public UISimpleAction 402 { 403 Q_OBJECT; 404 405 public: 406 407 PerformShutdownAction(QObject *pParent) 408 : UISimpleAction(pParent, 409 ":/acpi_16px.png", ":/acpi_disabled_16px.png") 410 { 411 retranslateUi(); 412 } 413 414 protected: 415 416 void retranslateUi() 417 { 418 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "ACPI Sh&utdown"), gMS->shortcut(UIMachineShortcuts::ShutdownShortcut))); 419 setStatusTip(QApplication::translate("UIActionsPool", "Send the ACPI Power Button press event to the virtual machine")); 420 } 421 }; 422 423 class PerformCloseAction : public UISimpleAction 424 { 425 Q_OBJECT; 426 427 public: 428 429 PerformCloseAction(QObject *pParent) 430 : UISimpleAction(pParent, 431 ":/exit_16px.png") 432 { 433 setMenuRole(QAction::QuitRole); 434 retranslateUi(); 435 } 436 437 protected: 438 439 void retranslateUi() 440 { 441 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "&Close..."), gMS->shortcut(UIMachineShortcuts::CloseShortcut))); 442 setStatusTip(QApplication::translate("UIActionsPool", "Close the virtual machine")); 443 } 444 }; 445 446 class MenuViewAction : public UIMenuAction 447 { 448 Q_OBJECT; 449 450 public: 451 452 MenuViewAction(QObject *pParent) 453 : UIMenuAction(pParent) 454 { 455 retranslateUi(); 456 } 457 458 protected: 459 460 void retranslateUi() 461 { 462 menu()->setTitle(QApplication::translate("UIActionsPool", "&View")); 463 } 464 }; 465 225 466 class ToggleFullscreenModeAction : public UIToggleAction 226 467 { … … 337 578 }; 338 579 339 class MenuMouseIntegrationAction : public UIMenuAction340 {341 Q_OBJECT;342 343 public:344 345 MenuMouseIntegrationAction(QObject *pParent)346 : UIMenuAction(pParent)347 {348 retranslateUi();349 }350 351 protected:352 353 void retranslateUi()354 {355 }356 };357 358 class ToggleMouseIntegrationAction : public UIToggleAction359 {360 Q_OBJECT;361 362 public:363 364 ToggleMouseIntegrationAction(QObject *pParent)365 : UIToggleAction(pParent,366 ":/mouse_can_seamless_on_16px.png", ":/mouse_can_seamless_16px.png",367 ":/mouse_can_seamless_on_disabled_16px.png", ":/mouse_can_seamless_disabled_16px.png")368 {369 retranslateUi();370 }371 372 protected:373 374 void retranslateUi()375 {376 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "Disable &Mouse Integration"), gMS->shortcut(UIMachineShortcuts::MouseIntegrationShortcut)));377 setStatusTip(QApplication::translate("UIActionsPool", "Temporarily disable host mouse pointer integration"));378 }379 };380 381 class PerformTypeCADAction : public UISimpleAction382 {383 Q_OBJECT;384 385 public:386 387 PerformTypeCADAction(QObject *pParent)388 : UISimpleAction(pParent,389 ":/hostkey_16px.png", ":/hostkey_disabled_16px.png")390 {391 retranslateUi();392 }393 394 protected:395 396 void retranslateUi()397 {398 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "&Insert Ctrl-Alt-Del"), gMS->shortcut(UIMachineShortcuts::TypeCADShortcut)));399 setStatusTip(QApplication::translate("UIActionsPool", "Send the Ctrl-Alt-Del sequence to the virtual machine"));400 }401 };402 403 #ifdef Q_WS_X11404 class PerformTypeCABSAction : public UISimpleAction405 {406 Q_OBJECT;407 408 public:409 410 PerformTypeCABSAction(QObject *pParent)411 : UISimpleAction(pParent,412 ":/hostkey_16px.png", ":/hostkey_disabled_16px.png")413 {414 retranslateUi();415 }416 417 protected:418 419 void retranslateUi()420 {421 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "&Insert Ctrl-Alt-Backspace"), gMS->shortcut(UIMachineShortcuts::TypeCABSShortcut)));422 setStatusTip(QApplication::translate("UIActionsPool", "Send the Ctrl-Alt-Backspace sequence to the virtual machine"));423 }424 };425 #endif426 427 class PerformTakeSnapshotAction : public UISimpleAction428 {429 Q_OBJECT;430 431 public:432 433 PerformTakeSnapshotAction(QObject *pParent)434 : UISimpleAction(pParent,435 ":/take_snapshot_16px.png", ":/take_snapshot_dis_16px.png")436 {437 retranslateUi();438 }439 440 protected:441 442 void retranslateUi()443 {444 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "Take &Snapshot..."), gMS->shortcut(UIMachineShortcuts::TakeSnapshotShortcut)));445 setStatusTip(QApplication::translate("UIActionsPool", "Take a snapshot of the virtual machine"));446 }447 };448 449 class ShowInformationDialogAction : public UISimpleAction450 {451 Q_OBJECT;452 453 public:454 455 ShowInformationDialogAction(QObject *pParent)456 : UISimpleAction(pParent,457 ":/session_info_16px.png", ":/session_info_disabled_16px.png")458 {459 retranslateUi();460 }461 462 protected:463 464 void retranslateUi()465 {466 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "Session I&nformation"), gMS->shortcut(UIMachineShortcuts::InformationDialogShortcut)));467 setStatusTip(QApplication::translate("UIActionsPool", "Show Session Information Dialog"));468 }469 };470 471 class TogglePauseAction : public UIToggleAction472 {473 Q_OBJECT;474 475 public:476 477 TogglePauseAction(QObject *pParent)478 : UIToggleAction(pParent,479 ":/pause_16px.png", ":/pause_disabled_16px.png")480 {481 retranslateUi();482 }483 484 protected:485 486 void retranslateUi()487 {488 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "&Pause"), gMS->shortcut(UIMachineShortcuts::PauseShortcut)));489 setStatusTip(QApplication::translate("UIActionsPool", "Suspend the execution of the virtual machine"));490 }491 };492 493 class PerformResetAction : public UISimpleAction494 {495 Q_OBJECT;496 497 public:498 499 PerformResetAction(QObject *pParent)500 : UISimpleAction(pParent,501 ":/reset_16px.png", ":/reset_disabled_16px.png")502 {503 retranslateUi();504 }505 506 protected:507 508 void retranslateUi()509 {510 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "&Reset"), gMS->shortcut(UIMachineShortcuts::ResetShortcut)));511 setStatusTip(QApplication::translate("UIActionsPool", "Reset the virtual machine"));512 }513 };514 515 class PerformShutdownAction : public UISimpleAction516 {517 Q_OBJECT;518 519 public:520 521 PerformShutdownAction(QObject *pParent)522 : UISimpleAction(pParent,523 ":/acpi_16px.png", ":/acpi_disabled_16px.png")524 {525 retranslateUi();526 }527 528 protected:529 530 void retranslateUi()531 {532 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "ACPI Sh&utdown"), gMS->shortcut(UIMachineShortcuts::ShutdownShortcut)));533 setStatusTip(QApplication::translate("UIActionsPool", "Send the ACPI Power Button press event to the virtual machine"));534 }535 };536 537 class PerformCloseAction : public UISimpleAction538 {539 Q_OBJECT;540 541 public:542 543 PerformCloseAction(QObject *pParent)544 : UISimpleAction(pParent,545 ":/exit_16px.png")546 {547 setMenuRole(QAction::QuitRole);548 retranslateUi();549 }550 551 protected:552 553 void retranslateUi()554 {555 setText(vboxGlobal().insertKeyToActionText(QApplication::translate("UIActionsPool", "&Close..."), gMS->shortcut(UIMachineShortcuts::CloseShortcut)));556 setStatusTip(QApplication::translate("UIActionsPool", "Close the virtual machine"));557 }558 };559 560 class MenuViewAction : public UIMenuAction561 {562 Q_OBJECT;563 564 public:565 566 MenuViewAction(QObject *pParent)567 : UIMenuAction(pParent)568 {569 retranslateUi();570 }571 572 protected:573 574 void retranslateUi()575 {576 menu()->setTitle(QApplication::translate("UIActionsPool", "&View"));577 }578 };579 580 580 class MenuDevicesAction : public UIMenuAction 581 581 { … … 1114 1114 { 1115 1115 /* "Machine" menu actions: */ 1116 m_actionsPool[UIActionIndex_Simple_TakeSnapshot] = new PerformTakeSnapshotAction(this); 1117 m_actionsPool[UIActionIndex_Simple_InformationDialog] = new ShowInformationDialogAction(this); 1118 m_actionsPool[UIActionIndex_Toggle_MouseIntegration] = new ToggleMouseIntegrationAction(this); 1119 m_actionsPool[UIActionIndex_Simple_TypeCAD] = new PerformTypeCADAction(this); 1120 #ifdef Q_WS_X11 1121 m_actionsPool[UIActionIndex_Simple_TypeCABS] = new PerformTypeCABSAction(this); 1122 #endif 1123 m_actionsPool[UIActionIndex_Toggle_Pause] = new TogglePauseAction(this); 1124 m_actionsPool[UIActionIndex_Simple_Reset] = new PerformResetAction(this); 1125 m_actionsPool[UIActionIndex_Simple_Shutdown] = new PerformShutdownAction(this); 1126 m_actionsPool[UIActionIndex_Simple_Close] = new PerformCloseAction(this); 1127 1128 /* "View" menu actions: */ 1116 1129 m_actionsPool[UIActionIndex_Toggle_Fullscreen] = new ToggleFullscreenModeAction(this); 1117 1130 m_actionsPool[UIActionIndex_Toggle_Seamless] = new ToggleSeamlessModeAction(this); … … 1119 1132 m_actionsPool[UIActionIndex_Toggle_GuestAutoresize] = new ToggleGuestAutoresizeAction(this); 1120 1133 m_actionsPool[UIActionIndex_Simple_AdjustWindow] = new PerformWindowAdjustAction(this); 1121 m_actionsPool[UIActionIndex_Toggle_MouseIntegration] = new ToggleMouseIntegrationAction(this);1122 m_actionsPool[UIActionIndex_Simple_TypeCAD] = new PerformTypeCADAction(this);1123 #ifdef Q_WS_X111124 m_actionsPool[UIActionIndex_Simple_TypeCABS] = new PerformTypeCABSAction(this);1125 #endif1126 m_actionsPool[UIActionIndex_Simple_TakeSnapshot] = new PerformTakeSnapshotAction(this);1127 m_actionsPool[UIActionIndex_Simple_InformationDialog] = new ShowInformationDialogAction(this);1128 m_actionsPool[UIActionIndex_Toggle_Pause] = new TogglePauseAction(this);1129 m_actionsPool[UIActionIndex_Simple_Reset] = new PerformResetAction(this);1130 m_actionsPool[UIActionIndex_Simple_Shutdown] = new PerformShutdownAction(this);1131 m_actionsPool[UIActionIndex_Simple_Close] = new PerformCloseAction(this);1132 1134 1133 1135 /* "Devices" menu actions: */ … … 1226 1228 delete m_actionsPool[UIActionIndex_Menu_Machine]; 1227 1229 m_actionsPool[UIActionIndex_Menu_Machine] = new MenuMachineAction(this); 1230 if (m_actionsPool[UIActionIndex_Menu_MouseIntegration]) 1231 delete m_actionsPool[UIActionIndex_Menu_MouseIntegration]; 1232 m_actionsPool[UIActionIndex_Menu_MouseIntegration] = new MenuMouseIntegrationAction(this); 1233 1228 1234 if (m_actionsPool[UIActionIndex_Menu_View]) 1229 1235 delete m_actionsPool[UIActionIndex_Menu_View]; 1230 1236 m_actionsPool[UIActionIndex_Menu_View] = new MenuViewAction(this); 1231 if (m_actionsPool[UIActionIndex_Menu_MouseIntegration])1232 delete m_actionsPool[UIActionIndex_Menu_MouseIntegration];1233 m_actionsPool[UIActionIndex_Menu_MouseIntegration] = new MenuMouseIntegrationAction(this);1234 1237 1235 1238 if (m_actionsPool[UIActionIndex_Menu_Devices]) … … 1248 1251 delete m_actionsPool[UIActionIndex_Menu_NetworkAdapters]; 1249 1252 m_actionsPool[UIActionIndex_Menu_NetworkAdapters] = new MenuNetworkAdaptersAction(this); 1250 1251 1253 if (m_actionsPool[UIActionIndex_Menu_SharedFolders]) 1252 1254 delete m_actionsPool[UIActionIndex_Menu_SharedFolders]; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp
r35424 r36083 144 144 { 145 145 QMenu *pMenuView = pActionsPool->action(UIActionIndex_Menu_View)->menu(); 146 prepareMenuView(pMenuView, pActionsPool); 146 147 preparedSubMenus << pMenuView; 147 148 } … … 189 190 190 191 /* Machine submenu: */ 191 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Fullscreen)); 192 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Seamless)); 193 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Scale)); 194 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_GuestAutoresize)); 195 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_AdjustWindow)); 192 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_TakeSnapshot)); 193 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_InformationDialog)); 196 194 pMenu->addSeparator(); 197 195 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_MouseIntegration)); … … 201 199 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_TypeCABS)); 202 200 #endif 203 pMenu->addSeparator();204 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_TakeSnapshot));205 pMenu->addSeparator();206 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_InformationDialog));207 201 pMenu->addSeparator(); 208 202 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Pause)); … … 213 207 #endif /* !Q_WS_MAC */ 214 208 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Close)); 209 } 210 211 void UIMachineMenuBar::prepareMenuView(QMenu *pMenu, UIActionsPool *pActionsPool) 212 { 213 /* Do not prepare if ready: */ 214 if (!pMenu->isEmpty()) 215 return; 216 217 /* View submenu: */ 218 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Fullscreen)); 219 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Seamless)); 220 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Scale)); 221 pMenu->addSeparator(); 222 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_GuestAutoresize)); 223 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_AdjustWindow)); 215 224 } 216 225 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.h
r28800 r36083 45 45 QList<QMenu*> prepareSubMenus(UIActionsPool *pActionsPool, UIMainMenuType fOptions = UIMainMenuType_All); 46 46 void prepareMenuMachine(QMenu *pMenu, UIActionsPool *pActionsPool); 47 void prepareMenuView(QMenu *pMenu, UIActionsPool *pActionsPool); 47 48 void prepareMenuDevices(QMenu *pMenu, UIActionsPool *pActionsPool); 48 49 #ifdef VBOX_WITH_DEBUGGER_GUI -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp
r29078 r36083 49 49 { 50 50 delete m_pScreenMap; 51 while (!m_screenMenuList.isEmpty()) 52 { 53 delete m_screenMenuList.first(); 54 m_screenMenuList.removeFirst(); 55 } 51 56 } 52 57 53 58 void UIMultiScreenLayout::initialize(QMenu *pMenu) 54 59 { 55 pMenu->clear(); 56 for (int i = 0; i < m_cGuestScreens; ++i) 57 { 58 QMenu *pScreenMenu = pMenu->addMenu(tr("Virtual Screen %1").arg(i + 1)); 59 QActionGroup *pScreenGroup = new QActionGroup(pScreenMenu); 60 pScreenGroup->setExclusive(true); 61 connect(pScreenGroup, SIGNAL(triggered(QAction*)), 62 this, SLOT(sltScreenLayoutChanged(QAction*))); 63 for (int a = 0; a < m_cHostScreens; ++a) 64 { 65 QAction *pAction = pScreenGroup->addAction(tr("Use Host Screen %1").arg(a + 1)); 66 pAction->setCheckable(true); 67 pAction->setData(RT_MAKE_U32(i, a)); 68 } 69 pScreenMenu->addActions(pScreenGroup->actions()); 60 if (m_cHostScreens > 1) 61 { 62 pMenu->addSeparator(); 63 for (int i = 0; i < m_cGuestScreens; ++i) 64 { 65 m_screenMenuList << pMenu->addMenu(tr("Virtual Screen %1").arg(i + 1)); 66 m_screenMenuList.last()->menuAction()->setData(true); 67 QActionGroup *pScreenGroup = new QActionGroup(m_screenMenuList.last()); 68 pScreenGroup->setExclusive(true); 69 connect(pScreenGroup, SIGNAL(triggered(QAction*)), this, SLOT(sltScreenLayoutChanged(QAction*))); 70 for (int a = 0; a < m_cHostScreens; ++a) 71 { 72 QAction *pAction = pScreenGroup->addAction(tr("Use Host Screen %1").arg(a + 1)); 73 pAction->setCheckable(true); 74 pAction->setData(RT_MAKE_U32(i, a)); 75 } 76 m_screenMenuList.last()->addActions(pScreenGroup->actions()); 77 } 70 78 } 71 79 } … … 84 92 for (int i = 0; i < m_cGuestScreens; ++i) 85 93 { 86 /* If the user ever selected a combination in the view menu, we have 87 * the following entry: */ 94 /* If the user ever selected a combination in the view menu, we have the following entry: */ 88 95 QString strTest = machine.GetExtraData(QString("%1%2").arg(VBoxDefs::GUI_VirtualScreenToHostScreen).arg(i)); 89 96 bool fOk; … … 127 134 } 128 135 129 QList<QAction*> actions = m_pMachineLogic->actionsPool()->action(UIActionIndex_Menu_View)->menu()->actions(); 130 for (int i = 0; i < m_pScreenMap->size(); ++i) 131 { 132 int hostScreen = m_pScreenMap->value(i); 133 QList<QAction*> actions1 = actions.at(i)->menu()->actions(); 134 for (int w = 0; w < actions1.size(); ++w) 135 { 136 QAction *pTmpAction = actions1.at(w); 136 /* Get the list of all view-menu actions: */ 137 QList<QAction*> viewMenuActions = m_pMachineLogic->actionsPool()->action(UIActionIndex_Menu_View)->menu()->actions(); 138 /* Get the list of all view related actions: */ 139 QList<QAction*> viewActions; 140 for (int i = 0; i < viewMenuActions.size(); ++i) 141 { 142 if (viewMenuActions[i]->data().toBool()) 143 viewActions << viewMenuActions[i]; 144 } 145 /* Mark currently chosen action: */ 146 for (int i = 0; i < viewActions.size(); ++i) 147 { 148 int iHostScreen = m_pScreenMap->value(i); 149 QList<QAction*> screenActions = viewActions.at(i)->menu()->actions(); 150 for (int w = 0; w < screenActions.size(); ++w) 151 { 152 QAction *pTmpAction = screenActions.at(w); 137 153 pTmpAction->blockSignals(true); 138 pTmpAction->setChecked(RT_HIWORD(pTmpAction->data().toInt()) == hostScreen);154 pTmpAction->setChecked(RT_HIWORD(pTmpAction->data().toInt()) == iHostScreen); 139 155 pTmpAction->blockSignals(false); 140 156 } … … 222 238 } 223 239 224 /* Update the menu items. Even if we can't switch we have to revert the 225 * menu items. */ 226 QList<QAction*> actions = m_pMachineLogic->actionsPool()->action(UIActionIndex_Menu_View)->menu()->actions(); 227 /* Update the settings. */ 228 for (int i = 0; i < m_cGuestScreens; ++i) 229 { 230 int hostScreen = m_pScreenMap->value(i); 231 machine.SetExtraData(QString("%1%2").arg(VBoxDefs::GUI_VirtualScreenToHostScreen).arg(i), QString::number(hostScreen)); 232 QList<QAction*> actions1 = actions.at(i)->menu()->actions(); 233 for (int w = 0; w < actions1.size(); ++w) 234 { 235 QAction *pTmpAction = actions1.at(w); 240 /* Get the list of all view-menu actions: */ 241 QList<QAction*> viewMenuActions = m_pMachineLogic->actionsPool()->action(UIActionIndex_Menu_View)->menu()->actions(); 242 /* Get the list of all view related actions: */ 243 QList<QAction*> viewActions; 244 for (int i = 0; i < viewMenuActions.size(); ++i) 245 { 246 if (viewMenuActions[i]->data().toBool()) 247 viewActions << viewMenuActions[i]; 248 } 249 /* Update the menu items. Even if we can't switch we have to revert the menu items. */ 250 for (int i = 0; i < viewActions.size(); ++i) 251 { 252 int iHostScreen = m_pScreenMap->value(i); 253 machine.SetExtraData(QString("%1%2").arg(VBoxDefs::GUI_VirtualScreenToHostScreen).arg(i), QString::number(iHostScreen)); 254 QList<QAction*> screenActions = viewActions.at(i)->menu()->actions(); 255 for (int w = 0; w < screenActions.size(); ++w) 256 { 257 QAction *pTmpAction = screenActions.at(w); 236 258 pTmpAction->blockSignals(true); 237 pTmpAction->setChecked(RT_HIWORD(pTmpAction->data().toInt()) == hostScreen);259 pTmpAction->setChecked(RT_HIWORD(pTmpAction->data().toInt()) == iHostScreen); 238 260 pTmpAction->blockSignals(false); 239 261 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h
r29069 r36083 63 63 64 64 QMap<int, int> *m_pScreenMap; 65 QList<QMenu*> m_screenMenuList; 65 66 }; 66 67 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
r31866 r36083 166 166 void UIMachineWindowFullscreen::prepareMenu() 167 167 { 168 UIMainMenuType fMenus = UIMainMenuType_All;169 /* Remove the view menu in the case there is one screen only. */170 if (QApplication::desktop()->numScreens() == 1)171 fMenus = UIMainMenuType(fMenus ^ UIMainMenuType_View);172 168 #ifdef Q_WS_MAC 173 setMenuBar(uisession()->newMenuBar( fMenus));169 setMenuBar(uisession()->newMenuBar()); 174 170 #endif /* Q_WS_MAC */ 175 m_pMainMenu = uisession()->newMenu( fMenus);171 m_pMainMenu = uisession()->newMenu(); 176 172 } 177 173 … … 193 189 m_pMiniToolBar->updateDisplay(true, true); 194 190 QList<QMenu*> menus; 195 UIMainMenuType fMenu = UIMainMenuType(UIMainMenuType_Machine | UIMainMenuType_Devices); 196 if (QApplication::desktop()->numScreens() > 1) 197 fMenu = UIMainMenuType(fMenu | UIMainMenuType_View); 198 QList<QAction*> actions = uisession()->newMenu(fMenu)->actions(); 191 QList<QAction*> actions = uisession()->newMenu()->actions(); 199 192 for (int i=0; i < actions.size(); ++i) 200 193 menus << actions.at(i)->menu(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r35808 r36083 376 376 void UIMachineWindowNormal::prepareMenu() 377 377 { 378 /* No view menu in normal mode */ 379 setMenuBar(uisession()->newMenuBar(UIMainMenuType(UIMainMenuType_All ^ UIMainMenuType_View))); 378 setMenuBar(uisession()->newMenuBar()); 380 379 } 381 380 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp
r35865 r36083 230 230 void UIMachineWindowScale::prepareMenu() 231 231 { 232 UIMainMenuType fMenus = UIMainMenuType(UIMainMenuType_All ^ UIMainMenuType_View); 233 #ifdef Q_WS_MAC 234 setMenuBar(uisession()->newMenuBar(fMenus)); 232 #ifdef Q_WS_MAC 233 setMenuBar(uisession()->newMenuBar()); 235 234 #endif /* Q_WS_MAC */ 236 /* No view menu in normal mode: */ 237 m_pMainMenu = uisession()->newMenu(fMenus); 235 m_pMainMenu = uisession()->newMenu(); 238 236 } 239 237 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
r33540 r36083 215 215 void UIMachineWindowSeamless::prepareMenu() 216 216 { 217 UIMainMenuType fMenus = UIMainMenuType_All; 218 /* Remove the view menu in the case there is one screen only. */ 219 if (QApplication::desktop()->numScreens() == 1) 220 fMenus = UIMainMenuType(fMenus ^ UIMainMenuType_View); 221 #ifdef Q_WS_MAC 222 setMenuBar(uisession()->newMenuBar(fMenus)); 223 #endif /* Q_WS_MAC */ 224 m_pMainMenu = uisession()->newMenu(fMenus); 217 #ifdef Q_WS_MAC 218 setMenuBar(uisession()->newMenuBar()); 219 #endif /* Q_WS_MAC */ 220 m_pMainMenu = uisession()->newMenu(); 225 221 } 226 222 … … 244 240 m_pMiniToolBar->updateDisplay(true, true); 245 241 QList<QMenu*> menus; 246 UIMainMenuType fMenu = UIMainMenuType(UIMainMenuType_Machine | UIMainMenuType_Devices); 247 if (QApplication::desktop()->numScreens() > 1) 248 fMenu = UIMainMenuType(fMenu | UIMainMenuType_View); 249 QList<QAction*> actions = uisession()->newMenu(fMenu)->actions(); 242 QList<QAction*> actions = uisession()->newMenu()->actions(); 250 243 for (int i=0; i < actions.size(); ++i) 251 244 menus << actions.at(i)->menu();
Note:
See TracChangeset
for help on using the changeset viewer.