VirtualBox

Changeset 43919 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Nov 20, 2012 11:46:25 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Make sure taking online-snapshot progress-dialog is always mac-sheet on mac-host.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r43762 r43919  
    925925        return;
    926926
    927     /* Remember the paused state. */
     927    /* Remember the paused state: */
    928928    bool fWasPaused = uisession()->isPaused();
    929929    if (!fWasPaused)
     
    935935    }
    936936
     937    /* Get current machine: */
    937938    CMachine machine = session().GetMachine();
    938939
    939     VBoxTakeSnapshotDlg dlg(activeMachineWindow(), machine);
    940 
     940    /* Create take-snapshot dialog: */
     941    QPointer<VBoxTakeSnapshotDlg> pDlg = new VBoxTakeSnapshotDlg(activeMachineWindow(), machine);
     942
     943    /* Assign corresponding icon: */
    941944    QString strTypeId = machine.GetOSTypeId();
    942     dlg.mLbIcon->setPixmap(vboxGlobal().vmGuestOSTypeIcon(strTypeId));
    943 
    944     /* Search for the max available filter index. */
     945    pDlg->mLbIcon->setPixmap(vboxGlobal().vmGuestOSTypeIcon(strTypeId));
     946
     947    /* Search for the max available filter index: */
    945948    QString strNameTemplate = QApplication::translate("UIMachineLogic", "Snapshot %1");
    946949    int iMaxSnapshotIndex = searchMaxSnapshotIndex(machine, machine.FindSnapshot(QString()), strNameTemplate);
    947     dlg.mLeName->setText(strNameTemplate.arg(++ iMaxSnapshotIndex));
    948 
    949     if (dlg.exec() == QDialog::Accepted)
    950     {
    951         CConsole console = session().GetConsole();
    952 
    953         CProgress progress = console.TakeSnapshot(dlg.mLeName->text().trimmed(), dlg.mTeDescription->toPlainText());
    954 
    955         if (console.isOk())
    956         {
    957             /* Show the "Taking Snapshot" progress dialog */
    958             msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_snapshot_create_90px.png", 0, true);
    959 
    960             if (progress.GetResultCode() != 0)
    961                 msgCenter().cannotTakeSnapshot(progress);
    962         }
    963         else
    964             msgCenter().cannotTakeSnapshot(console);
    965     }
    966 
    967     /* Restore the running state if needed. */
     950    pDlg->mLeName->setText(strNameTemplate.arg(++ iMaxSnapshotIndex));
     951
     952    /* Exec the dialog: */
     953    bool fDialogAccepted = pDlg->exec() == QDialog::Accepted;
     954
     955    /* Is the dialog still valid? */
     956    if (pDlg)
     957    {
     958        /* Acquire variables: */
     959        QString strSnapshotName = pDlg->mLeName->text().trimmed();
     960        QString strSnapshotDescription = pDlg->mTeDescription->toPlainText();
     961
     962        /* Destroy dialog early: */
     963        delete pDlg;
     964
     965        /* Was the dialog accepted? */
     966        if (fDialogAccepted)
     967        {
     968            /* Prepare the take-snapshot progress: */
     969            CConsole console = session().GetConsole();
     970            CProgress progress = console.TakeSnapshot(strSnapshotName, strSnapshotDescription);
     971            if (console.isOk())
     972            {
     973                /* Show the take-snapshot progress: */
     974                msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_snapshot_create_90px.png", 0, true);
     975                if (progress.GetResultCode() != 0)
     976                    msgCenter().cannotTakeSnapshot(progress);
     977            }
     978            else
     979                msgCenter().cannotTakeSnapshot(console);
     980        }
     981    }
     982
     983    /* Restore the running state if needed: */
    968984    if (!fWasPaused)
    969985    {
Note: See TracChangeset for help on using the changeset viewer.

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