Changeset 61052 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 19, 2016 4:17:43 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 107319
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r60458 r61052 540 540 case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Pause: strResult = "Pause"; break; 541 541 case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Reset: strResult = "Reset"; break; 542 case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Detach: strResult = "Detach"; break; 542 543 case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SaveState: strResult = "SaveState"; break; 543 544 case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Shutdown: strResult = "Shutdown"; break; … … 565 566 keys << "Pause"; values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Pause; 566 567 keys << "Reset"; values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Reset; 568 keys << "Detach"; values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Detach; 567 569 keys << "SaveState"; values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SaveState; 568 570 keys << "Shutdown"; values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Shutdown; -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r60599 r61052 381 381 RuntimeMenuMachineActionType_Pause = RT_BIT(3), 382 382 RuntimeMenuMachineActionType_Reset = RT_BIT(4), 383 RuntimeMenuMachineActionType_SaveState = RT_BIT(5), 384 RuntimeMenuMachineActionType_Shutdown = RT_BIT(6), 385 RuntimeMenuMachineActionType_PowerOff = RT_BIT(7), 386 RuntimeMenuMachineActionType_Nothing = RT_BIT(8), 383 RuntimeMenuMachineActionType_Detach = RT_BIT(5), 384 RuntimeMenuMachineActionType_SaveState = RT_BIT(6), 385 RuntimeMenuMachineActionType_Shutdown = RT_BIT(7), 386 RuntimeMenuMachineActionType_PowerOff = RT_BIT(8), 387 RuntimeMenuMachineActionType_Nothing = RT_BIT(9), 387 388 RuntimeMenuMachineActionType_All = 0xFFFF 388 389 }; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp
r60362 r61052 243 243 }; 244 244 245 class UIActionSimplePerformDetach : public UIActionSimple 246 { 247 Q_OBJECT; 248 249 public: 250 251 UIActionSimplePerformDetach(UIActionPool *pParent) 252 : UIActionSimple(pParent, ":/vm_create_shortcut_16px.png", ":/vm_create_shortcut_disabled_16px.png") {} 253 254 protected: 255 256 /** Returns action extra-data ID. */ 257 virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Detach; } 258 /** Returns action extra-data key. */ 259 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Detach); } 260 /** Returns whether action is allowed. */ 261 virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Detach); } 262 263 QString shortcutExtraDataID() const 264 { 265 return QString("DetachUI"); 266 } 267 268 void retranslateUi() 269 { 270 setName(QApplication::translate("UIActionPool", "&Detach GUI")); 271 setStatusTip(QApplication::translate("UIActionPool", "Detach the GUI from headless VM")); 272 } 273 }; 274 245 275 class UIActionSimplePerformSaveState : public UIActionSimple 246 276 { … … 2074 2104 m_pool[UIActionIndexRT_M_Machine_T_Pause] = new UIActionTogglePause(this); 2075 2105 m_pool[UIActionIndexRT_M_Machine_S_Reset] = new UIActionSimplePerformReset(this); 2106 m_pool[UIActionIndexRT_M_Machine_S_Detach] = new UIActionSimplePerformDetach(this); 2076 2107 m_pool[UIActionIndexRT_M_Machine_S_SaveState] = new UIActionSimplePerformSaveState(this); 2077 2108 m_pool[UIActionIndexRT_M_Machine_S_Shutdown] = new UIActionSimplePerformShutdown(this); … … 2372 2403 /* 'Reset' action: */ 2373 2404 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_Reset)) || fSeparator; 2405 /* 'Detach' action: */ 2406 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_Detach)) || fSeparator; 2374 2407 /* 'SaveState' action: */ 2375 2408 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_SaveState)) || fSeparator; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h
r60362 r61052 47 47 UIActionIndexRT_M_Machine_T_Pause, 48 48 UIActionIndexRT_M_Machine_S_Reset, 49 UIActionIndexRT_M_Machine_S_Detach, 49 50 UIActionIndexRT_M_Machine_S_SaveState, 50 51 UIActionIndexRT_M_Machine_S_Shutdown, -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r61028 r61052 387 387 } 388 388 #endif /* VBOX_WS_MAC */ 389 390 void UIMachineLogic::detach() 391 { 392 /* Enable 'manual-override', 393 * preventing automatic Runtime UI closing: */ 394 setManualOverrideMode(true); 395 396 /* Was the step successful? */ 397 bool fSuccess = true; 398 LogRel(("GUI: Passing request to detach UI from machine-logic to UI session.\n")); 399 fSuccess = uisession()->detach(); 400 401 /* Manually close Runtime UI: */ 402 if (fSuccess) 403 closeRuntimeUI(); 404 } 389 405 390 406 void UIMachineLogic::saveState() … … 1003 1019 1004 1020 /* Move actions into running-n-paused actions group: */ 1021 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Machine_S_Detach)); 1005 1022 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Machine_S_SaveState)); 1006 1023 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Machine_S_Settings)); … … 1072 1089 connect(actionPool()->action(UIActionIndexRT_M_Machine_S_Reset), SIGNAL(triggered()), 1073 1090 this, SLOT(sltReset())); 1091 connect(actionPool()->action(UIActionIndexRT_M_Machine_S_Detach), SIGNAL(triggered()), 1092 this, SLOT(sltDetach()), Qt::QueuedConnection); 1074 1093 connect(actionPool()->action(UIActionIndexRT_M_Machine_S_SaveState), SIGNAL(triggered()), 1075 1094 this, SLOT(sltSaveState()), Qt::QueuedConnection); … … 1570 1589 } 1571 1590 1591 void UIMachineLogic::sltDetach() 1592 { 1593 /* Make sure machine is in one of the allowed states: */ 1594 if (!uisession()->isRunning() && !uisession()->isPaused()) 1595 { 1596 AssertMsgFailed(("Invalid machine-state. Action should be prohibited!")); 1597 return; 1598 } 1599 1600 detach(); 1601 } 1602 1572 1603 void UIMachineLogic::sltSaveState() 1573 1604 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r60362 r61052 140 140 #endif /* VBOX_WS_MAC */ 141 141 142 /** Detach and close Runtime UI. */ 143 void detach(); 142 144 /** Save VM state, then close Runtime UI. */ 143 145 void saveState(); … … 267 269 void sltReset(); 268 270 void sltPause(bool fOn); 271 void sltDetach(); 269 272 void sltSaveState(); 270 273 void sltShutdown(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r60362 r61052 421 421 /* Just close Runtime UI: */ 422 422 LogRel(("GUI: Request for close-action to detach GUI.\n")); 423 machineLogic()-> closeRuntimeUI();423 machineLogic()->detach(); 424 424 break; 425 425 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp
r60362 r61052 882 882 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_T_Pause)); 883 883 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_Reset)); 884 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_Detach)); 884 885 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_SaveState)); 885 886 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_Shutdown)); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r61021 r61052 321 321 322 322 /* True by default: */ 323 return true; 324 } 325 326 bool UISession::detach() 327 { 328 /* Nothing here for now: */ 323 329 return true; 324 330 } … … 2132 2138 /* Get host and prepare restrictions: */ 2133 2139 const CHost host = vboxGlobal().host(); 2140 UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictionForMachine = UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid; 2134 2141 UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictionForView = UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid; 2135 2142 UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictionForDevices = UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid; 2143 2144 /* Separate process stuff: */ 2145 { 2146 /* Initialize 'Machine' menu: */ 2147 if (!vboxGlobal().isSeparateProcess()) 2148 restrictionForMachine = (UIExtraDataMetaDefs::RuntimeMenuMachineActionType)(restrictionForMachine | UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Detach); 2149 } 2136 2150 2137 2151 /* VRDE server stuff: */ … … 2203 2217 } 2204 2218 2219 /* Apply cumulative restriction for 'Machine' menu: */ 2220 actionPool()->toRuntime()->setRestrictionForMenuMachine(UIActionRestrictionLevel_Session, restrictionForMachine); 2205 2221 /* Apply cumulative restriction for 'View' menu: */ 2206 2222 actionPool()->toRuntime()->setRestrictionForMenuView(UIActionRestrictionLevel_Session, restrictionForView); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r60362 r61052 94 94 bool initialize(); 95 95 bool powerUp(); 96 bool detach(); 96 97 bool saveState(); 97 98 bool shutdown();
Note:
See TracChangeset
for help on using the changeset viewer.