VirtualBox

Ignore:
Timestamp:
Mar 3, 2020 12:25:47 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
136318
Message:

FE/Qt: bugref:9653: Extend UICloudMachine and UICloudNetworkingStuff with image name and size information as well.

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

Legend:

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

    r83182 r83190  
    8484    m_strBootingFirmware = fetchBootingFirmware(instanceInfoMap);
    8585    m_strImageId = fetchImageId(instanceInfoMap);
     86
     87    /* Acquire image info sync way, be aware, this is blocking stuff, it takes some time: */
     88    const QMap<QString, QString> imageInfoMap = getImageInfo(m_comCloudClient, m_strImageId);
     89    //printf("Image info:\n");
     90    //foreach (const QString &strKey, imageInfoMap.keys())
     91    //    printf("key = %s, value = %s\n", strKey.toUtf8().constData(), imageInfoMap.value(strKey).toUtf8().constData());
     92    //printf("\n");
     93
     94    /* Sorry, but these are hardcoded in Main: */
     95    m_strImageName = imageInfoMap.value("display name");
     96    m_strImageSize = imageInfoMap.value("size");
    8697}
    8798
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/globals/UICloudMachine.h

    r83182 r83190  
    8181    /** Returns cloud VM image id. */
    8282    QString imageId() const { return m_strImageId; }
     83    /** Returns cloud VM image name. */
     84    QString imageName() const { return m_strImageName; }
     85    /** Returns cloud VM image size. */
     86    QString imageSize() const { return m_strImageSize; }
    8387
    8488private:
     
    112116    /** Holds the cloud VM image id. */
    113117    QString  m_strImageId;
     118    /** Holds the cloud VM image name. */
     119    QString  m_strImageName;
     120    /** Holds the cloud VM image size. */
     121    QString  m_strImageSize;
    114122};
    115123
     
    168176    /** Returns cloud VM image id. */
    169177    QString imageId() const { return d->imageId(); }
     178    /** Returns cloud VM image name. */
     179    QString imageName() const { return d->imageName(); }
     180    /** Returns cloud VM image size. */
     181    QString imageSize() const { return d->imageSize(); }
    170182
    171183private:
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/globals/UICloudNetworkingStuff.cpp

    r83182 r83190  
    184184}
    185185
     186QMap<QString, QString> UICloudNetworkingStuff::getImageInfo(const CCloudClient &comCloudClient,
     187                                                            const QString &strId,
     188                                                            QWidget *pParent /* = 0 */)
     189{
     190    /* Prepare result: */
     191    QMap<QString, QString> resultMap;
     192
     193    /* Execute GetImageInfo async method: */
     194    CStringArray comStringArray;
     195    CProgress comProgress = comCloudClient.GetImageInfo(strId, comStringArray);
     196    if (!comCloudClient.isOk())
     197    {
     198        if (pParent)
     199            msgCenter().cannotAcquireCloudClientParameter(comCloudClient, pParent);
     200        else
     201        {
     202            /// @todo fetch error info
     203        }
     204    }
     205    else
     206    {
     207        /* Show "Acquire image info" progress: */
     208        if (pParent)
     209            msgCenter().showModalProgressDialog(comProgress,
     210                                                UICommon::tr("Acquire cloud image info ..."),
     211                                                ":/progress_reading_appliance_90px.png", pParent, 0);
     212        else
     213            comProgress.WaitForCompletion(-1);
     214        if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     215        {
     216            if (pParent)
     217                msgCenter().cannotAcquireCloudClientParameter(comProgress, pParent);
     218            else
     219            {
     220                /// @todo fetch error info
     221            }
     222        }
     223        else
     224        {
     225            /* Append resulting list values we have, split them by pairs: */
     226            foreach (const QString &strPair, comStringArray.GetValues())
     227            {
     228                const QList<QString> pair = strPair.split(" = ");
     229                AssertReturn(pair.size() == 2, resultMap);
     230                resultMap[pair.at(0)] = pair.at(1);
     231            }
     232        }
     233    }
     234
     235    /* Return result: */
     236    return resultMap;
     237}
     238
    186239QString UICloudNetworkingStuff::fetchOsType(const QMap<KVirtualSystemDescriptionType, QString> &infoMap)
    187240{
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/globals/UICloudNetworkingStuff.h

    r83182 r83190  
    5858                                                 QWidget *pParent = 0);
    5959
     60    /** Acquires image info as a map.
     61      * @param  comCloudClient  Brings cloud client object.
     62      * @param  strId           Brings cloud image id.
     63      * @param  pWidget         Brings parent widget to show messages according to,
     64      *                         if no parent set, progress will be executed in blocking way. */
     65    SHARED_LIBRARY_STUFF QMap<QString, QString> getImageInfo(const CCloudClient &comCloudClient,
     66                                                             const QString &strId,
     67                                                             QWidget *pParent = 0);
     68
    6069    /** Fetches cloud instance OS type from the passed @a info. */
    6170    SHARED_LIBRARY_STUFF QString fetchOsType(const QMap<KVirtualSystemDescriptionType, QString> &infoMap);
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