Changeset 42751 in vbox
- Timestamp:
- Aug 10, 2012 11:24:04 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 79969
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.cpp
r42631 r42751 867 867 }; 868 868 869 class UIActionSimpleSave : public UIActionSimple 870 { 871 Q_OBJECT; 872 873 public: 874 875 UIActionSimpleSave(QObject *pParent) 876 : UIActionSimple(pParent, ":/state_saved_16px.png") 877 { 878 retranslateUi(); 879 } 880 881 protected: 882 883 void retranslateUi() 884 { 885 setText(QApplication::translate("UIActionPool", "Save state")); 886 setStatusTip(QApplication::translate("UIActionPool", "Save the machine state of the selected virtual machine")); 887 setShortcut(gSS->keySequence(UISelectorShortcuts::SaveVMShortcut)); 888 } 889 }; 890 869 891 class UIActionSimpleACPIShutdown : public UIActionSimple 870 892 { … … 982 1004 983 1005 /* 'Machine/Close' actions: */ 1006 m_pool[UIActionIndexSelector_Simple_Machine_Close_Save] = new UIActionSimpleSave(this); 984 1007 m_pool[UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown] = new UIActionSimpleACPIShutdown(this); 985 1008 m_pool[UIActionIndexSelector_Simple_Machine_Close_PowerOff] = new UIActionSimplePowerOff(this); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.h
r42563 r42751 69 69 /* 'Machine/Close' menu actions: */ 70 70 UIActionIndexSelector_Menu_Machine_Close, 71 UIActionIndexSelector_Simple_Machine_Close_Save, 71 72 UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, 72 73 UIActionIndexSelector_Simple_Machine_Close_PowerOff, -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorShortcuts.cpp
r42631 r42751 43 43 m_Shortcuts[PauseVMShortcut] = UIKeySequence("PauseVM", "Ctrl+P"); 44 44 m_Shortcuts[ResetVMShortcut] = UIKeySequence("ResetVM", "Ctrl+T"); 45 m_Shortcuts[SaveVMShortcut] = UIKeySequence("SaveVM", "Ctrl+V"); 45 46 m_Shortcuts[ACPIShutdownVMShortcut] = UIKeySequence("ACPIShutdownVM", "Ctrl+H"); 46 47 m_Shortcuts[PowerOffVMShortcut] = UIKeySequence("PowerOffVM", "Ctrl+F"); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorShortcuts.h
r42631 r42751 45 45 PauseVMShortcut, 46 46 ResetVMShortcut, 47 SaveVMShortcut, 47 48 ACPIShutdownVMShortcut, 48 49 PowerOffVMShortcut, -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r42734 r42751 562 562 /* Reset VM: */ 563 563 console.Reset(); 564 565 /* Unlock machine finally: */ 566 session.UnlockMachine(); 567 } 568 } 569 570 void UISelectorWindow::sltPerformSaveAction() 571 { 572 /* Get selected items: */ 573 QList<UIVMItem*> items = currentItems(); 574 AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n")); 575 576 /* Check if all the items could be saved: */ 577 if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_Save, items)) 578 return; 579 580 /* For each selected item: */ 581 foreach (UIVMItem *pItem, items) 582 { 583 /* Open a session to modify VM state: */ 584 CSession session = vboxGlobal().openExistingSession(pItem->id()); 585 if (session.isNull()) 586 { 587 msgCenter().cannotOpenSession(session); 588 return; 589 } 590 591 /* Get session console: */ 592 CConsole console = session.GetConsole(); 593 /* Save machine state: */ 594 CProgress progress = console.SaveState(); 595 if (!console.isOk()) 596 msgCenter().cannotSaveMachineState(console); 597 else 598 { 599 /* Get machine: */ 600 CMachine machine = session.GetMachine(); 601 /* Show the "VM saving" progress dialog: */ 602 msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_state_save_90px.png", 0, true); 603 if (progress.GetResultCode() != 0) 604 msgCenter().cannotSaveMachineState(progress); 605 } 564 606 565 607 /* Unlock machine finally: */ … … 1181 1223 1182 1224 /* Populate Machine/Close-menu: */ 1225 m_pSaveAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_Save); 1226 pMenu->addAction(m_pSaveAction); 1183 1227 m_pACPIShutdownAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown); 1184 1228 pMenu->addAction(m_pACPIShutdownAction); … … 1329 1373 /* 'Machine/Close' menu connections: */ 1330 1374 connect(m_pMachineCloseMenu, SIGNAL(aboutToShow()), this, SLOT(sltMachineCloseMenuAboutToShow())); 1375 connect(m_pSaveAction, SIGNAL(triggered()), this, SLOT(sltPerformSaveAction())); 1331 1376 connect(m_pACPIShutdownAction, SIGNAL(triggered()), this, SLOT(sltPerformACPIShutdownAction())); 1332 1377 connect(m_pPowerOffAction, SIGNAL(triggered()), this, SLOT(sltPerformPowerOffAction())); … … 1534 1579 /* Enable/disable machine-close actions: */ 1535 1580 m_pMachineCloseMenuAction->setEnabled(isActionEnabled(UIActionIndexSelector_Menu_Machine_Close, items)); 1581 m_pSaveAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_Save, items)); 1536 1582 m_pACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, items)); 1537 1583 m_pPowerOffAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_PowerOff, items)); … … 1730 1776 return pItem->machineState() == KMachineState_Running || 1731 1777 pItem->machineState() == KMachineState_Paused; 1778 } 1779 case UIActionIndexSelector_Simple_Machine_Close_Save: 1780 { 1781 /* The same as 'Machine/Close' menu is enabled: */ 1782 return isActionEnabled(UIActionIndexSelector_Menu_Machine_Close, items); 1732 1783 } 1733 1784 case UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown: -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r42722 r42751 93 93 void sltPerformPauseResumeAction(bool fPause); 94 94 void sltPerformResetAction(); 95 void sltPerformSaveAction(); 95 96 void sltPerformACPIShutdownAction(); 96 97 void sltPerformPowerOffAction(); … … 217 218 UIAction *m_pMachineCloseMenuAction; 218 219 QMenu *m_pMachineCloseMenu; 220 UIAction *m_pSaveAction; 219 221 UIAction *m_pACPIShutdownAction; 220 222 UIAction *m_pPowerOffAction;
Note:
See TracChangeset
for help on using the changeset viewer.