Changeset 54297 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Feb 19, 2015 3:02:58 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r54272 r54297 522 522 case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SettingsDialog: strResult = "SettingsDialog"; break; 523 523 case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeSnapshot: strResult = "TakeSnapshot"; break; 524 case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeScreenshot: strResult = "TakeScreenshot"; break;525 524 case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_InformationDialog: strResult = "InformationDialog"; break; 526 525 case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Pause: strResult = "Pause"; break; … … 551 550 keys << "SettingsDialog"; values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SettingsDialog; 552 551 keys << "TakeSnapshot"; values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeSnapshot; 553 keys << "TakeScreenshot"; values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeScreenshot;554 552 keys << "InformationDialog"; values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_InformationDialog; 555 553 keys << "Pause"; values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Pause; … … 581 579 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize: strResult = "GuestAutoresize"; break; 582 580 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow: strResult = "AdjustWindow"; break; 581 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_TakeScreenshot: strResult = "TakeScreenshot"; break; 583 582 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar: strResult = "MenuBar"; break; 584 583 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings: strResult = "MenuBarSettings"; break; … … 611 610 keys << "GuestAutoresize"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize; 612 611 keys << "AdjustWindow"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow; 612 keys << "TakeScreenshot"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_TakeScreenshot; 613 613 keys << "MenuBar"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar; 614 614 keys << "MenuBarSettings"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings; -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r54272 r54297 365 365 RuntimeMenuMachineActionType_SettingsDialog = RT_BIT(0), 366 366 RuntimeMenuMachineActionType_TakeSnapshot = RT_BIT(1), 367 RuntimeMenuMachineActionType_TakeScreenshot = RT_BIT(2), 368 RuntimeMenuMachineActionType_InformationDialog = RT_BIT(3), 369 RuntimeMenuMachineActionType_Pause = RT_BIT(10), 370 RuntimeMenuMachineActionType_Reset = RT_BIT(11), 371 RuntimeMenuMachineActionType_SaveState = RT_BIT(12), 372 RuntimeMenuMachineActionType_Shutdown = RT_BIT(13), 373 RuntimeMenuMachineActionType_PowerOff = RT_BIT(14), 367 RuntimeMenuMachineActionType_InformationDialog = RT_BIT(2), 368 RuntimeMenuMachineActionType_Pause = RT_BIT(3), 369 RuntimeMenuMachineActionType_Reset = RT_BIT(4), 370 RuntimeMenuMachineActionType_SaveState = RT_BIT(5), 371 RuntimeMenuMachineActionType_Shutdown = RT_BIT(6), 372 RuntimeMenuMachineActionType_PowerOff = RT_BIT(7), 374 373 #ifndef RT_OS_DARWIN 375 RuntimeMenuMachineActionType_Close = RT_BIT( 15),374 RuntimeMenuMachineActionType_Close = RT_BIT(8), 376 375 #endif /* !RT_OS_DARWIN */ 377 RuntimeMenuMachineActionType_Nothing = RT_BIT( 16),376 RuntimeMenuMachineActionType_Nothing = RT_BIT(9), 378 377 RuntimeMenuMachineActionType_All = 0xFFFF 379 378 }; … … 388 387 RuntimeMenuViewActionType_GuestAutoresize = RT_BIT(3), 389 388 RuntimeMenuViewActionType_AdjustWindow = RT_BIT(4), 390 RuntimeMenuViewActionType_MenuBar = RT_BIT(5), 391 RuntimeMenuViewActionType_MenuBarSettings = RT_BIT(6), 392 RuntimeMenuViewActionType_ToggleMenuBar = RT_BIT(7), 393 RuntimeMenuViewActionType_StatusBar = RT_BIT(8), 394 RuntimeMenuViewActionType_StatusBarSettings = RT_BIT(9), 395 RuntimeMenuViewActionType_ToggleStatusBar = RT_BIT(10), 396 RuntimeMenuViewActionType_ScaleFactor = RT_BIT(11), 397 RuntimeMenuViewActionType_Resize = RT_BIT(12), 398 RuntimeMenuViewActionType_Multiscreen = RT_BIT(13), 389 RuntimeMenuViewActionType_TakeScreenshot = RT_BIT(5), 390 RuntimeMenuViewActionType_MenuBar = RT_BIT(6), 391 RuntimeMenuViewActionType_MenuBarSettings = RT_BIT(7), 392 RuntimeMenuViewActionType_ToggleMenuBar = RT_BIT(8), 393 RuntimeMenuViewActionType_StatusBar = RT_BIT(9), 394 RuntimeMenuViewActionType_StatusBarSettings = RT_BIT(10), 395 RuntimeMenuViewActionType_ToggleStatusBar = RT_BIT(11), 396 RuntimeMenuViewActionType_ScaleFactor = RT_BIT(12), 397 RuntimeMenuViewActionType_Resize = RT_BIT(13), 398 RuntimeMenuViewActionType_Multiscreen = RT_BIT(14), 399 399 RuntimeMenuViewActionType_All = 0xFFFF 400 400 }; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp
r54285 r54297 135 135 }; 136 136 137 class UIActionSimplePerformTakeScreenshot : public UIActionSimple138 {139 Q_OBJECT;140 141 public:142 143 UIActionSimplePerformTakeScreenshot(UIActionPool *pParent)144 : UIActionSimple(pParent, ":/screenshot_take_16px.png", ":/screenshot_take_disabled_16px.png") {}145 146 protected:147 148 /** Returns action extra-data ID. */149 virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeScreenshot; }150 /** Returns action extra-data key. */151 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeScreenshot); }152 /** Returns whether action is allowed. */153 virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeScreenshot); }154 155 QString shortcutExtraDataID() const156 {157 return QString("TakeScreenshot");158 }159 160 QKeySequence defaultShortcut(UIActionPoolType) const161 {162 return QKeySequence("E");163 }164 165 void retranslateUi()166 {167 setName(QApplication::translate("UIActionPool", "Take Screensh&ot..."));168 setStatusTip(QApplication::translate("UIActionPool", "Take a screenshot of the virtual machine"));169 }170 };171 172 137 class UIActionSimpleShowInformationDialog : public UIActionSimple 173 138 { … … 644 609 }; 645 610 611 class UIActionSimplePerformTakeScreenshot : public UIActionSimple 612 { 613 Q_OBJECT; 614 615 public: 616 617 UIActionSimplePerformTakeScreenshot(UIActionPool *pParent) 618 : UIActionSimple(pParent, ":/screenshot_take_16px.png", ":/screenshot_take_disabled_16px.png") {} 619 620 protected: 621 622 /** Returns action extra-data ID. */ 623 virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_TakeScreenshot; } 624 /** Returns action extra-data key. */ 625 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_TakeScreenshot); } 626 /** Returns whether action is allowed. */ 627 virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_TakeScreenshot); } 628 629 QString shortcutExtraDataID() const 630 { 631 return QString("TakeScreenshot"); 632 } 633 634 QKeySequence defaultShortcut(UIActionPoolType) const 635 { 636 return QKeySequence("E"); 637 } 638 639 void retranslateUi() 640 { 641 setName(QApplication::translate("UIActionPool", "Take Screensh&ot...")); 642 setStatusTip(QApplication::translate("UIActionPool", "Take a screenshot of the virtual machine")); 643 } 644 }; 645 646 646 class UIActionMenuMenuBar : public UIActionMenu 647 647 { … … 1995 1995 m_pool[UIActionIndexRT_M_Machine_S_Settings] = new UIActionSimpleShowSettingsDialog(this); 1996 1996 m_pool[UIActionIndexRT_M_Machine_S_TakeSnapshot] = new UIActionSimplePerformTakeSnapshot(this); 1997 m_pool[UIActionIndexRT_M_Machine_S_TakeScreenshot] = new UIActionSimplePerformTakeScreenshot(this);1998 1997 m_pool[UIActionIndexRT_M_Machine_S_ShowInformation] = new UIActionSimpleShowInformationDialog(this); 1999 1998 m_pool[UIActionIndexRT_M_Machine_T_Pause] = new UIActionTogglePause(this); … … 2014 2013 m_pool[UIActionIndexRT_M_View_T_GuestAutoresize] = new UIActionToggleGuestAutoresize(this); 2015 2014 m_pool[UIActionIndexRT_M_View_S_AdjustWindow] = new UIActionSimplePerformWindowAdjust(this); 2015 m_pool[UIActionIndexRT_M_View_S_TakeScreenshot] = new UIActionSimplePerformTakeScreenshot(this); 2016 2016 m_pool[UIActionIndexRT_M_View_M_MenuBar] = new UIActionMenuMenuBar(this); 2017 2017 m_pool[UIActionIndexRT_M_View_M_MenuBar_S_Settings] = new UIActionSimpleShowMenuBarSettingsWindow(this); … … 2277 2277 /* 'Take Snapshot' action: */ 2278 2278 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_TakeSnapshot)) || fSeparator; 2279 /* 'Take Screenshot' action: */2280 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_TakeScreenshot)) || fSeparator;2281 2279 /* 'Information Dialog' action: */ 2282 2280 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_ShowInformation)) || fSeparator; … … 2345 2343 /* 'Guest Autoresize' action: */ 2346 2344 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_GuestAutoresize)) || fSeparator; 2345 2346 /* Separator: */ 2347 if (fSeparator) 2348 { 2349 pMenu->addSeparator(); 2350 fSeparator = false; 2351 } 2352 2353 /* 'Take Screenshot' action: */ 2354 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_S_TakeScreenshot)) || fSeparator; 2347 2355 2348 2356 /* Separator: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h
r54272 r54297 43 43 UIActionIndexRT_M_Machine_S_Settings, 44 44 UIActionIndexRT_M_Machine_S_TakeSnapshot, 45 UIActionIndexRT_M_Machine_S_TakeScreenshot,46 45 UIActionIndexRT_M_Machine_S_ShowInformation, 47 46 UIActionIndexRT_M_Machine_T_Pause, … … 62 61 UIActionIndexRT_M_View_S_AdjustWindow, 63 62 UIActionIndexRT_M_View_T_GuestAutoresize, 63 UIActionIndexRT_M_View_S_TakeScreenshot, 64 64 UIActionIndexRT_M_View_M_MenuBar, 65 65 UIActionIndexRT_M_View_M_MenuBar_S_Settings, -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r54272 r54297 924 924 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Machine_S_Settings)); 925 925 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Machine_S_TakeSnapshot)); 926 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Machine_S_TakeScreenshot));927 926 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Machine_S_ShowInformation)); 928 927 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Machine_T_Pause)); 928 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_S_TakeScreenshot)); 929 929 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar)); 930 930 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings)); … … 972 972 connect(actionPool()->action(UIActionIndexRT_M_Machine_S_TakeSnapshot), SIGNAL(triggered()), 973 973 this, SLOT(sltTakeSnapshot())); 974 connect(actionPool()->action(UIActionIndexRT_M_Machine_S_TakeScreenshot), SIGNAL(triggered()),975 this, SLOT(sltTakeScreenshot()));976 974 connect(actionPool()->action(UIActionIndexRT_M_Machine_S_ShowInformation), SIGNAL(triggered()), 977 975 this, SLOT(sltShowInformationDialog())); … … 999 997 connect(actionPool()->action(UIActionIndexRT_M_View_S_AdjustWindow), SIGNAL(triggered()), 1000 998 this, SLOT(sltAdjustWindow())); 999 connect(actionPool()->action(UIActionIndexRT_M_View_S_TakeScreenshot), SIGNAL(triggered()), 1000 this, SLOT(sltTakeScreenshot())); 1001 1001 1002 1002 /* 'Input' actions connections: */ … … 1425 1425 } 1426 1426 1427 void UIMachineLogic::sltShowInformationDialog() 1428 { 1429 /* Do not process if window(s) missed! */ 1430 if (!isMachineWindowsCreated()) 1431 return; 1432 1433 /* Invoke VM information dialog: */ 1434 UIVMInfoDialog::invoke(mainMachineWindow()); 1435 } 1436 1437 void UIMachineLogic::sltReset() 1438 { 1439 /* Confirm/Reset current console: */ 1440 if (msgCenter().confirmResetMachine(machineName())) 1441 console().Reset(); 1442 1443 /* TODO_NEW_CORE: On reset the additional screens didn't get a display 1444 update. Emulate this for now until it get fixed. */ 1445 ulong uMonitorCount = machine().GetMonitorCount(); 1446 for (ulong uScreenId = 1; uScreenId < uMonitorCount; ++uScreenId) 1447 machineWindows().at(uScreenId)->update(); 1448 } 1449 1450 void UIMachineLogic::sltPause(bool fOn) 1451 { 1452 uisession()->setPause(fOn); 1453 } 1454 1455 void UIMachineLogic::sltSaveState() 1456 { 1457 /* Make sure machine is in one of the allowed states: */ 1458 if (!uisession()->isRunning() && !uisession()->isPaused()) 1459 { 1460 AssertMsgFailed(("Invalid machine-state. Action should be prohibited!")); 1461 return; 1462 } 1463 1464 saveState(); 1465 } 1466 1467 void UIMachineLogic::sltShutdown() 1468 { 1469 /* Make sure machine is in one of the allowed states: */ 1470 if (!uisession()->isRunning()) 1471 { 1472 AssertMsgFailed(("Invalid machine-state. Action should be prohibited!")); 1473 return; 1474 } 1475 1476 shutdown(); 1477 } 1478 1479 void UIMachineLogic::sltPowerOff() 1480 { 1481 /* Make sure machine is in one of the allowed states: */ 1482 if (!uisession()->isRunning() && !uisession()->isPaused() && !uisession()->isStuck()) 1483 { 1484 AssertMsgFailed(("Invalid machine-state. Action should be prohibited!")); 1485 return; 1486 } 1487 1488 powerOff(machine().GetSnapshotCount() > 0); 1489 } 1490 1491 void UIMachineLogic::sltClose() 1492 { 1493 /* Do not process if window(s) missed! */ 1494 if (!isMachineWindowsCreated()) 1495 return; 1496 1497 /* Do not try to close machine-window if restricted: */ 1498 if (isPreventAutoClose()) 1499 return; 1500 1501 /* First, we have to close/hide any opened modal & popup application widgets. 1502 * We have to make sure such window is hidden even if close-event was rejected. 1503 * We are re-throwing this slot if any widget present to test again. 1504 * If all opened widgets are closed/hidden, we can try to close machine-window: */ 1505 QWidget *pWidget = QApplication::activeModalWidget() ? QApplication::activeModalWidget() : 1506 QApplication::activePopupWidget() ? QApplication::activePopupWidget() : 0; 1507 if (pWidget) 1508 { 1509 /* Closing/hiding all we found: */ 1510 pWidget->close(); 1511 if (!pWidget->isHidden()) 1512 pWidget->hide(); 1513 QTimer::singleShot(0, this, SLOT(sltClose())); 1514 return; 1515 } 1516 1517 /* Try to close active machine-window: */ 1518 activeMachineWindow()->close(); 1519 } 1520 1427 1521 void UIMachineLogic::sltTakeScreenshot() 1428 1522 { … … 1492 1586 if (!strFilename.isEmpty()) 1493 1587 takeScreenshot(strFilename, strFilter.split(" ").value(0, "png")); 1494 }1495 1496 void UIMachineLogic::sltShowInformationDialog()1497 {1498 /* Do not process if window(s) missed! */1499 if (!isMachineWindowsCreated())1500 return;1501 1502 /* Invoke VM information dialog: */1503 UIVMInfoDialog::invoke(mainMachineWindow());1504 }1505 1506 void UIMachineLogic::sltReset()1507 {1508 /* Confirm/Reset current console: */1509 if (msgCenter().confirmResetMachine(machineName()))1510 console().Reset();1511 1512 /* TODO_NEW_CORE: On reset the additional screens didn't get a display1513 update. Emulate this for now until it get fixed. */1514 ulong uMonitorCount = machine().GetMonitorCount();1515 for (ulong uScreenId = 1; uScreenId < uMonitorCount; ++uScreenId)1516 machineWindows().at(uScreenId)->update();1517 }1518 1519 void UIMachineLogic::sltPause(bool fOn)1520 {1521 uisession()->setPause(fOn);1522 }1523 1524 void UIMachineLogic::sltSaveState()1525 {1526 /* Make sure machine is in one of the allowed states: */1527 if (!uisession()->isRunning() && !uisession()->isPaused())1528 {1529 AssertMsgFailed(("Invalid machine-state. Action should be prohibited!"));1530 return;1531 }1532 1533 saveState();1534 }1535 1536 void UIMachineLogic::sltShutdown()1537 {1538 /* Make sure machine is in one of the allowed states: */1539 if (!uisession()->isRunning())1540 {1541 AssertMsgFailed(("Invalid machine-state. Action should be prohibited!"));1542 return;1543 }1544 1545 shutdown();1546 }1547 1548 void UIMachineLogic::sltPowerOff()1549 {1550 /* Make sure machine is in one of the allowed states: */1551 if (!uisession()->isRunning() && !uisession()->isPaused() && !uisession()->isStuck())1552 {1553 AssertMsgFailed(("Invalid machine-state. Action should be prohibited!"));1554 return;1555 }1556 1557 powerOff(machine().GetSnapshotCount() > 0);1558 }1559 1560 void UIMachineLogic::sltClose()1561 {1562 /* Do not process if window(s) missed! */1563 if (!isMachineWindowsCreated())1564 return;1565 1566 /* Do not try to close machine-window if restricted: */1567 if (isPreventAutoClose())1568 return;1569 1570 /* First, we have to close/hide any opened modal & popup application widgets.1571 * We have to make sure such window is hidden even if close-event was rejected.1572 * We are re-throwing this slot if any widget present to test again.1573 * If all opened widgets are closed/hidden, we can try to close machine-window: */1574 QWidget *pWidget = QApplication::activeModalWidget() ? QApplication::activeModalWidget() :1575 QApplication::activePopupWidget() ? QApplication::activePopupWidget() : 0;1576 if (pWidget)1577 {1578 /* Closing/hiding all we found: */1579 pWidget->close();1580 if (!pWidget->isHidden())1581 pWidget->hide();1582 QTimer::singleShot(0, this, SLOT(sltClose()));1583 return;1584 }1585 1586 /* Try to close active machine-window: */1587 activeMachineWindow()->close();1588 1588 } 1589 1589 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r54272 r54297 251 251 #endif /* Q_WS_X11 */ 252 252 void sltTakeSnapshot(); 253 void sltTakeScreenshot();254 253 void sltShowInformationDialog(); 255 254 void sltReset(); … … 259 258 void sltPowerOff(); 260 259 void sltClose(); 260 261 /* "View" menu functionality: */ 262 void sltTakeScreenshot(); 261 263 262 264 /* "Device" menu functionality: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp
r54272 r54297 473 473 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_Settings)); 474 474 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_TakeSnapshot)); 475 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_TakeScreenshot));476 475 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_ShowInformation)); 477 476 pMenu->addSeparator(); … … 496 495 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_S_AdjustWindow)); 497 496 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)); 497 pMenu->addSeparator(); 498 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_S_TakeScreenshot)); 498 499 pMenu->addSeparator(); 499 500 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_MenuBar));
Note:
See TracChangeset
for help on using the changeset viewer.