VirtualBox

Ignore:
Timestamp:
May 29, 2019 2:16:05 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9434: Import Appliance wizard: Importing cloud instance routine, basic implementation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.cpp

    r78063 r78852  
    1919#include <QDialogButtonBox>
    2020#include <QLabel>
     21#include <QPrintDialog>
     22#include <QPrinter>
    2123#include <QPushButton>
    2224#include <QTextEdit>
     
    2527
    2628/* GUI includes: */
     29#include "QIDialog.h"
     30#include "QIFileDialog.h"
     31#include "VBoxGlobal.h"
     32#include "UIMessageCenter.h"
    2733#include "UIWizardImportApp.h"
    2834#include "UIWizardImportAppPageBasic1.h"
    2935#include "UIWizardImportAppPageBasic2.h"
    3036#include "UIWizardImportAppPageExpert.h"
    31 #include "VBoxGlobal.h"
    32 #include "QIDialog.h"
    33 #include "QIFileDialog.h"
    34 
    35 #include <QPrintDialog>
    36 #include <QPrinter>
     37
     38/* COM includes: */
     39#include "CProgress.h"
    3740
    3841
     
    194197bool UIWizardImportApp::importAppliance()
    195198{
    196     /* Get import appliance widget: */
    197     UIApplianceImportEditorWidget *pImportApplianceWidget = field("applianceWidget").value<ImportAppliancePointer>();
    198     /* Make sure the final values are puted back: */
    199     pImportApplianceWidget->prepareImport();
    200     /* Check if there are license agreements the user must confirm: */
    201     QList < QPair <QString, QString> > licAgreements = pImportApplianceWidget->licenseAgreements();
    202     if (!licAgreements.isEmpty())
    203     {
    204         UIImportLicenseViewer ilv(this);
    205         for (int i = 0; i < licAgreements.size(); ++ i)
    206         {
    207             const QPair <QString, QString> &lic = licAgreements.at(i);
    208             ilv.setContents(lic.first, lic.second);
    209             if (ilv.exec() == QDialog::Rejected)
    210                 return false;
    211         }
    212     }
    213     /* Now import all virtual systems: */
    214     return pImportApplianceWidget->import();
     199    /* Check whether there was cloud source selected: */
     200    const bool fIsSourceCloudOne = field("isSourceCloudOne").toBool();
     201    if (fIsSourceCloudOne)
     202    {
     203        /* Acquire prepared appliance: */
     204        CAppliance comAppliance = field("appliance").value<CAppliance>();
     205        AssertReturn(!comAppliance.isNull(), false);
     206
     207        /* No options for cloud VMs for now: */
     208        QVector<KImportOptions> options;
     209
     210        /* Initiate import porocedure: */
     211        CProgress comProgress = comAppliance.ImportMachines(options);
     212
     213        /* Show error message if necessary: */
     214        if (!comAppliance.isOk())
     215            msgCenter().cannotImportAppliance(comAppliance, this);
     216        else
     217        {
     218            /* Show "Import appliance" progress: */
     219            msgCenter().showModalProgressDialog(comProgress, tr("Importing Appliance ..."), ":/progress_import_90px.png", this, 0);
     220            if (!comProgress.GetCanceled())
     221            {
     222                /* Show error message if necessary: */
     223                if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     224                    msgCenter().cannotImportAppliance(comProgress, comAppliance.GetPath(), this);
     225                else
     226                    return true;
     227            }
     228        }
     229
     230        /* Failure by default: */
     231        return false;
     232    }
     233    else
     234    {
     235        /* Get import appliance widget: */
     236        UIApplianceImportEditorWidget *pImportApplianceWidget = field("applianceWidget").value<ImportAppliancePointer>();
     237        /* Make sure the final values are puted back: */
     238        pImportApplianceWidget->prepareImport();
     239        /* Check if there are license agreements the user must confirm: */
     240        QList < QPair <QString, QString> > licAgreements = pImportApplianceWidget->licenseAgreements();
     241        if (!licAgreements.isEmpty())
     242        {
     243            UIImportLicenseViewer ilv(this);
     244            for (int i = 0; i < licAgreements.size(); ++ i)
     245            {
     246                const QPair <QString, QString> &lic = licAgreements.at(i);
     247                ilv.setContents(lic.first, lic.second);
     248                if (ilv.exec() == QDialog::Rejected)
     249                    return false;
     250            }
     251        }
     252        /* Now import all virtual systems: */
     253        return pImportApplianceWidget->import();
     254    }
    215255}
    216256
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