Changeset 90922 in vbox
- Timestamp:
- Aug 26, 2021 4:17:20 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
-
notificationcenter/UINotificationObjects.cpp (modified) (2 diffs)
-
notificationcenter/UINotificationObjects.h (modified) (3 diffs)
-
runtime/UISession.cpp (modified) (2 diffs)
-
runtime/UISession.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r90920 r90922 977 977 978 978 UINotificationProgressMachinePowerOff::UINotificationProgressMachinePowerOff(const CMachine &comMachine, 979 const CConsole &comConsole /* = CConsole() */) 979 const CConsole &comConsole /* = CConsole() */, 980 bool fIncludingDiscard /* = false */) 980 981 : m_comMachine(comMachine) 981 982 , m_comConsole(comConsole) 983 , m_fIncludingDiscard(fIncludingDiscard) 982 984 { 983 985 connect(this, &UINotificationProgress::sigProgressFinished, … … 1082 1084 if (m_comSession.isNotNull()) 1083 1085 m_comSession.UnlockMachine(); 1086 1087 /* Notifies listeners: */ 1088 emit sigMachinePoweredOff(error().isEmpty(), m_fIncludingDiscard); 1084 1089 } 1085 1090 -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r90920 r90922 564 564 Q_OBJECT; 565 565 566 signals: 567 568 /** Notifies listeners about machine powered off. 569 * @param fSuccess Brings whether power off sequence successfully. 570 * @param fIncludingDiscard Brings whether machine state should be discarded. */ 571 void sigMachinePoweredOff(bool fSuccess, bool fIncludingDiscard); 572 566 573 public: 567 574 … … 571 578 * @param fIncludingDiscard Brings whether machine state should be discarded. */ 572 579 UINotificationProgressMachinePowerOff(const CMachine &comMachine, 573 const CConsole &comConsole = CConsole()); 580 const CConsole &comConsole = CConsole(), 581 bool fIncludingDiscard = false); 574 582 575 583 protected: … … 593 601 /** Holds the console of machine being powered off. */ 594 602 CConsole m_comConsole; 603 /** Holds whether machine state should be discarded. */ 604 bool m_fIncludingDiscard; 595 605 /** Holds the session being opened. */ 596 606 CSession m_comSession; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r90893 r90922 371 371 void UISession::powerOff(bool fIncludingDiscard) 372 372 { 373 /* Prepare result: */374 bool fSuccess = false;375 376 373 /* Enable 'manual-override', 377 374 * preventing automatic Runtime UI closing: */ 378 375 setManualOverrideMode(true); 379 376 380 /* Prepare the power-off progress: */377 /* Now, do the magic: */ 381 378 LogRel(("GUI: Powering VM off..\n")); 382 CProgress comProgress = console().PowerDown(); 383 if (!console().isOk()) 384 { 385 /* Check the console state, it might be already gone: */ 386 if (!console().isNull()) 387 { 388 /* This can happen if VBoxSVC is not running: */ 389 COMResult res(console()); 390 if (FAILED_DEAD_INTERFACE(res.rc())) 391 fSuccess = true; 392 } 393 394 if (!fSuccess) 395 msgCenter().cannotPowerOffMachine(console()); 396 } 397 else 398 { 399 /* Show the power-off progress: */ 400 msgCenter().showModalProgressDialog(comProgress, machineName(), ":/progress_poweroff_90px.png"); 401 if (comProgress.isOk() && comProgress.GetResultCode() == 0) 402 { 403 fSuccess = true; 404 405 /* Discard the current state if requested: */ 406 if (fIncludingDiscard) 407 uiCommon().restoreCurrentSnapshot(uiCommon().managedVMUuid()); 408 } 409 else 410 msgCenter().cannotPowerOffMachine(comProgress, machineName()); 411 } 412 413 /* Disable 'manual-override' finally: */ 414 setManualOverrideMode(false); 415 416 /* Manually close Runtime UI: */ 417 if (fSuccess) 418 closeRuntimeUI(); 379 UINotificationProgressMachinePowerOff *pNotification = 380 new UINotificationProgressMachinePowerOff(machine(), console(), fIncludingDiscard); 381 connect(pNotification, &UINotificationProgressMachinePowerOff::sigMachinePoweredOff, 382 this, &UISession::sltHandleMachinePoweredOff); 383 gpNotificationCenter->append(pNotification); 419 384 } 420 385 … … 850 815 if (fSuccess) 851 816 closeRuntimeUI(); 817 } 818 819 void UISession::sltHandleMachinePoweredOff(bool fSuccess, bool fIncludingDiscard) 820 { 821 /* Disable 'manual-override' finally: */ 822 setManualOverrideMode(false); 823 824 /* Do we have other tasks? */ 825 if (fSuccess) 826 { 827 if (fIncludingDiscard) 828 uiCommon().restoreCurrentSnapshot(uiCommon().managedVMUuid()); 829 closeRuntimeUI(); 830 } 852 831 } 853 832 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r90893 r90922 403 403 * @param fSuccess Brings whether state was saved successfully. */ 404 404 void sltHandleMachineStateSaved(bool fSuccess); 405 /** Handles signal about machine powered off. 406 * @param fSuccess Brings whether machine was powered off successfully. 407 * @param fIncludingDiscard Brings whether machine state should be discarded. */ 408 void sltHandleMachinePoweredOff(bool fSuccess, bool fIncludingDiscard); 405 409 406 410 private:
Note:
See TracChangeset
for help on using the changeset viewer.

