VirtualBox

Changeset 90925 in vbox


Ignore:
Timestamp:
Aug 26, 2021 4:25:27 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
146562
Message:

FE/Qt: bugref:10067: Notification signature for snapshot restore progress (in Runtime UI) which should now go to center instead of modal dialogs, s.a. r146061.

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  
    25942594}
    25952595
    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         do
    2605         {
    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 
    26612596void UICommon::notifyCloudMachineUnregistered(const QString &strProviderShortName,
    26622597                                              const QString &strProfileName,
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h

    r90893 r90925  
    518518          * otherwise, no session will be created and machine will be left unchanged. */
    519519        CSession tryToOpenSessionFor(CMachine &comMachine);
    520 
    521         /** Restores current snapshot for machine with certain @a uMachineId. */
    522         void restoreCurrentSnapshot(const QUuid &uMachineId);
    523520    /** @} */
    524521
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r90923 r90925  
    17541754    /* Unlock session finally: */
    17551755    m_comSession.UnlockMachine();
     1756
     1757    /* Notifies listeners: */
     1758    emit sigSnapshotRestored(error().isEmpty());
    17561759}
    17571760
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r90923 r90925  
    10281028    Q_OBJECT;
    10291029
     1030signals:
     1031
     1032    /** Notifies listeners about snapshot restored.
     1033      * @param  fSuccess  Brings whether snapshot restored successfully. */
     1034    void sigSnapshotRestored(bool fSuccess);
     1035
    10301036public:
    10311037
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r90922 r90925  
    825825    if (fSuccess)
    826826    {
    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
     841void UISession::sltHandleSnapshotRestored(bool)
     842{
     843    /* Close Runtime UI independent of snapshot restoring state: */
     844    closeRuntimeUI();
    831845}
    832846
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r90922 r90925  
    407407      * @param  fIncludingDiscard  Brings whether machine state should be discarded. */
    408408    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);
    409412
    410413private:
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette