VirtualBox

Changeset 68068 in vbox


Ignore:
Timestamp:
Jul 20, 2017 2:46:24 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8916: Ability to export VMs into Oracle Public Cloud (OPC) format.

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

Legend:

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

    r62493 r68068  
    3333QStringList UIDefs::VBoxExtPackFileExts = QStringList() << "vbox-extpack";
    3434QStringList UIDefs::OVFFileExts = QStringList() << "ovf" << "ova";
     35QStringList UIDefs::OPCFileExts = QStringList() << "tar.gz";
    3536
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h

    r64604 r68068  
    8787    extern QStringList VBoxExtPackFileExts;
    8888    extern QStringList OVFFileExts;
     89    extern QStringList OPCFileExts;
    8990}
    9091using namespace UIDefs /* if header included */;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp

    r62493 r68068  
    55
    66/*
    7  * Copyright (C) 2009-2016 Oracle Corporation
     7 * Copyright (C) 2009-2017 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    100100    }
    101101
    102     /* Use the default filename: */
    103     QString strName = m_strDefaultApplianceName;
    104     /* If it is one VM only, we use the VM name as filename: */
     102    /* Compose file-name: */
     103    QString strName;
     104
     105    /* If it's one VM only, we use the VM name as file-name: */
    105106    if (fieldImp("machineNames").toStringList().size() == 1)
    106107        strName = fieldImp("machineNames").toStringList()[0];
    107     strName += ".ova";
     108    /* Otherwise => we use the default file-name: */
     109    else
     110        strName = m_strDefaultApplianceName;
     111
     112    /* If the format is set to OPC: */
     113    if (fieldImp("format").toString() == "opc-1.0")
     114    {
     115        /* We use .tar.gz extension: */
     116        strName += ".tar.gz";
     117
     118        /* Update file chooser accordingly: */
     119        m_pFileSelector->setFileFilters(UIWizardExportApp::tr("Oracle Public Cloud Format Archive (%1)").arg("*.tar.gz"));
     120
     121        /* Disable manifest file creation: */
     122        m_pManifestCheckbox->setChecked(false);
     123        m_pManifestCheckbox->setEnabled(false);
     124    }
     125    /* Otherwise: */
     126    else
     127    {
     128        /* We use the default (.ova) extension: */
     129        strName += ".ova";
     130
     131        /* Update file chooser accordingly: */
     132        m_pFileSelector->setFileFilters(UIWizardExportApp::tr("Open Virtualization Format Archive (%1)").arg("*.ova") + ";;" +
     133                                        UIWizardExportApp::tr("Open Virtualization Format (%1)").arg("*.ovf"));
     134
     135        /* Enable manifest file creation: */
     136        m_pManifestCheckbox->setEnabled(true);
     137    }
     138
     139    /* Copose file-path for 'Filesystem' storage case: */
    108140    if (storageType == Filesystem)
    109141        strName = QDir::toNativeSeparators(QString("%1/%2").arg(vboxGlobal().documentsPath()).arg(strName));
     142
     143    /* Assign file-path: */
    110144    m_pFileSelector->setPath(strName);
    111145}
     
    240274            m_pFormatComboBox = new QComboBox(this);
    241275            {
    242                 const QString strFormat09("ovf-0.9");
    243                 const QString strFormat10("ovf-1.0");
    244                 const QString strFormat20("ovf-2.0");
    245                 m_pFormatComboBox->addItem(strFormat09, strFormat09);
    246                 m_pFormatComboBox->addItem(strFormat10, strFormat10);
    247                 m_pFormatComboBox->addItem(strFormat20, strFormat20);
    248                 connect(m_pFormatComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(sltUpdateFormatComboToolTip()));
     276                const QString strFormatOVF09("ovf-0.9");
     277                const QString strFormatOVF10("ovf-1.0");
     278                const QString strFormatOVF20("ovf-2.0");
     279                const QString strFormatOPC10("opc-1.0");
     280                m_pFormatComboBox->addItem(strFormatOVF09, strFormatOVF09);
     281                m_pFormatComboBox->addItem(strFormatOVF10, strFormatOVF10);
     282                m_pFormatComboBox->addItem(strFormatOVF20, strFormatOVF20);
     283                m_pFormatComboBox->addItem(strFormatOPC10, strFormatOPC10);
     284                connect(m_pFormatComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
     285                        this, &UIWizardExportAppPageBasic3::sltHandleFormatComboChange);
    249286            }
    250287            m_pFormatComboBoxLabel = new QLabel(this);
     
    291328}
    292329
     330void UIWizardExportAppPageBasic3::sltHandleFormatComboChange()
     331{
     332    refreshCurrentSettings();
     333    updateFormatComboToolTip();
     334}
     335
    293336void UIWizardExportAppPageBasic3::retranslateUi()
    294337{
     
    306349    m_pFileSelector->setChooseButtonToolTip(tr("Choose a file to export the virtual appliance to..."));
    307350    m_pFileSelector->setFileDialogTitle(UIWizardExportApp::tr("Please choose a file to export the virtual appliance to"));
    308     m_pFileSelector->setFileFilters(UIWizardExportApp::tr("Open Virtualization Format Archive (%1)").arg("*.ova") + ";;" +
    309                                     UIWizardExportApp::tr("Open Virtualization Format (%1)").arg("*.ovf"));
    310351    m_pFormatComboBoxLabel->setText(UIWizardExportApp::tr("F&ormat:"));
    311     m_pFormatComboBox->setItemText(0, UIWizardExportApp::tr("OVF 0.9"));
    312     m_pFormatComboBox->setItemText(1, UIWizardExportApp::tr("OVF 1.0"));
    313     m_pFormatComboBox->setItemText(2, UIWizardExportApp::tr("OVF 2.0"));
     352    m_pFormatComboBox->setItemText(0, UIWizardExportApp::tr("Open Virtualization Format 0.9"));
     353    m_pFormatComboBox->setItemText(1, UIWizardExportApp::tr("Open Virtualization Format 1.0"));
     354    m_pFormatComboBox->setItemText(2, UIWizardExportApp::tr("Open Virtualization Format 2.0"));
     355    m_pFormatComboBox->setItemText(3, UIWizardExportApp::tr("Oracle Public Cloud Format 1.0"));
    314356    m_pFormatComboBox->setItemData(0, UIWizardExportApp::tr("Write in legacy OVF 0.9 format for compatibility "
    315357                                                            "with other virtualization products."), Qt::ToolTipRole);
    316358    m_pFormatComboBox->setItemData(1, UIWizardExportApp::tr("Write in standard OVF 1.0 format."), Qt::ToolTipRole);
    317359    m_pFormatComboBox->setItemData(2, UIWizardExportApp::tr("Write in new experimental OVF 2.0 format."), Qt::ToolTipRole);
     360    m_pFormatComboBox->setItemData(3, UIWizardExportApp::tr("Write in Oracle Public Cloud 1.0 format."), Qt::ToolTipRole);
    318361    m_pManifestCheckbox->setToolTip(UIWizardExportApp::tr("Create a Manifest file for automatic data integrity checks on import."));
    319362    m_pManifestCheckbox->setText(UIWizardExportApp::tr("Write &Manifest file"));
     
    339382    {
    340383        const QString &strFile = m_pFileSelector->path().toLower();
    341         fResult = VBoxGlobal::hasAllowedExtension(strFile, OVFFileExts);
     384        bool fOVF =    field("format").toString() == "ovf-0.9"
     385                    || field("format").toString() == "ovf-1.0"
     386                    || field("format").toString() == "ovf-2.0";
     387        bool fOPC =    field("format").toString() == "opc-1.0";
     388        fResult =    (   fOVF
     389                      && VBoxGlobal::hasAllowedExtension(strFile, OVFFileExts))
     390                  || (   fOPC
     391                      && VBoxGlobal::hasAllowedExtension(strFile, OPCFileExts));
    342392        if (fResult)
    343393        {
     
    377427        case Filesystem:
    378428        {
    379             m_pLabel->setText(tr("<p>Please choose a filename to export the OVF/OVA to.</p>"
    380                                  "<p>If you use an <i>ova</i> extension, "
    381                                  "then all the files will be combined into one Open Virtualization Format Archive.</p>"
    382                                  "<p>If you use an <i>ovf</i> extension, "
    383                                  "several files will be written separately.</p>"
    384                                  "<p>Other extensions are not allowed.</p>"));
     429            m_pLabel->setText(tr("<p>Please choose a filename to export the virtual appliance to.</p>"
     430                                 "<p><b>Open Virtualization Format</b> supports only "
     431                                 "<b>ovf</b> or <b>ova</b> extensions. "
     432                                 "<br>If you use an <b>ovf</b> extension, "
     433                                 "several files will be written separately."
     434                                 "<br>If you use an <b>ova</b> extension, "
     435                                 "all the files will be combined into one Open Virtualization Format archive.</p>"
     436                                 "<p><b>Oracle Public Cloud Format</b> supports only <b>tar.gz</b> extension."
     437                                 "<br>Each virtual disk file will be written separately.</p>"));
    385438            m_pFileSelector->setFocus();
    386439            break;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h

    r62493 r68068  
    112112
    113113    /* Format combo change handler: */
    114     void sltUpdateFormatComboToolTip() { updateFormatComboToolTip(); }
     114    void sltHandleFormatComboChange();
    115115
    116116private:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp

    r62493 r68068  
    55
    66/*
    7  * Copyright (C) 2009-2016 Oracle Corporation
     7 * Copyright (C) 2009-2017 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    131131                m_pFormatComboBox = new QComboBox(m_pSettingsCnt);
    132132                {
    133                     const QString strFormat09("ovf-0.9");
    134                     const QString strFormat10("ovf-1.0");
    135                     const QString strFormat20("ovf-2.0");
    136                     m_pFormatComboBox->addItem(strFormat09, strFormat09);
    137                     m_pFormatComboBox->addItem(strFormat10, strFormat10);
    138                     m_pFormatComboBox->addItem(strFormat20, strFormat20);
    139                     connect(m_pFormatComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(sltUpdateFormatComboToolTip()));
     133                    const QString strFormatOVF09("ovf-0.9");
     134                    const QString strFormatOVF10("ovf-1.0");
     135                    const QString strFormatOVF20("ovf-2.0");
     136                    const QString strFormatOPC10("opc-1.0");
     137                    m_pFormatComboBox->addItem(strFormatOVF09, strFormatOVF09);
     138                    m_pFormatComboBox->addItem(strFormatOVF10, strFormatOVF10);
     139                    m_pFormatComboBox->addItem(strFormatOVF20, strFormatOVF20);
     140                    m_pFormatComboBox->addItem(strFormatOPC10, strFormatOPC10);
     141                    connect(m_pFormatComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
     142                            this, &UIWizardExportAppPageExpert::sltHandleFormatComboChange);
    140143                }
    141144                m_pFormatComboBoxLabel = new QLabel(m_pSettingsCnt);
     
    214217    /* Broadcast complete-change: */
    215218    emit completeChanged();
     219}
     220
     221void UIWizardExportAppPageExpert::sltHandleFormatComboChange()
     222{
     223    refreshCurrentSettings();
     224    updateFormatComboToolTip();
    216225}
    217226
     
    235244    m_pFileSelector->setChooseButtonToolTip(tr("Choose a file to export the virtual appliance to..."));
    236245    m_pFileSelector->setFileDialogTitle(UIWizardExportApp::tr("Please choose a file to export the virtual appliance to"));
    237     m_pFileSelector->setFileFilters(UIWizardExportApp::tr("Open Virtualization Format Archive (%1)").arg("*.ova") + ";;" +
    238                                     UIWizardExportApp::tr("Open Virtualization Format (%1)").arg("*.ovf"));
    239246    m_pFormatComboBoxLabel->setText(UIWizardExportApp::tr("F&ormat:"));
    240     m_pFormatComboBox->setItemText(0, UIWizardExportApp::tr("OVF 0.9"));
    241     m_pFormatComboBox->setItemText(1, UIWizardExportApp::tr("OVF 1.0"));
    242     m_pFormatComboBox->setItemText(2, UIWizardExportApp::tr("OVF 2.0"));
     247    m_pFormatComboBox->setItemText(0, UIWizardExportApp::tr("Open Virtualization Format 0.9"));
     248    m_pFormatComboBox->setItemText(1, UIWizardExportApp::tr("Open Virtualization Format 1.0"));
     249    m_pFormatComboBox->setItemText(2, UIWizardExportApp::tr("Open Virtualization Format 2.0"));
     250    m_pFormatComboBox->setItemText(3, UIWizardExportApp::tr("Oracle Public Cloud Format 1.0"));
    243251    m_pFormatComboBox->setItemData(0, UIWizardExportApp::tr("Write in legacy OVF 0.9 format for compatibility "
    244252                                                            "with other virtualization products."), Qt::ToolTipRole);
    245253    m_pFormatComboBox->setItemData(1, UIWizardExportApp::tr("Write in standard OVF 1.0 format."), Qt::ToolTipRole);
    246254    m_pFormatComboBox->setItemData(2, UIWizardExportApp::tr("Write in new experimental OVF 2.0 format."), Qt::ToolTipRole);
     255    m_pFormatComboBox->setItemData(3, UIWizardExportApp::tr("Write in Oracle Public Cloud 1.0 format."), Qt::ToolTipRole);
    247256    m_pManifestCheckbox->setToolTip(UIWizardExportApp::tr("Create a Manifest file for automatic data integrity checks on import."));
    248257    m_pManifestCheckbox->setText(UIWizardExportApp::tr("Write &Manifest file"));
    249258
    250259    /* Refresh current settings: */
     260    refreshCurrentSettings();
    251261    updateFormatComboToolTip();
    252262}
     
    275285    {
    276286        const QString &strFile = m_pFileSelector->path().toLower();
    277         fResult = VBoxGlobal::hasAllowedExtension(strFile, OVFFileExts);
     287        bool fOVF =    field("format").toString() == "ovf-0.9"
     288                    || field("format").toString() == "ovf-1.0"
     289                    || field("format").toString() == "ovf-2.0";
     290        bool fOPC =    field("format").toString() == "opc-1.0";
     291        fResult =    (   fOVF
     292                      && VBoxGlobal::hasAllowedExtension(strFile, OVFFileExts))
     293                  || (   fOPC
     294                      && VBoxGlobal::hasAllowedExtension(strFile, OPCFileExts));
    278295        if (fResult)
    279296        {
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.h

    r62493 r68068  
    7171
    7272    /* Format combo change handler: */
    73     void sltUpdateFormatComboToolTip() { updateFormatComboToolTip(); }
     73    void sltHandleFormatComboChange();
    7474
    7575private:
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