VirtualBox

Changeset 90302 in vbox for trunk/src


Ignore:
Timestamp:
Jul 23, 2021 1:08:11 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10067: Notification signature for final Add Cloud VM wizard progress which should now go to center instead of modal dialog.

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

Legend:

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

    r90301 r90302  
    41554155}
    41564156
     4157void UICommon::sltHandleCloudMachineAdded(const QString &strShortProviderName,
     4158                                          const QString &strProfileName,
     4159                                          const CCloudMachine &comMachine)
     4160{
     4161    /* Make sure we cached added cloud VM in GUI: */
     4162    notifyCloudMachineRegistered(strShortProviderName,
     4163                                 strProfileName,
     4164                                 comMachine);
     4165}
     4166
    41574167bool UICommon::eventFilter(QObject *pObject, QEvent *pEvent)
    41584168{
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h

    r90301 r90302  
    735735    /** @} */
    736736
     737    /** @name Cloud Machine related stuff.
     738     * @{ */
     739        /** Handles signal about cloud machine was added. */
     740        void sltHandleCloudMachineAdded(const QString &strShortProviderName,
     741                                        const QString &strProfileName,
     742                                        const CCloudMachine &comMachine);
     743    /** @} */
     744
    737745protected:
    738746
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r90301 r90302  
    4040QString UINotificationProgressMediumMove::details() const
    4141{
    42     return UINotificationProgress::tr("<b>From</b>: %1<br><b>To</b>: %2").arg(m_strFrom, m_strTo);
     42    return UINotificationProgress::tr("<b>From:</b> %1<br><b>To:</b> %2").arg(m_strFrom, m_strTo);
    4343}
    4444
     
    7676QString UINotificationProgressMediumCopy::details() const
    7777{
    78     return UINotificationProgress::tr("<b>From</b>: %1<br><b>To</b>: %2")
     78    return UINotificationProgress::tr("<b>From:</b> %1<br><b>To:</b> %2")
    7979                                     .arg(m_comSource.GetLocation(), m_comTarget.GetLocation());
    8080}
     
    9595        emit sigMediumCopied(m_comTarget);
    9696}
     97
     98
     99/*********************************************************************************************************************************
     100*   Class UINotificationProgressCloudMachineAdd implementation.                                                                  *
     101*********************************************************************************************************************************/
     102
     103UINotificationProgressCloudMachineAdd::UINotificationProgressCloudMachineAdd(const CCloudClient &comClient,
     104                                                                             const CCloudMachine &comMachine,
     105                                                                             const QString &strInstanceName,
     106                                                                             const QString &strShortProviderName,
     107                                                                             const QString &strProfileName)
     108    : m_comClient(comClient)
     109    , m_comMachine(comMachine)
     110    , m_strInstanceName(strInstanceName)
     111    , m_strShortProviderName(strShortProviderName)
     112    , m_strProfileName(strProfileName)
     113{
     114    connect(this, &UINotificationProgress::sigProgressFinished,
     115            this, &UINotificationProgressCloudMachineAdd::sltHandleProgressFinished);
     116}
     117
     118QString UINotificationProgressCloudMachineAdd::name() const
     119{
     120    return UINotificationProgress::tr("Adding cloud VM ...");
     121}
     122
     123QString UINotificationProgressCloudMachineAdd::details() const
     124{
     125    return UINotificationProgress::tr("<b>Provider:</b> %1<br><b>Profile:</b> %2<br><b>Instance Name:</b> %3")
     126                                     .arg(m_strShortProviderName, m_strProfileName, m_strInstanceName);
     127}
     128
     129CProgress UINotificationProgressCloudMachineAdd::createProgress(COMResult &comResult)
     130{
     131    /* Initialize progress-wrapper: */
     132    CProgress comProgress = m_comClient.AddCloudMachine(m_strInstanceName, m_comMachine);
     133    /* Store COM result: */
     134    comResult = m_comClient;
     135    /* Return progress-wrapper: */
     136    return comProgress;
     137}
     138
     139void UINotificationProgressCloudMachineAdd::sltHandleProgressFinished()
     140{
     141    if (m_comMachine.isNotNull() && !m_comMachine.GetId().isNull())
     142        emit sigCloudMachineAdded(m_strShortProviderName, m_strProfileName, m_comMachine);
     143}
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r90301 r90302  
    2727/* COM includes: */
    2828#include "COMEnums.h"
     29#include "CCloudClient.h"
     30#include "CCloudMachine.h"
    2931#include "CMedium.h"
    3032
     
    107109};
    108110
     111/** UINotificationProgress extension for cloud machine add functionality. */
     112class SHARED_LIBRARY_STUFF UINotificationProgressCloudMachineAdd : public UINotificationProgress
     113{
     114    Q_OBJECT;
     115
     116signals:
     117
     118    /** Notifies listeners about cloud @a comMachine was added.
     119      * @param  strShortProviderName  Brigns the short provider name.
     120      * @param  strProfileName        Brings the profile name. */
     121    void sigCloudMachineAdded(const QString &strShortProviderName,
     122                              const QString &strProfileName,
     123                              const CCloudMachine &comMachine);
     124
     125public:
     126
     127    /** Constructs cloud machine add notification-progress.
     128      * @param  comClient             Brings the cloud client being adding machine.
     129      * @param  comMachine            Brings the cloud machine being added.
     130      * @param  strInstanceName       Brings the instance name.
     131      * @param  strShortProviderName  Brings the short provider name.
     132      * @param  strProfileName        Brings the profile name. */
     133    UINotificationProgressCloudMachineAdd(const CCloudClient &comClient,
     134                                          const CCloudMachine &comMachine,
     135                                          const QString &strInstanceName,
     136                                          const QString &strShortProviderName,
     137                                          const QString &strProfileName);
     138
     139protected:
     140
     141    /** Returns object name. */
     142    virtual QString name() const /* override final */;
     143    /** Returns object details. */
     144    virtual QString details() const /* override final */;
     145    /** Creates and returns started progress-wrapper. */
     146    virtual CProgress createProgress(COMResult &comResult) /* override final */;
     147
     148private slots:
     149
     150    /** Handles signal about progress being finished. */
     151    void sltHandleProgressFinished();
     152
     153private:
     154
     155    /** Holds the cloud client being adding machine. */
     156    CCloudClient   m_comClient;
     157    /** Holds the cloud machine being added. */
     158    CCloudMachine  m_comMachine;
     159    /** Holds the instance name. */
     160    QString        m_strInstanceName;
     161    /** Holds the short provider name. */
     162    QString        m_strShortProviderName;
     163    /** Holds the profile name. */
     164    QString        m_strProfileName;
     165};
     166
    109167#endif /* !FEQT_INCLUDED_SRC_notificationcenter_UINotificationObjects_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/addcloudvm/UIWizardAddCloudVM.cpp

    r89999 r90302  
    1919#include "UICommon.h"
    2020#include "UIMessageCenter.h"
     21#include "UINotificationCenter.h"
    2122#include "UIWizardAddCloudVM.h"
    2223#include "UIWizardAddCloudVMPageBasic1.h"
     
    5758        /* Initiate cloud VM add procedure: */
    5859        CCloudMachine comMachine;
    59         CProgress comProgress = comClient.AddCloudMachine(strInstanceName, comMachine);
    60         /* Check for immediate errors: */
    61         if (!comClient.isOk())
    62         {
    63             msgCenter().cannotCreateCloudMachine(comClient, this);
    64             break;
    65         }
    66         else
    67         {
    68             /* Show "Add cloud machine" progress: */
    69             msgCenter().showModalProgressDialog(comProgress, QString(),
    70                                                 ":/progress_new_cloud_vm_90px.png", this, 0);
    71             /* Check for canceled progress: */
    72             if (comProgress.GetCanceled())
    73                 break;
    74             else
    75             {
    76                 /* Check for progress errors: */
    77                 if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
    78                 {
    79                     msgCenter().cannotCreateCloudMachine(comProgress, this);
    80                     break;
    81                 }
    82                 else
    83                 {
    84                     /* Check whether VM really added: */
    85                     if (comMachine.isNotNull())
    86                     {
    87                         /* Notify GUI about VM was added: */
    88                         uiCommon().notifyCloudMachineRegistered(shortProviderName(),
    89                                                                 profileName(),
    90                                                                 comMachine);
    9160
    92                         /* Finally, success: */
    93                         fResult = true;
    94                     }
    95                 }
    96             }
    97         }
     61        /* Add cloud VM: */
     62        UINotificationProgressCloudMachineAdd *pNotification = new UINotificationProgressCloudMachineAdd(comClient,
     63                                                                                                         comMachine,
     64                                                                                                         strInstanceName,
     65                                                                                                         shortProviderName(),
     66                                                                                                         profileName());
     67        connect(pNotification, &UINotificationProgressCloudMachineAdd::sigCloudMachineAdded,
     68                &uiCommon(), &UICommon::sltHandleCloudMachineAdded);
     69        notificationCenter().append(pNotification);
     70
     71        /* Positive: */
     72        fResult = true;
    9873    }
    9974
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