VirtualBox

Changeset 72920 in vbox


Ignore:
Timestamp:
Jul 5, 2018 2:51:50 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123469
Message:

FE/Qt: bugref:9152: Cleanup/rework for Export Appliance wizard: Overall coding-style fixes; Better API get/set error checking.

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

Legend:

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

    r72347 r72920  
    7575# include "CExtPackFile.h"
    7676# include "CHostNetworkInterface.h"
     77# include "CVFSExplorer.h"
    7778# ifdef VBOX_WITH_DRAG_AND_DROP
    7879#  include "CGuest.h"
     
    17481749}
    17491750
    1750 void UIMessageCenter::cannotCheckFiles(const CProgress &progress, QWidget *pParent /* = 0*/) const
     1751bool UIMessageCenter::cannotCheckFiles(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const
    17511752{
    17521753    error(pParent, MessageType_Error,
    17531754          tr("Failed to check files."),
    1754           UIErrorString::formatErrorInfo(progress));
    1755 }
    1756 
    1757 void UIMessageCenter::cannotRemoveFiles(const CProgress &progress, QWidget *pParent /* = 0*/) const
     1755          UIErrorString::formatErrorInfo(comAppliance));
     1756    return false;
     1757}
     1758
     1759bool UIMessageCenter::cannotCheckFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent /* = 0 */) const
     1760{
     1761    error(pParent, MessageType_Error,
     1762          tr("Failed to check files."),
     1763          UIErrorString::formatErrorInfo(comVFSExplorer));
     1764    return false;
     1765}
     1766
     1767bool UIMessageCenter::cannotCheckFiles(const CProgress &comProgress, QWidget *pParent /* = 0 */) const
     1768{
     1769    error(pParent, MessageType_Error,
     1770          tr("Failed to check files."),
     1771          UIErrorString::formatErrorInfo(comProgress));
     1772    return false;
     1773}
     1774
     1775bool UIMessageCenter::cannotRemoveFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent /* = 0 */) const
    17581776{
    17591777    error(pParent, MessageType_Error,
    17601778          tr("Failed to remove file."),
    1761           UIErrorString::formatErrorInfo(progress));
     1779          UIErrorString::formatErrorInfo(comVFSExplorer));
     1780    return false;
     1781}
     1782
     1783bool UIMessageCenter::cannotRemoveFiles(const CProgress &comProgress, QWidget *pParent /* = 0 */) const
     1784{
     1785    error(pParent, MessageType_Error,
     1786          tr("Failed to remove file."),
     1787          UIErrorString::formatErrorInfo(comProgress));
     1788    return false;
    17621789}
    17631790
     
    17761803}
    17771804
    1778 void UIMessageCenter::cannotExportAppliance(const CAppliance &appliance, QWidget *pParent /* = 0*/) const
     1805bool UIMessageCenter::cannotExportAppliance(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const
    17791806{
    17801807    error(pParent, MessageType_Error,
    17811808          tr("Failed to prepare the export of the appliance <b>%1</b>.")
    1782              .arg(CAppliance(appliance).GetPath()),
    1783           UIErrorString::formatErrorInfo(appliance));
    1784 }
    1785 
    1786 void UIMessageCenter::cannotExportAppliance(const CMachine &machine, const QString &strPath, QWidget *pParent /* = 0*/) const
     1809             .arg(CAppliance(comAppliance).GetPath()),
     1810          UIErrorString::formatErrorInfo(comAppliance));
     1811    return false;
     1812}
     1813
     1814void UIMessageCenter::cannotExportAppliance(const CMachine &machine, const QString &strPath, QWidget *pParent /* = 0 */) const
    17871815{
    17881816    error(pParent, MessageType_Error,
     
    17921820}
    17931821
    1794 void UIMessageCenter::cannotExportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent /* = 0*/) const
     1822bool UIMessageCenter::cannotExportAppliance(const CProgress &comProgress, const QString &strPath, QWidget *pParent /* = 0 */) const
    17951823{
    17961824    error(pParent, MessageType_Error,
    17971825          tr("Failed to export appliance <b>%1</b>.")
    17981826             .arg(strPath),
    1799           UIErrorString::formatErrorInfo(progress));
    1800 }
    1801 
    1802 void UIMessageCenter::cannotAddDiskEncryptionPassword(const CAppliance &appliance, QWidget *pParent /* = 0 */)
     1827          UIErrorString::formatErrorInfo(comProgress));
     1828    return false;
     1829}
     1830
     1831bool UIMessageCenter::cannotAddDiskEncryptionPassword(const CAppliance &comAppliance, QWidget *pParent /* = 0 */)
    18031832{
    18041833    error(pParent, MessageType_Error,
    18051834          tr("Bad password or authentication failure."),
    1806           UIErrorString::formatErrorInfo(appliance));
     1835          UIErrorString::formatErrorInfo(comAppliance));
     1836    return false;
    18071837}
    18081838
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r72869 r72920  
    376376    void cannotImportAppliance(CAppliance &appliance, QWidget *pParent = 0) const;
    377377    void cannotImportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent = 0) const;
    378     void cannotCheckFiles(const CProgress &progress, QWidget *pParent = 0) const;
    379     void cannotRemoveFiles(const CProgress &progress, QWidget *pParent = 0) const;
     378    bool cannotCheckFiles(const CAppliance &comAppliance, QWidget *pParent = 0) const;
     379    bool cannotCheckFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent = 0) const;
     380    bool cannotCheckFiles(const CProgress &comProgress, QWidget *pParent = 0) const;
     381    bool cannotRemoveFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent = 0) const;
     382    bool cannotRemoveFiles(const CProgress &comProgress, QWidget *pParent = 0) const;
    380383    bool confirmExportMachinesInSaveState(const QStringList &machineNames, QWidget *pParent = 0) const;
    381     void cannotExportAppliance(const CAppliance &appliance, QWidget *pParent = 0) const;
     384    bool cannotExportAppliance(const CAppliance &comAppliance, QWidget *pParent = 0) const;
    382385    void cannotExportAppliance(const CMachine &machine, const QString &strPath, QWidget *pParent = 0) const;
    383     void cannotExportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent = 0) const;
    384     void cannotAddDiskEncryptionPassword(const CAppliance &appliance, QWidget *pParent = 0);
     386    bool cannotExportAppliance(const CProgress &comProgress, const QString &strPath, QWidget *pParent = 0) const;
     387    bool cannotAddDiskEncryptionPassword(const CAppliance &comAppliance, QWidget *pParent = 0);
    385388
    386389    /* API: Runtime UI warnings: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp

    r72916 r72920  
    2121
    2222/* Qt includes: */
     23# include <QFileInfo>
    2324# include <QVariant>
    24 # include <QFileInfo>
    2525
    2626/* GUI includes: */
     27# include "UIAddDiskEncryptionPasswordDialog.h"
     28# include "UIMessageCenter.h"
    2729# include "UIWizardExportApp.h"
    2830# include "UIWizardExportAppDefs.h"
     
    3234# include "UIWizardExportAppPageBasic4.h"
    3335# include "UIWizardExportAppPageExpert.h"
    34 # include "UIAddDiskEncryptionPasswordDialog.h"
    35 # include "UIMessageCenter.h"
    3636
    3737/* COM includes: */
     
    6565    /* Get export appliance widget & fetch all settings from the appliance editor: */
    6666    UIApplianceExportEditorWidget *pExportApplianceWidget = field("applianceWidget").value<ExportAppliancePointer>();
     67    AssertPtrReturn(pExportApplianceWidget, false);
    6768    pExportApplianceWidget->prepareExport();
    6869
    6970    /* Get the appliance: */
    70     CAppliance *pAppliance = pExportApplianceWidget->appliance();
     71    CAppliance *pComAppliance = pExportApplianceWidget->appliance();
     72    AssertPtrReturn(pComAppliance, false);
    7173
    7274    /* Compose a list of all required files: */
     
    8587
    8688        /* Add all hard disk images: */
    87         CVirtualSystemDescriptionVector vsds = pAppliance->GetVirtualSystemDescriptions();
    88         for (int i = 0; i < vsds.size(); ++ i)
     89        CVirtualSystemDescriptionVector vsds = pComAppliance->GetVirtualSystemDescriptions();
     90        for (int i = 0; i < vsds.size(); ++i)
    8991        {
    9092            QVector<KVirtualSystemDescriptionType> types;
     
    9294            vsds[i].GetDescriptionByType(KVirtualSystemDescriptionType_HardDiskImage, types,
    9395                                         refs, origValues, configValues, extraConfigValues);
    94             foreach (const QString &s, origValues)
    95                 files << QString("%2").arg(s);
     96            foreach (const QString &strValue, origValues)
     97                files << QString("%2").arg(strValue);
    9698        }
    9799    }
    98100
    99101    /* Initialize VFS explorer: */
    100     CVFSExplorer explorer = pAppliance->CreateVFSExplorer(uri(false /* fWithFile */));
    101     CProgress progress = explorer.Update();
    102     bool fResult = explorer.isOk();
    103     if (fResult)
    104     {
    105         msgCenter().showModalProgressDialog(progress, QApplication::translate("UIWizardExportApp", "Checking files ..."),
    106                                             ":/progress_refresh_90px.png", this);
    107         if (progress.GetCanceled())
    108             return false;
    109         if (!progress.isOk() || progress.GetResultCode() != 0)
    110         {
    111             msgCenter().cannotCheckFiles(progress, this);
    112             return false;
    113         }
    114     }
     102    CVFSExplorer comExplorer = pComAppliance->CreateVFSExplorer(uri(false /* fWithFile */));
     103    if (comExplorer.isNotNull())
     104    {
     105        CProgress comProgress = comExplorer.Update();
     106        if (comExplorer.isOk() && comProgress.isNotNull())
     107        {
     108            msgCenter().showModalProgressDialog(comProgress, QApplication::translate("UIWizardExportApp", "Checking files ..."),
     109                                                ":/progress_refresh_90px.png", this);
     110            if (comProgress.GetCanceled())
     111                return false;
     112            if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     113                return msgCenter().cannotCheckFiles(comProgress, this);
     114        }
     115        else
     116            return msgCenter().cannotCheckFiles(comExplorer, this);
     117    }
     118    else
     119        return msgCenter().cannotCheckFiles(*pComAppliance, this);
    115120
    116121    /* Confirm overwriting for existing files: */
    117     QVector<QString> exists = explorer.Exists(files);
     122    QVector<QString> exists = comExplorer.Exists(files);
    118123    if (!msgCenter().confirmOverridingFiles(exists, this))
    119124        return false;
     
    122127    if (!exists.isEmpty())
    123128    {
    124         CProgress progress1 = explorer.Remove(exists);
    125         fResult = explorer.isOk();
    126         if (fResult)
    127         {
    128             msgCenter().showModalProgressDialog(progress1, QApplication::translate("UIWizardExportApp", "Removing files ..."),
     129        CProgress comProgress = comExplorer.Remove(exists);
     130        if (comExplorer.isOk() && comProgress.isNotNull())
     131        {
     132            msgCenter().showModalProgressDialog(comProgress, QApplication::translate("UIWizardExportApp", "Removing files ..."),
    129133                                                ":/progress_delete_90px.png", this);
    130             if (progress1.GetCanceled())
     134            if (comProgress.GetCanceled())
    131135                return false;
    132             if (!progress1.isOk() || progress1.GetResultCode() != 0)
    133             {
    134                 msgCenter().cannotRemoveFiles(progress1, this);
    135                 return false;
    136             }
    137         }
     136            if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     137                return msgCenter().cannotRemoveFiles(comProgress, this);
     138        }
     139        else
     140            return msgCenter().cannotCheckFiles(comExplorer, this);
    138141    }
    139142
    140143    /* Export the VMs, on success we are finished: */
    141     return exportVMs(*pAppliance);
    142 }
    143 
    144 bool UIWizardExportApp::exportVMs(CAppliance &appliance)
     144    return exportVMs(*pComAppliance);
     145}
     146
     147QString UIWizardExportApp::uri(bool fWithFile) const
     148{
     149    /* Prepare storage path: */
     150    QString strPath = field("path").toString();
     151    /* Append file name if requested: */
     152    if (!fWithFile)
     153    {
     154        QFileInfo fi(strPath);
     155        strPath = fi.path();
     156    }
     157
     158    /* For known storage types: */
     159    StorageType enmType = field("storageType").value<StorageType>();
     160    switch (enmType)
     161    {
     162        case Filesystem:
     163        {
     164            return strPath;
     165        }
     166        case SunCloud:
     167        {
     168            QString strUri("SunCloud://");
     169            if (!field("username").toString().isEmpty())
     170                strUri = QString("%1%2").arg(strUri).arg(field("username").toString());
     171            if (!field("password").toString().isEmpty())
     172                strUri = QString("%1:%2").arg(strUri).arg(field("password").toString());
     173            if (!field("username").toString().isEmpty() || !field("password").toString().isEmpty())
     174                strUri = QString("%1@").arg(strUri);
     175            strUri = QString("%1%2/%3/%4").arg(strUri).arg("object.storage.network.com").arg(field("bucket").toString()).arg(strPath);
     176            return strUri;
     177        }
     178        case S3:
     179        {
     180            QString strUri("S3://");
     181            if (!field("username").toString().isEmpty())
     182                strUri = QString("%1%2").arg(strUri).arg(field("username").toString());
     183            if (!field("password").toString().isEmpty())
     184                strUri = QString("%1:%2").arg(strUri).arg(field("password").toString());
     185            if (!field("username").toString().isEmpty() || !field("password").toString().isEmpty())
     186                strUri = QString("%1@").arg(strUri);
     187            strUri = QString("%1%2/%3/%4").arg(strUri).arg(field("hostname").toString()).arg(field("bucket").toString()).arg(strPath);
     188            return strUri;
     189        }
     190    }
     191
     192    /* Nothing by default: */
     193    return QString();
     194}
     195
     196void UIWizardExportApp::sltCurrentIdChanged(int iId)
     197{
     198    /* Call to base-class: */
     199    UIWizard::sltCurrentIdChanged(iId);
     200
     201    /* Enable 2nd button (Reset to Defaults) for 4th and Expert pages only! */
     202    setOption(QWizard::HaveCustomButton2,    (mode() == WizardMode_Basic && iId == Page4)
     203                                          || (mode() == WizardMode_Expert && iId == PageExpert));
     204}
     205
     206void UIWizardExportApp::sltCustomButtonClicked(int iId)
     207{
     208    /* Call to base-class: */
     209    UIWizard::sltCustomButtonClicked(iId);
     210
     211    /* Handle 2nd button: */
     212    if (iId == CustomButton2)
     213    {
     214        /* Get appliance widget and make sure it's valid: */
     215        ExportAppliancePointer pApplianceWidget = field("applianceWidget").value<ExportAppliancePointer>();
     216        AssertMsg(!pApplianceWidget.isNull(), ("Appliance Widget is not set!\n"));
     217        /* Reset it to default: */
     218        pApplianceWidget->restoreDefaults();
     219    }
     220}
     221
     222void UIWizardExportApp::retranslateUi()
     223{
     224    /* Call to base-class: */
     225    UIWizard::retranslateUi();
     226
     227    /* Translate wizard: */
     228    setWindowTitle(tr("Export Virtual Appliance"));
     229    setButtonText(QWizard::CustomButton2, tr("Restore Defaults"));
     230    setButtonText(QWizard::FinishButton, tr("Export"));
     231}
     232
     233void UIWizardExportApp::prepare()
     234{
     235    /* Create corresponding pages: */
     236    switch (mode())
     237    {
     238        case WizardMode_Basic:
     239        {
     240            setPage(Page1, new UIWizardExportAppPageBasic1(m_selectedVMNames));
     241            setPage(Page2, new UIWizardExportAppPageBasic2);
     242            setPage(Page3, new UIWizardExportAppPageBasic3);
     243            setPage(Page4, new UIWizardExportAppPageBasic4);
     244            break;
     245        }
     246        case WizardMode_Expert:
     247        {
     248            setPage(PageExpert, new UIWizardExportAppPageExpert(m_selectedVMNames));
     249            break;
     250        }
     251        default:
     252        {
     253            AssertMsgFailed(("Invalid mode: %d", mode()));
     254            break;
     255        }
     256    }
     257
     258    /* Call to base-class: */
     259    UIWizard::prepare();
     260}
     261
     262bool UIWizardExportApp::exportVMs(CAppliance &comAppliance)
    145263{
    146264    /* Get the map of the password IDs: */
    147265    EncryptedMediumMap encryptedMediums;
    148     foreach (const QString &strPasswordId, appliance.GetPasswordIds())
    149         foreach (const QString &strMediumId, appliance.GetMediumIdsForPasswordId(strPasswordId))
     266    foreach (const QString &strPasswordId, comAppliance.GetPasswordIds())
     267        foreach (const QString &strMediumId, comAppliance.GetMediumIdsForPasswordId(strPasswordId))
    150268            encryptedMediums.insert(strPasswordId, strMediumId);
    151269
     
    174292
    175293            /* Provide appliance with passwords if possible: */
    176             appliance.AddPasswords(encryptionPasswords.keys().toVector(),
    177                                    encryptionPasswords.values().toVector());
    178             if (!appliance.isOk())
    179             {
    180                 /* Warn the user about failure: */
    181                 msgCenter().cannotAddDiskEncryptionPassword(appliance);
    182 
    183                 return false;
    184             }
     294            comAppliance.AddPasswords(encryptionPasswords.keys().toVector(),
     295                                      encryptionPasswords.values().toVector());
     296            if (!comAppliance.isOk())
     297                return msgCenter().cannotAddDiskEncryptionPassword(comAppliance);
    185298        }
    186299        else
    187300        {
    188             if (pDlg)
    189             {
    190                 /* Delete the dialog: */
    191                 delete pDlg;
    192             }
    193 
     301            /* Delete the dialog: */
     302            delete pDlg;
    194303            return false;
    195304        }
     
    200309    if (field("manifestSelected").toBool())
    201310        options.append(KExportOptions_CreateManifest);
    202     CProgress progress = appliance.Write(field("format").toString(), options, uri());
    203     bool fResult = appliance.isOk();
    204     if (fResult)
    205     {
    206         msgCenter().showModalProgressDialog(progress, QApplication::translate("UIWizardExportApp", "Exporting Appliance ..."),
     311    CProgress comProgress = comAppliance.Write(field("format").toString(), options, uri());
     312    if (comAppliance.isOk() && comProgress.isNotNull())
     313    {
     314        msgCenter().showModalProgressDialog(comProgress, QApplication::translate("UIWizardExportApp", "Exporting Appliance ..."),
    207315                                            ":/progress_export_90px.png", this);
    208         if (progress.GetCanceled())
     316        if (comProgress.GetCanceled())
    209317            return false;
    210         if (!progress.isOk() || progress.GetResultCode() != 0)
    211         {
    212             msgCenter().cannotExportAppliance(progress, appliance.GetPath(), this);
    213             return false;
    214         }
    215         else
    216             return true;
    217     }
    218     if (!fResult)
    219         msgCenter().cannotExportAppliance(appliance, this);
    220     return false;
    221 }
    222 
    223 QString UIWizardExportApp::uri(bool fWithFile) const
    224 {
    225     StorageType type = field("storageType").value<StorageType>();
    226 
    227     /* Prepare stirage path: */
    228     QString path = field("path").toString();
    229     if (!fWithFile)
    230     {
    231         QFileInfo fi(path);
    232         path = fi.path();
    233     }
    234 
    235     /* For known storage types: */
    236     switch (type)
    237     {
    238         case Filesystem:
    239         {
    240             return path;
    241         }
    242         case SunCloud:
    243         {
    244             QString uri("SunCloud://");
    245             if (!field("username").toString().isEmpty())
    246                 uri = QString("%1%2").arg(uri).arg(field("username").toString());
    247             if (!field("password").toString().isEmpty())
    248                 uri = QString("%1:%2").arg(uri).arg(field("password").toString());
    249             if (!field("username").toString().isEmpty() || !field("password").toString().isEmpty())
    250                 uri = QString("%1@").arg(uri);
    251             uri = QString("%1%2/%3/%4").arg(uri).arg("object.storage.network.com").arg(field("bucket").toString()).arg(path);
    252             return uri;
    253         }
    254         case S3:
    255         {
    256             QString uri("S3://");
    257             if (!field("username").toString().isEmpty())
    258                 uri = QString("%1%2").arg(uri).arg(field("username").toString());
    259             if (!field("password").toString().isEmpty())
    260                 uri = QString("%1:%2").arg(uri).arg(field("password").toString());
    261             if (!field("username").toString().isEmpty() || !field("password").toString().isEmpty())
    262                 uri = QString("%1@").arg(uri);
    263             uri = QString("%1%2/%3/%4").arg(uri).arg(field("hostname").toString()).arg(field("bucket").toString()).arg(path);
    264             return uri;
    265         }
    266     }
    267 
    268     /* Return nothing by default: */
    269     return QString();
    270 }
    271 
    272 void UIWizardExportApp::sltCurrentIdChanged(int iId)
    273 {
    274     /* Call to base-class: */
    275     UIWizard::sltCurrentIdChanged(iId);
    276 
    277     /* Enable 2nd button (Reset to Defaults) for 4th and Expert pages only! */
    278     setOption(QWizard::HaveCustomButton2, (mode() == WizardMode_Basic && iId == Page4) ||
    279                                           (mode() == WizardMode_Expert && iId == PageExpert));
    280 }
    281 
    282 void UIWizardExportApp::sltCustomButtonClicked(int iId)
    283 {
    284     /* Call to base-class: */
    285     UIWizard::sltCustomButtonClicked(iId);
    286 
    287     /* Handle 2nd button: */
    288     if (iId == CustomButton2)
    289     {
    290         /* Get appliance widget and make sure it's valid: */
    291         ExportAppliancePointer pApplianceWidget = field("applianceWidget").value<ExportAppliancePointer>();
    292         AssertMsg(!pApplianceWidget.isNull(), ("Appliance Widget is not set!\n"));
    293         /* Reset it to default: */
    294         pApplianceWidget->restoreDefaults();
    295     }
    296 }
    297 
    298 void UIWizardExportApp::retranslateUi()
    299 {
    300     /* Call to base-class: */
    301     UIWizard::retranslateUi();
    302 
    303     /* Translate wizard: */
    304     setWindowTitle(tr("Export Virtual Appliance"));
    305     setButtonText(QWizard::CustomButton2, tr("Restore Defaults"));
    306     setButtonText(QWizard::FinishButton, tr("Export"));
    307 }
    308 
    309 void UIWizardExportApp::prepare()
    310 {
    311     /* Create corresponding pages: */
    312     switch (mode())
    313     {
    314         case WizardMode_Basic:
    315         {
    316             setPage(Page1, new UIWizardExportAppPageBasic1(m_selectedVMNames));
    317             setPage(Page2, new UIWizardExportAppPageBasic2);
    318             setPage(Page3, new UIWizardExportAppPageBasic3);
    319             setPage(Page4, new UIWizardExportAppPageBasic4);
    320             break;
    321         }
    322         case WizardMode_Expert:
    323         {
    324             setPage(PageExpert, new UIWizardExportAppPageExpert(m_selectedVMNames));
    325             break;
    326         }
    327         default:
    328         {
    329             AssertMsgFailed(("Invalid mode: %d", mode()));
    330             break;
    331         }
    332     }
    333     /* Call to base-class: */
    334     UIWizard::prepare();
    335 }
     318        if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     319            return msgCenter().cannotExportAppliance(comProgress, comAppliance.GetPath(), this);
     320    }
     321    else
     322        return msgCenter().cannotExportAppliance(comAppliance, this);
     323
     324    /* True finally: */
     325    return true;
     326}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.h

    r72916 r72920  
    5151    UIWizardExportApp(QWidget *pParent, const QStringList &selectedVMNames = QStringList());
    5252
    53 protected:
    54 
    5553    /** Exports full appliance. */
    5654    bool exportAppliance();
    57     /** Exports @a appliance VMs. */
    58     bool exportVMs(CAppliance &appliance);
     55
    5956    /** Composes universal resource identifier.
    6057      * @param  fWithFile  Brings whether uri should include file name as well. */
    6158    QString uri(bool fWithFile = true) const;
    6259
    63     /** @todo remove it */
    64     /* Who will be able to export appliance: */
    65     friend class UIWizardExportAppPage4;
    66     friend class UIWizardExportAppPageBasic4;
    67     friend class UIWizardExportAppPageExpert;
    68 
    69 private slots:
     60protected slots:
    7061
    7162    /** Handles page change to @a iId. */
    72     void sltCurrentIdChanged(int iId);
     63    virtual void sltCurrentIdChanged(int iId) /* override */;
     64
    7365    /** Handles custom button @a iId click. */
    74     void sltCustomButtonClicked(int iId);
     66    virtual void sltCustomButtonClicked(int iId) /* override */;
     67
     68protected:
     69
     70    /** Handles translation event. */
     71    virtual void retranslateUi() /* override */;
     72
     73    /** Prepares all. */
     74    virtual void prepare() /* override */;
    7575
    7676private:
    7777
    78     /** Handles translation event. */
    79     void retranslateUi();
    80 
    81     /** Prepares all. */
    82     void prepare();
     78    /** Exports @a comAppliance VMs. */
     79    bool exportVMs(CAppliance &comAppliance);
    8380
    8481    /** Holds the names of VMs to be exported. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppDefs.h

    r72916 r72920  
    3636
    3737/** QListWidgetItem subclass for Export Appliance wizard VM list. */
    38 class VMListWidgetItem : public QListWidgetItem
     38class UIVMListWidgetItem : public QListWidgetItem
    3939{
    4040public:
     
    4343      * @param  strUuid       Brings the machine ID.
    4444      * @param  fInSaveState  Brings whether machine is in Saved state. */
    45     VMListWidgetItem(QPixmap &pixIcon, QString &strText, QString strUuid, bool fInSaveState, QListWidget *pParent)
     45    UIVMListWidgetItem(QPixmap &pixIcon, QString &strText, QString strUuid, bool fInSaveState, QListWidget *pParent)
    4646        : QListWidgetItem(pixIcon, strText, pParent)
    4747        , m_strUuid(strUuid)
     
    5656
    5757    /** Returns the machine ID. */
    58     QString uuid() { return m_strUuid; }
     58    QString uuid() const { return m_strUuid; }
    5959    /** Returns whether machine is in Saved state. */
    60     bool isInSaveState() { return m_fInSaveState; }
     60    bool isInSaveState() const { return m_fInSaveState; }
    6161
    6262private:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic1.cpp

    r72916 r72920  
    2424
    2525/* GUI includes: */
    26 # include "UIWizardExportAppPageBasic1.h"
     26# include "QILabelSeparator.h"
     27# include "QIRichTextLabel.h"
     28# include "VBoxGlobal.h"
     29# include "UIMessageCenter.h"
    2730# include "UIWizardExportApp.h"
    2831# include "UIWizardExportAppDefs.h"
    29 # include "VBoxGlobal.h"
    30 # include "UIMessageCenter.h"
    31 # include "QILabelSeparator.h"
    32 # include "QIRichTextLabel.h"
     32# include "UIWizardExportAppPageBasic1.h"
    3333
    3434/* COM includes: */
     
    7575            pixIcon = QPixmap(":/os_other.png").scaled(iIconMetric, iIconMetric, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    7676        }
    77         QListWidgetItem *pItem = new VMListWidgetItem(pixIcon, strName, strUuid, fInSaveState, m_pVMSelector);
     77        QListWidgetItem *pItem = new UIVMListWidgetItem(pixIcon, strName, strUuid, fInSaveState, m_pVMSelector);
    7878        if (!fEnabled)
    7979            pItem->setFlags(0);
     
    113113    /* Iterate over all the selected items: */
    114114    foreach (QListWidgetItem *pItem, m_pVMSelector->selectedItems())
    115         machineIDs << static_cast<VMListWidgetItem*>(pItem)->uuid();
     115        machineIDs << static_cast<UIVMListWidgetItem*>(pItem)->uuid();
    116116    /* Return result list: */
    117117    return machineIDs;
     
    127127    /* Create main layout: */
    128128    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
     129    if (pMainLayout)
    129130    {
    130131        /* Create label: */
    131         m_pLabel = new QIRichTextLabel(this);
     132        m_pLabel = new QIRichTextLabel;
     133        if (m_pLabel)
     134        {
     135            /* Add into layout: */
     136            pMainLayout->addWidget(m_pLabel);
     137        }
    132138
    133139        /* Create VM selector: */
    134         m_pVMSelector = new QListWidget(this);
     140        m_pVMSelector = new QListWidget;
     141        if (m_pVMSelector)
    135142        {
    136143            m_pVMSelector->setAlternatingRowColors(true);
    137144            m_pVMSelector->setSelectionMode(QAbstractItemView::ExtendedSelection);
    138         }
    139 
    140         /* Add into layout: */
    141         pMainLayout->addWidget(m_pLabel);
    142         pMainLayout->addWidget(m_pVMSelector);
    143 
    144         /* Populate VM selector items: */
    145         populateVMSelectorItems(selectedVMNames);
    146     }
     145
     146            /* Add into layout: */
     147            pMainLayout->addWidget(m_pVMSelector);
     148        }
     149    }
     150
     151    /* Populate VM selector items: */
     152    populateVMSelectorItems(selectedVMNames);
    147153
    148154    /* Setup connections: */
     
    184190    /* Ask user about machines which are in Saved state currently: */
    185191    QStringList savedMachines;
    186     QList<QListWidgetItem*> pItems = m_pVMSelector->selectedItems();
    187     for (int i=0; i < pItems.size(); ++i)
    188     {
    189         if (static_cast<VMListWidgetItem*>(pItems.at(i))->isInSaveState())
    190             savedMachines << pItems.at(i)->text();
     192    QList<QListWidgetItem*> items = m_pVMSelector->selectedItems();
     193    for (int i=0; i < items.size(); ++i)
     194    {
     195        if (static_cast<UIVMListWidgetItem*>(items.at(i))->isInSaveState())
     196            savedMachines << items.at(i)->text();
    191197    }
    192198    if (!savedMachines.isEmpty())
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic1.h

    r72916 r72920  
    4040    /** Returns a list of selected machine names. */
    4141    QStringList machineNames() const;
    42 
    4342    /** Returns a list of selected machine IDs. */
    4443    QStringList machineIDs() const;
     
    6564
    6665    /** Handles translation event. */
    67     void retranslateUi();
     66    virtual void retranslateUi() /* override */;
    6867
    6968    /** Performs page initialization. */
    70     void initializePage();
     69    virtual void initializePage() /* override */;
    7170
    7271    /** Returns whether page is complete. */
    73     bool isComplete() const;
     72    virtual bool isComplete() const /* override */;
     73
    7474    /** Performs page validation. */
    75     bool validatePage();
     75    virtual bool validatePage() /* override */;
    7676
    7777    /** Returns next page ID. */
    78     int nextId() const;
     78    virtual int nextId() const /* override */;
     79
     80private:
    7981
    8082    /** Holds the label instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp

    r72916 r72920  
    2121
    2222/* Qt includes: */
    23 # include <QVBoxLayout>
    2423# include <QGroupBox>
    2524# include <QRadioButton>
     25# include <QVBoxLayout>
    2626
    2727/* GUI includes: */
     28# include "QIRichTextLabel.h"
     29# include "UIWizardExportApp.h"
    2830# include "UIWizardExportAppPageBasic2.h"
    29 # include "UIWizardExportApp.h"
    30 # include "QIRichTextLabel.h"
    3131
    3232#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     
    5959}
    6060
    61 void UIWizardExportAppPage2::setStorageType(StorageType storageType)
     61void UIWizardExportAppPage2::setStorageType(StorageType enmStorageType)
    6262{
    6363    /* Check and focus the requested type: */
    64     switch (storageType)
     64    switch (enmStorageType)
    6565    {
    6666        case Filesystem:
     
    8888    /* Create main layout: */
    8989    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
     90    if (pMainLayout)
    9091    {
    9192        /* Create label: */
    92         m_pLabel = new QIRichTextLabel(this);
     93        m_pLabel = new QIRichTextLabel;
     94        if (m_pLabel)
     95        {
     96            /* Add into layout: */
     97            pMainLayout->addWidget(m_pLabel);
     98        }
    9399
    94100        /* Create storage type container: */
    95         m_pTypeCnt = new QGroupBox(this);
     101        m_pTypeCnt = new QGroupBox;
     102        if (m_pTypeCnt)
    96103        {
    97104            /* Create storage type container layout: */
    98105            QVBoxLayout *pTypeCntLayout = new QVBoxLayout(m_pTypeCnt);
     106            if (pTypeCntLayout)
    99107            {
    100108                /* Create Local Filesystem radio-button: */
    101                 m_pTypeLocalFilesystem = new QRadioButton(m_pTypeCnt);
     109                m_pTypeLocalFilesystem = new QRadioButton;
     110                if (m_pTypeLocalFilesystem)
     111                {
     112                    /* Add into layout: */
     113                    pTypeCntLayout->addWidget(m_pTypeLocalFilesystem);
     114                }
    102115                /* Create SunCloud radio-button: */
    103                 m_pTypeSunCloud = new QRadioButton(m_pTypeCnt);
     116                m_pTypeSunCloud = new QRadioButton;
     117                if (m_pTypeSunCloud)
     118                {
     119                    /* Add into layout: */
     120                    pTypeCntLayout->addWidget(m_pTypeSunCloud);
     121                }
    104122                /* Create Simple Storage System radio-button: */
    105                 m_pTypeSimpleStorageSystem = new QRadioButton(m_pTypeCnt);
     123                m_pTypeSimpleStorageSystem = new QRadioButton;
     124                if (m_pTypeSimpleStorageSystem)
     125                {
     126                    /* Add into layout: */
     127                    pTypeCntLayout->addWidget(m_pTypeSimpleStorageSystem);
     128                }
     129            }
    106130
    107                 /* Add into layout: */
    108                 pTypeCntLayout->addWidget(m_pTypeLocalFilesystem);
    109                 pTypeCntLayout->addWidget(m_pTypeSunCloud);
    110                 pTypeCntLayout->addWidget(m_pTypeSimpleStorageSystem);
    111             }
     131            /* Add into layout: */
     132            pMainLayout->addWidget(m_pTypeCnt);
    112133        }
    113134
    114         /* Add into layout: */
    115         pMainLayout->addWidget(m_pLabel);
    116         pMainLayout->addWidget(m_pTypeCnt);
     135        /* Add vertical stretch: */
    117136        pMainLayout->addStretch();
     137    }
    118138
    119         /* Choose default storage type: */
    120         chooseDefaultStorageType();
    121     }
     139    /* Choose default storage type: */
     140    chooseDefaultStorageType();
    122141
    123142    /* Setup connections: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.h

    r72916 r72920  
    2020
    2121/* GUI includes: */
     22#include "UIWizardExportAppDefs.h"
    2223#include "UIWizardPage.h"
    23 #include "UIWizardExportAppDefs.h"
    2424
    2525/* Forward declarations: */
     
    4242    /** Returns current storage type. */
    4343    StorageType storageType() const;
    44     /** Defines current @a storageType. */
    45     void setStorageType(StorageType storageType);
     44    /** Defines current @a enmStorageType. */
     45    void setStorageType(StorageType enmStorageType);
    4646
    4747    /** Holds the storage type container instance. */
    48     QGroupBox *m_pTypeCnt;
     48    QGroupBox    *m_pTypeCnt;
    4949    /** Holds the Local Filesystem radio-button. */
    5050    QRadioButton *m_pTypeLocalFilesystem;
     
    6767    UIWizardExportAppPageBasic2();
    6868
    69 private:
     69protected:
    7070
    7171    /** Handles translation event. */
    72     void retranslateUi();
     72    virtual void retranslateUi() /* override */;
    7373
    7474    /** Performs page initialization. */
    75     void initializePage();
     75    virtual void initializePage() /* override */;
     76
     77private:
    7678
    7779    /** Holds the label instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp

    r72916 r72920  
    2121
    2222/* Qt includes: */
     23# include <QCheckBox>
     24# include <QComboBox>
    2325# include <QDir>
    24 # include <QVBoxLayout>
    2526# include <QGridLayout>
    2627# include <QLabel>
    2728# include <QLineEdit>
    28 # include <QComboBox>
    29 # include <QCheckBox>
     29# include <QVBoxLayout>
    3030
    3131/* GUI includes: */
    32 # include "UIWizardExportAppPageBasic3.h"
     32# include "QIRichTextLabel.h"
     33# include "VBoxGlobal.h"
     34# include "UIEmptyFilePathSelector.h"
    3335# include "UIWizardExportApp.h"
    3436# include "UIWizardExportAppDefs.h"
    35 # include "VBoxGlobal.h"
    36 # include "UIEmptyFilePathSelector.h"
    37 # include "QIRichTextLabel.h"
     37# include "UIWizardExportAppPageBasic3.h"
    3838
    3939#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     
    5757{
    5858    /* Setup components for chosen storage-type: */
    59     StorageType storageType = fieldImp("storageType").value<StorageType>();
    60     switch (storageType)
     59    const StorageType enmStorageType = fieldImp("storageType").value<StorageType>();
     60    switch (enmStorageType)
    6161    {
    6262        case Filesystem:
     
    142142
    143143    /* Copose file-path for 'Filesystem' storage case: */
    144     if (storageType == Filesystem)
     144    if (enmStorageType == Filesystem)
    145145        strName = QDir::toNativeSeparators(QString("%1/%2").arg(vboxGlobal().documentsPath()).arg(strName));
    146146
     
    151151void UIWizardExportAppPage3::updateFormatComboToolTip()
    152152{
    153     int iCurrentIndex = m_pFormatComboBox->currentIndex();
    154     QString strCurrentIndexToolTip = m_pFormatComboBox->itemData(iCurrentIndex, Qt::ToolTipRole).toString();
     153    const int iCurrentIndex = m_pFormatComboBox->currentIndex();
     154    const QString strCurrentIndexToolTip = m_pFormatComboBox->itemData(iCurrentIndex, Qt::ToolTipRole).toString();
    155155    m_pFormatComboBox->setToolTip(strCurrentIndexToolTip);
    156156}
     
    158158QString UIWizardExportAppPage3::format() const
    159159{
    160     int iIndex = m_pFormatComboBox->currentIndex();
     160    const int iIndex = m_pFormatComboBox->currentIndex();
    161161    return m_pFormatComboBox->itemData(iIndex).toString();
    162162}
     
    164164void UIWizardExportAppPage3::setFormat(const QString &strFormat)
    165165{
    166     int iIndex = m_pFormatComboBox->findData(strFormat);
     166    const int iIndex = m_pFormatComboBox->findData(strFormat);
    167167    AssertMsg(iIndex != -1, ("Field not found!"));
    168168    m_pFormatComboBox->setCurrentIndex(iIndex);
     
    238238    /* Create main layout: */
    239239    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
     240    if (pMainLayout)
    240241    {
    241242        /* Create label: */
    242         m_pLabel = new QIRichTextLabel(this);
     243        m_pLabel = new QIRichTextLabel;
     244        if (m_pLabel)
     245        {
     246            /* Add into layout: */
     247            pMainLayout->addWidget(m_pLabel);
     248        }
    243249
    244250        /* Create settings layout: */
    245251        QGridLayout *pSettingsLayout = new QGridLayout;
     252        if (pSettingsLayout)
    246253        {
    247254            /* Create username editor: */
    248             m_pUsernameEditor = new QLineEdit(this);
     255            m_pUsernameEditor = new QLineEdit;
     256            if (m_pUsernameEditor)
     257            {
     258                /* Add into layout: */
     259                pSettingsLayout->addWidget(m_pUsernameEditor, 0, 1);
     260            }
    249261            /* Create username label: */
    250             m_pUsernameLabel = new QLabel(this);
     262            m_pUsernameLabel = new QLabel;
     263            if (m_pUsernameLabel)
    251264            {
    252265                m_pUsernameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    253266                m_pUsernameLabel->setBuddy(m_pUsernameEditor);
     267
     268                /* Add into layout: */
     269                pSettingsLayout->addWidget(m_pUsernameLabel, 0, 0);
    254270            }
    255271
    256272            /* Create password editor: */
    257             m_pPasswordEditor = new QLineEdit(this);
     273            m_pPasswordEditor = new QLineEdit;
     274            if (m_pPasswordEditor)
    258275            {
    259276                m_pPasswordEditor->setEchoMode(QLineEdit::Password);
     277
     278                /* Add into layout: */
     279                pSettingsLayout->addWidget(m_pPasswordEditor, 1, 1);
    260280            }
    261281            /* Create password label: */
    262             m_pPasswordLabel = new QLabel(this);
     282            m_pPasswordLabel = new QLabel;
     283            if (m_pPasswordLabel)
    263284            {
    264285                m_pPasswordLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    265286                m_pPasswordLabel->setBuddy(m_pPasswordEditor);
     287
     288                /* Add into layout: */
     289                pSettingsLayout->addWidget(m_pPasswordLabel, 1, 0);
    266290            }
    267291
    268292            /* Create hostname editor: */
    269             m_pHostnameEditor = new QLineEdit(this);
     293            m_pHostnameEditor = new QLineEdit;
     294            if (m_pHostnameEditor)
     295            {
     296                /* Add into layout: */
     297                pSettingsLayout->addWidget(m_pHostnameEditor, 2, 1);
     298            }
    270299            /* Create hostname label: */
    271             m_pHostnameLabel = new QLabel(this);
     300            m_pHostnameLabel = new QLabel;
     301            if (m_pHostnameLabel)
    272302            {
    273303                m_pHostnameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    274304                m_pHostnameLabel->setBuddy(m_pHostnameEditor);
     305
     306                /* Add into layout: */
     307                pSettingsLayout->addWidget(m_pHostnameLabel, 2, 0);
    275308            }
    276309
    277310            /* Create bucket editor: */
    278             m_pBucketEditor = new QLineEdit(this);
     311            m_pBucketEditor = new QLineEdit;
     312            if (m_pBucketEditor)
     313            {
     314                /* Add into layout: */
     315                pSettingsLayout->addWidget(m_pBucketEditor, 3, 1);
     316            }
    279317            /* Create bucket label: */
    280             m_pBucketLabel = new QLabel(this);
     318            m_pBucketLabel = new QLabel;
     319            if (m_pBucketLabel)
    281320            {
    282321                m_pBucketLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    283322                m_pBucketLabel->setBuddy(m_pBucketEditor);
     323
     324                /* Add into layout: */
     325                pSettingsLayout->addWidget(m_pBucketLabel, 3, 0);
    284326            }
    285327
    286328            /* Create file selector: */
    287             m_pFileSelector = new UIEmptyFilePathSelector(this);
     329            m_pFileSelector = new UIEmptyFilePathSelector;
     330            if (m_pFileSelector)
    288331            {
    289332                m_pFileSelector->setMode(UIEmptyFilePathSelector::Mode_File_Save);
     
    291334                m_pFileSelector->setButtonPosition(UIEmptyFilePathSelector::RightPosition);
    292335                m_pFileSelector->setDefaultSaveExt("ova");
     336
     337                /* Add into layout: */
     338                pSettingsLayout->addWidget(m_pFileSelector, 4, 1);
    293339            }
    294340            /* Create file selector label: */
    295             m_pFileSelectorLabel = new QLabel(this);
     341            m_pFileSelectorLabel = new QLabel;
     342            if (m_pFileSelectorLabel)
    296343            {
    297344                m_pFileSelectorLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    298345                m_pFileSelectorLabel->setBuddy(m_pFileSelector);
     346
     347                /* Add into layout: */
     348                pSettingsLayout->addWidget(m_pFileSelectorLabel, 4, 0);
    299349            }
    300350
    301351            /* Create format combo-box: */
    302             m_pFormatComboBox = new QComboBox(this);
     352            m_pFormatComboBox = new QComboBox;
     353            if (m_pFormatComboBox)
    303354            {
    304355                const QString strFormatOVF09("ovf-0.9");
     
    310361                m_pFormatComboBox->addItem(strFormatOVF20, strFormatOVF20);
    311362                m_pFormatComboBox->addItem(strFormatOPC10, strFormatOPC10);
    312                 connect(m_pFormatComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
    313                         this, &UIWizardExportAppPageBasic3::sltHandleFormatComboChange);
     363
     364                /* Add into layout: */
     365                pSettingsLayout->addWidget(m_pFormatComboBox, 5, 1);
    314366            }
    315367            /* Create format combo-box label: */
    316             m_pFormatComboBoxLabel = new QLabel(this);
     368            m_pFormatComboBoxLabel = new QLabel;
     369            if (m_pFormatComboBoxLabel)
    317370            {
    318371                m_pFormatComboBoxLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    319372                m_pFormatComboBoxLabel->setBuddy(m_pFormatComboBox);
     373
     374                /* Add into layout: */
     375                pSettingsLayout->addWidget(m_pFormatComboBoxLabel, 5, 0);
    320376            }
    321377
    322378            /* Add into layout: */
    323             pSettingsLayout->addWidget(m_pUsernameLabel, 0, 0);
    324             pSettingsLayout->addWidget(m_pUsernameEditor, 0, 1);
    325             pSettingsLayout->addWidget(m_pPasswordLabel, 1, 0);
    326             pSettingsLayout->addWidget(m_pPasswordEditor, 1, 1);
    327             pSettingsLayout->addWidget(m_pHostnameLabel, 2, 0);
    328             pSettingsLayout->addWidget(m_pHostnameEditor, 2, 1);
    329             pSettingsLayout->addWidget(m_pBucketLabel, 3, 0);
    330             pSettingsLayout->addWidget(m_pBucketEditor, 3, 1);
    331             pSettingsLayout->addWidget(m_pFileSelectorLabel, 4, 0);
    332             pSettingsLayout->addWidget(m_pFileSelector, 4, 1);
    333             pSettingsLayout->addWidget(m_pFormatComboBoxLabel, 5, 0);
    334             pSettingsLayout->addWidget(m_pFormatComboBox, 5, 1);
     379            pMainLayout->addLayout(pSettingsLayout);
    335380        }
    336381
    337382        /* Create manifest check-box: */
    338         m_pManifestCheckbox = new QCheckBox(this);
    339 
    340         /* Add into layout: */
    341         pMainLayout->addWidget(m_pLabel);
    342         pMainLayout->addLayout(pSettingsLayout);
    343         pMainLayout->addWidget(m_pManifestCheckbox);
     383        m_pManifestCheckbox = new QCheckBox;
     384        if (m_pManifestCheckbox)
     385        {
     386            /* Add into layout: */
     387            pMainLayout->addWidget(m_pManifestCheckbox);
     388        }
     389
     390        /* Add vertical stretch: */
    344391        pMainLayout->addStretch();
    345 
    346         /* Choose default settings: */
    347         chooseDefaultSettings();
    348392    }
     393
     394    /* Choose default settings: */
     395    chooseDefaultSettings();
    349396
    350397    /* Setup connections: */
     
    354401    connect(m_pBucketEditor, &QLineEdit::textChanged,               this, &UIWizardExportAppPageBasic3::completeChanged);
    355402    connect(m_pFileSelector, &UIEmptyFilePathSelector::pathChanged, this, &UIWizardExportAppPageBasic3::completeChanged);
     403    connect(m_pFormatComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
     404            this, &UIWizardExportAppPageBasic3::sltHandleFormatComboChange);
    356405
    357406    /* Register fields: */
     
    363412    registerField("bucket", this, "bucket");
    364413    registerField("path", this, "path");
    365 }
    366 
    367 void UIWizardExportAppPageBasic3::sltHandleFormatComboChange()
    368 {
    369     refreshCurrentSettings();
    370     updateFormatComboToolTip();
    371414}
    372415
     
    419462    {
    420463        const QString &strFile = m_pFileSelector->path().toLower();
    421         bool fOVF =    field("format").toString() == "ovf-0.9"
    422                     || field("format").toString() == "ovf-1.0"
    423                     || field("format").toString() == "ovf-2.0";
    424         bool fOPC =    field("format").toString() == "opc-1.0";
     464        const bool fOVF =    field("format").toString() == "ovf-0.9"
     465                          || field("format").toString() == "ovf-1.0"
     466                          || field("format").toString() == "ovf-2.0";
     467        const bool fOPC =    field("format").toString() == "opc-1.0";
    425468        fResult =    (   fOVF
    426469                      && VBoxGlobal::hasAllowedExtension(strFile, OVFFileExts))
     
    429472        if (fResult)
    430473        {
    431             StorageType storageType = field("storageType").value<StorageType>();
    432             switch (storageType)
     474            const StorageType enmStorageType = field("storageType").value<StorageType>();
     475            switch (enmStorageType)
    433476            {
    434477                case Filesystem:
     
    459502
    460503    /* Setup components for chosen storage-type: */
    461     StorageType storageType = field("storageType").value<StorageType>();
    462     switch (storageType)
     504    const StorageType enmStorageType = field("storageType").value<StorageType>();
     505    switch (enmStorageType)
    463506    {
    464507        case Filesystem:
     
    492535    }
    493536}
     537
     538void UIWizardExportAppPageBasic3::sltHandleFormatComboChange()
     539{
     540    refreshCurrentSettings();
     541    updateFormatComboToolTip();
     542}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h

    r72916 r72920  
    2626
    2727/* Forward declarations: */
     28class QCheckBox;
     29class QComboBox;
    2830class QLabel;
    2931class QLineEdit;
     32class QIRichTextLabel;
    3033class UIEmptyFilePathSelector;
    31 class QComboBox;
    32 class QCheckBox;
    33 class QIRichTextLabel;
    3434
    3535
     
    4444    /** Chooses default settings. */
    4545    void chooseDefaultSettings();
     46
    4647    /** Refreshes current settings. */
    4748    virtual void refreshCurrentSettings();
     
    8586
    8687    /** Holds the default appliance name. */
    87     QString m_strDefaultApplianceName;
     88    QString  m_strDefaultApplianceName;
    8889
    8990    /** Holds the username label instance. */
    90     QLabel *m_pUsernameLabel;
     91    QLabel    *m_pUsernameLabel;
    9192    /** Holds the username editor instance. */
    9293    QLineEdit *m_pUsernameEditor;
    9394
    9495    /** Holds the password label instance. */
    95     QLabel *m_pPasswordLabel;
     96    QLabel    *m_pPasswordLabel;
    9697    /** Holds the password editor instance. */
    9798    QLineEdit *m_pPasswordEditor;
    9899
    99100    /** Holds the hostname label instance. */
    100     QLabel *m_pHostnameLabel;
     101    QLabel    *m_pHostnameLabel;
    101102    /** Holds the hostname editor instance. */
    102103    QLineEdit *m_pHostnameEditor;
    103104
    104105    /** Holds the bucket label instance. */
    105     QLabel *m_pBucketLabel;
     106    QLabel    *m_pBucketLabel;
    106107    /** Holds the bucket editor instance. */
    107108    QLineEdit *m_pBucketEditor;
    108109
    109110    /** Holds the file selector label instance. */
    110     QLabel *m_pFileSelectorLabel;
     111    QLabel    *m_pFileSelectorLabel;
    111112    /** Holds the file selector instance. */
    112113    UIEmptyFilePathSelector *m_pFileSelector;
    113114
    114115    /** Holds the format combo-box label instance. */
    115     QLabel *m_pFormatComboBoxLabel;
     116    QLabel    *m_pFormatComboBoxLabel;
    116117    /** Holds the format combo-box instance. */
    117118    QComboBox *m_pFormatComboBox;
     
    144145    QVariant fieldImp(const QString &strFieldName) const { return UIWizardPage::field(strFieldName); }
    145146
     147    /** Handles translation event. */
     148    virtual void retranslateUi() /* override */;
     149
     150    /** Performs page initialization. */
     151    virtual void initializePage() /* override */;
     152
     153    /** Returns whether page is complete. */
     154    virtual bool isComplete() const /* override */;
     155
     156    /** Refreshes current settings. */
     157    virtual void refreshCurrentSettings() /* override */;
     158
    146159private slots:
    147160
     
    151164private:
    152165
    153     /** Handles translation event. */
    154     void retranslateUi();
    155 
    156     /** Performs page initialization. */
    157     void initializePage();
    158 
    159     /** Returns whether page is complete. */
    160     bool isComplete() const;
    161 
    162     /** Refreshes current settings. */
    163     void refreshCurrentSettings();
    164 
    165166    /** Holds the label instance. */
    166167    QIRichTextLabel *m_pLabel;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic4.cpp

    r72916 r72920  
    2424
    2525/* GUI includes: */
    26 # include "UIWizardExportAppPageBasic4.h"
    27 # include "UIWizardExportApp.h"
     26# include "QILabelSeparator.h"
     27# include "QIRichTextLabel.h"
    2828# include "VBoxGlobal.h"
    2929# include "UIMessageCenter.h"
    30 # include "QILabelSeparator.h"
    31 # include "QIRichTextLabel.h"
     30# include "UIWizardExportApp.h"
     31# include "UIWizardExportAppPageBasic4.h"
    3232
    3333/* COM includes: */
     
    4949{
    5050    /* Refresh settings widget: */
    51     CVirtualBox vbox = vboxGlobal().virtualBox();
     51    CVirtualBox comVBox = vboxGlobal().virtualBox();
    5252    CAppliance *pAppliance = m_pApplianceWidget->init();
    53     bool fResult = pAppliance->isOk();
    54     if (fResult)
     53    if (pAppliance->isOk())
    5554    {
    5655        /* Iterate over all the selected machine ids: */
     
    5958        {
    6059            /* Get the machine with the uuid: */
    61             CMachine machine = vbox.FindMachine(uuid);
    62             fResult = machine.isOk();
    63             if (fResult)
     60            CMachine comMachine = comVBox.FindMachine(uuid);
     61            if (comVBox.isOk() && comMachine.isNotNull())
    6462            {
    6563                /* Add the export description to our appliance object: */
    66                 CVirtualSystemDescription vsd = machine.ExportTo(*pAppliance, qobject_cast<UIWizardExportApp*>(wizardImp())->uri());
    67                 fResult = machine.isOk();
    68                 if (!fResult)
     64                CVirtualSystemDescription comVsd = comMachine.ExportTo(*pAppliance, qobject_cast<UIWizardExportApp*>(wizardImp())->uri());
     65                if (comMachine.isOk() && comVsd.isNotNull())
    6966                {
    70                     msgCenter().cannotExportAppliance(machine, pAppliance->GetPath(), thisImp());
    71                     return;
     67                    /* Now add some new fields the user may change: */
     68                    comVsd.AddDescription(KVirtualSystemDescriptionType_Product, "", "");
     69                    comVsd.AddDescription(KVirtualSystemDescriptionType_ProductUrl, "", "");
     70                    comVsd.AddDescription(KVirtualSystemDescriptionType_Vendor, "", "");
     71                    comVsd.AddDescription(KVirtualSystemDescriptionType_VendorUrl, "", "");
     72                    comVsd.AddDescription(KVirtualSystemDescriptionType_Version, "", "");
     73                    comVsd.AddDescription(KVirtualSystemDescriptionType_License, "", "");
    7274                }
    73                 /* Now add some new fields the user may change: */
    74                 vsd.AddDescription(KVirtualSystemDescriptionType_Product, "", "");
    75                 vsd.AddDescription(KVirtualSystemDescriptionType_ProductUrl, "", "");
    76                 vsd.AddDescription(KVirtualSystemDescriptionType_Vendor, "", "");
    77                 vsd.AddDescription(KVirtualSystemDescriptionType_VendorUrl, "", "");
    78                 vsd.AddDescription(KVirtualSystemDescriptionType_Version, "", "");
    79                 vsd.AddDescription(KVirtualSystemDescriptionType_License, "", "");
     75                else
     76                    return msgCenter().cannotExportAppliance(comMachine, pAppliance->GetPath(), thisImp());
    8077            }
    8178            else
    82                 break;
     79                return msgCenter().cannotFindMachineById(comVBox, uuid);
    8380        }
    8481        /* Make sure the settings widget get the new descriptions: */
    8582        m_pApplianceWidget->populate();
    8683    }
    87     if (!fResult)
    88         msgCenter().cannotExportAppliance(*pAppliance, thisImp());
    8984}
    9085
     
    9893    /* Create main layout: */
    9994    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
     95    if (pMainLayout)
    10096    {
    10197        /* Create label: */
    102         m_pLabel = new QIRichTextLabel(this);
     98        m_pLabel = new QIRichTextLabel;
     99        if (m_pLabel)
     100        {
     101            /* Add into layout: */
     102            pMainLayout->addWidget(m_pLabel);
     103        }
    103104
    104105        /* Create appliance widget: */
    105         m_pApplianceWidget = new UIApplianceExportEditorWidget(this);
     106        m_pApplianceWidget = new UIApplianceExportEditorWidget;
     107        if (m_pApplianceWidget)
    106108        {
    107109            m_pApplianceWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
     110
     111            /* Add into layout: */
     112            pMainLayout->addWidget(m_pApplianceWidget);
    108113        }
    109 
    110         /* Add into layout: */
    111         pMainLayout->addWidget(m_pLabel);
    112         pMainLayout->addWidget(m_pApplianceWidget);
    113114    }
    114115
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic4.h

    r72916 r72920  
    2323
    2424/* GUI includes: */
     25#include "UIWizardExportAppDefs.h"
    2526#include "UIWizardPage.h"
    26 #include "UIWizardExportAppDefs.h"
    2727
    2828/* Forward declarations: */
     29class QIRichTextLabel;
    2930class UIWizardExportApp;
    30 class QIRichTextLabel;
    3131
    3232
     
    7070    QVariant fieldImp(const QString &strFieldName) const { return UIWizardPage::field(strFieldName); }
    7171
    72 private:
    73 
    7472    /** Handles translation event. */
    75     void retranslateUi();
     73    virtual void retranslateUi() /* override */;
    7674
    7775    /** Performs page initialization. */
    78     void initializePage();
     76    virtual void initializePage() /* override */;
    7977
    8078    /** Performs page validation. */
    81     bool validatePage();
     79    virtual bool validatePage() /* override */;
     80
     81private:
    8282
    8383    /** Holds the label instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp

    r72916 r72920  
    2121
    2222/* Qt includes: */
     23# include <QCheckBox>
     24# include <QGridLayout>
     25# include <QGroupBox>
     26# include <QLabel>
     27# include <QLineEdit>
     28# include <QListWidget>
     29# include <QRadioButton>
    2330# include <QVBoxLayout>
    24 # include <QGridLayout>
    25 # include <QListWidget>
    26 # include <QGroupBox>
    27 # include <QRadioButton>
    28 # include <QLineEdit>
    29 # include <QLabel>
    30 # include <QCheckBox>
    31 # include <QGroupBox>
    3231
    3332/* GUI includes: */
    34 # include "UIWizardExportAppPageExpert.h"
     33# include "VBoxGlobal.h"
     34# include "UIApplianceExportEditorWidget.h"
     35# include "UIEmptyFilePathSelector.h"
    3536# include "UIWizardExportApp.h"
    3637# include "UIWizardExportAppDefs.h"
    37 # include "VBoxGlobal.h"
    38 # include "UIEmptyFilePathSelector.h"
    39 # include "UIApplianceExportEditorWidget.h"
     38# include "UIWizardExportAppPageExpert.h"
    4039
    4140#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     
    5049    /* Create widgets: */
    5150    QGridLayout *pMainLayout = new QGridLayout(this);
     51    if (pMainLayout)
    5252    {
    5353        /* Create VM selector container: */
    54         m_pSelectorCnt = new QGroupBox(this);
     54        m_pSelectorCnt = new QGroupBox;
     55        if (m_pSelectorCnt)
    5556        {
    5657            /* Create VM selector container layout: */
    5758            QVBoxLayout *pSelectorCntLayout = new QVBoxLayout(m_pSelectorCnt);
     59            if (pSelectorCntLayout)
    5860            {
    5961                /* Create VM selector: */
    60                 m_pVMSelector = new QListWidget(m_pSelectorCnt);
     62                m_pVMSelector = new QListWidget;
     63                if (m_pVMSelector)
    6164                {
    6265                    m_pVMSelector->setAlternatingRowColors(true);
    6366                    m_pVMSelector->setSelectionMode(QAbstractItemView::ExtendedSelection);
    64                 }
    65 
    66                 /* Add into layout: */
    67                 pSelectorCntLayout->addWidget(m_pVMSelector);
     67
     68                    /* Add into layout: */
     69                    pSelectorCntLayout->addWidget(m_pVMSelector);
     70                }
    6871            }
     72
     73            /* Add into layout: */
     74            pMainLayout->addWidget(m_pSelectorCnt, 0, 0);
    6975        }
    7076
    7177        /* Create appliance widget container: */
    72         m_pApplianceCnt = new QGroupBox(this);
     78        m_pApplianceCnt = new QGroupBox;
     79        if (m_pApplianceCnt)
    7380        {
    7481            /* Create appliance widget container layout: */
    7582            QVBoxLayout *pApplianceCntLayout = new QVBoxLayout(m_pApplianceCnt);
     83            if (pApplianceCntLayout)
    7684            {
    7785                /* Create appliance widget: */
    78                 m_pApplianceWidget = new UIApplianceExportEditorWidget(m_pApplianceCnt);
     86                m_pApplianceWidget = new UIApplianceExportEditorWidget;
     87                if (m_pApplianceWidget)
    7988                {
    8089                    m_pApplianceWidget->setMinimumHeight(250);
    8190                    m_pApplianceWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
    82                 }
    83 
    84                 /* Add into layout: */
    85                 pApplianceCntLayout->addWidget(m_pApplianceWidget);
     91
     92                    /* Add into layout: */
     93                    pApplianceCntLayout->addWidget(m_pApplianceWidget);
     94                }
    8695            }
     96
     97            /* Add into layout: */
     98            pMainLayout->addWidget(m_pApplianceCnt, 0, 1);
    8799        }
    88100
    89101        /* Create storage type container: */
    90         m_pTypeCnt = new QGroupBox(this);
     102        m_pTypeCnt = new QGroupBox;
     103        if (m_pTypeCnt)
    91104        {
    92105            /* Hide it for now: */
     
    95108            /* Create storage type container layout: */
    96109            QVBoxLayout *pTypeCntLayout = new QVBoxLayout(m_pTypeCnt);
     110            if (pTypeCntLayout)
    97111            {
    98112                /* Create Local Filesystem radio-button: */
    99                 m_pTypeLocalFilesystem = new QRadioButton(m_pTypeCnt);
     113                m_pTypeLocalFilesystem = new QRadioButton;
     114                if (m_pTypeLocalFilesystem)
     115                {
     116                    /* Add into layout: */
     117                    pTypeCntLayout->addWidget(m_pTypeLocalFilesystem);
     118                }
    100119                /* Create SunCloud radio-button: */
    101                 m_pTypeSunCloud = new QRadioButton(m_pTypeCnt);
     120                m_pTypeSunCloud = new QRadioButton;
     121                if (m_pTypeSunCloud)
     122                {
     123                    /* Add into layout: */
     124                    pTypeCntLayout->addWidget(m_pTypeSunCloud);
     125                }
    102126                /* Create Simple Storage System radio-button: */
    103                 m_pTypeSimpleStorageSystem = new QRadioButton(m_pTypeCnt);
    104 
    105                 /* Add into layout: */
    106                 pTypeCntLayout->addWidget(m_pTypeLocalFilesystem);
    107                 pTypeCntLayout->addWidget(m_pTypeSunCloud);
    108                 pTypeCntLayout->addWidget(m_pTypeSimpleStorageSystem);
     127                m_pTypeSimpleStorageSystem = new QRadioButton;
     128                if (m_pTypeSimpleStorageSystem)
     129                {
     130                    /* Add into layout: */
     131                    pTypeCntLayout->addWidget(m_pTypeSimpleStorageSystem);
     132                }
    109133            }
     134
     135            /* Add into layout: */
     136            pMainLayout->addWidget(m_pTypeCnt, 1, 0, 1, 2);
    110137        }
    111138
    112139        /* Create settings widget container: */
    113         m_pSettingsCnt = new QGroupBox(this);
     140        m_pSettingsCnt = new QGroupBox;
     141        if (m_pSettingsCnt)
    114142        {
    115143            /* Create settings widget container layout: */
    116144            QGridLayout *pSettingsLayout = new QGridLayout(m_pSettingsCnt);
     145            if (pSettingsLayout)
    117146            {
    118147                /* Create username editor: */
    119                 m_pUsernameEditor = new QLineEdit(m_pSettingsCnt);
     148                m_pUsernameEditor = new QLineEdit;
     149                if (m_pUsernameEditor)
     150                {
     151                    /* Add into layout: */
     152                    pSettingsLayout->addWidget(m_pUsernameEditor, 0, 1);
     153                }
    120154                /* Create username label: */
    121                 m_pUsernameLabel = new QLabel(m_pSettingsCnt);
     155                m_pUsernameLabel = new QLabel;
     156                if (m_pUsernameLabel)
    122157                {
    123158                    m_pUsernameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    124159                    m_pUsernameLabel->setBuddy(m_pUsernameEditor);
     160
     161                    /* Add into layout: */
     162                    pSettingsLayout->addWidget(m_pUsernameLabel, 0, 0);
    125163                }
    126164
    127165                /* Create password editor: */
    128                 m_pPasswordEditor = new QLineEdit(m_pSettingsCnt);
     166                m_pPasswordEditor = new QLineEdit;
     167                if (m_pPasswordEditor)
    129168                {
    130169                    m_pPasswordEditor->setEchoMode(QLineEdit::Password);
     170
     171                    /* Add into layout: */
     172                    pSettingsLayout->addWidget(m_pPasswordEditor, 1, 1);
    131173                }
    132174                /* Create password label: */
    133                 m_pPasswordLabel = new QLabel(m_pSettingsCnt);
     175                m_pPasswordLabel = new QLabel;
     176                if (m_pPasswordLabel)
    134177                {
    135178                    m_pPasswordLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    136179                    m_pPasswordLabel->setBuddy(m_pPasswordEditor);
     180
     181                    /* Add into layout: */
     182                    pSettingsLayout->addWidget(m_pPasswordLabel, 1, 0);
    137183                }
    138184
    139185                /* Create hostname editor: */
    140                 m_pHostnameEditor = new QLineEdit(m_pSettingsCnt);
     186                m_pHostnameEditor = new QLineEdit;
     187                if (m_pHostnameEditor)
     188                {
     189                    /* Add into layout: */
     190                    pSettingsLayout->addWidget(m_pHostnameEditor, 2, 1);
     191                }
    141192                /* Create hostname label: */
    142                 m_pHostnameLabel = new QLabel(m_pSettingsCnt);
     193                m_pHostnameLabel = new QLabel;
     194                if (m_pHostnameLabel)
    143195                {
    144196                    m_pHostnameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    145197                    m_pHostnameLabel->setBuddy(m_pHostnameEditor);
     198
     199                    /* Add into layout: */
     200                    pSettingsLayout->addWidget(m_pHostnameLabel, 2, 0);
    146201                }
    147202
    148203                /* Create bucket editor: */
    149                 m_pBucketEditor = new QLineEdit(m_pSettingsCnt);
     204                m_pBucketEditor = new QLineEdit;
     205                if (m_pBucketEditor)
     206                {
     207                    /* Add into layout: */
     208                    pSettingsLayout->addWidget(m_pBucketEditor, 3, 1);
     209                }
    150210                /* Create bucket label: */
    151                 m_pBucketLabel = new QLabel(m_pSettingsCnt);
     211                m_pBucketLabel = new QLabel;
     212                if (m_pBucketLabel)
    152213                {
    153214                    m_pBucketLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    154215                    m_pBucketLabel->setBuddy(m_pBucketEditor);
     216
     217                    /* Add into layout: */
     218                    pSettingsLayout->addWidget(m_pBucketLabel, 3, 0);
    155219                }
    156220
    157221                /* Create file selector: */
    158                 m_pFileSelector = new UIEmptyFilePathSelector(m_pSettingsCnt);
     222                m_pFileSelector = new UIEmptyFilePathSelector;
     223                if (m_pFileSelector)
    159224                {
    160225                    m_pFileSelector->setMode(UIEmptyFilePathSelector::Mode_File_Save);
     
    162227                    m_pFileSelector->setButtonPosition(UIEmptyFilePathSelector::RightPosition);
    163228                    m_pFileSelector->setDefaultSaveExt("ova");
     229
     230                    /* Add into layout: */
     231                    pSettingsLayout->addWidget(m_pFileSelector, 4, 1);
    164232                }
    165233                /* Create file selector label: */
    166                 m_pFileSelectorLabel = new QLabel(m_pSettingsCnt);
     234                m_pFileSelectorLabel = new QLabel;
     235                if (m_pFileSelectorLabel)
    167236                {
    168237                    m_pFileSelectorLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    169238                    m_pFileSelectorLabel->setBuddy(m_pFileSelector);
     239
     240                    /* Add into layout: */
     241                    pSettingsLayout->addWidget(m_pFileSelectorLabel, 4, 0);
    170242                }
    171243
    172244                /* Create format combo-box editor: */
    173                 m_pFormatComboBox = new QComboBox(m_pSettingsCnt);
     245                m_pFormatComboBox = new QComboBox;
     246                if (m_pFormatComboBox)
    174247                {
    175248                    const QString strFormatOVF09("ovf-0.9");
     
    181254                    m_pFormatComboBox->addItem(strFormatOVF20, strFormatOVF20);
    182255                    m_pFormatComboBox->addItem(strFormatOPC10, strFormatOPC10);
    183                     connect(m_pFormatComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
    184                             this, &UIWizardExportAppPageExpert::sltHandleFormatComboChange);
     256
     257                    /* Add into layout: */
     258                    pSettingsLayout->addWidget(m_pFormatComboBox, 5, 1);
    185259                }
    186260                /* Create format combo-box label: */
    187                 m_pFormatComboBoxLabel = new QLabel(m_pSettingsCnt);
     261                m_pFormatComboBoxLabel = new QLabel;
     262                if (m_pFormatComboBoxLabel)
    188263                {
    189264                    m_pFormatComboBoxLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    190265                    m_pFormatComboBoxLabel->setBuddy(m_pFormatComboBox);
     266
     267                    /* Add into layout: */
     268                    pSettingsLayout->addWidget(m_pFormatComboBoxLabel, 5, 0);
    191269                }
    192270
    193271                /* Create manifest check-box editor: */
    194                 m_pManifestCheckbox = new QCheckBox(m_pSettingsCnt);
    195 
    196                 /* Add into layout: */
    197                 pSettingsLayout->addWidget(m_pUsernameLabel, 0, 0);
    198                 pSettingsLayout->addWidget(m_pUsernameEditor, 0, 1);
    199                 pSettingsLayout->addWidget(m_pPasswordLabel, 1, 0);
    200                 pSettingsLayout->addWidget(m_pPasswordEditor, 1, 1);
    201                 pSettingsLayout->addWidget(m_pHostnameLabel, 2, 0);
    202                 pSettingsLayout->addWidget(m_pHostnameEditor, 2, 1);
    203                 pSettingsLayout->addWidget(m_pBucketLabel, 3, 0);
    204                 pSettingsLayout->addWidget(m_pBucketEditor, 3, 1);
    205                 pSettingsLayout->addWidget(m_pFileSelectorLabel, 4, 0);
    206                 pSettingsLayout->addWidget(m_pFileSelector, 4, 1);
    207                 pSettingsLayout->addWidget(m_pFormatComboBoxLabel, 5, 0);
    208                 pSettingsLayout->addWidget(m_pFormatComboBox, 5, 1);
    209                 pSettingsLayout->addWidget(m_pManifestCheckbox, 6, 0, 1, 2);
     272                m_pManifestCheckbox = new QCheckBox;
     273                if (m_pManifestCheckbox)
     274                {
     275                    /* Add into layout: */
     276                    pSettingsLayout->addWidget(m_pManifestCheckbox, 6, 0, 1, 2);
     277                }
    210278            }
     279
     280            /* Add into layout: */
     281            pMainLayout->addWidget(m_pSettingsCnt, 2, 0, 1, 2);
    211282        }
    212 
    213         /* Add into layout: */
    214         pMainLayout->addWidget(m_pSelectorCnt, 0, 0);
    215         pMainLayout->addWidget(m_pApplianceCnt, 0, 1);
    216         pMainLayout->addWidget(m_pTypeCnt, 1, 0, 1, 2);
    217         pMainLayout->addWidget(m_pSettingsCnt, 2, 0, 1, 2);
    218 
    219         /* Populate VM selector items: */
    220         populateVMSelectorItems(selectedVMNames);
    221         /* Choose default storage type: */
    222         chooseDefaultStorageType();
    223         /* Choose default settings: */
    224         chooseDefaultSettings();
    225283    }
     284
     285    /* Populate VM selector items: */
     286    populateVMSelectorItems(selectedVMNames);
     287    /* Choose default storage type: */
     288    chooseDefaultStorageType();
     289    /* Choose default settings: */
     290    chooseDefaultSettings();
    226291
    227292    /* Setup connections: */
     
    235300    connect(m_pBucketEditor, &QLineEdit::textChanged,               this, &UIWizardExportAppPageExpert::completeChanged);
    236301    connect(m_pFileSelector, &UIEmptyFilePathSelector::pathChanged, this, &UIWizardExportAppPageExpert::completeChanged);
     302    connect(m_pFormatComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
     303            this, &UIWizardExportAppPageExpert::sltHandleFormatComboChange);
    237304
    238305    /* Register classes: */
     
    252319    registerField("path", this, "path");
    253320    registerField("applianceWidget", this, "applianceWidget");
    254 }
    255 
    256 void UIWizardExportAppPageExpert::sltVMSelectionChangeHandler()
    257 {
    258     /* Call to base-class: */
    259     refreshCurrentSettings();
    260     refreshApplianceSettingsWidget();
    261 
    262     /* Broadcast complete-change: */
    263     emit completeChanged();
    264 }
    265 
    266 void UIWizardExportAppPageExpert::sltStorageTypeChangeHandler()
    267 {
    268     /* Call to base-class: */
    269     refreshCurrentSettings();
    270 
    271     /* Broadcast complete-change: */
    272     emit completeChanged();
    273 }
    274 
    275 void UIWizardExportAppPageExpert::sltHandleFormatComboChange()
    276 {
    277     refreshCurrentSettings();
    278     updateFormatComboToolTip();
    279321}
    280322
     
    322364    retranslateUi();
    323365
    324     /* Call to base-class: */
     366    /* Refresh current settings: */
    325367    refreshCurrentSettings();
    326368    refreshApplianceSettingsWidget();
     
    340382    {
    341383        const QString &strFile = m_pFileSelector->path().toLower();
    342         bool fOVF =    field("format").toString() == "ovf-0.9"
    343                     || field("format").toString() == "ovf-1.0"
    344                     || field("format").toString() == "ovf-2.0";
    345         bool fOPC =    field("format").toString() == "opc-1.0";
     384        const bool fOVF =    field("format").toString() == "ovf-0.9"
     385                          || field("format").toString() == "ovf-1.0"
     386                          || field("format").toString() == "ovf-2.0";
     387        const bool fOPC =    field("format").toString() == "opc-1.0";
    346388        fResult =    (   fOVF
    347389                      && VBoxGlobal::hasAllowedExtension(strFile, OVFFileExts))
     
    350392        if (fResult)
    351393        {
    352             StorageType st = storageType();
    353             switch (st)
     394            const StorageType enmStorageType = storageType();
     395            switch (enmStorageType)
    354396            {
    355397                case Filesystem:
     
    391433    return fResult;
    392434}
     435
     436void UIWizardExportAppPageExpert::sltVMSelectionChangeHandler()
     437{
     438    /* Refresh current settings: */
     439    refreshCurrentSettings();
     440    refreshApplianceSettingsWidget();
     441
     442    /* Broadcast complete-change: */
     443    emit completeChanged();
     444}
     445
     446void UIWizardExportAppPageExpert::sltStorageTypeChangeHandler()
     447{
     448    /* Refresh current settings: */
     449    refreshCurrentSettings();
     450
     451    /* Broadcast complete-change: */
     452    emit completeChanged();
     453}
     454
     455void UIWizardExportAppPageExpert::sltHandleFormatComboChange()
     456{
     457    /* Refresh current settings: */
     458    refreshCurrentSettings();
     459    updateFormatComboToolTip();
     460}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.h

    r72916 r72920  
    6565    QVariant fieldImp(const QString &strFieldName) const { return UIWizardPage::field(strFieldName); }
    6666
     67    /** Handles translation event. */
     68    virtual void retranslateUi() /* override */;
     69
     70    /** Performs page initialization. */
     71    virtual void initializePage() /* override */;
     72
     73    /** Returns whether page is complete. */
     74    virtual bool isComplete() const /* override */;
     75
     76    /** Performs page validation. */
     77    virtual bool validatePage() /* override */;
     78
    6779private slots:
    6880
     
    7890private:
    7991
    80     /** Wraps wizard field API, calling it with certain @a strFieldName argument. */
    81     QVariant field(const QString &strFieldName) const { return UIWizardPage::field(strFieldName); }
    82 
    83     /** Handles translation event. */
    84     void retranslateUi();
    85 
    86     /** Performs page initialization. */
    87     void initializePage();
    88 
    89     /** Returns whether page is complete. */
    90     bool isComplete() const;
    91     /** Performs page validation. */
    92     bool validatePage();
    93 
    9492    /** Holds the VM selector container instance. */
    9593    QGroupBox *m_pSelectorCnt;
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