VirtualBox

Changeset 90373 in vbox


Ignore:
Timestamp:
Jul 28, 2021 3:33:16 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145954
Message:

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

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

Legend:

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

    r90365 r90373  
    13391339{
    13401340    root()->resetDragToken();
     1341}
     1342
     1343void UIChooserModel::sltHandleCloudMachineRemoved(const QString &strShortProviderName,
     1344                                                  const QString &strProfileName,
     1345                                                  const QString &strName)
     1346{
     1347    Q_UNUSED(strName);
     1348
     1349    /* Update profile to make sure it has no stale instances: */
     1350    const UICloudEntityKey cloudEntityKeyForProfile = UICloudEntityKey(strShortProviderName, strProfileName);
     1351    createReadCloudMachineListTask(cloudEntityKeyForProfile, false /* with refresh? */);
    13411352}
    13421353
     
    18781889                continue;
    18791890            }
    1880             /* Remove machine: */
     1891            /* Removing machine: */
    18811892            UINotificationProgressMachineMediaRemove *pNotification = new UINotificationProgressMachineMediaRemove(comMachine, media);
    18821893            notificationCenter().append(pNotification);
     
    19081919        machines << pMachineItem->cache()->toCloud()->machine();
    19091920
    1910     /* Stop cloud update prematurely: */
     1921    /* Stop cloud profile update prematurely: */
    19111922    m_pTimerCloudProfileUpdate->stop();
    19121923
     
    19151926    if (iResultCode == AlertButton_Cancel)
    19161927    {
    1917         /* Resume cloud update if cancelled: */
     1928        /* Resume cloud profile update if cancelled: */
    19181929        m_pTimerCloudProfileUpdate->start(10000);
    19191930        return;
     
    19211932
    19221933    /* For every selected machine-item: */
    1923     QSet<UICloudEntityKey> changedCloudEntityKeys;
    19241934    foreach (UIChooserItemMachine *pMachineItem, machineItems)
    19251935    {
     
    19281938        const QString strProfileName = pMachineItem->parentItem()->name();
    19291939        const QUuid uMachineId = pMachineItem->id();
    1930         const UICloudEntityKey cloudEntityKeyForProfile = UICloudEntityKey(strProviderShortName, strProfileName);
    19311940        const UICloudEntityKey cloudEntityKeyForMachine = UICloudEntityKey(strProviderShortName, strProfileName, uMachineId);
    19321941
     
    19371946        /* Acquire cloud machine: */
    19381947        CCloudMachine comMachine = pMachineItem->cache()->toCloud()->machine();
    1939         CProgress comProgress;
    1940         /* Prepare remove progress: */
    1941         if (iResultCode == AlertButton_Choice1)
    1942             comProgress = comMachine.Remove();
    1943         /* Prepare unregister progress: */
    1944         else if (iResultCode == AlertButton_Choice2)
    1945             comProgress = comMachine.Unregister();
    1946         if (!comMachine.isOk())
    1947         {
    1948             msgCenter().cannotRemoveCloudMachine(comMachine);
    1949             continue;
    1950         }
    1951         /* And show unregister progress finally: */
    1952         msgCenter().showModalProgressDialog(comProgress, comMachine.GetName(), ":/progress_delete_cloud_vm_90px.png", 0, 0);
    1953         if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
    1954         {
    1955             msgCenter().cannotRemoveCloudMachine(comMachine, comProgress);
    1956             continue;
    1957         }
    1958 
    1959         /* Append cloud entity key for profile to update: */
    1960         if (!changedCloudEntityKeys.contains(cloudEntityKeyForProfile))
    1961             changedCloudEntityKeys.insert(cloudEntityKeyForProfile);
    1962     }
    1963 
    1964     /* Restart List Cloud Machines task for required profile keys: */
    1965     foreach (const UICloudEntityKey &guiCloudProfileKey, changedCloudEntityKeys)
    1966         createReadCloudMachineListTask(guiCloudProfileKey, false /* with refresh? */);
     1948
     1949        /* Removing cloud machine: */
     1950        UINotificationProgressCloudMachineRemove *pNotification =
     1951            new UINotificationProgressCloudMachineRemove(comMachine,
     1952                                                         iResultCode == AlertButton_Choice1,
     1953                                                         strProviderShortName,
     1954                                                         strProfileName);
     1955        connect(pNotification, &UINotificationProgressCloudMachineRemove::sigCloudMachineRemoved,
     1956                this, &UIChooserModel::sltHandleCloudMachineRemoved);
     1957        notificationCenter().append(pNotification);
     1958    }
    19671959}
    19681960
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h

    r88681 r90373  
    341341    /** @name Cloud stuff.
    342342      * @{ */
     343        /** Handles cloud machine removal.
     344          * @param  strShortProviderName  Brigns the provider short name.
     345          * @param  strProfileName        Brings the profile name.
     346          * @param  strName               Brings the machine name. */
     347        void sltHandleCloudMachineRemoved(const QString &strShortProviderName,
     348                                          const QString &strProfileName,
     349                                          const QString &strName);
     350
    343351        /** Updates selected cloud profiles. */
    344352        void sltUpdateSelectedCloudProfiles();
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r90366 r90373  
    321321
    322322/*********************************************************************************************************************************
     323*   Class UINotificationProgressCloudMachineCreate implementation.                                                               *
     324*********************************************************************************************************************************/
     325
     326UINotificationProgressCloudMachineRemove::UINotificationProgressCloudMachineRemove(const CCloudMachine &comMachine,
     327                                                                                   bool fFullRemoval,
     328                                                                                   const QString &strShortProviderName,
     329                                                                                   const QString &strProfileName)
     330    : m_comMachine(comMachine)
     331    , m_fFullRemoval(fFullRemoval)
     332    , m_strShortProviderName(strShortProviderName)
     333    , m_strProfileName(strProfileName)
     334{
     335    /* Acquire cloud VM name: */
     336    m_strName = m_comMachine.GetName();
     337
     338    /* Listen for last progress signal: */
     339    connect(this, &UINotificationProgress::sigProgressFinished,
     340            this, &UINotificationProgressCloudMachineRemove::sltHandleProgressFinished);
     341}
     342
     343QString UINotificationProgressCloudMachineRemove::name() const
     344{
     345    return   m_fFullRemoval
     346           ? UINotificationProgress::tr("Deleting cloud VM files ...")
     347           : UINotificationProgress::tr("Removing cloud VM ...");
     348}
     349
     350QString UINotificationProgressCloudMachineRemove::details() const
     351{
     352    return UINotificationProgress::tr("<b>Name:</b> %1").arg(m_strName);
     353}
     354
     355CProgress UINotificationProgressCloudMachineRemove::createProgress(COMResult &comResult)
     356{
     357    /* Initialize progress-wrapper: */
     358    CProgress comProgress = m_fFullRemoval
     359                          ? m_comMachine.Remove()
     360                          : m_comMachine.Unregister();
     361    /* Store COM result: */
     362    comResult = m_comMachine;
     363    /* Return progress-wrapper: */
     364    return comProgress;
     365}
     366
     367void UINotificationProgressCloudMachineRemove::sltHandleProgressFinished()
     368{
     369    if (error().isEmpty())
     370        emit sigCloudMachineRemoved(m_strShortProviderName, m_strProfileName, m_strName);
     371}
     372
     373
     374/*********************************************************************************************************************************
    323375*   Class UINotificationProgressApplianceExport implementation.                                                                  *
    324376*********************************************************************************************************************************/
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r90365 r90373  
    350350};
    351351
     352/** UINotificationProgress extension for cloud machine remove functionality. */
     353class SHARED_LIBRARY_STUFF UINotificationProgressCloudMachineRemove : public UINotificationProgress
     354{
     355    Q_OBJECT;
     356
     357signals:
     358
     359    /** Notifies listeners about cloud machine was removed.
     360      * @param  strShortProviderName  Brigns the short provider name.
     361      * @param  strProfileName        Brings the profile name.
     362      * @param  strName               Brings the machine name. */
     363    void sigCloudMachineRemoved(const QString &strShortProviderName,
     364                                const QString &strProfileName,
     365                                const QString &strName);
     366
     367public:
     368
     369    /** Constructs cloud machine remove notification-progress.
     370      * @param  comMachine    Brings the cloud machine being removed.
     371      * @param  fFullRemoval  Brings whether cloud machine should be removed fully. */
     372    UINotificationProgressCloudMachineRemove(const CCloudMachine &comMachine,
     373                                             bool fFullRemoval,
     374                                             const QString &strShortProviderName,
     375                                             const QString &strProfileName);
     376
     377protected:
     378
     379    /** Returns object name. */
     380    virtual QString name() const /* override final */;
     381    /** Returns object details. */
     382    virtual QString details() const /* override final */;
     383    /** Creates and returns started progress-wrapper. */
     384    virtual CProgress createProgress(COMResult &comResult) /* override final */;
     385
     386private slots:
     387
     388    /** Handles signal about progress being finished. */
     389    void sltHandleProgressFinished();
     390
     391private:
     392
     393    /** Holds the cloud machine being removed. */
     394    CCloudMachine  m_comMachine;
     395    /** Holds the name acquired from cloud machine. */
     396    QString        m_strName;
     397    /** Holds whether cloud machine should be removed fully. */
     398    bool           m_fFullRemoval;
     399    /** Holds the short provider name. */
     400    QString        m_strShortProviderName;
     401    /** Holds the profile name. */
     402    QString        m_strProfileName;
     403};
     404
    352405/** UINotificationProgress extension for export appliance functionality. */
    353406class SHARED_LIBRARY_STUFF UINotificationProgressApplianceExport : public UINotificationProgress
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