VirtualBox

Changeset 89996 in vbox


Ignore:
Timestamp:
Jul 2, 2021 10:24:18 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145473
Message:

FE/Qt: bugref:9996: UIWizardNewCloudVM: A bit of structural refactoring for createVSDForm() and createCloudVM() functionality.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVM.cpp

    r89979 r89996  
    5858    bool fResult = false;
    5959
    60     /* Main API request sequence, can be interrupted after any step: */
    61     do
    62     {
    63         /* Acquire prepared client and description: */
    64         CCloudClient comClient = client();
    65         CVirtualSystemDescription comVSD = vsd();
    66         AssertReturn(comClient.isNotNull() && comVSD.isNotNull(), false);
    67 
    68         /* Read Cloud Client description form: */
    69         CVirtualSystemDescriptionForm comForm;
    70         CProgress comProgress = comClient.GetLaunchDescriptionForm(comVSD, comForm);
    71         if (!comClient.isOk())
    72         {
    73             msgCenter().cannotAcquireCloudClientParameter(comClient);
    74             break;
    75         }
    76 
     60    /* Acquire prepared client and description: */
     61    CCloudClient comClient = client();
     62    CVirtualSystemDescription comVSD = vsd();
     63    AssertReturn(comClient.isNotNull() && comVSD.isNotNull(), false);
     64
     65    /* Read Cloud Client description form: */
     66    CVirtualSystemDescriptionForm comForm;
     67    CProgress comProgress = comClient.GetLaunchDescriptionForm(comVSD, comForm);
     68    /* Check for immediate errors: */
     69    if (!comClient.isOk())
     70        msgCenter().cannotAcquireCloudClientParameter(comClient);
     71    else
     72    {
    7773        /* Show "Acquire launch form" progress: */
    78         msgCenter().showModalProgressDialog(comProgress, QString(), ":/progress_refresh_90px.png", this, 0);
    79         if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
    80         {
    81             msgCenter().cannotAcquireCloudClientParameter(comProgress);
    82             break;
    83         }
    84 
    85         /* Remember Virtual System Description Form: */
    86         setVSDForm(comForm);
    87 
    88         /* Finally, success: */
    89         fResult = true;
    90     }
    91     while (0);
     74        msgCenter().showModalProgressDialog(comProgress, QString(),
     75                                            ":/progress_refresh_90px.png", this, 0);
     76        /* Check for canceled progress: */
     77        if (!comProgress.GetCanceled())
     78        {
     79            /* Check for progress errors: */
     80            if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     81                msgCenter().cannotAcquireCloudClientParameter(comProgress);
     82            else
     83            {
     84                /* Check whether form really read: */
     85                if (comForm.isNotNull())
     86                {
     87                    /* Remember Virtual System Description Form: */
     88                    setVSDForm(comForm);
     89
     90                    /* Finally, success: */
     91                    fResult = true;
     92                }
     93            }
     94        }
     95    }
    9296
    9397    /* Return result: */
     
    100104    bool fResult = false;
    101105
    102     /* Main API request sequence, can be interrupted after any step: */
    103     do
    104     {
    105         /* Do nothing if prevented: */
    106         if (m_fFinalStepPrevented)
    107         {
    108             fResult = true;
    109             break;
    110         }
    111 
    112         /* Acquire prepared client and description: */
    113         CCloudClient comClient = client();
    114         CVirtualSystemDescription comVSD = vsd();
    115         AssertReturn(comClient.isNotNull() && comVSD.isNotNull(), false);
    116 
    117         /* Initiate cloud VM creation procedure: */
    118         CCloudMachine comMachine;
    119         CProgress comProgress = comClient.CreateCloudMachine(comVSD, comMachine);
    120         if (!comClient.isOk())
    121         {
    122             msgCenter().cannotCreateCloudMachine(comClient, this);
    123             break;
    124         }
    125 
     106    /* Do nothing if prevented: */
     107    if (m_fFinalStepPrevented)
     108    {
     109        fResult = true;
     110        return fResult;
     111    }
     112
     113    /* Acquire prepared client and description: */
     114    CCloudClient comClient = client();
     115    CVirtualSystemDescription comVSD = vsd();
     116    AssertReturn(comClient.isNotNull() && comVSD.isNotNull(), false);
     117
     118    /* Initiate cloud VM creation procedure: */
     119    CCloudMachine comMachine;
     120    CProgress comProgress = comClient.CreateCloudMachine(comVSD, comMachine);
     121    /* Check for immediate errors: */
     122    if (!comClient.isOk())
     123        msgCenter().cannotCreateCloudMachine(comClient, this);
     124    else
     125    {
    126126        /* Show "Create Cloud Machine" progress: */
    127         msgCenter().showModalProgressDialog(comProgress, QString(), ":/progress_new_cloud_vm_90px.png", this, 0);
    128         if (comProgress.GetCanceled())
    129             break;
    130         if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
    131         {
    132             msgCenter().cannotCreateCloudMachine(comProgress, this);
    133             break;
    134         }
    135 
    136         /* Check whether VM really added: */
    137         if (comMachine.isNotNull())
    138             uiCommon().notifyCloudMachineRegistered(shortProviderName(),
    139                                                     profileName(),
    140                                                     comMachine);
    141 
    142         /* Finally, success: */
    143         fResult = true;
    144     }
    145     while (0);
     127        msgCenter().showModalProgressDialog(comProgress, QString(),
     128                                            ":/progress_new_cloud_vm_90px.png", this, 0);
     129        /* Check for canceled progress: */
     130        if (!comProgress.GetCanceled())
     131        {
     132            /* Check for progress errors: */
     133            if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     134                msgCenter().cannotCreateCloudMachine(comProgress, this);
     135            else
     136            {
     137                /* Check whether VM really added: */
     138                if (comMachine.isNotNull())
     139                {
     140                    /* Notify GUI about VM was added: */
     141                    uiCommon().notifyCloudMachineRegistered(shortProviderName(),
     142                                                            profileName(),
     143                                                            comMachine);
     144
     145                    /* Finally, success: */
     146                    fResult = true;
     147                }
     148            }
     149        }
     150    }
    146151
    147152    /* Return result: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVM.h

    r89979 r89996  
    3838public:
    3939
    40     /** Constructs New Cloud VM wizard passing @a pParent to the base-class.
     40    /** Constructs New Cloud VM wizard passing @a pParent & @a enmMode to the base-class.
    4141      * @param  strFullGroupName  Brings full group name (/provider/profile) to create VM in.
    4242      * @param  comClient         Brings the Cloud Client object to work with.
     
    9292
    9393    /** Populates pages. */
    94     virtual void populatePages() /* final */;
     94    virtual void populatePages() /* override final */;
    9595
    9696    /** Handles translation event. */
    97     virtual void retranslateUi() /* final */;
     97    virtual void retranslateUi() /* override final */;
    9898
    9999private slots:
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