VirtualBox

Changeset 45314 in vbox for trunk/src


Ignore:
Timestamp:
Apr 3, 2013 5:18:31 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Message-center cleanup (part 20): Snapshot stuff.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r45313 r45314  
    742742}
    743743
    744 void UIMessageCenter::cannotRestoreSnapshot(const CConsole &console, const QString &strSnapshotName) const
    745 {
    746     message(mainWindowShown(), MessageType_Error,
     744void UIMessageCenter::cannotRestoreSnapshot(const CConsole &console, const QString &strSnapshotName, const QString &strMachineName, QWidget *pParent /*= 0*/) const
     745{
     746    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
    747747            tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
    748                .arg(strSnapshotName).arg(CConsole(console).GetMachine().GetName()),
     748               .arg(strSnapshotName, strMachineName),
    749749            formatErrorInfo(console));
    750750}
    751751
    752 void UIMessageCenter::cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName) const
    753 {
    754     /* Get console: */
    755     AssertWrapperOk(progress);
    756     CConsole console(CProgress(progress).GetInitiator());
    757     AssertWrapperOk(console);
    758     /* Show the message: */
    759     message(mainWindowShown(), MessageType_Error,
     752void UIMessageCenter::cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName, QWidget *pParent /*= 0*/) const
     753{
     754    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
    760755            tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
    761                .arg(strSnapshotName).arg(console.GetMachine().GetName()),
    762             formatErrorInfo(progress.GetErrorInfo()));
    763 }
    764 
    765 void UIMessageCenter::cannotRemoveSnapshot(const CConsole &console, const QString &strSnapshotName) const
     756               .arg(strSnapshotName, strMachineName),
     757            !progress.isOk() ? formatErrorInfo(progress) : formatErrorInfo(progress.GetErrorInfo()));
     758}
     759
     760void UIMessageCenter::cannotRemoveSnapshot(const CConsole &console, const QString &strSnapshotName, const QString &strMachineName) const
    766761{
    767762    message(mainWindowShown(), MessageType_Error,
    768763            tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
    769                .arg(strSnapshotName)
    770                .arg(CConsole(console).GetMachine().GetName()),
     764               .arg(strSnapshotName, strMachineName),
    771765            formatErrorInfo(console));
    772766}
    773767
    774 void UIMessageCenter::cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName) const
    775 {
    776     /* Get console: */
    777     AssertWrapperOk(progress);
    778     CConsole console(CProgress(progress).GetInitiator());
    779     AssertWrapperOk(console);
    780     /* Show the message: */
     768void UIMessageCenter::cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const
     769{
    781770    message(mainWindowShown(), MessageType_Error,
    782771            tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
    783                .arg(strSnapshotName)
    784                .arg(console.GetMachine().GetName()),
    785             formatErrorInfo(progress.GetErrorInfo()));
     772               .arg(strSnapshotName).arg(strMachineName),
     773            !progress.isOk() ? formatErrorInfo(progress) : formatErrorInfo(progress.GetErrorInfo()));
    786774}
    787775
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r45313 r45314  
    236236    bool warnAboutSnapshotRemovalFreeSpace(const QString &strSnapshotName, const QString &strTargetImageName,
    237237                                           const QString &strTargetImageMaxSize, const QString &strTargetFileSystemFree) const;
    238     void cannotRestoreSnapshot(const CConsole &console, const QString &strSnapshotName) const;
    239     void cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName) const;
    240     void cannotRemoveSnapshot(const CConsole &console, const QString &strSnapshotName) const;
    241     void cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName) const;
     238    void cannotRestoreSnapshot(const CConsole &console, const QString &strSnapshotName, const QString &strMachineName, QWidget *pParent = 0) const;
     239    void cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName, QWidget *pParent = 0) const;
     240    void cannotRemoveSnapshot(const CConsole &console, const QString &strSnapshotName, const QString &strMachineName) const;
     241    void cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const;
    242242
    243243    /* API: Settings warnings: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r45296 r45314  
    391391                    {
    392392                        /* Failed in progress: */
    393                         msgCenter().cannotRestoreSnapshot(progress, snapshot.GetName());
     393                        msgCenter().cannotRestoreSnapshot(progress, snapshot.GetName(), machine.GetName(), machineLogic()->activeMachineWindow());
    394394                        return false;
    395395                    }
     
    398398                {
    399399                    /* Failed in console: */
    400                     msgCenter().cannotRestoreSnapshot(console, snapshot.GetName());
     400                    msgCenter().cannotRestoreSnapshot(console, snapshot.GetName(), machine.GetName(), machineLogic()->activeMachineWindow());
    401401                    return false;
    402402                }
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp

    r45296 r45314  
    608608    {
    609609        msgCenter().showModalProgressDialog(progress, mMachine.GetName(), ":/progress_snapshot_restore_90px.png",
    610                                               msgCenter().mainWindowShown(), true);
     610                                            msgCenter().mainWindowShown(), true);
    611611        if (progress.GetResultCode() != 0)
    612             msgCenter().cannotRestoreSnapshot(progress, snapshot.GetName());
     612            msgCenter().cannotRestoreSnapshot(progress, snapshot.GetName(), mMachine.GetName());
    613613    }
    614614    else
    615         msgCenter().cannotRestoreSnapshot(console, snapshot.GetName());
     615        msgCenter().cannotRestoreSnapshot(console, snapshot.GetName(), mMachine.GetName());
    616616
    617617    /* Unlock machine finally: */
     
    656656    {
    657657        /* Show the progress dialog */
    658         msgCenter().showModalProgressDialog (progress, mMachine.GetName(), ":/progress_snapshot_discard_90px.png",
    659                                                msgCenter().mainWindowShown(), true);
     658        msgCenter().showModalProgressDialog(progress, mMachine.GetName(), ":/progress_snapshot_discard_90px.png",
     659                                            msgCenter().mainWindowShown(), true);
    660660
    661661        if (progress.GetResultCode() != 0)
    662             msgCenter().cannotRemoveSnapshot (progress,  snapshot.GetName());
     662            msgCenter().cannotRemoveSnapshot(progress,  snapshot.GetName(), mMachine.GetName());
    663663    }
    664664    else
    665         msgCenter().cannotRemoveSnapshot (console,  snapshot.GetName());
     665        msgCenter().cannotRemoveSnapshot(console,  snapshot.GetName(), mMachine.GetName());
    666666
    667667    session.UnlockMachine();
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