VirtualBox

Changeset 73007 in vbox


Ignore:
Timestamp:
Jul 9, 2018 12:02:55 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123559
Message:

FE/Qt: bugref:9152: Export Appliance wizard: Storage page: Adding cloud storage provider combo.

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

Legend:

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

    r72932 r73007  
    135135                                            "or on one of cloud servers you have registered."));
    136136    m_pTypeLocalFilesystem->setText(UIWizardExportApp::tr("&This computer"));
    137     m_pTypeCloudServiceProvider->setText(UIWizardExportApp::tr("&Cloud Service Provider"));
     137    m_pTypeCloudServiceProvider->setText(UIWizardExportApp::tr("&Cloud service provider"));
    138138}
    139139
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp

    r73006 r73007  
    4848}
    4949
     50void UIWizardExportAppPage3::populateProviders()
     51{
     52    /* Acquire provider list: */
     53    // Here goes the experiamental list with
     54    // arbitrary contents for testing purposes.
     55    QStringList providers;
     56    providers << "OCI";
     57    providers << "Amazon";
     58    providers << "Google";
     59    providers << "Microsoft";
     60    m_pProviderComboBox->addItems(providers);
     61
     62    /* Duplicate non-translated names to data fields: */
     63    for (int i = 0; i < m_pProviderComboBox->count(); ++i)
     64        m_pProviderComboBox->setItemData(i, m_pProviderComboBox->itemText(i));
     65}
     66
    5067void UIWizardExportAppPage3::chooseDefaultSettings()
    5168{
    5269    /* Choose defaults: */
    5370    setFormat("ovf-1.0");
     71    setProvider("OCI");
    5472}
    5573
     
    6886            m_pAdditionalLabel->setVisible(true);
    6987            m_pManifestCheckbox->setVisible(true);
     88            m_pProviderComboBoxLabel->setVisible(false);
     89            m_pProviderComboBox->setVisible(false);
    7090            break;
    7191        }
     
    7898            m_pAdditionalLabel->setVisible(false);
    7999            m_pManifestCheckbox->setVisible(false);
     100            m_pProviderComboBoxLabel->setVisible(true);
     101            m_pProviderComboBox->setVisible(true);
    80102            break;
    81103        }
     
    135157}
    136158
     159void UIWizardExportAppPage3::updateProviderComboToolTip()
     160{
     161    const int iCurrentIndex = m_pProviderComboBox->currentIndex();
     162    const QString strCurrentToolTip = m_pProviderComboBox->itemData(iCurrentIndex, Qt::ToolTipRole).toString();
     163    AssertMsg(!strCurrentToolTip.isEmpty(), ("Data not found!"));
     164    m_pProviderComboBox->setToolTip(strCurrentToolTip);
     165}
     166
    137167QString UIWizardExportAppPage3::path() const
    138168{
     
    166196{
    167197    m_pManifestCheckbox->setChecked(fChecked);
     198}
     199
     200QString UIWizardExportAppPage3::provider() const
     201{
     202    const int iIndex = m_pProviderComboBox->currentIndex();
     203    return m_pProviderComboBox->itemData(iIndex).toString();
     204}
     205
     206void UIWizardExportAppPage3::setProvider(const QString &strProvider)
     207{
     208    const int iIndex = m_pProviderComboBox->findData(strProvider);
     209    AssertMsg(iIndex != -1, ("Field not found!"));
     210    m_pProviderComboBox->setCurrentIndex(iIndex);
    168211}
    169212
     
    261304            }
    262305
     306            /* Create provider combo-box: */
     307            m_pProviderComboBox = new QComboBox;
     308            if (m_pProviderComboBox)
     309            {
     310                /* Add into layout: */
     311                pSettingsLayout->addWidget(m_pProviderComboBox, 7, 1);
     312            }
     313            /* Create provider label: */
     314            m_pProviderComboBoxLabel = new QLabel;
     315            if (m_pProviderComboBoxLabel)
     316            {
     317                m_pProviderComboBoxLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
     318                m_pProviderComboBoxLabel->setBuddy(m_pProviderComboBox);
     319
     320                /* Add into layout: */
     321                pSettingsLayout->addWidget(m_pProviderComboBoxLabel, 7, 0);
     322            }
     323
    263324            /* Add into layout: */
    264325            pMainLayout->addLayout(pSettingsLayout);
     
    269330    }
    270331
     332    /* Populate providers: */
     333    populateProviders();
    271334    /* Choose default settings: */
    272335    chooseDefaultSettings();
     
    276339    connect(m_pFormatComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
    277340            this, &UIWizardExportAppPageBasic3::sltHandleFormatComboChange);
     341    connect(m_pProviderComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
     342            this, &UIWizardExportAppPageBasic3::sltHandleProviderComboChange);
    278343
    279344    /* Register fields: */
     
    313378    m_pManifestCheckbox->setText(UIWizardExportApp::tr("Write &Manifest file"));
    314379
     380    /* Translate Provider combo-box: */
     381    m_pProviderComboBoxLabel->setText(UIWizardExportApp::tr("&Cloud Service Provider:"));
     382    for (int i = 0; i < m_pProviderComboBox->count(); ++i)
     383    {
     384        if (m_pProviderComboBox->itemText(i) == "OCI")
     385        {
     386            m_pProviderComboBox->setItemText(i, UIWizardExportApp::tr("Oracle Cloud Infrastructure"));
     387            m_pProviderComboBox->setItemData(i, UIWizardExportApp::tr("Write to Oracle Cloud Infrastructure"), Qt::ToolTipRole);
     388        }
     389    }
     390
    315391    /* Refresh current settings: */
    316392    refreshCurrentSettings();
    317393    updateFormatComboToolTip();
     394    updateProviderComboToolTip();
    318395}
    319396
     
    385462            m_pLabel->setText(tr("Please complete the additional fields and provide a filename for "
    386463                                 "the OVF target."));
    387             m_pLabel->setFocus(); /// @todo fix it!
     464            m_pProviderComboBox->setFocus();
    388465            break;
    389466        }
     
    396473    updateFormatComboToolTip();
    397474}
     475
     476void UIWizardExportAppPageBasic3::sltHandleProviderComboChange()
     477{
     478    refreshCurrentSettings();
     479    updateProviderComboToolTip();
     480}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h

    r73006 r73007  
    4242    UIWizardExportAppPage3();
    4343
     44    /** Populates providers. */
     45    void populateProviders();
     46
    4447    /** Chooses default settings. */
    4548    void chooseDefaultSettings();
     
    5053    /** Updates format combo tool-tips. */
    5154    virtual void updateFormatComboToolTip();
     55    /** Updates provider combo tool-tips. */
     56    virtual void updateProviderComboToolTip();
    5257
    5358    /** Returns path. */
     
    6570    /** Defines whether manifest @a fSelected. */
    6671    void setManifestSelected(bool fChecked);
     72
     73    /** Returns provider. */
     74    QString provider() const;
     75    /** Defines @a strProvider. */
     76    void setProvider(const QString &strProvider);
    6777
    6878    /** Holds the default appliance name. */
     
    8393    /** Holds the manifest check-box instance. */
    8494    QCheckBox *m_pManifestCheckbox;
     95
     96    /** Holds the provider combo-box label instance. */
     97    QLabel    *m_pProviderComboBoxLabel;
     98    /** Holds the provider combo-box instance. */
     99    QComboBox *m_pProviderComboBox;
    85100};
    86101
     
    93108    Q_PROPERTY(QString format READ format WRITE setFormat);
    94109    Q_PROPERTY(bool manifestSelected READ isManifestSelected WRITE setManifestSelected);
     110    Q_PROPERTY(QString provider READ provider WRITE setProvider);
    95111
    96112public:
     
    121137    void sltHandleFormatComboChange();
    122138
     139    /** Handles change in provider combo-box. */
     140    void sltHandleProviderComboChange();
     141
    123142private:
    124143
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp

    r72936 r73007  
    271271    refreshCurrentSettings();
    272272    updateFormatComboToolTip();
     273    updateProviderComboToolTip();
    273274}
    274275
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