VirtualBox

Changeset 83643 in vbox


Ignore:
Timestamp:
Apr 9, 2020 9:43:07 AM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: Extend UICloudNetworkingStuff namespace with stuff to acquire cloud machine list and cloud machine information.

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

Legend:

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

    r83255 r83643  
    8181    /* Return empty list by default: */
    8282    return QList<UICloudMachine>();
     83}
     84
     85QVector<CCloudMachine> UICloudNetworkingStuff::listCloudMachines(CCloudClient &comCloudClient,
     86                                                                 QString &strErrorMessage,
     87                                                                 QWidget *pParent /* = 0 */)
     88{
     89    /* Execute ReadCloudMachineList async method: */
     90    CProgress comProgress = comCloudClient.ReadCloudMachineList();
     91    if (!comCloudClient.isOk())
     92    {
     93        if (pParent)
     94            msgCenter().cannotAcquireCloudClientParameter(comCloudClient, pParent);
     95        else
     96            strErrorMessage = UIErrorString::formatErrorInfo(comCloudClient);
     97    }
     98    else
     99    {
     100        /* Show "Read cloud machines" progress: */
     101        if (pParent)
     102            msgCenter().showModalProgressDialog(comProgress,
     103                                                UICommon::tr("Read cloud machines ..."),
     104                                                ":/progress_reading_appliance_90px.png", pParent, 0);
     105        else
     106            comProgress.WaitForCompletion(-1);
     107        if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     108        {
     109            if (pParent)
     110                msgCenter().cannotAcquireCloudClientParameter(comProgress, pParent);
     111            else
     112                strErrorMessage = UIErrorString::formatErrorInfo(comProgress);
     113        }
     114        else
     115        {
     116            /* Return acquired cloud machines: */
     117            return comCloudClient.GetCloudMachineList();
     118        }
     119    }
     120
     121    /* Return empty list by default: */
     122    return QVector<CCloudMachine>();
    83123}
    84124
     
    176216}
    177217
     218void UICloudNetworkingStuff::refreshCloudMachineInfo(CCloudMachine &comCloudMachine,
     219                                                     QString &strErrorMessage,
     220                                                     QWidget *pParent /* = 0 */)
     221{
     222    /* Execute ReadState async method: */
     223    CProgress comProgress = comCloudMachine.ReadState();
     224    if (!comCloudMachine.isOk())
     225    {
     226        if (pParent)
     227            msgCenter().cannotAcquireCloudMachineParameter(comCloudMachine, pParent);
     228        else
     229            strErrorMessage = UIErrorString::formatErrorInfo(comCloudMachine);
     230    }
     231    else
     232    {
     233        /* Show "Read cloud machine state" progress: */
     234        if (pParent)
     235            msgCenter().showModalProgressDialog(comProgress,
     236                                                UICommon::tr("Read cloud machine state ..."),
     237                                                ":/progress_reading_appliance_90px.png", pParent, 0);
     238        else
     239            comProgress.WaitForCompletion(-1);
     240        if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     241        {
     242            if (pParent)
     243                msgCenter().cannotAcquireCloudMachineParameter(comProgress, pParent);
     244            else
     245                strErrorMessage = UIErrorString::formatErrorInfo(comProgress);
     246        }
     247    }
     248}
     249
    178250QMap<QString, QString> UICloudNetworkingStuff::getImageInfo(const CCloudClient &comCloudClient,
    179251                                                            const QString &strId,
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICloudNetworkingStuff.h

    r83255 r83643  
    2929#include "COMEnums.h"
    3030#include "CCloudClient.h"
     31#include "CCloudMachine.h"
    3132
    3233/** Cloud networking stuff namespace. */
     
    4142                                                             QString &strErrorMessage,
    4243                                                             QWidget *pParent = 0);
     44    /** Acquires cloud machine list.
     45      * @param  comCloudClient   Brings cloud client object.
     46      * @param  strErrorMessage  Brings error message container.
     47      * @param  pWidget          Brings parent widget to show messages according to,
     48      *                          if no parent set, progress will be executed in blocking way. */
     49    SHARED_LIBRARY_STUFF QVector<CCloudMachine> listCloudMachines(CCloudClient &comCloudClient,
     50                                                                  QString &strErrorMessage,
     51                                                                  QWidget *pParent = 0);
    4352
    4453    /** Acquires instance info as a map.
     
    6372                                                 QString &strErrorMessage,
    6473                                                 QWidget *pParent = 0);
     74    /** Refreshes cloud machine information.
     75      * @param  comCloudMachine  Brings cloud machine object.
     76      * @param  strErrorMessage  Brings error message container.
     77      * @param  pWidget          Brings parent widget to show messages according to,
     78      *                          if no parent set, progress will be executed in blocking way. */
     79    SHARED_LIBRARY_STUFF void refreshCloudMachineInfo(CCloudMachine &comCloudMachine,
     80                                                      QString &strErrorMessage,
     81                                                      QWidget *pParent = 0);
    6582
    6683    /** Acquires image info as a map.
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r83526 r83643  
    5757#include "CChoiceFormValue.h"
    5858#include "CCloudClient.h"
     59#include "CCloudMachine.h"
    5960#include "CCloudProfile.h"
    6061#include "CCloudProvider.h"
     
    17691770}
    17701771
     1772void UIMessageCenter::cannotAcquireCloudMachineParameter(const CCloudMachine &comMachine, QWidget *pParent /* = 0 */) const
     1773{
     1774    error(pParent, MessageType_Error,
     1775          tr("Failed to acquire cloud machine parameter."),
     1776          UIErrorString::formatErrorInfo(comMachine));
     1777}
     1778
     1779void UIMessageCenter::cannotAcquireCloudMachineParameter(const CProgress &comProgress, QWidget *pParent /* = 0 */) const
     1780{
     1781    error(pParent, MessageType_Error,
     1782          tr("Failed to acquire cloud machine parameter."),
     1783          UIErrorString::formatErrorInfo(comProgress));
     1784}
     1785
    17711786bool UIMessageCenter::confirmCloudProfileRemoval(const QString &strName, QWidget *pParent /* = 0 */) const
    17721787{
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r83212 r83643  
    389389    void cannotAcquireCloudClientParameter(const CCloudClient &comClient, QWidget *pParent = 0) const;
    390390    void cannotAcquireCloudClientParameter(const CProgress &comProgress, QWidget *pParent = 0) const;
     391    void cannotAcquireCloudMachineParameter(const CCloudMachine &comMachine, QWidget *pParent = 0) const;
     392    void cannotAcquireCloudMachineParameter(const CProgress &comProgress, QWidget *pParent = 0) const;
    391393    bool confirmCloudProfileRemoval(const QString &strName, QWidget *pParent = 0) const;
    392394    bool confirmCloudProfilesImport(QWidget *pParent = 0) const;
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