VirtualBox

Changeset 84053 in vbox


Ignore:
Timestamp:
Apr 28, 2020 3:59:22 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
137631
Message:

FE/Qt: bugref:9653: UICloudNetworkingStuff: Duplicate some of cloud wrapper methods to be able to call them on other than the GUI thread, gathering error information instead of showing errors instantly.

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

Legend:

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

    r84051 r84053  
    4949}
    5050
     51CCloudProviderManager UICloudNetworkingStuff::cloudProviderManager(QString &strErrorMessage)
     52{
     53    /* Acquire VBox: */
     54    const CVirtualBox comVBox = uiCommon().virtualBox();
     55    if (comVBox.isNotNull())
     56    {
     57        /* Acquire cloud provider manager: */
     58        CCloudProviderManager comProviderManager = comVBox.GetCloudProviderManager();
     59        if (!comVBox.isOk())
     60            strErrorMessage = UIErrorString::formatErrorInfo(comVBox);
     61        else
     62            return comProviderManager;
     63    }
     64    /* Null by default: */
     65    return CCloudProviderManager();
     66}
     67
    5168CCloudProvider UICloudNetworkingStuff::cloudProviderByShortName(const QString &strProviderShortName,
    5269                                                                QWidget *pParent /* = 0 */)
     
    6784}
    6885
     86CCloudProvider UICloudNetworkingStuff::cloudProviderByShortName(const QString &strProviderShortName,
     87                                                                QString &strErrorMessage)
     88{
     89    /* Acquire cloud provider manager: */
     90    CCloudProviderManager comProviderManager = cloudProviderManager(strErrorMessage);
     91    if (comProviderManager.isNotNull())
     92    {
     93        /* Acquire cloud provider: */
     94        CCloudProvider comProvider = comProviderManager.GetProviderByShortName(strProviderShortName);
     95        if (!comProviderManager.isOk())
     96            strErrorMessage = UIErrorString::formatErrorInfo(comProviderManager);
     97        else
     98            return comProvider;
     99    }
     100    /* Null by default: */
     101    return CCloudProvider();
     102}
     103
    69104CCloudProfile UICloudNetworkingStuff::cloudProfileByName(const QString &strProviderShortName,
    70105                                                         const QString &strProfileName,
     
    86121}
    87122
     123CCloudProfile UICloudNetworkingStuff::cloudProfileByName(const QString &strProviderShortName,
     124                                                         const QString &strProfileName,
     125                                                         QString &strErrorMessage)
     126{
     127    /* Acquire cloud provider: */
     128    CCloudProvider comProvider = cloudProviderByShortName(strProviderShortName, strErrorMessage);
     129    if (comProvider.isNotNull())
     130    {
     131        /* Acquire cloud profile: */
     132        CCloudProfile comProfile = comProvider.GetProfileByName(strProfileName);
     133        if (!comProvider.isOk())
     134            strErrorMessage = UIErrorString::formatErrorInfo(comProvider);
     135        else
     136            return comProfile;
     137    }
     138    /* Null by default: */
     139    return CCloudProfile();
     140}
     141
    88142CCloudClient UICloudNetworkingStuff::cloudClientByName(const QString &strProviderShortName,
    89143                                                       const QString &strProfileName,
     
    105159}
    106160
     161CCloudClient UICloudNetworkingStuff::cloudClientByName(const QString &strProviderShortName,
     162                                                       const QString &strProfileName,
     163                                                       QString &strErrorMessage)
     164{
     165    /* Acquire cloud profile: */
     166    CCloudProfile comProfile = cloudProfileByName(strProviderShortName, strProfileName, strErrorMessage);
     167    if (comProfile.isNotNull())
     168    {
     169        /* Create cloud client: */
     170        CCloudClient comClient = comProfile.CreateCloudClient();
     171        if (!comProfile.isOk())
     172            strErrorMessage = UIErrorString::formatErrorInfo(comProfile);
     173        else
     174            return comClient;
     175    }
     176    /* Null by default: */
     177    return CCloudClient();
     178}
     179
    107180CCloudMachine UICloudNetworkingStuff::cloudMachineById(const QString &strProviderShortName,
    108181                                                       const QString &strProfileName,
     
    118191        if (!comClient.isOk())
    119192            msgCenter().cannotAcquireCloudClientParameter(comClient, pParent);
     193        else
     194            return comMachine;
     195    }
     196    /* Null by default: */
     197    return CCloudMachine();
     198}
     199
     200CCloudMachine UICloudNetworkingStuff::cloudMachineById(const QString &strProviderShortName,
     201                                                       const QString &strProfileName,
     202                                                       const QUuid &uMachineId,
     203                                                       QString &strErrorMessage)
     204{
     205    /* Acquire cloud client: */
     206    CCloudClient comClient = cloudClientByName(strProviderShortName, strProfileName, strErrorMessage);
     207    if (comClient.isNotNull())
     208    {
     209        /* Acquire cloud machine: */
     210        CCloudMachine comMachine = comClient.GetCloudMachine(uMachineId);
     211        if (!comClient.isOk())
     212            strErrorMessage = UIErrorString::formatErrorInfo(comClient);
    120213        else
    121214            return comMachine;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICloudNetworkingStuff.h

    r84051 r84053  
    4040      * using @a pParent to show messages according to. */
    4141    SHARED_LIBRARY_STUFF CCloudProviderManager cloudProviderManager(QWidget *pParent = 0);
     42    /** Acquires cloud provider manager,
     43      * using @a strErrorMessage to store messages to. */
     44    SHARED_LIBRARY_STUFF CCloudProviderManager cloudProviderManager(QString &strErrorMessage);
    4245    /** Acquires cloud provider specified by @a strProviderShortName,
    4346      * using @a pParent to show messages according to. */
    4447    SHARED_LIBRARY_STUFF CCloudProvider cloudProviderByShortName(const QString &strProviderShortName,
    4548                                                                 QWidget *pParent = 0);
     49    /** Acquires cloud provider specified by @a strProviderShortName,
     50      * using @a strErrorMessage to store messages to. */
     51    SHARED_LIBRARY_STUFF CCloudProvider cloudProviderByShortName(const QString &strProviderShortName,
     52                                                                 QString &strErrorMessage);
    4653    /** Acquires cloud profile specified by @a strProviderShortName and @a strProfileName,
    4754      * using @a pParent to show messages according to. */
     
    4956                                                          const QString &strProfileName,
    5057                                                          QWidget *pParent = 0);
     58    /** Acquires cloud profile specified by @a strProviderShortName and @a strProfileName,
     59      * using @a strErrorMessage to store messages to. */
     60    SHARED_LIBRARY_STUFF CCloudProfile cloudProfileByName(const QString &strProviderShortName,
     61                                                          const QString &strProfileName,
     62                                                          QString &strErrorMessage);
    5163    /** Acquires cloud client specified by @a strProviderShortName and @a strProfileName,
    5264      * using @a pParent to show messages according to. */
     
    5466                                                        const QString &strProfileName,
    5567                                                        QWidget *pParent = 0);
     68    /** Acquires cloud client specified by @a strProviderShortName and @a strProfileName,
     69      * using @a strErrorMessage to store messages to. */
     70    SHARED_LIBRARY_STUFF CCloudClient cloudClientByName(const QString &strProviderShortName,
     71                                                        const QString &strProfileName,
     72                                                        QString &strErrorMessage);
    5673    /** Acquires cloud machine specified by @a strProviderShortName, @a strProfileName and @a uMachineId,
    5774      * using @a pParent to show messages according to. */
     
    6077                                                        const QUuid &uMachineId,
    6178                                                        QWidget *pParent = 0);
     79    /** Acquires cloud machine specified by @a strProviderShortName, @a strProfileName and @a uMachineId,
     80      * using @a strErrorMessage to store messages to. */
     81    SHARED_LIBRARY_STUFF CCloudMachine cloudMachineById(const QString &strProviderShortName,
     82                                                        const QString &strProfileName,
     83                                                        const QUuid &uMachineId,
     84                                                        QString &strErrorMessage);
    6285
    6386    /** Acquires cloud machines of certain @a comCloudClient, using @a pParent to show messages according to. */
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