VirtualBox

Changeset 73580 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 9, 2018 8:52:48 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
124218
Message:

FE/Qt: bugref:9152: Export Appliance Wizard: Fixes for r124208 and r124210.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp

    r73573 r73580  
    6969    , m_pAccountPropertyTable(0)
    7070{
    71     /* Init Cloud User-profile Manager: */
     71    /* Init Cloud Provider Manager: */
    7272    CVirtualBox comVBox = vboxGlobal().virtualBox();
    7373    m_comCloudProviderManager = comVBox.CreateCloudProviderManager();
     
    118118
    119119    /* Acquire provider ID list: */
    120 //  QVector<KCloudProviderId> providerIds = m_comCloudProviderManager.GetSupportedProviders();
    121120    QVector<QString> providerIds = m_comCloudProviderManager.GetSupportedProviders();
    122121    /* Make sure at least one provider is supported: */
    123122    AssertReturnVoid(!providerIds.isEmpty());
    124123
    125     /* Iterate through provider types: */
    126 //  foreach (KCloudProviderId enmType, providerIds)
    127 //  {
    128 //      /* Acquire Cloud User-profile List: */
    129 //      CCloudUserProfiles comProfiles = m_comCloudProviderManager.GetProfilesByProvider(enmType);
    130 //      /* Skip if we have nothing to populate (file missing?): */
    131 //      if (comProfiles.isNull())
    132 //          continue;
    133 //
    134 //      /* Iterate through profile names: */
    135 //      foreach (const QString &strProfileName, comProfiles.GetStoredProfilesNames())
    136 //      {
    137 //          m_pAccountComboBox->addItem(QString());
    138 //          m_pAccountComboBox->setItemData(m_pAccountComboBox->count() - 1, (int)enmType, ProviderID);
    139 //          m_pAccountComboBox->setItemData(m_pAccountComboBox->count() - 1, strProfileName, ProfileName);
    140 //      }
    141 //  }
    142 //
    143 //  /* Set default: */
    144 //  if (m_pAccountComboBox->count() != 0)
    145 //      setProvider(KCloudProviderId_OCI);
     124    /* Iterate through provider IDs: */
     125    foreach (const QString &strProviderId, providerIds)
     126    {
     127        /* Acquire Cloud Provider: */
     128        const CCloudProvider comProvider = m_comCloudProviderManager.GetProfilesByProvider(strProviderId);
     129        /* Skip if we have nothing to populate (file missing?): */
     130        if (comProvider.isNull())
     131            continue;
     132
     133        /* Iterate through profile names: */
     134        foreach (const QString &strProfileName, comProvider.GetStoredProfilesNames())
     135        {
     136            m_pAccountComboBox->addItem(QString());
     137            m_pAccountComboBox->setItemData(m_pAccountComboBox->count() - 1, strProviderId, ProviderID);
     138            m_pAccountComboBox->setItemData(m_pAccountComboBox->count() - 1, strProfileName, ProfileName);
     139        }
     140    }
     141
     142    /* Set default: */
     143    if (m_pAccountComboBox->count() != 0)
     144        setProviderById("OCI");
    146145}
    147146
    148147void UIWizardExportAppPage2::populateAccountProperties()
    149148{
    150     /* Acquire Cloud User-profile List: */
    151     m_comCloudProvider = m_comCloudProviderManager.GetProfilesByProvider(provider());
     149    /* Acquire Cloud Provider: */
     150    m_comCloudProvider = m_comCloudProviderManager.GetProfilesByProvider(providerId());
    152151    /* Return if we have nothing to populate (file missing?): */
    153152    if (m_comCloudProvider.isNull())
     
    160159    QVector<QString> keys;
    161160    QVector<QString> values;
    162     values = m_comCloudProvider.GetProfileProperties(profile(), keys);
     161    values = m_comCloudProvider.GetProfileProperties(profileName(), keys);
    163162
    164163    /* Configure table: */
     
    369368{
    370369    const int iIndex = m_pFormatComboBox->findData(strFormat);
    371     AssertMsg(iIndex != -1, ("Field not found!"));
     370    AssertMsg(iIndex != -1, ("Data not found!"));
    372371    m_pFormatComboBox->setCurrentIndex(iIndex);
    373372}
     
    392391{
    393392    const int iIndex = m_pMACComboBox->findData((int)enmMACAddressPolicy);
    394     AssertMsg(iIndex != -1, ("Field not found!"));
     393    AssertMsg(iIndex != -1, ("Data not found!"));
    395394    m_pMACComboBox->setCurrentIndex(iIndex);
    396395}
     
    416415}
    417416
    418 void UIWizardExportAppPage2::setProvider(KCloudProviderId enmProvider)
    419 {
    420     const int iIndex = m_pAccountComboBox->findData((int)enmProvider, ProviderID);
    421     AssertMsg(iIndex != -1, ("Field not found!"));
     417void UIWizardExportAppPage2::setProviderById(const QString &strId)
     418{
     419    const int iIndex = m_pAccountComboBox->findData(strId, ProviderID);
     420    AssertMsg(iIndex != -1, ("Data not found!"));
    422421    m_pAccountComboBox->setCurrentIndex(iIndex);
    423422}
    424423
    425 //KCloudProviderId UIWizardExportAppPage2::provider() const
    426 //{
    427 //  const int iIndex = m_pAccountComboBox->currentIndex();
    428 //  return (KCloudProviderId)m_pAccountComboBox->itemData(iIndex, ProviderID).toInt();
    429 //}
    430 
    431 QString UIWizardExportAppPage2::provider() const
    432 {
    433     return "OCI";
    434 //const int iIndex = m_pAccountComboBox->currentIndex();
    435 //return (KCloudProviderId)m_pAccountComboBox->itemData(iIndex, ProviderID).toInt();
    436 }
    437 
    438 QString UIWizardExportAppPage2::profile() const
     424QString UIWizardExportAppPage2::providerId() const
     425{
     426    const int iIndex = m_pAccountComboBox->currentIndex();
     427    return m_pAccountComboBox->itemData(iIndex, ProviderID).toString();
     428}
     429
     430QString UIWizardExportAppPage2::profileName() const
    439431{
    440432    const int iIndex = m_pAccountComboBox->currentIndex();
     
    442434}
    443435
    444 CCloudProvider UIWizardExportAppPage2::profiles() const
     436CCloudProvider UIWizardExportAppPage2::provider() const
    445437{
    446438    return m_comCloudProvider;
     
    702694    registerField("manifestSelected", this, "manifestSelected");
    703695    registerField("includeISOsSelected", this, "includeISOsSelected");
    704     registerField("profiles", this, "profiles");
    705     registerField("profile", this, "profile");
     696    registerField("profileName", this, "profileName");
     697    registerField("provider", this, "provider");
    706698}
    707699
     
    794786    for (int i = 0; i < m_pAccountComboBox->count(); ++i)
    795787    {
    796         if (m_pAccountComboBox->itemData(i, ProviderID).toInt() == KCloudProviderId_OCI)
     788        if (m_pAccountComboBox->itemData(i, ProviderID).toString() == "OCI")
    797789        {
    798790            m_pAccountComboBox->setItemText(i, UIWizardExportApp::tr("Oracle Cloud Infrastructure: %1", "provider: profile")
     
    802794        {
    803795            m_pAccountComboBox->setItemText(i, UIWizardExportApp::tr("%1: %2", "provider: profile")
    804                 .arg(gpConverter->toInternalInteger((KCloudProviderId)m_pAccountComboBox->itemData(i, ProviderID).toInt()))
     796                .arg(m_pAccountComboBox->itemData(i, ProviderID).toString())
    805797                .arg(m_pAccountComboBox->itemData(i, ProfileName).toString()));
    806798        }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.h

    r73571 r73580  
    125125    void setIncludeISOsSelected(bool fChecked);
    126126
    127     /** Defines @a strProvider. */
    128     void setProvider(KCloudProviderId enmProvider);
    129     /** Returns provider. */
    130 //  KCloudProviderId provider() const;
    131     QString provider() const;
    132     /** Returns profile. */
    133     QString profile() const;
    134     /** Returns Cloud User-profile object. */
    135     CCloudProvider profiles() const;
    136 
    137     /** Holds the Cloud User-profile Manager reference. */
     127    /** Defines provider by @a strId. */
     128    void setProviderById(const QString &strId);
     129    /** Returns provider ID. */
     130    QString providerId() const;
     131    /** Returns profile name. */
     132    QString profileName() const;
     133    /** Returns Cloud Provider object. */
     134    CCloudProvider provider() const;
     135
     136    /** Holds the Cloud Provider Manager reference. */
    138137    CCloudProviderManager  m_comCloudProviderManager;
    139     /** Holds the Cloud User-profile object reference. */
    140     CCloudProvider     m_comCloudProvider;
     138    /** Holds the Cloud Provider object reference. */
     139    CCloudProvider         m_comCloudProvider;
    141140
    142141    /** Holds the default appliance name. */
     
    198197    Q_PROPERTY(bool manifestSelected READ isManifestSelected WRITE setManifestSelected);
    199198    Q_PROPERTY(bool includeISOsSelected READ isIncludeISOsSelected WRITE setIncludeISOsSelected);
    200     Q_PROPERTY(CCloudProvider profiles READ profiles);
    201     Q_PROPERTY(QString profile READ profile);
     199    Q_PROPERTY(CCloudProvider provider READ provider);
     200    Q_PROPERTY(QString profileName READ profileName);
    202201
    203202public:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp

    r73571 r73580  
    5757    m_listCloudClientParameters.clear();
    5858
    59     /* Acquire Cloud User-profiles: */
    60     CCloudProvider comCloudProvider = fieldImp("profiles").value<CCloudProvider>();
     59    /* Acquire Cloud Provider: */
     60    CCloudProvider comCloudProvider = fieldImp("provider").value<CCloudProvider>();
    6161    AssertMsgReturnVoid(comCloudProvider.isNotNull(),
    6262                        ("Cloud provider object is undefined!"));
    6363
    6464    /* Create Cloud Client: */
    65     CCloudClient comCloudClient = comCloudProvider.CreateCloudClient(fieldImp("profile").toString());
     65    CCloudClient comCloudClient = comCloudProvider.CreateCloudClient(fieldImp("profileName").toString());
    6666    AssertMsgReturnVoid(comCloudProvider.isOk() && comCloudClient.isNotNull(),
    6767                        ("Can't create Cloud Client object!"));
     
    7272    /* Create JSON document on the basis of it, make sure it isn't empty: */
    7373    const QJsonDocument document = QJsonDocument::fromJson(strJSON.toUtf8());
    74     AssertMsgReturnVoid(!document.isEmpty(), ("Document is empty!"));
     74    AssertMsgReturnVoid(!document.isEmpty(), ("JSON document is empty!"));
    7575
    7676    /* Parse JSON document: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp

    r73349 r73580  
    349349    registerField("manifestSelected", this, "manifestSelected");
    350350    registerField("includeISOsSelected", this, "includeISOsSelected");
    351     registerField("profiles", this, "profiles");
    352     registerField("profile", this, "profile");
     351    registerField("profileName", this, "profileName");
     352    registerField("provider", this, "provider");
    353353    registerField("applianceWidget", this, "applianceWidget");
    354354}
     
    432432    for (int i = 0; i < m_pAccountComboBox->count(); ++i)
    433433    {
    434         if (m_pAccountComboBox->itemData(i, Qt::UserRole + 1).toInt() == KCloudProviderId_OCI)
     434        if (m_pAccountComboBox->itemData(i, ProviderID).toString() == "OCI")
    435435        {
    436436            m_pAccountComboBox->setItemText(i, UIWizardExportApp::tr("Oracle Cloud Infrastructure: %1", "provider: profile")
    437                 .arg(m_pAccountComboBox->itemData(i, Qt::UserRole + 2).toString()));
     437                .arg(m_pAccountComboBox->itemData(i, ProfileName).toString()));
    438438        }
    439439        else
    440440        {
    441441            m_pAccountComboBox->setItemText(i, UIWizardExportApp::tr("%1: %2", "provider: profile")
    442                 .arg(gpConverter->toInternalInteger((KCloudProviderId)m_pAccountComboBox->itemData(i, Qt::UserRole + 1).toInt()))
    443                 .arg(m_pAccountComboBox->itemData(i, Qt::UserRole + 2).toString()));
     442                .arg(m_pAccountComboBox->itemData(i, ProviderID).toString())
     443                .arg(m_pAccountComboBox->itemData(i, ProfileName).toString()));
    444444        }
    445445    }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.h

    r73571 r73580  
    4141    Q_PROPERTY(bool manifestSelected READ isManifestSelected WRITE setManifestSelected);
    4242    Q_PROPERTY(bool includeISOsSelected READ isIncludeISOsSelected WRITE setIncludeISOsSelected);
    43     Q_PROPERTY(CCloudProvider profiles READ profiles);
    44     Q_PROPERTY(QString profile READ profile);
     43    Q_PROPERTY(CCloudProvider provider READ provider);
     44    Q_PROPERTY(QString profileName READ profileName);
    4545    Q_PROPERTY(ExportAppliancePointer applianceWidget READ applianceWidget);
    4646
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