VirtualBox

Changeset 91145 in vbox


Ignore:
Timestamp:
Sep 7, 2021 7:10:39 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
146799
Message:

FE/Qt: bugref:10067: Reuse UICloudNetworkingStuff in Export / Import Appliance wizards, few more places.

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

Legend:

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

    r89998 r91145  
    7676        CCloudProvider comProvider = comProviderManager.GetProviderById(uProviderId);
    7777        if (!comProviderManager.isOk())
    78             msgCenter().cannotAcquireCloudProviderManagerParameter(comProviderManager, pParent);
     78            msgCenter().cannotFindCloudProvider(comProviderManager, uProviderId, pParent);
    7979        else
    8080            return comProvider;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp

    r91144 r91145  
    176176    {
    177177        /* (Re)initialize Cloud Provider: */
    178         m_comCloudProvider = m_comCloudProviderManager.GetProviderById(providerId());
    179         /* Show error message if necessary: */
    180         if (!m_comCloudProviderManager.isOk())
    181             msgCenter().cannotFindCloudProvider(m_comCloudProviderManager, providerId());
    182         else
     178        m_comCloudProvider = cloudProviderById(providerId(), wizardImp());
     179        if (m_comCloudProvider.isNotNull())
    183180        {
    184             /* Acquire existing profile names: */
    185             const QVector<QString> profileNames = m_comCloudProvider.GetProfileNames();
    186             /* Show error message if necessary: */
    187             if (!m_comCloudProvider.isOk())
    188                 msgCenter().cannotAcquireCloudProviderParameter(m_comCloudProvider);
    189             else
    190             {
    191                 /* Iterate through existing profile names: */
    192                 foreach (const QString &strProfileName, profileNames)
     181            /* Iterate through existing profile names: */
     182            foreach (const CCloudProfile &comProfile, listCloudProfiles(m_comCloudProvider, wizardImp()))
     183            {
     184                /* Acquire profile name: */
     185                QString strProfileName;
     186                if (cloudProfileName(comProfile, strProfileName, wizardImp()))
    193187                {
    194                     /* Skip if we have nothing to show (wtf happened?): */
    195                     if (strProfileName.isEmpty())
    196                         continue;
    197 
    198188                    /* Compose item, fill it's data: */
    199189                    m_pProfileComboBox->addItem(strProfileName);
     
    225215
    226216    /* If both provider and profile chosen: */
    227     if (!m_comCloudProvider.isNull() && !profileName().isNull())
     217    if (!providerShortName().isNull() && !profileName().isNull())
    228218    {
    229219        /* Acquire Cloud Profile: */
    230         m_comCloudProfile = m_comCloudProvider.GetProfileByName(profileName());
    231         /* Show error message if necessary: */
    232         if (!m_comCloudProvider.isOk())
    233             msgCenter().cannotFindCloudProfile(m_comCloudProvider, profileName());
     220        m_comCloudProfile = cloudProfileByName(providerShortName(), profileName(), wizardImp());
    234221    }
    235222}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp

    r91144 r91145  
    130130    if (!sourceId().isNull())
    131131    {
    132         /* Main API request sequence, can be interrupted after any step: */
    133         do
    134         {
    135             /* (Re)initialize Cloud Provider: */
    136             m_comCloudProvider = m_comCloudProviderManager.GetProviderById(sourceId());
    137             if (!m_comCloudProviderManager.isOk())
    138             {
    139                 msgCenter().cannotFindCloudProvider(m_comCloudProviderManager, sourceId());
    140                 break;
    141             }
    142 
    143             /* Acquire existing profile names: */
    144             const QVector<QString> profileNames = m_comCloudProvider.GetProfileNames();
    145             if (!m_comCloudProvider.isOk())
    146             {
    147                 msgCenter().cannotAcquireCloudProviderParameter(m_comCloudProvider);
    148                 break;
    149             }
    150 
     132        /* (Re)initialize Cloud Provider: */
     133        m_comCloudProvider = cloudProviderById(sourceId(), wizardImp());
     134        if (m_comCloudProvider.isNotNull())
     135        {
    151136            /* Iterate through existing profile names: */
    152             foreach (const QString &strProfileName, profileNames)
    153             {
    154                 /* Skip if we have nothing to show (wtf happened?): */
    155                 if (strProfileName.isEmpty())
    156                     continue;
    157 
    158                 /* Compose item, fill it's data: */
    159                 m_pProfileComboBox->addItem(strProfileName);
    160                 m_pProfileComboBox->setItemData(m_pProfileComboBox->count() - 1, strProfileName, ProfileData_Name);
    161             }
    162 
    163             /* Set previous/default item if possible: */
    164             int iNewIndex = -1;
    165             if (   iNewIndex == -1
    166                 && !strOldData.isNull())
    167                 iNewIndex = m_pProfileComboBox->findData(strOldData, ProfileData_Name);
    168             if (   iNewIndex == -1
    169                 && m_pProfileComboBox->count() > 0)
    170                 iNewIndex = 0;
    171             if (iNewIndex != -1)
    172                 m_pProfileComboBox->setCurrentIndex(iNewIndex);
    173         }
    174         while (0);
     137            foreach (const CCloudProfile &comProfile, listCloudProfiles(m_comCloudProvider, wizardImp()))
     138            {
     139                /* Acquire profile name: */
     140                QString strProfileName;
     141                if (cloudProfileName(comProfile, strProfileName, wizardImp()))
     142                {
     143                    /* Compose item, fill it's data: */
     144                    m_pProfileComboBox->addItem(strProfileName);
     145                    m_pProfileComboBox->setItemData(m_pProfileComboBox->count() - 1, strProfileName, ProfileData_Name);
     146                }
     147            }
     148        }
     149
     150        /* Set previous/default item if possible: */
     151        int iNewIndex = -1;
     152        if (   iNewIndex == -1
     153            && !strOldData.isNull())
     154            iNewIndex = m_pProfileComboBox->findData(strOldData, ProfileData_Name);
     155        if (   iNewIndex == -1
     156            && m_pProfileComboBox->count() > 0)
     157            iNewIndex = 0;
     158        if (iNewIndex != -1)
     159            m_pProfileComboBox->setCurrentIndex(iNewIndex);
    175160    }
    176161
     
    185170
    186171    /* If both provider and profile chosen: */
    187     if (m_comCloudProvider.isNotNull() && !profileName().isNull())
     172    if (!source().isNull() && !profileName().isNull())
    188173    {
    189174        /* Acquire Cloud Profile: */
    190         m_comCloudProfile = m_comCloudProvider.GetProfileByName(profileName());
    191         /* Show error message if necessary: */
    192         if (!m_comCloudProvider.isOk())
    193             msgCenter().cannotFindCloudProfile(m_comCloudProvider, profileName());
     175        m_comCloudProfile = cloudProfileByName(source(), profileName(), wizardImp());
    194176    }
    195177}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.h

    r86346 r91145  
    170170protected:
    171171
     172    /** Allows access wizard from base part. */
     173    UIWizard *wizardImp() const { return UIWizardPage::wizard(); }
     174
    172175    /** Handles translation event. */
    173176    virtual void retranslateUi() /* override */;
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