Changeset 90925 in vbox
- Timestamp:
- Aug 26, 2021 4:25:27 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 146562
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r90906 r90925 2594 2594 } 2595 2595 2596 void UICommon::restoreCurrentSnapshot(const QUuid &uMachineId)2597 {2598 /* Open a session to modify VM: */2599 const bool fDirectSessionAvailable = (m_enmType == UIType_RuntimeUI) && isSeparateProcess();2600 CSession comSession = openSession(uMachineId, fDirectSessionAvailable ? KLockType_Write : KLockType_Shared);2601 if (!comSession.isNull())2602 {2603 /* Simulate try-catch block: */2604 do2605 {2606 /* Acquire session machine: */2607 CMachine comMachine = comSession.GetMachine();2608 if (!comSession.isOk())2609 {2610 msgCenter().cannotAcquireSessionParameter(comSession);2611 break;2612 }2613 2614 /* Acquire machine name: */2615 const QString strMachineName = comMachine.GetName();2616 if (!comMachine.isOk())2617 {2618 msgCenter().cannotAcquireMachineParameter(comMachine);2619 break;2620 }2621 2622 /* Acquire current snapshot: */2623 const CSnapshot comSnapshot = comMachine.GetCurrentSnapshot();2624 if (!comMachine.isOk())2625 {2626 msgCenter().cannotAcquireMachineParameter(comMachine);2627 break;2628 }2629 2630 /* Acquire snapshot name: */2631 const QString strSnapshotName = comSnapshot.GetName();2632 if (!comSnapshot.isOk())2633 {2634 msgCenter().cannotAcquireSnapshotParameter(comSnapshot);2635 break;2636 }2637 2638 /* Prepare the snapshot-discard progress: */2639 CProgress comProgress = comMachine.RestoreSnapshot(comSnapshot);2640 if (!comMachine.isOk())2641 {2642 msgCenter().cannotRestoreSnapshot(comMachine, strSnapshotName, strMachineName);2643 break;2644 }2645 2646 /* Show the snapshot-discard progress: */2647 msgCenter().showModalProgressDialog(comProgress, comMachine.GetName(), ":/progress_snapshot_discard_90px.png");2648 if (comProgress.GetResultCode() != 0)2649 {2650 msgCenter().cannotRestoreSnapshot(comProgress, strSnapshotName, strMachineName);2651 break;2652 }2653 }2654 while (0);2655 2656 /* Unlock machine finally: */2657 comSession.UnlockMachine();2658 }2659 }2660 2661 2596 void UICommon::notifyCloudMachineUnregistered(const QString &strProviderShortName, 2662 2597 const QString &strProfileName, -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r90893 r90925 518 518 * otherwise, no session will be created and machine will be left unchanged. */ 519 519 CSession tryToOpenSessionFor(CMachine &comMachine); 520 521 /** Restores current snapshot for machine with certain @a uMachineId. */522 void restoreCurrentSnapshot(const QUuid &uMachineId);523 520 /** @} */ 524 521 -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r90923 r90925 1754 1754 /* Unlock session finally: */ 1755 1755 m_comSession.UnlockMachine(); 1756 1757 /* Notifies listeners: */ 1758 emit sigSnapshotRestored(error().isEmpty()); 1756 1759 } 1757 1760 -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r90923 r90925 1028 1028 Q_OBJECT; 1029 1029 1030 signals: 1031 1032 /** Notifies listeners about snapshot restored. 1033 * @param fSuccess Brings whether snapshot restored successfully. */ 1034 void sigSnapshotRestored(bool fSuccess); 1035 1030 1036 public: 1031 1037 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r90922 r90925 825 825 if (fSuccess) 826 826 { 827 if (fIncludingDiscard) 828 uiCommon().restoreCurrentSnapshot(uiCommon().managedVMUuid()); 829 closeRuntimeUI(); 830 } 827 if (!fIncludingDiscard) 828 closeRuntimeUI(); 829 else 830 { 831 /* Now, do more magic! */ 832 UINotificationProgressSnapshotRestore *pNotification = 833 new UINotificationProgressSnapshotRestore(uiCommon().managedVMUuid()); 834 connect(pNotification, &UINotificationProgressSnapshotRestore::sigSnapshotRestored, 835 this, &UISession::sltHandleSnapshotRestored); 836 gpNotificationCenter->append(pNotification); 837 } 838 } 839 } 840 841 void UISession::sltHandleSnapshotRestored(bool) 842 { 843 /* Close Runtime UI independent of snapshot restoring state: */ 844 closeRuntimeUI(); 831 845 } 832 846 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r90922 r90925 407 407 * @param fIncludingDiscard Brings whether machine state should be discarded. */ 408 408 void sltHandleMachinePoweredOff(bool fSuccess, bool fIncludingDiscard); 409 /** Handles signal about snapshot restored. 410 * @param fSuccess Brings whether machine was powered off successfully. */ 411 void sltHandleSnapshotRestored(bool fSuccess); 409 412 410 413 private:
Note:
See TracChangeset
for help on using the changeset viewer.