VirtualBox

Changeset 43920 in vbox for trunk


Ignore:
Timestamp:
Nov 21, 2012 12:21:24 AM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
82224
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp

    r43424 r43920  
    2828#include <QScrollBar>
    2929#include <QWindowsStyle>
     30#include <QPointer>
    3031
    3132/* GUI includes: */
     
    813814        }
    814815
    815         /* Create 'take new snapshot' dialog: */
    816816        if (fIsValid)
    817817        {
    818             /* Prepare dialog: */
    819             VBoxTakeSnapshotDlg dlg(this, mMachine);
    820             dlg.mLbIcon->setPixmap(vboxGlobal().vmGuestOSTypeIcon(mMachine.GetOSTypeId()));
     818            /* Create take-snapshot dialog: */
     819            QPointer<VBoxTakeSnapshotDlg> pDlg = new VBoxTakeSnapshotDlg(this, mMachine);
     820
     821            /* Assign corresponding icon: */
     822            pDlg->mLbIcon->setPixmap(vboxGlobal().vmGuestOSTypeIcon(mMachine.GetOSTypeId()));
    821823
    822824            /* Search for the max available snapshot index: */
     
    833835                ++iterator;
    834836            }
    835             dlg.mLeName->setText(snapShotName.arg(iMaxSnapShotIndex + 1));
    836 
    837             /* Show 'take new snapshot' dialog: */
    838             if (dlg.exec() == QDialog::Accepted)
     837            pDlg->mLeName->setText(snapShotName.arg(iMaxSnapShotIndex + 1));
     838
     839            /* Exec the dialog: */
     840            bool fDialogAccepted = pDlg->exec() == QDialog::Accepted;
     841
     842            /* Is the dialog still valid? */
     843            if (pDlg)
    839844            {
    840                 /* Take new snapshot: */
    841                 CProgress progress = console.TakeSnapshot(dlg.mLeName->text().trimmed(), dlg.mTeDescription->toPlainText());
    842                 if (console.isOk())
     845                /* Acquire variables: */
     846                QString strSnapshotName = pDlg->mLeName->text().trimmed();
     847                QString strSnapshotDescription = pDlg->mTeDescription->toPlainText();
     848
     849                /* Destroy dialog early: */
     850                delete pDlg;
     851
     852                /* Was the dialog accepted? */
     853                if (fDialogAccepted)
    843854                {
    844                     /* Show the progress dialog: */
    845                     msgCenter().showModalProgressDialog(progress, mMachine.GetName(), ":/progress_snapshot_create_90px.png",
    846                                                         msgCenter().mainWindowShown(), true);
    847                     if (progress.GetResultCode() != 0)
     855                    /* Prepare the take-snapshot progress: */
     856                    CProgress progress = console.TakeSnapshot(strSnapshotName, strSnapshotDescription);
     857                    if (console.isOk())
    848858                    {
    849                         msgCenter().cannotTakeSnapshot(progress);
     859                        /* Show the take-snapshot progress: */
     860                        msgCenter().showModalProgressDialog(progress, mMachine.GetName(), ":/progress_snapshot_create_90px.png",
     861                                                            msgCenter().mainWindowShown(), true);
     862                        if (progress.GetResultCode() != 0)
     863                        {
     864                            msgCenter().cannotTakeSnapshot(progress);
     865                            fIsValid = false;
     866                        }
     867                    }
     868                    else
     869                    {
     870                        msgCenter().cannotTakeSnapshot(console);
    850871                        fIsValid = false;
    851872                    }
    852873                }
    853874                else
    854                 {
    855                     msgCenter().cannotTakeSnapshot(console);
    856875                    fIsValid = false;
    857                 }
    858876            }
    859877            else
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