- Timestamp:
- Aug 25, 2021 4:33:13 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r90883 r90888 400 400 if (fSuccess) 401 401 uisession()->closeRuntimeUI(); 402 }403 404 void UIMachineLogic::saveState()405 {406 /* Do we save state? */407 bool fSaveState = true;408 409 /* If VM is not paused, we should pause it first: */410 if (!uisession()->isPaused())411 fSaveState = uisession()->pause();412 413 /* Saving state: */414 if (fSaveState)415 {416 /* Enable 'manual-override',417 * preventing automatic Runtime UI closing: */418 uisession()->setManualOverrideMode(true);419 420 /* Saving VM state: */421 LogRel(("GUI: Passing request to save VM state from machine-logic to UI session.\n"));422 UINotificationProgressMachineSaveState *pNotification = new UINotificationProgressMachineSaveState(machine());423 connect(pNotification, &UINotificationProgressMachineSaveState::sigMachineStateSaved,424 this, &UIMachineLogic::sltHandleMachineStateSaved);425 gpNotificationCenter->append(pNotification);426 }427 402 } 428 403 … … 1909 1884 1910 1885 LogRel(("GUI: User requested to save VM state.\n")); 1911 saveState(); 1912 } 1913 1914 void UIMachineLogic::sltHandleMachineStateSaved(bool fSuccess) 1915 { 1916 /* Disable 'manual-override' finally: */ 1917 uisession()->setManualOverrideMode(false); 1918 1919 /* Close Runtime UI if state was saved: */ 1920 if (fSuccess) 1921 uisession()->closeRuntimeUI(); 1886 uisession()->saveState(); 1922 1887 } 1923 1888 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r90883 r90888 145 145 /** Detach and close Runtime UI. */ 146 146 void detach(); 147 /** Save VM state, then close Runtime UI. */148 void saveState();149 147 /** Call for guest shutdown to close Runtime UI. */ 150 148 void shutdown(); … … 285 283 void sltDetach(); 286 284 void sltSaveState(); 287 /** Handles machine state saved. */288 void sltHandleMachineStateSaved(bool fSuccess);289 285 void sltShutdown(); 290 286 void sltPowerOff(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r90706 r90888 455 455 /* Save VM state: */ 456 456 LogRel(("GUI: Request for close-action to save VM state.\n")); 457 machineLogic()->saveState();457 uisession()->saveState(); 458 458 break; 459 459 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r90883 r90888 326 326 } 327 327 328 void UISession::saveState() 329 { 330 /* Saving state? */ 331 bool fSaveState = true; 332 333 /* If VM is not paused, we should pause it first: */ 334 if (!isPaused()) 335 fSaveState = pause(); 336 337 /* Save state: */ 338 if (fSaveState) 339 { 340 /* Enable 'manual-override', 341 * preventing automatic Runtime UI closing: */ 342 setManualOverrideMode(true); 343 344 /* Now, do the magic: */ 345 LogRel(("GUI: Saving VM state..\n")); 346 UINotificationProgressMachineSaveState *pNotification = new UINotificationProgressMachineSaveState(machine()); 347 connect(pNotification, &UINotificationProgressMachineSaveState::sigMachineStateSaved, 348 this, &UISession::sltHandleMachineStateSaved); 349 gpNotificationCenter->append(pNotification); 350 } 351 } 352 328 353 bool UISession::shutdown() 329 354 { … … 802 827 /* Notify current machine-logic: */ 803 828 emit sigHostScreenAvailableAreaChange(); 829 } 830 831 void UISession::sltHandleMachineStateSaved(bool fSuccess) 832 { 833 /* Disable 'manual-override' finally: */ 834 setManualOverrideMode(false); 835 836 /* Close Runtime UI if state was saved: */ 837 if (fSuccess) 838 closeRuntimeUI(); 804 839 } 805 840 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r90883 r90888 75 75 /* API: Runtime UI stuff: */ 76 76 bool initialize(); 77 /** Powers VM up. */ 77 78 bool powerUp(); 79 /** Detaches and closes Runtime UI. */ 78 80 bool detach(); 81 /** Saves VM state, then closes Runtime UI. */ 82 void saveState(); 83 /** Calls for guest shutdown to close Runtime UI. */ 79 84 bool shutdown(); 85 /** Powers VM down, then closes Runtime UI. */ 80 86 bool powerOff(bool fIncludingDiscard, bool &fServerCrashed); 81 87 … … 394 400 void sltHandleHostScreenAvailableAreaChange(); 395 401 402 /** Handles signal about machine state saved. 403 * @param fSuccess Brings whether state was saved successfully. */ 404 void sltHandleMachineStateSaved(bool fSuccess); 405 396 406 private: 397 407
Note:
See TracChangeset
for help on using the changeset viewer.