VirtualBox

Changeset 45220 in vbox for trunk/src


Ignore:
Timestamp:
Mar 28, 2013 6:36:46 AM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: 6022: Export appliance wizard: OVF 2.0 support.

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

Legend:

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

    r45193 r45220  
    137137{
    138138    /* Write the appliance: */
    139     const QString strVersion = field("OVF09Selected").toBool() ? "ovf-0.9" : "ovf-1.0";
    140     CProgress progress = appliance.Write(strVersion, field("manifestSelected").toBool() /* fManifest */, uri());
     139    CProgress progress = appliance.Write(field("format").toString(), field("manifestSelected").toBool() /* fManifest */, uri());
    141140    bool fResult = appliance.isOk();
    142141    if (fResult)
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp

    r45085 r45220  
    2424#include <QLabel>
    2525#include <QLineEdit>
     26#include <QComboBox>
    2627#include <QCheckBox>
    2728
     
    4647    m_pBucketEditor->setText(vboxGlobal().virtualBox().GetExtraData(GUI_Export_Bucket));
    4748#else
    48     /* Do nothing for now... */
     49    /* Choose defalt format: */
     50    setFormat("ovf-1.0");
    4951#endif
    5052}
     
    6668            m_pBucketLabel->setVisible(false);
    6769            m_pBucketEditor->setVisible(false);
    68             m_pOVF09Checkbox->setVisible(true);
     70            m_pFormatComboBox->setVisible(true);
    6971            m_pFileSelector->setChooserVisible(true);
    7072            break;
     
    8082            m_pBucketLabel->setVisible(true);
    8183            m_pBucketEditor->setVisible(true);
    82             m_pOVF09Checkbox->setVisible(false);
    83             m_pOVF09Checkbox->setChecked(false);
     84            m_pFormatComboBox->setVisible(false);
    8485            m_pFileSelector->setChooserVisible(false);
    8586            break;
     
    9596            m_pBucketLabel->setVisible(true);
    9697            m_pBucketEditor->setVisible(true);
    97             m_pOVF09Checkbox->setVisible(true);
     98            m_pFormatComboBox->setVisible(true);
    9899            m_pFileSelector->setChooserVisible(false);
    99100            break;
     
    112113}
    113114
    114 bool UIWizardExportAppPage3::isOVF09Selected() const
    115 {
    116     return m_pOVF09Checkbox->isChecked();
    117 }
    118 
    119 void UIWizardExportAppPage3::setOVF09Selected(bool fChecked)
    120 {
    121     m_pOVF09Checkbox->setChecked(fChecked);
     115void UIWizardExportAppPage3::updateFormatComboToolTip()
     116{
     117    int iCurrentIndex = m_pFormatComboBox->currentIndex();
     118    QString strCurrentIndexToolTip = m_pFormatComboBox->itemData(iCurrentIndex, Qt::ToolTipRole).toString();
     119    m_pFormatComboBox->setToolTip(strCurrentIndexToolTip);
     120}
     121
     122QString UIWizardExportAppPage3::format() const
     123{
     124    int iIndex = m_pFormatComboBox->currentIndex();
     125    return m_pFormatComboBox->itemData(iIndex).toString();
     126}
     127
     128void UIWizardExportAppPage3::setFormat(const QString &strFormat)
     129{
     130    int iIndex = m_pFormatComboBox->findData(strFormat);
     131    AssertMsg(iIndex != -1, ("Field not found!"));
     132    m_pFormatComboBox->setCurrentIndex(iIndex);
    122133}
    123134
     
    228239                m_pFileSelectorLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    229240                m_pFileSelectorLabel->setBuddy(m_pFileSelector);
     241            }
     242            m_pFormatComboBox = new QComboBox(this);
     243            {
     244                const QString strFormat09("ovf-0.9");
     245                const QString strFormat10("ovf-1.0");
     246                const QString strFormat20("ovf-2.0");
     247                m_pFormatComboBox->addItem(strFormat09, strFormat09);
     248                m_pFormatComboBox->addItem(strFormat10, strFormat10);
     249                m_pFormatComboBox->addItem(strFormat20, strFormat20);
     250                connect(m_pFormatComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(sltUpdateFormatComboToolTip()));
     251            }
     252            m_pFormatComboBoxLabel = new QLabel(this);
     253            {
     254                m_pFormatComboBoxLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
     255                m_pFormatComboBoxLabel->setBuddy(m_pFormatComboBox);
    230256            }
    231257            pSettingsLayout->addWidget(m_pUsernameLabel, 0, 0);
     
    239265            pSettingsLayout->addWidget(m_pFileSelectorLabel, 4, 0);
    240266            pSettingsLayout->addWidget(m_pFileSelector, 4, 1);
    241         }
    242         m_pOVF09Checkbox = new QCheckBox(this);
     267            pSettingsLayout->addWidget(m_pFormatComboBoxLabel, 5, 0);
     268            pSettingsLayout->addWidget(m_pFormatComboBox, 5, 1);
     269        }
    243270        m_pManifestCheckbox = new QCheckBox(this);
    244271        pMainLayout->addWidget(m_pLabel);
    245272        pMainLayout->addLayout(pSettingsLayout);
    246         pMainLayout->addWidget(m_pOVF09Checkbox);
    247273        pMainLayout->addWidget(m_pManifestCheckbox);
    248274        pMainLayout->addStretch();
     
    258284
    259285    /* Register fields: */
    260     registerField("OVF09Selected", this, "OVF09Selected");
     286    registerField("format", this, "format");
    261287    registerField("manifestSelected", this, "manifestSelected");
    262288    registerField("username", this, "username");
     
    284310    m_pFileSelector->setFileFilters(UIWizardExportApp::tr("Open Virtualization Format Archive (%1)").arg("*.ova") + ";;" +
    285311                                    UIWizardExportApp::tr("Open Virtualization Format (%1)").arg("*.ovf"));
    286     m_pOVF09Checkbox->setToolTip(UIWizardExportApp::tr("Write in legacy OVF 0.9 format for compatibility with other virtualization products."));
    287     m_pOVF09Checkbox->setText(UIWizardExportApp::tr("&Write legacy OVF 0.9"));
     312    m_pFormatComboBoxLabel->setText(UIWizardExportApp::tr("F&ormat:"));
     313    m_pFormatComboBox->setItemText(0, UIWizardExportApp::tr("OVF 0.9"));
     314    m_pFormatComboBox->setItemText(1, UIWizardExportApp::tr("OVF 1.0"));
     315    m_pFormatComboBox->setItemText(2, UIWizardExportApp::tr("OVF 2.0"));
     316    m_pFormatComboBox->setItemData(0, UIWizardExportApp::tr("Write in legacy OVF 0.9 format for compatibility "
     317                                                            "with other virtualization products."), Qt::ToolTipRole);
     318    m_pFormatComboBox->setItemData(1, UIWizardExportApp::tr("Write in standard OVF 1.0 format."), Qt::ToolTipRole);
     319    m_pFormatComboBox->setItemData(2, UIWizardExportApp::tr("Write in new experimental OVF 2.0 format."), Qt::ToolTipRole);
    288320    m_pManifestCheckbox->setToolTip(UIWizardExportApp::tr("Create a Manifest file for automatic data integrity checks on import."));
    289321    m_pManifestCheckbox->setText(UIWizardExportApp::tr("Write &Manifest file"));
     
    291323    /* Refresh current settings: */
    292324    refreshCurrentSettings();
     325    updateFormatComboToolTip();
    293326}
    294327
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h

    r41021 r45220  
    3030class QLineEdit;
    3131class VBoxEmptyFileSelector;
     32class QComboBox;
    3233class QCheckBox;
    3334class QIRichTextLabel;
     
    4445    void chooseDefaultSettings();
    4546    virtual void refreshCurrentSettings();
     47    virtual void updateFormatComboToolTip();
    4648
    47     /* Stuff for 'OVF09Selected' field: */
    48     bool isOVF09Selected() const;
    49     void setOVF09Selected(bool fChecked);
     49    /* Stuff for 'format' field: */
     50    QString format() const;
     51    void setFormat(const QString &strFormat);
    5052    /* Stuff for 'manifestSelected' field: */
    5153    bool isManifestSelected() const;
     
    8183    QLabel *m_pFileSelectorLabel;
    8284    VBoxEmptyFileSelector *m_pFileSelector;
    83     QCheckBox *m_pOVF09Checkbox;
     85    QLabel *m_pFormatComboBoxLabel;
     86    QComboBox *m_pFormatComboBox;
    8487    QCheckBox *m_pManifestCheckbox;
    8588};
     
    8992{
    9093    Q_OBJECT;
    91     Q_PROPERTY(bool OVF09Selected READ isOVF09Selected WRITE setOVF09Selected);
     94    Q_PROPERTY(QString format READ format WRITE setFormat);
    9295    Q_PROPERTY(bool manifestSelected READ isManifestSelected WRITE setManifestSelected);
    9396    Q_PROPERTY(QString username READ username WRITE setUserName);
     
    106109    /* Wrapper to access 'wizard-field' from base part: */
    107110    QVariant fieldImp(const QString &strFieldName) const { return UIWizardPage::field(strFieldName); }
     111
     112private slots:
     113
     114    /* Format combo change handler: */
     115    void sltUpdateFormatComboToolTip() { updateFormatComboToolTip(); }
    108116
    109117private:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp

    r45085 r45220  
    124124                    m_pFileSelectorLabel->setBuddy(m_pFileSelector);
    125125                }
    126                 m_pOVF09Checkbox = new QCheckBox(m_pSettingsCnt);
     126                m_pFormatComboBox = new QComboBox(m_pSettingsCnt);
     127                {
     128                    const QString strFormat09("ovf-0.9");
     129                    const QString strFormat10("ovf-1.0");
     130                    const QString strFormat20("ovf-2.0");
     131                    m_pFormatComboBox->addItem(strFormat09, strFormat09);
     132                    m_pFormatComboBox->addItem(strFormat10, strFormat10);
     133                    m_pFormatComboBox->addItem(strFormat20, strFormat20);
     134                    connect(m_pFormatComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(sltUpdateFormatComboToolTip()));
     135                }
     136                m_pFormatComboBoxLabel = new QLabel(m_pSettingsCnt);
     137                {
     138                    m_pFormatComboBoxLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
     139                    m_pFormatComboBoxLabel->setBuddy(m_pFormatComboBox);
     140                }
    127141                m_pManifestCheckbox = new QCheckBox(m_pSettingsCnt);
    128142                pSettingsLayout->addWidget(m_pUsernameLabel, 0, 0);
     
    136150                pSettingsLayout->addWidget(m_pFileSelectorLabel, 4, 0);
    137151                pSettingsLayout->addWidget(m_pFileSelector, 4, 1);
    138                 pSettingsLayout->addWidget(m_pOVF09Checkbox, 5, 0, 1, 2);
     152                pSettingsLayout->addWidget(m_pFormatComboBoxLabel, 5, 0);
     153                pSettingsLayout->addWidget(m_pFormatComboBox, 5, 1);
    139154                pSettingsLayout->addWidget(m_pManifestCheckbox, 6, 0, 1, 2);
    140155            }
     
    167182    registerField("machineIDs", this, "machineIDs");
    168183    registerField("storageType", this, "storageType");
    169     registerField("OVF09Selected", this, "OVF09Selected");
     184    registerField("format", this, "format");
    170185    registerField("manifestSelected", this, "manifestSelected");
    171186    registerField("username", this, "username");
     
    217232    m_pFileSelector->setFileFilters(UIWizardExportApp::tr("Open Virtualization Format Archive (%1)").arg("*.ova") + ";;" +
    218233                                    UIWizardExportApp::tr("Open Virtualization Format (%1)").arg("*.ovf"));
    219     m_pOVF09Checkbox->setToolTip(UIWizardExportApp::tr("Write in legacy OVF 0.9 format for compatibility with other virtualization products."));
    220     m_pOVF09Checkbox->setText(UIWizardExportApp::tr("&Write legacy OVF 0.9"));
     234    m_pFormatComboBoxLabel->setText(UIWizardExportApp::tr("F&ormat:"));
     235    m_pFormatComboBox->setItemText(0, UIWizardExportApp::tr("OVF 0.9"));
     236    m_pFormatComboBox->setItemText(1, UIWizardExportApp::tr("OVF 1.0"));
     237    m_pFormatComboBox->setItemText(2, UIWizardExportApp::tr("OVF 2.0"));
     238    m_pFormatComboBox->setItemData(0, UIWizardExportApp::tr("Write in legacy OVF 0.9 format for compatibility "
     239                                                            "with other virtualization products."), Qt::ToolTipRole);
     240    m_pFormatComboBox->setItemData(1, UIWizardExportApp::tr("Write in standard OVF 1.0 format."), Qt::ToolTipRole);
     241    m_pFormatComboBox->setItemData(2, UIWizardExportApp::tr("Write in new experimental OVF 2.0 format."), Qt::ToolTipRole);
    221242    m_pManifestCheckbox->setToolTip(UIWizardExportApp::tr("Create a Manifest file for automatic data integrity checks on import."));
    222243    m_pManifestCheckbox->setText(UIWizardExportApp::tr("Write &Manifest file"));
     244
     245    /* Refresh current settings: */
     246    updateFormatComboToolTip();
    223247}
    224248
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.h

    r45083 r45220  
    4040    Q_PROPERTY(QStringList machineIDs READ machineIDs);
    4141    Q_PROPERTY(StorageType storageType READ storageType WRITE setStorageType);
    42     Q_PROPERTY(bool OVF09Selected READ isOVF09Selected WRITE setOVF09Selected);
     42    Q_PROPERTY(QString format READ format WRITE setFormat);
    4343    Q_PROPERTY(bool manifestSelected READ isManifestSelected WRITE setManifestSelected);
    4444    Q_PROPERTY(QString username READ username WRITE setUserName);
     
    7171    void sltStorageTypeChangeHandler();
    7272
     73    /* Format combo change handler: */
     74    void sltUpdateFormatComboToolTip() { updateFormatComboToolTip(); }
     75
    7376private:
    7477
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette