VirtualBox

Changeset 90645 in vbox


Ignore:
Timestamp:
Aug 12, 2021 9:49:54 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
146257
Message:

FE/Qt: bugref:10067: Notification signature for snapshot take progress which should now go to center instead of modal dialogs; Used in Runtime UI. S.a. r146059.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r90606 r90645  
    10151015    }
    10161016
    1017     /* Acquire session state: */
    1018     const KSessionState enmSessionState = m_comMachine.GetSessionState();
    1019     if (!m_comMachine.isOk())
    1020     {
    1021         comResult = m_comMachine;
    1022         return CProgress();
    1023     }
    1024 
    1025     /* Open a session thru which we will modify the machine: */
    1026     if (enmSessionState != KSessionState_Unlocked)
    1027         m_comSession = uiCommon().openExistingSession(uId);
    1028     else
    1029         m_comSession = uiCommon().openSession(uId);
    1030     if (m_comSession.isNull())
    1031         return CProgress();
    1032 
    10331017    /* Get session machine: */
    1034     CMachine comMachine = m_comSession.GetMachine();
    1035     if (!m_comSession.isOk())
    1036     {
    1037         comResult = m_comSession;
    1038         m_comSession.UnlockMachine();
    1039         return CProgress();
     1018    CMachine comMachine;
     1019
     1020    /* For Manager UI: */
     1021    switch (uiCommon().uiType())
     1022    {
     1023        case UICommon::UIType_SelectorUI:
     1024        {
     1025            /* Acquire session state: */
     1026            const KSessionState enmSessionState = m_comMachine.GetSessionState();
     1027            if (!m_comMachine.isOk())
     1028            {
     1029                comResult = m_comMachine;
     1030                return CProgress();
     1031            }
     1032
     1033            /* Open a session thru which we will modify the machine: */
     1034            if (enmSessionState != KSessionState_Unlocked)
     1035                m_comSession = uiCommon().openExistingSession(uId);
     1036            else
     1037                m_comSession = uiCommon().openSession(uId);
     1038            if (m_comSession.isNull())
     1039                return CProgress();
     1040
     1041            /* Get session machine: */
     1042            comMachine = m_comSession.GetMachine();
     1043            if (!m_comSession.isOk())
     1044            {
     1045                comResult = m_comSession;
     1046                m_comSession.UnlockMachine();
     1047                return CProgress();
     1048            }
     1049
     1050            break;
     1051        }
     1052        case UICommon::UIType_RuntimeUI:
     1053        {
     1054            /* Get passed machine: */
     1055            comMachine = m_comMachine;
     1056
     1057            break;
     1058        }
    10401059    }
    10411060
     
    10531072void UINotificationProgressSnapshotTake::sltHandleProgressFinished()
    10541073{
    1055     m_comSession.UnlockMachine();
     1074    if (m_comSession.isNotNull())
     1075        m_comSession.UnlockMachine();
    10561076}
    10571077
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r90627 r90645  
    18031803
    18041804    /* Search for the max available filter index: */
    1805     QString strNameTemplate = UITakeSnapshotDialog::tr("Snapshot %1");
     1805    const QString strNameTemplate = UITakeSnapshotDialog::tr("Snapshot %1");
    18061806    int iMaxSnapshotIndex = searchMaxSnapshotIndex(machine(), machine().FindSnapshot(QString()), strNameTemplate);
    18071807    pDlg->setName(strNameTemplate.arg(++ iMaxSnapshotIndex));
    18081808
    18091809    /* Exec the dialog: */
    1810     bool fDialogAccepted = pDlg->exec() == QDialog::Accepted;
     1810    const bool fDialogAccepted = pDlg->exec() == QDialog::Accepted;
    18111811
    18121812    /* Make sure dialog still valid: */
     
    18151815
    18161816    /* Acquire variables: */
    1817     QString strSnapshotName = pDlg->name().trimmed();
    1818     QString strSnapshotDescription = pDlg->description();
     1817    const QString strSnapshotName = pDlg->name().trimmed();
     1818    const QString strSnapshotDescription = pDlg->description();
    18191819
    18201820    /* Destroy dialog early: */
     
    18221822
    18231823    /* Was the dialog accepted? */
    1824     if (fDialogAccepted)
    1825     {
    1826         QUuid uSnapshotId;
    1827         /* Prepare the take-snapshot progress: */
    1828         CProgress progress = machine().TakeSnapshot(strSnapshotName, strSnapshotDescription, true, uSnapshotId);
    1829         if (machine().isOk())
    1830         {
    1831             /* Show the take-snapshot progress: */
    1832             const bool fStillValid = msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_snapshot_create_90px.png");
    1833             if (!fStillValid)
    1834                 return;
    1835             if (!progress.isOk() || progress.GetResultCode() != 0)
    1836                 msgCenter().cannotTakeSnapshot(progress, machineName());
    1837         }
    1838         else
    1839             msgCenter().cannotTakeSnapshot(machine(), machineName());
    1840     }
     1824    if (!fDialogAccepted)
     1825        return;
     1826
     1827    /* Take snapshot: */
     1828    UINotificationProgressSnapshotTake *pNotification = new UINotificationProgressSnapshotTake(machine(),
     1829                                                                                               strSnapshotName,
     1830                                                                                               strSnapshotDescription);
     1831    gpNotificationCenter->append(pNotification);
    18411832}
    18421833
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