VirtualBox

Changeset 92086 in vbox for trunk


Ignore:
Timestamp:
Oct 26, 2021 3:16:43 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10067: UIWizardNewVM: Migrate a bit of UIMessageCenter stuff to UINotificationCenter.

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

Legend:

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

    r92036 r92086  
    980980
    981981/* static */
    982 void UINotificationMessage::cannotRemoveMachine(const CMachine &comMachine)
     982void UINotificationMessage::cannotRemoveMachine(const CMachine &comMachine, UINotificationCenter *pParent /* = 0 */)
    983983{
    984984    createMessage(
     
    986986        QApplication::translate("UIMessageCenter", "Failed to remove the virtual machine <b>%1</b>.")
    987987                                                   .arg(CMachine(comMachine).GetName()) +
    988         UIErrorString::formatErrorInfo(comMachine));
     988        UIErrorString::formatErrorInfo(comMachine),
     989        QString(), QString(), pParent);
    989990}
    990991
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r92036 r92086  
    394394        /** Notifies about inability to remove machine.
    395395          * @param  comMachine  Brings machine being removed. */
    396         static void cannotRemoveMachine(const CMachine &comMachine);
     396        static void cannotRemoveMachine(const CMachine &comMachine, UINotificationCenter *pParent = 0);
    397397
    398398        /** Notifies about inability to find snapshot by ID.
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r92032 r92086  
    444444    if (!success)
    445445    {
    446         CVirtualBox vbox = uiCommon().virtualBox();
    447         /* Unregister on failure */
    448         QVector<CMedium> aMedia = m_machine.Unregister(KCleanupMode_DetachAllReturnHardDisksOnly);
    449         if (vbox.isOk())
    450         {
    451             CProgress progress = m_machine.DeleteConfig(aMedia);
    452             progress.WaitForCompletion(-1);         /// @todo do this nicely with a progress dialog, this can delete lots of files
    453         }
    454     }
    455 
    456     /* Make sure we detach CMedium wrapper from IMedium pointer to avoid deletion of IMedium as m_virtualDisk is deallocated: */
    457     /* Or in case of IMachine::DeleteConfig IMedium has been already deleted so detach in this case as well:*/
     446        /* Unregister VM on failure: */
     447        const QVector<CMedium> media = m_machine.Unregister(KCleanupMode_DetachAllReturnHardDisksOnly);
     448        if (!m_machine.isOk())
     449            UINotificationMessage::cannotRemoveMachine(m_machine, notificationCenter());
     450        else
     451        {
     452            UINotificationProgressMachineMediaRemove *pNotification =
     453                new UINotificationProgressMachineMediaRemove(m_machine, media);
     454            handleNotificationProgressNow(pNotification);
     455        }
     456    }
     457
     458    /* Make sure we detach CMedium wrapper from IMedium pointer to avoid deletion of IMedium as m_virtualDisk
     459     * is deallocated.  Or in case of UINotificationProgressMachineMediaRemove handling, IMedium has been
     460     * already deleted so detach in this case as well. */
    458461    if (!m_virtualDisk.isNull())
    459462        m_virtualDisk.detach();
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