VirtualBox

Changeset 90365 in vbox


Ignore:
Timestamp:
Jul 28, 2021 11:18:52 AM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10067: Notification signatures for virtual machine media remove progress which should now go to center instead of modal dialogs.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r90035 r90365  
    4444#include "UIMessageCenter.h"
    4545#include "UIModalWindowManager.h"
     46#include "UINotificationCenter.h"
    4647#include "UIVirtualBoxManagerWidget.h"
    4748#include "UIVirtualMachineItemCloud.h"
     
    18711872        {
    18721873            /* Unregister machine first: */
    1873             CMediumVector comMedia = comMachine.Unregister(KCleanupMode_DetachAllReturnHardDisksOnly);
     1874            CMediumVector media = comMachine.Unregister(KCleanupMode_DetachAllReturnHardDisksOnly);
    18741875            if (!comMachine.isOk())
    18751876            {
     
    18771878                continue;
    18781879            }
    1879             /* Prepare cleanup progress: */
    1880             CProgress comProgress = comMachine.DeleteConfig(comMedia);
    1881             if (!comMachine.isOk())
    1882             {
    1883                 msgCenter().cannotRemoveMachine(comMachine);
    1884                 continue;
    1885             }
    1886             /* And show cleanup progress finally: */
    1887             msgCenter().showModalProgressDialog(comProgress, comMachine.GetName(), ":/progress_delete_90px.png");
    1888             if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
    1889             {
    1890                 msgCenter().cannotRemoveMachine(comMachine, comProgress);
    1891                 continue;
    1892             }
     1880            /* Remove machine: */
     1881            UINotificationProgressMachineMediaRemove *pNotification = new UINotificationProgressMachineMediaRemove(comMachine, media);
     1882            notificationCenter().append(pNotification);
    18931883        }
    18941884        else if (iResultCode == AlertButton_Choice2 || iResultCode == AlertButton_Ok)
    18951885        {
    18961886            /* Unregister machine first: */
    1897             CMediumVector comMedia = comMachine.Unregister(KCleanupMode_DetachAllReturnHardDisksOnly);
     1887            CMediumVector media = comMachine.Unregister(KCleanupMode_DetachAllReturnHardDisksOnly);
    18981888            if (!comMachine.isOk())
    18991889            {
     
    19021892            }
    19031893            /* Finally close all media, deliberately ignoring errors: */
    1904             foreach (CMedium comMedium, comMedia)
     1894            foreach (CMedium comMedium, media)
    19051895            {
    19061896                if (!comMedium.isNull())
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r90352 r90365  
    186186
    187187/*********************************************************************************************************************************
     188*   Class UINotificationProgressMachineMediaRemove implementation.                                                                    *
     189*********************************************************************************************************************************/
     190
     191UINotificationProgressMachineMediaRemove::UINotificationProgressMachineMediaRemove(const CMachine &comMachine,
     192                                                                                   const CMediumVector &media)
     193    : m_comMachine(comMachine)
     194    , m_media(media)
     195{
     196}
     197
     198QString UINotificationProgressMachineMediaRemove::name() const
     199{
     200    return UINotificationProgress::tr("Removing machine media ...");
     201}
     202
     203QString UINotificationProgressMachineMediaRemove::details() const
     204{
     205    return UINotificationProgress::tr("<b>Machine Name:</b> %1").arg(m_comMachine.GetName());
     206}
     207
     208CProgress UINotificationProgressMachineMediaRemove::createProgress(COMResult &comResult)
     209{
     210    /* Initialize progress-wrapper: */
     211    CProgress comProgress = m_comMachine.DeleteConfig(m_media);
     212    /* Store COM result: */
     213    comResult = m_comMachine;
     214    /* Return progress-wrapper: */
     215    return comProgress;
     216}
     217
     218
     219/*********************************************************************************************************************************
    188220*   Class UINotificationProgressCloudMachineAdd implementation.                                                                  *
    189221*********************************************************************************************************************************/
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r90352 r90365  
    204204    /** Holds the target machine options. */
    205205    QVector<KCloneOptions>  m_options;
     206};
     207
     208/** UINotificationProgress extension for machine media remove functionality. */
     209class SHARED_LIBRARY_STUFF UINotificationProgressMachineMediaRemove : public UINotificationProgress
     210{
     211    Q_OBJECT;
     212
     213public:
     214
     215    /** Constructs machine media remove notification-progress.
     216      * @param  comMachine  Brings the machine being removed.
     217      * @param  media       Brings the machine media being removed. */
     218    UINotificationProgressMachineMediaRemove(const CMachine &comMachine,
     219                                             const CMediumVector &media);
     220
     221protected:
     222
     223    /** Returns object name. */
     224    virtual QString name() const /* override final */;
     225    /** Returns object details. */
     226    virtual QString details() const /* override final */;
     227    /** Creates and returns started progress-wrapper. */
     228    virtual CProgress createProgress(COMResult &comResult) /* override final */;
     229
     230private:
     231
     232    /** Holds the machine being removed. */
     233    CMachine       m_comMachine;
     234    /** Holds the machine media being removed. */
     235    CMediumVector  m_media;
    206236};
    207237
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