VirtualBox

Changeset 91757 in vbox


Ignore:
Timestamp:
Oct 15, 2021 9:58:36 AM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10067: UIWizardNewCloudVM: Migrate intermediate progress related to launch VSD form creation to notification-center.

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

Legend:

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

    r91216 r91757  
    19321932
    19331933/*********************************************************************************************************************************
     1934*   Class UINotificationProgressLaunchVSDFormCreate implementation.                                                              *
     1935*********************************************************************************************************************************/
     1936
     1937UINotificationProgressLaunchVSDFormCreate::UINotificationProgressLaunchVSDFormCreate(const CCloudClient &comClient,
     1938                                                                                     const CVirtualSystemDescription &comVSD,
     1939                                                                                     const QString &strProviderShortName,
     1940                                                                                     const QString &strProfileName)
     1941    : m_comClient(comClient)
     1942    , m_comVSD(comVSD)
     1943    , m_strProviderShortName(strProviderShortName)
     1944    , m_strProfileName(strProfileName)
     1945{
     1946    connect(this, &UINotificationProgress::sigProgressFinished,
     1947            this, &UINotificationProgressLaunchVSDFormCreate::sltHandleProgressFinished);
     1948}
     1949
     1950QString UINotificationProgressLaunchVSDFormCreate::name() const
     1951{
     1952    return UINotificationProgress::tr("Creating launch VSD form ...");
     1953}
     1954
     1955QString UINotificationProgressLaunchVSDFormCreate::details() const
     1956{
     1957    return UINotificationProgress::tr("<b>Provider:</b> %1<br><b>Profile:</b> %2")
     1958                                      .arg(m_strProviderShortName, m_strProfileName);
     1959}
     1960
     1961CProgress UINotificationProgressLaunchVSDFormCreate::createProgress(COMResult &comResult)
     1962{
     1963    /* Initialize progress-wrapper: */
     1964    CProgress comProgress = m_comClient.GetLaunchDescriptionForm(m_comVSD, m_comVSDForm);
     1965    /* Store COM result: */
     1966    comResult = m_comClient;
     1967    /* Return progress-wrapper: */
     1968    return comProgress;
     1969}
     1970
     1971void UINotificationProgressLaunchVSDFormCreate::sltHandleProgressFinished()
     1972{
     1973    if (m_comVSDForm.isNotNull())
     1974        emit sigVSDFormCreated(m_comVSDForm);
     1975}
     1976
     1977
     1978/*********************************************************************************************************************************
    19341979*   Class UINotificationProgressCloudMachineAdd implementation.                                                                  *
    19351980*********************************************************************************************************************************/
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r91216 r91757  
    4545#include "CSnapshot.h"
    4646#include "CVirtualSystemDescription.h"
     47#include "CVirtualSystemDescriptionForm.h"
    4748
    4849/* Forward declarations: */
     
    960961};
    961962
     963/** UINotificationProgress extension for launch VSD form create functionality. */
     964class SHARED_LIBRARY_STUFF UINotificationProgressLaunchVSDFormCreate : public UINotificationProgress
     965{
     966    Q_OBJECT;
     967
     968signals:
     969
     970    /** Notifies listeners about VSD @a comForm created.
     971      * @param  comForm  Brings created VSD form. */
     972    void sigVSDFormCreated(const CVirtualSystemDescriptionForm &comForm);
     973
     974public:
     975
     976    /** Constructs launch VSD form create notification-progress.
     977      * @param  comClient             Brings the cloud client being creating VSD form.
     978      * @param  comVsd                Brings the VSD, form being created for.
     979      * @param  strProviderShortName  Brings the short provider name.
     980      * @param  strProfileName        Brings the profile name. */
     981    UINotificationProgressLaunchVSDFormCreate(const CCloudClient &comClient,
     982                                              const CVirtualSystemDescription &comVSD,
     983                                              const QString &strProviderShortName,
     984                                              const QString &strProfileName);
     985
     986protected:
     987
     988    /** Returns object name. */
     989    virtual QString name() const /* override final */;
     990    /** Returns object details. */
     991    virtual QString details() const /* override final */;
     992    /** Creates and returns started progress-wrapper. */
     993    virtual CProgress createProgress(COMResult &comResult) /* override final */;
     994
     995private slots:
     996
     997    /** Handles signal about progress being finished. */
     998    void sltHandleProgressFinished();
     999
     1000private:
     1001
     1002    /** Holds the cloud client being creating VSD form. */
     1003    CCloudClient                   m_comClient;
     1004    /** Holds the VSD, form being created for. */
     1005    CVirtualSystemDescription      m_comVSD;
     1006    /** Holds the VSD form being created. */
     1007    CVirtualSystemDescriptionForm  m_comVSDForm;
     1008    /** Holds the short provider name. */
     1009    QString                        m_strProviderShortName;
     1010    /** Holds the profile name. */
     1011    QString                        m_strProfileName;
     1012};
     1013
    9621014/** UINotificationProgress extension for cloud machine add functionality. */
    9631015class SHARED_LIBRARY_STUFF UINotificationProgressCloudMachineAdd : public UINotificationProgress
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVM.cpp

    r91499 r91757  
    5252}
    5353
    54 bool UIWizardNewCloudVM::createVSDForm()
     54void UIWizardNewCloudVM::createVSDForm()
    5555{
    56     /* Prepare result: */
    57     bool fResult = false;
    58 
    5956    /* Acquire prepared client and description: */
    6057    CCloudClient comClient = client();
    6158    CVirtualSystemDescription comVSD = vsd();
    62     AssertReturn(comClient.isNotNull() && comVSD.isNotNull(), false);
     59    AssertReturnVoid(comClient.isNotNull() && comVSD.isNotNull());
    6360
    64     /* Read Cloud Client description form: */
    65     CVirtualSystemDescriptionForm comForm;
    66     CProgress comProgress = comClient.GetLaunchDescriptionForm(comVSD, comForm);
    67     /* Check for immediate errors: */
    68     if (!comClient.isOk())
    69         msgCenter().cannotAcquireCloudClientParameter(comClient);
    70     else
    71     {
    72         /* Make sure progress initially valid: */
    73         if (!comProgress.isNull() && !comProgress.GetCompleted())
    74         {
    75             /* Create take snapshot progress object: */
    76             QPointer<UIProgressObject> pObject = new UIProgressObject(comProgress, this);
    77             if (pObject)
    78             {
    79                 connect(pObject.data(), &UIProgressObject::sigProgressChange,
    80                         this, &UIWizardNewCloudVM::sltHandleProgressChange);
    81                 connect(pObject.data(), &UIProgressObject::sigProgressComplete,
    82                         this, &UIWizardNewCloudVM::sltHandleProgressFinished);
    83                 sltHandleProgressStarted();
    84                 pObject->exec();
    85                 if (pObject)
    86                     delete pObject;
    87                 else
    88                 {
    89                     // Premature application shutdown,
    90                     // exit immediately:
    91                     return fResult;
    92                 }
    93             }
    94         }
    95 
    96         /* Check for progress errors: */
    97         if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
    98             msgCenter().cannotAcquireCloudClientParameter(comProgress);
    99         else
    100         {
    101             /* Check whether form really read: */
    102             if (comForm.isNotNull())
    103             {
    104                 /* Remember Virtual System Description Form: */
    105                 setVSDForm(comForm);
    106 
    107                 /* Finally, success: */
    108                 fResult = true;
    109             }
    110         }
    111     }
    112 
    113     /* Return result: */
    114     return fResult;
     61    /* Create launch VSD form: */
     62    UINotificationProgressLaunchVSDFormCreate *pNotification = new UINotificationProgressLaunchVSDFormCreate(comClient,
     63                                                                                                             comVSD,
     64                                                                                                             providerShortName(),
     65                                                                                                             profileName());
     66    connect(pNotification, &UINotificationProgressLaunchVSDFormCreate::sigVSDFormCreated,
     67            this, &UIWizardNewCloudVM::setVSDForm);
     68    handleNotificationProgressNow(pNotification);
    11569}
    11670
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVM.h

    r91756 r91757  
    5454
    5555    /** Creates VSD Form. */
    56     bool createVSDForm();
     56    void createVSDForm();
    5757
    5858    /** Creates New Cloud VM. */
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