- Timestamp:
- Aug 10, 2012 10:34:00 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.cpp
r42760 r42767 630 630 631 631 632 class UIActionMenu MachineClose : public UIActionMenu633 { 634 Q_OBJECT; 635 636 public: 637 638 UIActionMenu MachineClose(QObject *pParent)632 class UIActionMenuClose : public UIActionMenu 633 { 634 Q_OBJECT; 635 636 public: 637 638 UIActionMenuClose(QObject *pParent) 639 639 : UIActionMenu(pParent, ":/exit_16px.png") 640 640 { … … 759 759 m_pool[UIActionIndexSelector_Simple_Group_Remove] = new UIActionSimpleGroupRemove(this); 760 760 m_pool[UIActionIndexSelector_Simple_Group_Sort] = new UIActionSimpleGroupSort(this); 761 m_pool[UIActionIndexSelector_Simple_Group_Close_Save] = new UIActionSimpleSave(this); 762 m_pool[UIActionIndexSelector_Simple_Group_Close_ACPIShutdown] = new UIActionSimpleACPIShutdown(this); 763 m_pool[UIActionIndexSelector_Simple_Group_Close_PowerOff] = new UIActionSimplePowerOff(this); 761 764 762 765 /* 'Machine' actions: */ … … 765 768 m_pool[UIActionIndexSelector_Simple_Machine_Remove] = new UIActionSimpleMachineRemove(this); 766 769 m_pool[UIActionIndexSelector_Simple_Machine_AddGroup] = new UIActionSimpleMachineAddGroup(this); 770 m_pool[UIActionIndexSelector_Simple_Machine_Close_Save] = new UIActionSimpleSave(this); 771 m_pool[UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown] = new UIActionSimpleACPIShutdown(this); 772 m_pool[UIActionIndexSelector_Simple_Machine_Close_PowerOff] = new UIActionSimplePowerOff(this); 767 773 768 774 /* Common actions: */ … … 777 783 m_pool[UIActionIndexSelector_Simple_Common_CreateShortcut] = new UIActionSimpleCommonCreateShortcut(this); 778 784 m_pool[UIActionIndexSelector_Simple_Common_SortParent] = new UIActionSimpleCommonSortParent(this); 779 780 /* 'Machine/Close' actions: */781 m_pool[UIActionIndexSelector_Simple_Machine_Close_Save] = new UIActionSimpleSave(this);782 m_pool[UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown] = new UIActionSimpleACPIShutdown(this);783 m_pool[UIActionIndexSelector_Simple_Machine_Close_PowerOff] = new UIActionSimplePowerOff(this);784 785 } 785 786 … … 794 795 /* 'Group' menu: */ 795 796 m_pool[UIActionIndexSelector_Menu_Group] = new UIActionMenuGroup(this); 797 m_pool[UIActionIndexSelector_Menu_Group_Close] = new UIActionMenuClose(this); 796 798 797 799 /* 'Machine' menu: */ 798 800 m_pool[UIActionIndexSelector_Menu_Machine] = new UIActionMenuMachine(this); 799 800 /* 'Machine/Close' menu: */ 801 m_pool[UIActionIndexSelector_Menu_Machine_Close] = new UIActionMenuMachineClose(this); 801 m_pool[UIActionIndexSelector_Menu_Machine_Close] = new UIActionMenuClose(this); 802 802 } 803 803 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.h
r42760 r42767 39 39 UIActionIndexSelector_Simple_Group_Remove, 40 40 UIActionIndexSelector_Simple_Group_Sort, 41 UIActionIndexSelector_Menu_Group_Close, 42 UIActionIndexSelector_Simple_Group_Close_Save, 43 UIActionIndexSelector_Simple_Group_Close_ACPIShutdown, 44 UIActionIndexSelector_Simple_Group_Close_PowerOff, 41 45 42 46 /* 'Machine' menu actions: */ … … 46 50 UIActionIndexSelector_Simple_Machine_Remove, 47 51 UIActionIndexSelector_Simple_Machine_AddGroup, 52 UIActionIndexSelector_Menu_Machine_Close, 53 UIActionIndexSelector_Simple_Machine_Close_Save, 54 UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, 55 UIActionIndexSelector_Simple_Machine_Close_PowerOff, 48 56 49 57 /* Common 'Group' / 'Machine' menu actions: */ … … 58 66 UIActionIndexSelector_Simple_Common_CreateShortcut, 59 67 UIActionIndexSelector_Simple_Common_SortParent, 60 61 /* 'Machine/Close' menu actions: */62 UIActionIndexSelector_Menu_Machine_Close,63 UIActionIndexSelector_Simple_Machine_Close_Save,64 UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown,65 UIActionIndexSelector_Simple_Machine_Close_PowerOff,66 68 67 69 /* Maximum index: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r42766 r42767 776 776 } 777 777 778 void UISelectorWindow::slt MachineCloseMenuAboutToShow()778 void UISelectorWindow::sltGroupCloseMenuAboutToShow() 779 779 { 780 780 /* Get selected items: */ … … 782 782 AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n")); 783 783 784 m_pACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, items)); 784 m_pGroupACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Close_ACPIShutdown, items)); 785 } 786 void UISelectorWindow::sltMachineCloseMenuAboutToShow() 787 { 788 /* Get selected items: */ 789 QList<UIVMItem*> items = currentItems(); 790 AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n")); 791 792 m_pMachineACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, items)); 785 793 } 786 794 … … 1071 1079 menuBar()->addMenu(m_pFileMenu); 1072 1080 1073 /* Prepare 'Close' menu: */ 1081 /* Prepare 'Group' / 'Close' menu: */ 1082 m_pGroupCloseMenuAction = gActionPool->action(UIActionIndexSelector_Menu_Group_Close); 1083 m_pGroupCloseMenu = m_pGroupCloseMenuAction->menu(); 1084 prepareMenuGroupClose(m_pGroupCloseMenu); 1085 1086 /* Prepare 'Machine' / 'Close' menu: */ 1074 1087 m_pMachineCloseMenuAction = gActionPool->action(UIActionIndexSelector_Menu_Machine_Close); 1075 1088 m_pMachineCloseMenu = m_pMachineCloseMenuAction->menu(); … … 1175 1188 pMenu->addAction(m_pAction_Common_PauseAndResume); 1176 1189 pMenu->addAction(m_pAction_Common_Reset); 1177 pMenu->addMenu(m_p MachineCloseMenu);1190 pMenu->addMenu(m_pGroupCloseMenu); 1178 1191 pMenu->addSeparator(); 1179 1192 pMenu->addAction(m_pAction_Common_Discard); … … 1228 1241 } 1229 1242 1230 void UISelectorWindow::prepareMenu MachineClose(QMenu *pMenu)1243 void UISelectorWindow::prepareMenuGroupClose(QMenu *pMenu) 1231 1244 { 1232 1245 /* Do not touch if filled already: */ … … 1234 1247 return; 1235 1248 1236 /* Populate Machine/Close-menu: */ 1237 m_pSaveAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_Save); 1238 pMenu->addAction(m_pSaveAction); 1239 m_pACPIShutdownAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown); 1240 pMenu->addAction(m_pACPIShutdownAction); 1241 m_pPowerOffAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_PowerOff); 1242 pMenu->addAction(m_pPowerOffAction); 1249 /* Populate 'Group' / 'Close' menu: */ 1250 m_pGroupSaveAction = gActionPool->action(UIActionIndexSelector_Simple_Group_Close_Save); 1251 pMenu->addAction(m_pGroupSaveAction); 1252 m_pGroupACPIShutdownAction = gActionPool->action(UIActionIndexSelector_Simple_Group_Close_ACPIShutdown); 1253 pMenu->addAction(m_pGroupACPIShutdownAction); 1254 m_pGroupPowerOffAction = gActionPool->action(UIActionIndexSelector_Simple_Group_Close_PowerOff); 1255 pMenu->addAction(m_pGroupPowerOffAction); 1256 } 1257 1258 void UISelectorWindow::prepareMenuMachineClose(QMenu *pMenu) 1259 { 1260 /* Do not touch if filled already: */ 1261 if (!pMenu->isEmpty()) 1262 return; 1263 1264 /* Populate 'Machine' / 'Close' menu: */ 1265 m_pMachineSaveAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_Save); 1266 pMenu->addAction(m_pMachineSaveAction); 1267 m_pMachineACPIShutdownAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown); 1268 pMenu->addAction(m_pMachineACPIShutdownAction); 1269 m_pMachinePowerOffAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_PowerOff); 1270 pMenu->addAction(m_pMachinePowerOffAction); 1243 1271 } 1244 1272 … … 1375 1403 connect(m_pAction_Machine_Clone, SIGNAL(triggered()), this, SLOT(sltShowCloneMachineWizard())); 1376 1404 1405 /* 'Group/Close' menu connections: */ 1406 connect(m_pGroupCloseMenu, SIGNAL(aboutToShow()), this, SLOT(sltGroupCloseMenuAboutToShow())); 1407 connect(m_pGroupSaveAction, SIGNAL(triggered()), this, SLOT(sltPerformSaveAction())); 1408 connect(m_pGroupACPIShutdownAction, SIGNAL(triggered()), this, SLOT(sltPerformACPIShutdownAction())); 1409 connect(m_pGroupPowerOffAction, SIGNAL(triggered()), this, SLOT(sltPerformPowerOffAction())); 1410 1377 1411 /* 'Machine/Close' menu connections: */ 1378 1412 connect(m_pMachineCloseMenu, SIGNAL(aboutToShow()), this, SLOT(sltMachineCloseMenuAboutToShow())); 1379 connect(m_p SaveAction, SIGNAL(triggered()), this, SLOT(sltPerformSaveAction()));1380 connect(m_p ACPIShutdownAction, SIGNAL(triggered()), this, SLOT(sltPerformACPIShutdownAction()));1381 connect(m_p PowerOffAction, SIGNAL(triggered()), this, SLOT(sltPerformPowerOffAction()));1413 connect(m_pMachineSaveAction, SIGNAL(triggered()), this, SLOT(sltPerformSaveAction())); 1414 connect(m_pMachineACPIShutdownAction, SIGNAL(triggered()), this, SLOT(sltPerformACPIShutdownAction())); 1415 connect(m_pMachinePowerOffAction, SIGNAL(triggered()), this, SLOT(sltPerformPowerOffAction())); 1382 1416 1383 1417 /* 'Help' menu connections: */ … … 1575 1609 m_pAction_Common_SortParent->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Common_SortParent, items)); 1576 1610 1611 /* Enable/disable group-close actions: */ 1612 m_pGroupCloseMenuAction->setEnabled(isActionEnabled(UIActionIndexSelector_Menu_Group_Close, items)); 1613 m_pGroupSaveAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Close_Save, items)); 1614 m_pGroupACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Close_ACPIShutdown, items)); 1615 m_pGroupPowerOffAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Close_PowerOff, items)); 1616 1577 1617 /* Enable/disable machine-close actions: */ 1578 1618 m_pMachineCloseMenuAction->setEnabled(isActionEnabled(UIActionIndexSelector_Menu_Machine_Close, items)); 1579 m_p SaveAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_Save, items));1580 m_p ACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, items));1581 m_p PowerOffAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_PowerOff, items));1619 m_pMachineSaveAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_Save, items)); 1620 m_pMachineACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, items)); 1621 m_pMachinePowerOffAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_PowerOff, items)); 1582 1622 1583 1623 /* Start/Show action is deremined by 1st item: */ … … 1688 1728 return isAtLeastOneItemSupportsShortcuts(items); 1689 1729 } 1730 case UIActionIndexSelector_Menu_Group_Close: 1690 1731 case UIActionIndexSelector_Menu_Machine_Close: 1691 1732 { 1692 1733 return isAtLeastOneItemStarted(items); 1693 1734 } 1735 case UIActionIndexSelector_Simple_Group_Close_Save: 1694 1736 case UIActionIndexSelector_Simple_Machine_Close_Save: 1695 1737 { 1696 1738 return isActionEnabled(UIActionIndexSelector_Menu_Machine_Close, items); 1697 1739 } 1740 case UIActionIndexSelector_Simple_Group_Close_ACPIShutdown: 1698 1741 case UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown: 1699 1742 { … … 1701 1744 isAtLeastOneItemAbleToShutdown(items); 1702 1745 } 1746 case UIActionIndexSelector_Simple_Group_Close_PowerOff: 1703 1747 case UIActionIndexSelector_Simple_Machine_Close_PowerOff: 1704 1748 { -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r42766 r42767 100 100 void sltShowMachineInFileManager(); 101 101 void sltPerformCreateShortcutAction(); 102 void sltGroupCloseMenuAboutToShow(); 102 103 void sltMachineCloseMenuAboutToShow(); 103 104 … … 130 131 void prepareMenuGroup(QMenu *pMenu); 131 132 void prepareMenuMachine(QMenu *pMenu); 133 void prepareMenuGroupClose(QMenu *pMenu); 132 134 void prepareMenuMachineClose(QMenu *pMenu); 133 135 void prepareMenuHelp(QMenu *pMenu); … … 212 214 UIAction *m_pAction_Group_Remove; 213 215 UIAction *m_pAction_Group_Sort; 216 /* 'Group / Close' menu action pointers: */ 217 UIAction *m_pGroupCloseMenuAction; 218 QMenu *m_pGroupCloseMenu; 219 UIAction *m_pGroupSaveAction; 220 UIAction *m_pGroupACPIShutdownAction; 221 UIAction *m_pGroupPowerOffAction; 214 222 215 223 /* 'Machine' menu action pointers: */ … … 221 229 UIAction *m_pAction_Machine_Remove; 222 230 UIAction *m_pAction_Machine_AddGroup; 223 224 231 /* 'Machine / Close' menu action pointers: */ 225 232 UIAction *m_pMachineCloseMenuAction; 226 233 QMenu *m_pMachineCloseMenu; 227 UIAction *m_p SaveAction;228 UIAction *m_p ACPIShutdownAction;229 UIAction *m_p PowerOffAction;234 UIAction *m_pMachineSaveAction; 235 UIAction *m_pMachineACPIShutdownAction; 236 UIAction *m_pMachinePowerOffAction; 230 237 231 238 /* 'Help' menu action pointers: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
r42760 r42767 906 906 m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Toggle_Common_PauseAndResume)); 907 907 m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Common_Reset)); 908 m_pContextMenuGroup->addMenu(gActionPool->action(UIActionIndexSelector_Menu_ Machine_Close)->menu());908 m_pContextMenuGroup->addMenu(gActionPool->action(UIActionIndexSelector_Menu_Group_Close)->menu()); 909 909 m_pContextMenuGroup->addSeparator(); 910 910 m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Common_Discard));
Note:
See TracChangeset
for help on using the changeset viewer.