Changeset 97277 in vbox
- Timestamp:
- Oct 24, 2022 12:37:37 PM (2 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
-
globals/UIActionPoolManager.cpp (modified) (10 diffs)
-
globals/UIActionPoolManager.h (modified) (4 diffs)
-
manager/UIVirtualBoxManager.cpp (modified) (16 diffs)
-
manager/UIVirtualBoxManager.h (modified) (1 diff)
-
manager/chooser/UIChooserModel.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.cpp
r96483 r97277 1215 1215 }; 1216 1216 1217 /** Simple action extension, used as 'Perform Detach' action class. */ 1218 class UIActionSimpleManagerCommonPerformDetach : public UIActionSimple 1219 { 1220 Q_OBJECT; 1221 1222 public: 1223 1224 /** Constructs action passing @a pParent to the base-class. */ 1225 UIActionSimpleManagerCommonPerformDetach(UIActionPool *pParent) 1226 : UIActionSimple(pParent, ":/vm_create_shortcut_16px.png", ":/vm_create_shortcut_disabled_16px.png") 1227 {} 1228 1229 protected: 1230 1231 /** Returns shortcut extra-data ID. */ 1232 virtual QString shortcutExtraDataID() const RT_OVERRIDE 1233 { 1234 return QString("DetachUIVM"); 1235 } 1236 1237 /** Handles translation event. */ 1238 virtual void retranslateUi() RT_OVERRIDE 1239 { 1240 setName(QApplication::translate("UIActionPool", "&Detach GUI")); 1241 setStatusTip(QApplication::translate("UIActionPool", "Detach the GUI from headless VM")); 1242 } 1243 }; 1244 1217 1245 /** Simple menu action extension, used as 'Perform Discard' action class. */ 1218 1246 class UIActionSimpleManagerCommonPerformDiscard : public UIActionSimple … … 1646 1674 }; 1647 1675 1648 /** Simple action extension, used as 'Perform Detach' action class. */1649 class UIActionSimpleManagerClosePerformDetach : public UIActionSimple1650 {1651 Q_OBJECT;1652 1653 public:1654 1655 /** Constructs action passing @a pParent to the base-class. */1656 UIActionSimpleManagerClosePerformDetach(UIActionPool *pParent)1657 : UIActionSimple(pParent, ":/vm_create_shortcut_16px.png", ":/vm_create_shortcut_disabled_16px.png")1658 {}1659 1660 protected:1661 1662 /** Returns shortcut extra-data ID. */1663 virtual QString shortcutExtraDataID() const RT_OVERRIDE1664 {1665 return QString("DetachUIVM");1666 }1667 1668 /** Handles translation event. */1669 virtual void retranslateUi() RT_OVERRIDE1670 {1671 setName(QApplication::translate("UIActionPool", "&Detach GUI"));1672 setStatusTip(QApplication::translate("UIActionPool", "Detach the GUI from headless VM"));1673 }1674 };1675 1676 1676 /** Simple action extension, used as 'Perform Save' action class. */ 1677 1677 class UIActionSimpleManagerClosePerformSave : public UIActionSimple … … 3645 3645 m_pool[UIActionIndexMN_M_Group_T_Pause] = new UIActionToggleManagerCommonPauseAndResume(this); 3646 3646 m_pool[UIActionIndexMN_M_Group_S_Reset] = new UIActionSimpleManagerCommonPerformReset(this); 3647 m_pool[UIActionIndexMN_M_Group_S_Detach] = new UIActionSimpleManagerCommonPerformDetach(this); 3647 3648 m_pool[UIActionIndexMN_M_Group_M_Console] = new UIActionMenuManagerConsole(this); 3648 3649 m_pool[UIActionIndexMN_M_Group_M_Console_S_CreateConnection] = new UIActionSimpleManagerConsolePerformCreateConnection(this); … … 3650 3651 m_pool[UIActionIndexMN_M_Group_M_Console_S_ConfigureApplications] = new UIActionSimpleManagerConsolePerformConfigureApplications(this); 3651 3652 m_pool[UIActionIndexMN_M_Group_M_Close] = new UIActionMenuManagerClose(this); 3652 m_pool[UIActionIndexMN_M_Group_M_Close_S_Detach] = new UIActionSimpleManagerClosePerformDetach(this);3653 3653 m_pool[UIActionIndexMN_M_Group_M_Close_S_SaveState] = new UIActionSimpleManagerClosePerformSave(this); 3654 3654 m_pool[UIActionIndexMN_M_Group_M_Close_S_Terminate] = new UIActionSimpleManagerClosePerformTerminate(this); … … 3687 3687 m_pool[UIActionIndexMN_M_Machine_T_Pause] = new UIActionToggleManagerCommonPauseAndResume(this); 3688 3688 m_pool[UIActionIndexMN_M_Machine_S_Reset] = new UIActionSimpleManagerCommonPerformReset(this); 3689 m_pool[UIActionIndexMN_M_Machine_S_Detach] = new UIActionSimpleManagerCommonPerformDetach(this); 3689 3690 m_pool[UIActionIndexMN_M_Machine_M_Console] = new UIActionMenuManagerConsole(this); 3690 3691 m_pool[UIActionIndexMN_M_Machine_M_Console_S_CreateConnection] = new UIActionSimpleManagerConsolePerformCreateConnection(this); … … 3697 3698 m_pool[UIActionIndexMN_M_Machine_M_Console_S_ShowLog] = new UIActionSimpleManagerConsolePerformShowLog(this); 3698 3699 m_pool[UIActionIndexMN_M_Machine_M_Close] = new UIActionMenuManagerClose(this); 3699 m_pool[UIActionIndexMN_M_Machine_M_Close_S_Detach] = new UIActionSimpleManagerClosePerformDetach(this);3700 3700 m_pool[UIActionIndexMN_M_Machine_M_Close_S_SaveState] = new UIActionSimpleManagerClosePerformSave(this); 3701 3701 m_pool[UIActionIndexMN_M_Machine_M_Close_S_Terminate] = new UIActionSimpleManagerClosePerformTerminate(this); … … 3959 3959 << action(UIActionIndexMN_M_Group_T_Pause) 3960 3960 << action(UIActionIndexMN_M_Group_S_Reset) 3961 // << action(UIActionIndexMN_M_Group_S_Detach) 3961 3962 << action(UIActionIndexMN_M_Group_S_Discard) 3962 3963 << action(UIActionIndexMN_M_Group_S_ShowLogDialog) … … 3971 3972 << action(UIActionIndexMN_M_Group_M_Console_S_DeleteConnection) 3972 3973 << action(UIActionIndexMN_M_Group_M_Console_S_ConfigureApplications) 3973 // << action(UIActionIndexMN_M_Group_M_Close_S_Detach)3974 3974 << action(UIActionIndexMN_M_Group_M_Close_S_SaveState) 3975 3975 << action(UIActionIndexMN_M_Group_M_Close_S_Terminate) … … 3995 3995 << action(UIActionIndexMN_M_Machine_T_Pause) 3996 3996 << action(UIActionIndexMN_M_Machine_S_Reset) 3997 // << action(UIActionIndexMN_M_Machine_S_Detach) 3997 3998 << action(UIActionIndexMN_M_Machine_S_Discard) 3998 3999 << action(UIActionIndexMN_M_Machine_S_ShowLogDialog) … … 4013 4014 << action(UIActionIndexMN_M_Machine_M_Console_S_ConfigureApplications) 4014 4015 << action(UIActionIndexMN_M_Machine_M_Console_S_ShowLog) 4015 // << action(UIActionIndexMN_M_Machine_M_Close_S_Detach)4016 4016 << action(UIActionIndexMN_M_Machine_M_Close_S_SaveState) 4017 4017 << action(UIActionIndexMN_M_Machine_M_Close_S_Terminate) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.h
r96407 r97277 79 79 UIActionIndexMN_M_Group_T_Pause, 80 80 UIActionIndexMN_M_Group_S_Reset, 81 UIActionIndexMN_M_Group_S_Detach, 81 82 UIActionIndexMN_M_Group_M_Console, 82 83 UIActionIndexMN_M_Group_M_Console_S_CreateConnection, … … 84 85 UIActionIndexMN_M_Group_M_Console_S_ConfigureApplications, 85 86 UIActionIndexMN_M_Group_M_Close, 86 UIActionIndexMN_M_Group_M_Close_S_Detach,87 87 UIActionIndexMN_M_Group_M_Close_S_SaveState, 88 88 UIActionIndexMN_M_Group_M_Close_S_Terminate, … … 120 120 UIActionIndexMN_M_Machine_T_Pause, 121 121 UIActionIndexMN_M_Machine_S_Reset, 122 UIActionIndexMN_M_Machine_S_Detach, 122 123 UIActionIndexMN_M_Machine_M_Console, 123 124 UIActionIndexMN_M_Machine_M_Console_S_CreateConnection, … … 130 131 UIActionIndexMN_M_Machine_M_Console_S_ShowLog, 131 132 UIActionIndexMN_M_Machine_M_Close, 132 UIActionIndexMN_M_Machine_M_Close_S_Detach,133 133 UIActionIndexMN_M_Machine_M_Close_S_SaveState, 134 134 UIActionIndexMN_M_Machine_M_Close_S_Terminate, -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r97076 r97277 1685 1685 { 1686 1686 /* Check if current item could be detached: */ 1687 if (!isActionEnabled(UIActionIndexMN_M_Machine_ M_Close_S_Detach, QList<UIVirtualMachineItem*>() << pItem))1687 if (!isActionEnabled(UIActionIndexMN_M_Machine_S_Detach, QList<UIVirtualMachineItem*>() << pItem)) 1688 1688 continue; 1689 1689 … … 2231 2231 connect(actionPool()->action(UIActionIndexMN_M_Group_S_Reset), &UIAction::triggered, 2232 2232 this, &UIVirtualBoxManager::sltPerformResetMachine); 2233 connect(actionPool()->action(UIActionIndexMN_M_Group_S_Detach), &UIAction::triggered, 2234 this, &UIVirtualBoxManager::sltPerformDetachMachineUI); 2233 2235 connect(actionPool()->action(UIActionIndexMN_M_Group_S_Discard), &UIAction::triggered, 2234 2236 this, &UIVirtualBoxManager::sltPerformDiscardMachineState); … … 2271 2273 connect(actionPool()->action(UIActionIndexMN_M_Machine_S_Reset), &UIAction::triggered, 2272 2274 this, &UIVirtualBoxManager::sltPerformResetMachine); 2275 connect(actionPool()->action(UIActionIndexMN_M_Machine_S_Detach), &UIAction::triggered, 2276 this, &UIVirtualBoxManager::sltPerformDetachMachineUI); 2273 2277 connect(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard), &UIAction::triggered, 2274 2278 this, &UIVirtualBoxManager::sltPerformDiscardMachineState); … … 2331 2335 2332 2336 /* 'Group/Close' menu connections: */ 2333 connect(actionPool()->action(UIActionIndexMN_M_Group_M_Close_S_Detach), &UIAction::triggered,2334 this, &UIVirtualBoxManager::sltPerformDetachMachineUI);2335 2337 connect(actionPool()->action(UIActionIndexMN_M_Group_M_Close_S_SaveState), &UIAction::triggered, 2336 2338 this, &UIVirtualBoxManager::sltPerformSaveMachineState); … … 2343 2345 2344 2346 /* 'Machine/Close' menu connections: */ 2345 connect(actionPool()->action(UIActionIndexMN_M_Machine_M_Close_S_Detach), &UIAction::triggered,2346 this, &UIVirtualBoxManager::sltPerformDetachMachineUI);2347 2347 connect(actionPool()->action(UIActionIndexMN_M_Machine_M_Close_S_SaveState), &UIAction::triggered, 2348 2348 this, &UIVirtualBoxManager::sltPerformSaveMachineState); … … 2811 2811 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_T_Pause)); 2812 2812 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Reset)); 2813 // pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Detach)); 2813 2814 pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Close)->menu()); 2814 2815 pMenu->addSeparator(); … … 2870 2871 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_T_Pause)); 2871 2872 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Reset)); 2873 // pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Detach)); 2872 2874 pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Close)->menu()); 2873 2875 pMenu->addSeparator(); … … 2924 2926 if (pItem->itemType() == UIVirtualMachineItemType_Local) 2925 2927 { 2926 // pMenu->addAction(action(UIActionIndexMN_M_Group_M_Close_S_Detach));2927 2928 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_M_Close_S_SaveState)); 2928 2929 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_M_Close_S_Shutdown)); … … 3070 3071 if (pItem->itemType() == UIVirtualMachineItemType_Local) 3071 3072 { 3072 // pMenu->addAction(action(UIActionIndexMN_M_Machine_M_Close_S_Detach));3073 3073 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_Close_S_SaveState)); 3074 3074 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_M_Close_S_Shutdown)); … … 3168 3168 actionPool()->action(UIActionIndexMN_M_Group_T_Pause)->setEnabled(isActionEnabled(UIActionIndexMN_M_Group_T_Pause, items)); 3169 3169 actionPool()->action(UIActionIndexMN_M_Group_S_Reset)->setEnabled(isActionEnabled(UIActionIndexMN_M_Group_S_Reset, items)); 3170 actionPool()->action(UIActionIndexMN_M_Group_S_Detach)->setEnabled(isActionEnabled(UIActionIndexMN_M_Group_S_Detach, items)); 3170 3171 actionPool()->action(UIActionIndexMN_M_Group_S_Discard)->setEnabled(isActionEnabled(UIActionIndexMN_M_Group_S_Discard, items)); 3171 3172 actionPool()->action(UIActionIndexMN_M_Group_S_ShowLogDialog)->setEnabled(isActionEnabled(UIActionIndexMN_M_Group_S_ShowLogDialog, items)); … … 3187 3188 actionPool()->action(UIActionIndexMN_M_Machine_T_Pause)->setEnabled(isActionEnabled(UIActionIndexMN_M_Machine_T_Pause, items)); 3188 3189 actionPool()->action(UIActionIndexMN_M_Machine_S_Reset)->setEnabled(isActionEnabled(UIActionIndexMN_M_Machine_S_Reset, items)); 3190 actionPool()->action(UIActionIndexMN_M_Machine_S_Detach)->setEnabled(isActionEnabled(UIActionIndexMN_M_Machine_S_Detach, items)); 3189 3191 actionPool()->action(UIActionIndexMN_M_Machine_S_Discard)->setEnabled(isActionEnabled(UIActionIndexMN_M_Machine_S_Discard, items)); 3190 3192 actionPool()->action(UIActionIndexMN_M_Machine_S_ShowLogDialog)->setEnabled(isActionEnabled(UIActionIndexMN_M_Machine_S_ShowLogDialog, items)); … … 3225 3227 /* Enable/disable group-close actions: */ 3226 3228 actionPool()->action(UIActionIndexMN_M_Group_M_Close)->setEnabled(isActionEnabled(UIActionIndexMN_M_Group_M_Close, items)); 3227 actionPool()->action(UIActionIndexMN_M_Group_M_Close_S_Detach)->setEnabled(isActionEnabled(UIActionIndexMN_M_Group_M_Close_S_Detach, items));3228 3229 actionPool()->action(UIActionIndexMN_M_Group_M_Close_S_SaveState)->setEnabled(isActionEnabled(UIActionIndexMN_M_Group_M_Close_S_SaveState, items)); 3229 3230 actionPool()->action(UIActionIndexMN_M_Group_M_Close_S_Terminate)->setEnabled(isActionEnabled(UIActionIndexMN_M_Group_M_Close_S_Terminate, items)); … … 3233 3234 /* Enable/disable machine-close actions: */ 3234 3235 actionPool()->action(UIActionIndexMN_M_Machine_M_Close)->setEnabled(isActionEnabled(UIActionIndexMN_M_Machine_M_Close, items)); 3235 actionPool()->action(UIActionIndexMN_M_Machine_M_Close_S_Detach)->setEnabled(isActionEnabled(UIActionIndexMN_M_Machine_M_Close_S_Detach, items));3236 3236 actionPool()->action(UIActionIndexMN_M_Machine_M_Close_S_SaveState)->setEnabled(isActionEnabled(UIActionIndexMN_M_Machine_M_Close_S_SaveState, items)); 3237 3237 actionPool()->action(UIActionIndexMN_M_Machine_M_Close_S_Terminate)->setEnabled(isActionEnabled(UIActionIndexMN_M_Machine_M_Close_S_Terminate, items)); … … 3460 3460 isAtLeastOneItemRunning(items); 3461 3461 } 3462 case UIActionIndexMN_M_Group_S_Detach: 3463 case UIActionIndexMN_M_Machine_S_Detach: 3464 { 3465 return isItemsLocal(items) && 3466 isAtLeastOneItemRunning(items) && 3467 isAtLeastOneItemDetachable(items); 3468 } 3462 3469 case UIActionIndexMN_M_Group_S_Refresh: 3463 3470 case UIActionIndexMN_M_Machine_S_Refresh: … … 3503 3510 || (isItemsCloud(items) && isAtLeastOneItemDiscardable(items)); 3504 3511 } 3505 case UIActionIndexMN_M_Group_M_Close_S_Detach:3506 case UIActionIndexMN_M_Machine_M_Close_S_Detach:3507 3512 case UIActionIndexMN_M_Group_M_Close_S_SaveState: 3508 3513 case UIActionIndexMN_M_Machine_M_Close_S_SaveState: … … 3717 3722 } 3718 3723 3724 /* static */ 3725 bool UIVirtualBoxManager::isAtLeastOneItemDetachable(const QList<UIVirtualMachineItem*> &items) 3726 { 3727 foreach (UIVirtualMachineItem *pItem, items) 3728 if (pItem->isItemRunningHeadless()) 3729 return true; 3730 return false; 3731 } 3732 3719 3733 #ifdef VBOX_WS_X11 3720 3734 /* static */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h
r97076 r97277 461 461 /** Returns whether at least one of passed @a items is running. */ 462 462 static bool isAtLeastOneItemRunning(const QList<UIVirtualMachineItem*> &items); 463 /** Returns whether at least one of passed @a items is detachable. */ 464 static bool isAtLeastOneItemDetachable(const QList<UIVirtualMachineItem*> &items); 463 465 464 466 #ifdef VBOX_WS_X11 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r96407 r97277 1499 1499 pMenuGroup->addAction(actionPool()->action(UIActionIndexMN_M_Group_T_Pause)); 1500 1500 pMenuGroup->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Reset)); 1501 // pMenuGroup->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Detach)); 1501 1502 pMenuGroup->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Close)->menu()); 1502 1503 pMenuGroup->addSeparator(); … … 1526 1527 pMenuMachine->addAction(actionPool()->action(UIActionIndexMN_M_Machine_T_Pause)); 1527 1528 pMenuMachine->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Reset)); 1529 // pMenuMachine->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Detach)); 1528 1530 pMenuMachine->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Close)->menu()); 1529 1531 pMenuMachine->addSeparator();
Note:
See TracChangeset
for help on using the changeset viewer.

