VirtualBox

Changeset 79256 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jun 20, 2019 1:40:17 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9495: New Cloud VM wizard initial implementation.

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

Legend:

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

    r79044 r79256  
    7979#include "CHostNetworkInterface.h"
    8080#include "CVFSExplorer.h"
     81#include "CVirtualSystemDescription.h"
    8182#include "CVirtualSystemDescriptionForm.h"
    8283#ifdef VBOX_WITH_DRAG_AND_DROP
     
    17021703}
    17031704
     1705void UIMessageCenter::cannotCreateCloudMachine(const CCloudClient &comClient, QWidget *pParent /* = 0 */) const
     1706{
     1707    error(pParent, MessageType_Error,
     1708          tr("Failed to create cloud machine."),
     1709          UIErrorString::formatErrorInfo(comClient));
     1710}
     1711
     1712void UIMessageCenter::cannotCreateCloudMachine(const CProgress &comProgress, QWidget *pParent /* = 0 */) const
     1713{
     1714    error(pParent, MessageType_Error,
     1715          tr("Failed to create cloud machine."),
     1716          UIErrorString::formatErrorInfo(comProgress));
     1717}
     1718
    17041719void UIMessageCenter::cannotAcquireCloudClientParameter(const CCloudClient &comClient, QWidget *pParent /* = 0 */) const
    17051720{
     
    19231938    error(pParent, MessageType_Critical, tr("<p>Cannot create a virtual system description.</p>"),
    19241939          UIErrorString::formatErrorInfo(comAppliance));
     1940}
     1941
     1942void UIMessageCenter::cannotAddVirtualSystemDescriptionValue(const CVirtualSystemDescription &comDescription,
     1943                                                             QWidget *pParent /* = 0 */) const
     1944{
     1945    error(pParent, MessageType_Critical, tr("<p>Cannot add a virtual system description value.</p>"),
     1946          UIErrorString::formatErrorInfo(comDescription));
    19251947}
    19261948
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r79044 r79256  
    378378    void cannotAssignCloudProfileParameter(const CCloudProfile &comProfile, QWidget *pParent = 0) const;
    379379    void cannotCreateCloudClient(const CCloudProfile &comProfile, QWidget *pParent = 0) const;
     380    void cannotCreateCloudMachine(const CCloudClient &comClient, QWidget *pParent = 0) const;
     381    void cannotCreateCloudMachine(const CProgress &comProgress, QWidget *pParent = 0) const;
    380382    void cannotAcquireCloudClientParameter(const CCloudClient &comClient, QWidget *pParent = 0) const;
    381383    void cannotAcquireCloudClientParameter(const CProgress &comProgress, QWidget *pParent = 0) const;
     
    408410    void cannotCreateVirtualSystemDescription(const CAppliance &comAppliance, QWidget *pParent = 0) const;
    409411    void cannotAcquireVirtualSystemDescription(const CAppliance &comAppliance, QWidget *pParent = 0) const;
     412    void cannotAddVirtualSystemDescriptionValue(const CVirtualSystemDescription &comDescription, QWidget *pParent = 0) const;
    410413    void cannotAcquireVirtualSystemDescriptionFormProperty(const CVirtualSystemDescriptionForm &comForm, QWidget *pParent = 0) const;
    411414    void cannotImportAppliance(CAppliance &appliance, QWidget *pParent = 0) const;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVM.cpp

    r79250 r79256  
    2727
    2828
    29 UIWizardNewCloudVM::UIWizardNewCloudVM(QWidget *pParent, bool fImportFromOCIByDefault)
     29UIWizardNewCloudVM::UIWizardNewCloudVM(QWidget *pParent)
    3030    : UIWizard(pParent, WizardType_NewCloudVM)
    31     , m_fImportFromOCIByDefault(fImportFromOCIByDefault)
    3231{
    3332#ifndef VBOX_WS_MAC
     
    4746        case WizardMode_Basic:
    4847        {
    49             setPage(Page1, new UIWizardNewCloudVMPageBasic1(m_fImportFromOCIByDefault));
     48            setPage(Page1, new UIWizardNewCloudVMPageBasic1);
    5049            setPage(Page2, new UIWizardNewCloudVMPageBasic2);
    5150            break;
     
    5352        case WizardMode_Expert:
    5453        {
    55             setPage(PageExpert, new UIWizardNewCloudVMPageExpert(m_fImportFromOCIByDefault));
     54            setPage(PageExpert, new UIWizardNewCloudVMPageExpert);
    5655            break;
    5756        }
     
    6665}
    6766
    68 bool UIWizardNewCloudVM::importAppliance()
     67bool UIWizardNewCloudVM::createCloudVM()
    6968{
    70     /* Acquire prepared appliance: */
    71     CAppliance comAppliance = field("appliance").value<CAppliance>();
    72     AssertReturn(!comAppliance.isNull(), false);
     69    /* Acquire prepared client and description: */
     70    CCloudClient comCloudClient = field("client").value<CCloudClient>();
     71    CVirtualSystemDescription comDescription = field("description").value<CVirtualSystemDescription>();
     72    AssertReturn(comCloudClient.isNotNull() && comDescription.isNotNull(), false);
    7373
    74     /* No options for cloud VMs for now: */
    75     QVector<KImportOptions> options;
    76 
    77     /* Initiate import porocedure: */
    78     CProgress comProgress = comAppliance.ImportMachines(options);
     74    /* Initiate cloud VM creation porocedure: */
     75    CProgress comProgress = comCloudClient.LaunchVM(comDescription);
    7976
    8077    /* Show error message if necessary: */
    81     if (!comAppliance.isOk())
    82         msgCenter().cannotImportAppliance(comAppliance, this);
     78    if (!comCloudClient.isOk())
     79        msgCenter().cannotCreateCloudMachine(comCloudClient, this);
    8380    else
    8481    {
    85         /* Show "Import appliance" progress: */
    86         msgCenter().showModalProgressDialog(comProgress, tr("Importing Appliance ..."), ":/progress_import_90px.png", this, 0);
     82        /* Show "Create Cloud Machine" progress: */
     83        msgCenter().showModalProgressDialog(comProgress, tr("Create Cloud Machine ..."), ":/progress_import_90px.png", this, 0);
    8784        if (!comProgress.GetCanceled())
    8885        {
    8986            /* Show error message if necessary: */
    9087            if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
    91                 msgCenter().cannotImportAppliance(comProgress, comAppliance.GetPath(), this);
     88                msgCenter().cannotCreateCloudMachine(comProgress, this);
    9289            else
    9390                return true;
     
    105102
    106103    /* Translate wizard: */
    107     setWindowTitle(tr("Import Virtual Appliance"));
    108     setButtonText(QWizard::FinishButton, tr("Import"));
     104    setWindowTitle(tr("Create Cloud Virtual Machine"));
     105    setButtonText(QWizard::FinishButton, tr("Create"));
    109106}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVM.h

    r79244 r79256  
    2525#include "UIWizard.h"
    2626
    27 /** Import Appliance wizard. */
     27/** New Cloud VM wizard. */
    2828class UIWizardNewCloudVM : public UIWizard
    2929{
     
    4545    };
    4646
    47     /** Constructs import appliance wizard passing @a pParent to the base-class. */
    48     UIWizardNewCloudVM(QWidget *pParent, bool fImportFromOCIByDefault);
     47    /** Constructs new cloud vm wizard passing @a pParent to the base-class. */
     48    UIWizardNewCloudVM(QWidget *pParent);
    4949
    5050    /** Prepares all. */
    5151    virtual void prepare() /* override */;
    5252
    53     /** Imports appliance. */
    54     bool importAppliance();
     53    /** Create cloud VM. */
     54    bool createCloudVM();
    5555
    5656protected:
     
    5858    /** Handles translation event. */
    5959    virtual void retranslateUi() /* override */;
    60 
    61 private:
    62 
    63     /** Holds whether default source should be Import from OCI. */
    64     bool  m_fImportFromOCIByDefault;
    6560};
    6661
    67 /** Safe pointer to appliance wizard. */
     62/** Safe pointer to new cloud vm wizard. */
    6863typedef QPointer<UIWizardNewCloudVM> UISafePointerWizardNewCloudVM;
    6964
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageBasic1.cpp

    r79247 r79256  
    3535
    3636/* COM includes: */
     37#include "CAppliance.h"
    3738#include "CStringArray.h"
    38 #include "CVirtualSystemDescription.h"
    3939
    4040
     
    4343*********************************************************************************************************************************/
    4444
    45 UIWizardNewCloudVMPage1::UIWizardNewCloudVMPage1(bool fImportFromOCIByDefault)
    46     : m_fImportFromOCIByDefault(fImportFromOCIByDefault)
    47     , m_fPolished(false)
    48     , m_pSourceLayout(0)
    49     , m_pSourceLabel(0)
    50     , m_pSourceComboBox(0)
     45UIWizardNewCloudVMPage1::UIWizardNewCloudVMPage1()
     46    : m_fPolished(false)
     47    , m_pDestinationLayout(0)
     48    , m_pDestinationLabel(0)
     49    , m_pDestinationComboBox(0)
    5150    , m_pCloudContainerLayout(0)
    5251    , m_pAccountLabel(0)
     
    5453    , m_pAccountToolButton(0)
    5554    , m_pAccountPropertyTable(0)
    56     , m_pAccountInstanceLabel(0)
    57     , m_pAccountInstanceList(0)
    58 {
    59 }
    60 
    61 void UIWizardNewCloudVMPage1::populateSources()
     55    , m_pAccountImageLabel(0)
     56    , m_pAccountImageList(0)
     57{
     58}
     59
     60void UIWizardNewCloudVMPage1::populateDestinations()
    6261{
    6362    /* To be executed just once, so combo should be empty: */
    64     AssertReturnVoid(m_pSourceComboBox->count() == 0);
    65 
    66     /* Do we have OCI source? */
     63    AssertReturnVoid(m_pDestinationComboBox->count() == 0);
     64
     65    /* Do we have OCI destination? */
    6766    bool fOCIPresent = false;
    6867
     
    9594
    9695            /* Compose empty item, fill it's data: */
    97             m_pSourceComboBox->addItem(QString());
    98             m_pSourceComboBox->setItemData(m_pSourceComboBox->count() - 1, comProvider.GetId(),        SourceData_ID);
    99             m_pSourceComboBox->setItemData(m_pSourceComboBox->count() - 1, comProvider.GetName(),      SourceData_Name);
    100             m_pSourceComboBox->setItemData(m_pSourceComboBox->count() - 1, comProvider.GetShortName(), SourceData_ShortName);
    101             m_pSourceComboBox->setItemData(m_pSourceComboBox->count() - 1, true,                       SourceData_IsItCloudFormat);
    102             if (m_pSourceComboBox->itemData(m_pSourceComboBox->count() - 1, SourceData_ShortName).toString() == "OCI")
     96            m_pDestinationComboBox->addItem(QString());
     97            m_pDestinationComboBox->setItemData(m_pDestinationComboBox->count() - 1, comProvider.GetId(),        DestinationData_ID);
     98            m_pDestinationComboBox->setItemData(m_pDestinationComboBox->count() - 1, comProvider.GetName(),      DestinationData_Name);
     99            m_pDestinationComboBox->setItemData(m_pDestinationComboBox->count() - 1, comProvider.GetShortName(), DestinationData_ShortName);
     100            if (m_pDestinationComboBox->itemData(m_pDestinationComboBox->count() - 1, DestinationData_ShortName).toString() == "OCI")
    103101                fOCIPresent = true;
    104102        }
     
    107105
    108106    /* Set default: */
    109     if (m_fImportFromOCIByDefault && fOCIPresent)
    110         setSource("OCI");
     107    if (fOCIPresent)
     108        setDestination("OCI");
    111109}
    112110
     
    127125
    128126    /* If provider chosen: */
    129     if (!sourceId().isNull())
     127    if (!destinationId().isNull())
    130128    {
    131129        /* Main API request sequence, can be interrupted after any step: */
     
    133131        {
    134132            /* (Re)initialize Cloud Provider: */
    135             m_comCloudProvider = m_comCloudProviderManager.GetProviderById(sourceId());
     133            m_comCloudProvider = m_comCloudProviderManager.GetProviderById(destinationId());
    136134            if (!m_comCloudProviderManager.isOk())
    137135            {
    138                 msgCenter().cannotFindCloudProvider(m_comCloudProviderManager, sourceId());
     136                msgCenter().cannotFindCloudProvider(m_comCloudProviderManager, destinationId());
    139137                break;
    140138            }
     
    271269}
    272270
    273 void UIWizardNewCloudVMPage1::populateAccountInstances()
     271void UIWizardNewCloudVMPage1::populateAccountImages()
    274272{
    275273    /* Block signals while updating: */
    276     m_pAccountInstanceList->blockSignals(true);
     274    m_pAccountImageList->blockSignals(true);
    277275
    278276    /* Clear list initially: */
    279     m_pAccountInstanceList->clear();
     277    m_pAccountImageList->clear();
    280278    /* Clear Cloud Client: */
    281279    m_comCloudClient = CCloudClient();
     
    295293            }
    296294
    297             /* Gather VM names, ids and states.
    298              * Currently we are interested in Running and Stopped VMs only. */
     295            /* Gather image names, ids and states.
     296             * Currently we are interested in Available images only. */
    299297            CStringArray comNames;
    300298            CStringArray comIDs;
    301             const QVector<KCloudMachineState> cloudMachineStates  = QVector<KCloudMachineState>()
    302                                                                  << KCloudMachineState_Running
    303                                                                  << KCloudMachineState_Stopped;
    304 
    305             /* Ask for cloud VMs: */
    306             CProgress comProgress = m_comCloudClient.ListInstances(cloudMachineStates, comNames, comIDs);
     299            const QVector<KCloudImageState> cloudImageStates  = QVector<KCloudImageState>()
     300                                                             << KCloudImageState_Available;
     301
     302            /* Ask for cloud custom images: */
     303            CProgress comProgress = m_comCloudClient.ListImages(cloudImageStates, comNames, comIDs);
    307304            if (!m_comCloudClient.isOk())
    308305            {
     
    311308            }
    312309
    313             /* Show "Acquire cloud instances" progress: */
    314             msgCenter().showModalProgressDialog(comProgress, UIWizardNewCloudVM::tr("Acquire cloud instances..."),
     310            /* Show "Acquire cloud images" progress: */
     311            msgCenter().showModalProgressDialog(comProgress, UIWizardNewCloudVM::tr("Acquire cloud images..."),
    315312                                                ":/progress_reading_appliance_90px.png", 0, 0);
    316313            if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     
    326323            {
    327324                /* Create list item: */
    328                 QListWidgetItem *pItem = new QListWidgetItem(names.at(i), m_pAccountInstanceList);
     325                QListWidgetItem *pItem = new QListWidgetItem(names.at(i), m_pAccountImageList);
    329326                if (pItem)
    330327                {
     
    335332
    336333            /* Choose the 1st one by default if possible: */
    337             if (m_pAccountInstanceList->count())
    338                 m_pAccountInstanceList->setCurrentRow(0);
     334            if (m_pAccountImageList->count())
     335                m_pAccountImageList->setCurrentRow(0);
    339336        }
    340337        while (0);
     
    342339
    343340    /* Unblock signals after update: */
    344     m_pAccountInstanceList->blockSignals(false);
     341    m_pAccountImageList->blockSignals(false);
    345342}
    346343
    347344void UIWizardNewCloudVMPage1::populateFormProperties()
    348345{
    349     /* Clear appliance: */
    350     m_comAppliance = CAppliance();
    351     /* Clear form properties: */
     346    /* Clear description & form properties: */
     347    m_comVSD = CVirtualSystemDescription();
    352348    m_comVSDForm = CVirtualSystemDescriptionForm();
    353349
     
    367363            }
    368364
    369             /* Remember appliance: */
    370             m_comAppliance = comAppliance;
    371 
    372             /* Read cloud instance info: */
    373             CProgress comReadProgress = m_comAppliance.Read(QString("OCI://%1/%2").arg(profileName(), machineId()));
    374             if (!m_comAppliance.isOk())
    375             {
    376                 msgCenter().cannotImportAppliance(m_comAppliance);
    377                 break;
    378             }
    379 
    380             /* Show "Read appliance" progress: */
    381             msgCenter().showModalProgressDialog(comReadProgress, UIWizardNewCloudVM::tr("Read appliance..."),
    382                                                 ":/progress_reading_appliance_90px.png", 0, 0);
    383             if (!comReadProgress.isOk() || comReadProgress.GetResultCode() != 0)
    384             {
    385                 msgCenter().cannotImportAppliance(comReadProgress, m_comAppliance.GetPath());
     365            /* Create virtual system description: */
     366            comAppliance.CreateVirtualSystemDescriptions(1);
     367            if (!comAppliance.isOk())
     368            {
     369                msgCenter().cannotCreateVirtualSystemDescription(comAppliance);
    386370                break;
    387371            }
    388372
    389373            /* Acquire virtual system description: */
    390             QVector<CVirtualSystemDescription> descriptions = m_comAppliance.GetVirtualSystemDescriptions();
    391             if (!m_comAppliance.isOk())
    392             {
    393                 msgCenter().cannotAcquireVirtualSystemDescription(m_comAppliance);
     374            QVector<CVirtualSystemDescription> descriptions = comAppliance.GetVirtualSystemDescriptions();
     375            if (!comAppliance.isOk())
     376            {
     377                msgCenter().cannotAcquireVirtualSystemDescription(comAppliance);
    394378                break;
    395379            }
     
    397381            /* Make sure there is at least one virtual system description created: */
    398382            AssertReturnVoid(!descriptions.isEmpty());
    399             CVirtualSystemDescription comDescription = descriptions.at(0);
     383            m_comVSD = descriptions.at(0);
     384
     385            /* Add image id to virtual system description: */
     386            m_comVSD.AddDescription(KVirtualSystemDescriptionType_CloudImageId, imageId(), QString());
     387            if (!m_comVSD.isOk())
     388            {
     389                msgCenter().cannotAddVirtualSystemDescriptionValue(m_comVSD);
     390                break;
     391            }
    400392
    401393            /* Read Cloud Client description form: */
    402394            CVirtualSystemDescriptionForm comForm;
    403             CProgress comImportDescriptionFormProgress = m_comCloudClient.GetImportDescriptionForm(comVBox, comDescription, comForm);
     395            CProgress comLaunchDescriptionFormProgress = m_comCloudClient.GetLaunchDescriptionForm(m_comVSD, comForm);
    404396            if (!m_comCloudClient.isOk())
    405397            {
     
    408400            }
    409401
    410             /* Show "Acquire import form" progress: */
    411             msgCenter().showModalProgressDialog(comImportDescriptionFormProgress, UIWizardNewCloudVM::tr("Acquire import form..."),
     402            /* Show "Acquire launch form" progress: */
     403            msgCenter().showModalProgressDialog(comLaunchDescriptionFormProgress, UIWizardNewCloudVM::tr("Acquire launch form..."),
    412404                                                ":/progress_reading_appliance_90px.png", 0, 0);
    413             if (!comImportDescriptionFormProgress.isOk() || comImportDescriptionFormProgress.GetResultCode() != 0)
    414             {
    415                 msgCenter().cannotAcquireCloudClientParameter(comImportDescriptionFormProgress);
     405            if (!comLaunchDescriptionFormProgress.isOk() || comLaunchDescriptionFormProgress.GetResultCode() != 0)
     406            {
     407                msgCenter().cannotAcquireCloudClientParameter(comLaunchDescriptionFormProgress);
    416408                break;
    417409            }
     
    424416}
    425417
    426 void UIWizardNewCloudVMPage1::updateSourceComboToolTip()
    427 {
    428     const int iCurrentIndex = m_pSourceComboBox->currentIndex();
    429     const QString strCurrentToolTip = m_pSourceComboBox->itemData(iCurrentIndex, Qt::ToolTipRole).toString();
     418void UIWizardNewCloudVMPage1::updateDestinationComboToolTip()
     419{
     420    const int iCurrentIndex = m_pDestinationComboBox->currentIndex();
     421    const QString strCurrentToolTip = m_pDestinationComboBox->itemData(iCurrentIndex, Qt::ToolTipRole).toString();
    430422    AssertMsg(!strCurrentToolTip.isEmpty(), ("Data not found!"));
    431     m_pSourceComboBox->setToolTip(strCurrentToolTip);
     423    m_pDestinationComboBox->setToolTip(strCurrentToolTip);
    432424}
    433425
     
    464456}
    465457
    466 void UIWizardNewCloudVMPage1::setSource(const QString &strSource)
    467 {
    468     const int iIndex = m_pSourceComboBox->findData(strSource, SourceData_ShortName);
     458void UIWizardNewCloudVMPage1::setDestination(const QString &strDestination)
     459{
     460    const int iIndex = m_pDestinationComboBox->findData(strDestination, DestinationData_ShortName);
    469461    AssertMsg(iIndex != -1, ("Data not found!"));
    470     m_pSourceComboBox->setCurrentIndex(iIndex);
    471 }
    472 
    473 QString UIWizardNewCloudVMPage1::source() const
    474 {
    475     const int iIndex = m_pSourceComboBox->currentIndex();
    476     return m_pSourceComboBox->itemData(iIndex, SourceData_ShortName).toString();
    477 }
    478 
    479 QUuid UIWizardNewCloudVMPage1::sourceId() const
    480 {
    481     const int iIndex = m_pSourceComboBox->currentIndex();
    482     return m_pSourceComboBox->itemData(iIndex, SourceData_ID).toUuid();
     462    m_pDestinationComboBox->setCurrentIndex(iIndex);
     463}
     464
     465QString UIWizardNewCloudVMPage1::destination() const
     466{
     467    const int iIndex = m_pDestinationComboBox->currentIndex();
     468    return m_pDestinationComboBox->itemData(iIndex, DestinationData_ShortName).toString();
     469}
     470
     471QUuid UIWizardNewCloudVMPage1::destinationId() const
     472{
     473    const int iIndex = m_pDestinationComboBox->currentIndex();
     474    return m_pDestinationComboBox->itemData(iIndex, DestinationData_ID).toUuid();
    483475}
    484476
     
    489481}
    490482
    491 QString UIWizardNewCloudVMPage1::machineId() const
    492 {
    493     QListWidgetItem *pItem = m_pAccountInstanceList->currentItem();
     483QString UIWizardNewCloudVMPage1::imageId() const
     484{
     485    QListWidgetItem *pItem = m_pAccountImageList->currentItem();
    494486    return pItem ? pItem->data(Qt::UserRole).toString() : QString();
    495487}
    496488
    497 CCloudProfile UIWizardNewCloudVMPage1::profile() const
    498 {
    499     return m_comCloudProfile;
    500 }
    501 
    502 CAppliance UIWizardNewCloudVMPage1::appliance() const
    503 {
    504     return m_comAppliance;
     489CCloudClient UIWizardNewCloudVMPage1::client() const
     490{
     491    return m_comCloudClient;
     492}
     493
     494CVirtualSystemDescription UIWizardNewCloudVMPage1::vsd() const
     495{
     496    return m_comVSD;
    505497}
    506498
     
    515507*********************************************************************************************************************************/
    516508
    517 UIWizardNewCloudVMPageBasic1::UIWizardNewCloudVMPageBasic1(bool fImportFromOCIByDefault)
    518     : UIWizardNewCloudVMPage1(fImportFromOCIByDefault)
    519     , m_pLabelMain(0)
     509UIWizardNewCloudVMPageBasic1::UIWizardNewCloudVMPageBasic1()
     510    : m_pLabelMain(0)
    520511    , m_pLabelDescription(0)
    521512{
     
    532523        }
    533524
    534         /* Create source layout: */
    535         m_pSourceLayout = new QGridLayout;
    536         if (m_pSourceLayout)
    537         {
    538             m_pSourceLayout->setColumnStretch(0, 0);
    539             m_pSourceLayout->setColumnStretch(1, 1);
    540 
    541             /* Create source label: */
    542             m_pSourceLabel = new QLabel(this);
    543             if (m_pSourceLabel)
     525        /* Create destination layout: */
     526        m_pDestinationLayout = new QGridLayout;
     527        if (m_pDestinationLayout)
     528        {
     529            m_pDestinationLayout->setColumnStretch(0, 0);
     530            m_pDestinationLayout->setColumnStretch(1, 1);
     531
     532            /* Create destination label: */
     533            m_pDestinationLabel = new QLabel(this);
     534            if (m_pDestinationLabel)
    544535            {
    545536                /* Add into layout: */
    546                 m_pSourceLayout->addWidget(m_pSourceLabel, 0, 0, Qt::AlignRight);
    547             }
    548             /* Create source selector: */
    549             m_pSourceComboBox = new QIComboBox(this);
    550             if (m_pSourceComboBox)
    551             {
    552                 m_pSourceLabel->setBuddy(m_pSourceComboBox);
     537                m_pDestinationLayout->addWidget(m_pDestinationLabel, 0, 0, Qt::AlignRight);
     538            }
     539            /* Create destination selector: */
     540            m_pDestinationComboBox = new QIComboBox(this);
     541            if (m_pDestinationComboBox)
     542            {
     543                m_pDestinationLabel->setBuddy(m_pDestinationComboBox);
    553544
    554545                /* Add into layout: */
    555                 m_pSourceLayout->addWidget(m_pSourceComboBox, 0, 1);
     546                m_pDestinationLayout->addWidget(m_pDestinationComboBox, 0, 1);
    556547            }
    557548
     
    561552            {
    562553                /* Add into layout: */
    563                 m_pSourceLayout->addWidget(m_pLabelDescription, 1, 0, 1, 2);
     554                m_pDestinationLayout->addWidget(m_pLabelDescription, 1, 0, 1, 2);
    564555            }
    565556
    566557            /* Add into layout: */
    567             pMainLayout->addLayout(m_pSourceLayout);
     558            pMainLayout->addLayout(m_pDestinationLayout);
    568559        }
    569560
     
    637628
    638629            /* Create account instance label: */
    639             m_pAccountInstanceLabel = new QLabel(this);
    640             if (m_pAccountInstanceLabel)
     630            m_pAccountImageLabel = new QLabel(this);
     631            if (m_pAccountImageLabel)
    641632            {
    642633                /* Add into layout: */
    643                 m_pCloudContainerLayout->addWidget(m_pAccountInstanceLabel, 2, 0, Qt::AlignRight);
     634                m_pCloudContainerLayout->addWidget(m_pAccountImageLabel, 2, 0, Qt::AlignRight);
    644635            }
    645636            /* Create profile instances table: */
    646             m_pAccountInstanceList = new QListWidget(this);
    647             if (m_pAccountInstanceList)
    648             {
    649                 m_pAccountInstanceLabel->setBuddy(m_pAccountInstanceLabel);
    650                 const QFontMetrics fm(m_pAccountInstanceList->font());
     637            m_pAccountImageList = new QListWidget(this);
     638            if (m_pAccountImageList)
     639            {
     640                m_pAccountImageLabel->setBuddy(m_pAccountImageLabel);
     641                const QFontMetrics fm(m_pAccountImageList->font());
    651642                const int iFontWidth = fm.width('x');
    652643                const int iTotalWidth = 50 * iFontWidth;
    653644                const int iFontHeight = fm.height();
    654645                const int iTotalHeight = 4 * iFontHeight;
    655                 m_pAccountInstanceList->setMinimumSize(QSize(iTotalWidth, iTotalHeight));
    656                 //m_pAccountInstanceList->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    657                 m_pAccountInstanceList->setAlternatingRowColors(true);
     646                m_pAccountImageList->setMinimumSize(QSize(iTotalWidth, iTotalHeight));
     647                //m_pAccountImageList->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
     648                m_pAccountImageList->setAlternatingRowColors(true);
    658649
    659650                /* Add into layout: */
    660                 m_pCloudContainerLayout->addWidget(m_pAccountInstanceList, 2, 1, 2, 1);
     651                m_pCloudContainerLayout->addWidget(m_pAccountImageList, 2, 1, 2, 1);
    661652            }
    662653
     
    666657    }
    667658
    668     /* Populate sources: */
    669     populateSources();
     659    /* Populate destinations: */
     660    populateDestinations();
    670661
    671662    /* Setup connections: */
    672663    if (gpManager)
    673664        connect(gpManager, &UIVirtualBoxManager::sigCloudProfileManagerChange,
    674                 this, &UIWizardNewCloudVMPageBasic1::sltHandleSourceChange);
    675     connect(m_pSourceComboBox, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::activated),
    676             this, &UIWizardNewCloudVMPageBasic1::sltHandleSourceChange);
     665                this, &UIWizardNewCloudVMPageBasic1::sltHandleDestinationChange);
     666    connect(m_pDestinationComboBox, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::activated),
     667            this, &UIWizardNewCloudVMPageBasic1::sltHandleDestinationChange);
    677668    connect(m_pAccountComboBox, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::currentIndexChanged),
    678669            this, &UIWizardNewCloudVMPageBasic1::sltHandleAccountComboChange);
    679670    connect(m_pAccountToolButton, &QIToolButton::clicked,
    680671            this, &UIWizardNewCloudVMPageBasic1::sltHandleAccountButtonClick);
    681     connect(m_pAccountInstanceList, &QListWidget::currentRowChanged,
     672    connect(m_pAccountImageList, &QListWidget::currentRowChanged,
    682673            this, &UIWizardNewCloudVMPageBasic1::completeChanged);
    683674
    684675    /* Register fields: */
    685     registerField("source", this, "source");
    686     registerField("profile", this, "profile");
    687     registerField("appliance", this, "appliance");
     676    registerField("client", this, "client");
     677    registerField("vsd", this, "vsd");
    688678    registerField("vsdForm", this, "vsdForm");
    689     registerField("machineId", this, "machineId");
    690679}
    691680
     
    713702{
    714703    /* Translate page: */
    715     setTitle(UIWizardNewCloudVM::tr("Appliance to import"));
     704    setTitle(UIWizardNewCloudVM::tr("Destination to create"));
    716705
    717706    /* Translate main label: */
    718     m_pLabelMain->setText(UIWizardNewCloudVM::tr("Please choose the source to import appliance from.  This can be "
    719                                                  "one of known cloud service providers to import cloud VM from."));
    720 
    721     /* Translate source label: */
    722     m_pSourceLabel->setText(tr("&Source:"));
    723     /* Translate received values of Source combo-box.
     707    m_pLabelMain->setText(UIWizardNewCloudVM::tr("Please choose the destination to create cloud virtual machine in.  This can "
     708                                                 "be one of known cloud service providers below."));
     709
     710    /* Translate destination label: */
     711    m_pDestinationLabel->setText(tr("&Destination:"));
     712    /* Translate received values of Destination combo-box.
    724713     * We are enumerating starting from 0 for simplicity: */
    725     for (int i = 0; i < m_pSourceComboBox->count(); ++i)
    726     {
    727         m_pSourceComboBox->setItemText(i, m_pSourceComboBox->itemData(i, SourceData_Name).toString());
    728         m_pSourceComboBox->setItemData(i, UIWizardNewCloudVM::tr("Import from cloud service provider."), Qt::ToolTipRole);
     714    for (int i = 0; i < m_pDestinationComboBox->count(); ++i)
     715    {
     716        m_pDestinationComboBox->setItemText(i, m_pDestinationComboBox->itemData(i, DestinationData_Name).toString());
     717        m_pDestinationComboBox->setItemData(i, UIWizardNewCloudVM::tr("Create VM for cloud service provider."), Qt::ToolTipRole);
    729718    }
    730719
    731720    /* Translate description label: */
    732721    m_pLabelDescription->setText(UIWizardNewCloudVM::tr("<p>Please choose one of cloud service accounts you have registered to "
    733                                                         "import virtual machine from.  Corresponding machines list will be "
    734                                                         "updated.  To continue, select one of machines to import below.</p>"));
     722                                                        "create virtual machine for.  Existing custom images list will be "
     723                                                        "updated.  To continue, select one of custom images to create virtual "
     724                                                        "machine on the basis of it.</p>"));
    735725
    736726    /* Translate cloud stuff: */
    737727    m_pAccountLabel->setText(UIWizardNewCloudVM::tr("&Account:"));
    738     m_pAccountInstanceLabel->setText(UIWizardNewCloudVM::tr("&Machines:"));
     728    m_pAccountImageLabel->setText(UIWizardNewCloudVM::tr("&Images:"));
    739729
    740730    /* Adjust label widths: */
    741731    QList<QWidget*> labels;
    742     labels << m_pSourceLabel;
     732    labels << m_pDestinationLabel;
    743733    labels << m_pAccountLabel;
    744     labels << m_pAccountInstanceLabel;
     734    labels << m_pAccountImageLabel;
    745735    int iMaxWidth = 0;
    746736    foreach (QWidget *pLabel, labels)
    747737        iMaxWidth = qMax(iMaxWidth, pLabel->minimumSizeHint().width());
    748     m_pSourceLayout->setColumnMinimumWidth(0, iMaxWidth);
     738    m_pDestinationLayout->setColumnMinimumWidth(0, iMaxWidth);
    749739    m_pCloudContainerLayout->setColumnMinimumWidth(0, iMaxWidth);
    750740
    751741    /* Update tool-tips: */
    752     updateSourceComboToolTip();
     742    updateDestinationComboToolTip();
    753743    updateAccountPropertyTableToolTips();
    754744}
     
    759749    if (!m_fPolished)
    760750    {
    761         QMetaObject::invokeMethod(this, "sltHandleSourceChange", Qt::QueuedConnection);
     751        QMetaObject::invokeMethod(this, "sltHandleDestinationChange", Qt::QueuedConnection);
    762752        m_fPolished = true;
    763753    }
     
    773763
    774764    /* Check cloud settings: */
    775     fResult =    !m_comCloudProfile.isNull()
    776               && !m_comCloudClient.isNull()
    777               && !machineId().isNull();
     765    fResult =    client().isNotNull()
     766              && !imageId().isNull();
    778767
    779768    /* Return result: */
     
    786775    bool fResult = true;
    787776
    788     /* Create appliance & populate form properties: */
     777    /* Populate vsd and form properties: */
    789778    populateFormProperties();
    790779    /* And make sure they are not NULL: */
    791     fResult =    m_comAppliance.isNotNull()
    792               && m_comVSDForm.isNotNull();
     780    fResult =    vsd().isNotNull()
     781              && vsdForm().isNotNull();
    793782
    794783    /* Return result: */
     
    796785}
    797786
    798 void UIWizardNewCloudVMPageBasic1::sltHandleSourceChange()
     787void UIWizardNewCloudVMPageBasic1::sltHandleDestinationChange()
    799788{
    800789    /* Update tool-tip: */
    801     updateSourceComboToolTip();
     790    updateDestinationComboToolTip();
    802791
    803792    /* Refresh required settings: */
    804793    populateAccounts();
    805794    populateAccountProperties();
    806     populateAccountInstances();
     795    populateAccountImages();
    807796    emit completeChanged();
    808797}
     
    812801    /* Refresh required settings: */
    813802    populateAccountProperties();
    814     populateAccountInstances();
     803    populateAccountImages();
    815804    emit completeChanged();
    816805}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageBasic1.h

    r79247 r79256  
    2727/* COM includes: */
    2828#include "COMEnums.h"
    29 #include "CAppliance.h"
    3029#include "CCloudClient.h"
    3130#include "CCloudProfile.h"
    3231#include "CCloudProvider.h"
    3332#include "CCloudProviderManager.h"
     33#include "CVirtualSystemDescription.h"
    3434#include "CVirtualSystemDescriptionForm.h"
    3535
     
    4343class QIToolButton;
    4444
    45 /** Source combo data fields. */
     45/** Destination combo data fields. */
    4646enum
    4747{
    48     SourceData_ID              = Qt::UserRole + 1,
    49     SourceData_Name            = Qt::UserRole + 2,
    50     SourceData_ShortName       = Qt::UserRole + 3,
    51     SourceData_IsItCloudFormat = Qt::UserRole + 4
     48    DestinationData_ID              = Qt::UserRole + 1,
     49    DestinationData_Name            = Qt::UserRole + 2,
     50    DestinationData_ShortName       = Qt::UserRole + 3
    5251};
    5352
     
    5857};
    5958
    60 /** UIWizardPageBase extension for 1st page of the Import Appliance wizard. */
     59/** UIWizardPageBase extension for 1st page of the New Cloud VM wizard. */
    6160class UIWizardNewCloudVMPage1 : public UIWizardPageBase
    6261{
     
    6463
    6564    /** Constructs 1st page base. */
    66     UIWizardNewCloudVMPage1(bool fImportFromOCIByDefault);
     65    UIWizardNewCloudVMPage1();
    6766
    68     /** Populates sources. */
    69     void populateSources();
     67    /** Populates destinations. */
     68    void populateDestinations();
    7069    /** Populates accounts. */
    7170    void populateAccounts();
    7271    /** Populates account properties. */
    7372    void populateAccountProperties();
    74     /** Populates account instances. */
    75     void populateAccountInstances();
     73    /** Populates account images. */
     74    void populateAccountImages();
    7675    /** Populates form properties. */
    7776    void populateFormProperties();
    7877
    79     /** Updates source combo tool-tips. */
    80     void updateSourceComboToolTip();
     78    /** Updates destination combo tool-tips. */
     79    void updateDestinationComboToolTip();
    8180    /** Updates account property table tool-tips. */
    8281    void updateAccountPropertyTableToolTips();
     
    8483    void adjustAccountPropertyTable();
    8584
    86     /** Defines @a strSource. */
    87     void setSource(const QString &strSource);
    88     /** Returns source. */
    89     QString source() const;
     85    /** Defines @a strDestination. */
     86    void setDestination(const QString &strDestination);
     87    /** Returns destination. */
     88    QString destination() const;
     89    /** Returns destination ID. */
     90    QUuid destinationId() const;
    9091
    91     /** Returns source ID. */
    92     QUuid sourceId() const;
    9392    /** Returns profile name. */
    9493    QString profileName() const;
    95     /** Returns machine ID. */
    96     QString machineId() const;
    97     /** Returns Cloud Profile object. */
    98     CCloudProfile profile() const;
    99     /** Returns Appliance object. */
    100     CAppliance appliance() const;
     94    /** Returns image ID. */
     95    QString imageId() const;
     96    /** Returns Cloud Client. */
     97    CCloudClient client() const;
     98    /** Returns Virtual System Description object. */
     99    CVirtualSystemDescription vsd() const;
    101100    /** Returns Virtual System Description Form object. */
    102101    CVirtualSystemDescriptionForm vsdForm() const;
    103102
    104     /** Holds whether default source should be Import from OCI. */
    105     bool  m_fImportFromOCIByDefault;
    106103    /** Holds whether starting page was polished. */
    107104    bool  m_fPolished;
     
    115112    /** Holds the Cloud Client object reference. */
    116113    CCloudClient                   m_comCloudClient;
    117     /** Holds the Appliance object reference. */
    118     CAppliance                     m_comAppliance;
     114    /** Holds the Virtual System Description object reference. */
     115    CVirtualSystemDescription      m_comVSD;
    119116    /** Holds the Virtual System Description Form object reference. */
    120117    CVirtualSystemDescriptionForm  m_comVSDForm;
    121118
    122     /** Holds the source layout instance. */
    123     QGridLayout *m_pSourceLayout;
    124     /** Holds the source type label instance. */
    125     QLabel      *m_pSourceLabel;
    126     /** Holds the source type combo-box instance. */
    127     QIComboBox  *m_pSourceComboBox;
     119    /** Holds the destination layout instance. */
     120    QGridLayout *m_pDestinationLayout;
     121    /** Holds the destination type label instance. */
     122    QLabel      *m_pDestinationLabel;
     123    /** Holds the destination type combo-box instance. */
     124    QIComboBox  *m_pDestinationComboBox;
    128125
    129126    /** Holds the cloud container layout instance. */
     
    137134    /** Holds the account property table instance. */
    138135    QTableWidget *m_pAccountPropertyTable;
    139     /** Holds the account instance label instance. */
    140     QLabel       *m_pAccountInstanceLabel;
    141     /** Holds the account instance list instance. */
    142     QListWidget  *m_pAccountInstanceList;
     136    /** Holds the account image label instance. */
     137    QLabel       *m_pAccountImageLabel;
     138    /** Holds the account image list instance. */
     139    QListWidget  *m_pAccountImageList;
    143140};
    144141
    145 /** UIWizardPage extension for 1st page of the Import Appliance wizard, extends UIWizardNewCloudVMPage1 as well. */
     142/** UIWizardPage extension for 1st page of the New Cloud VM wizard, extends UIWizardNewCloudVMPage1 as well. */
    146143class UIWizardNewCloudVMPageBasic1 : public UIWizardPage, public UIWizardNewCloudVMPage1
    147144{
    148145    Q_OBJECT;
    149     Q_PROPERTY(QString source READ source WRITE setSource);
    150     Q_PROPERTY(CCloudProfile profile READ profile);
    151     Q_PROPERTY(CAppliance appliance READ appliance);
     146    Q_PROPERTY(CCloudClient client READ client);
     147    Q_PROPERTY(CVirtualSystemDescription vsd READ vsd);
    152148    Q_PROPERTY(CVirtualSystemDescriptionForm vsdForm READ vsdForm);
    153     Q_PROPERTY(QString machineId READ machineId);
    154149
    155150public:
    156151
    157152    /** Constructs 1st basic page. */
    158     UIWizardNewCloudVMPageBasic1(bool fImportFromOCIByDefault);
     153    UIWizardNewCloudVMPageBasic1();
    159154
    160155protected:
     
    177172private slots:
    178173
    179     /** Handles import source change. */
    180     void sltHandleSourceChange();
     174    /** Handles change in destination combo-box. */
     175    void sltHandleDestinationChange();
    181176
    182177    /** Handles change in account combo-box. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageBasic2.cpp

    r79244 r79256  
    8080{
    8181    /* Translate page: */
    82     setTitle(UIWizardNewCloudVM::tr("Appliance settings"));
     82    setTitle(UIWizardNewCloudVM::tr("Cloud Virtual Machine settings"));
    8383
    8484    /* Translate description label: */
    85     m_pLabel->setText(UIWizardNewCloudVM::tr("These are the the suggested settings of the cloud VM import procedure, they are "
    86                                              "influencing the resulting local VM instance.  You can change many of the "
     85    m_pLabel->setText(UIWizardNewCloudVM::tr("These are the the suggested settings of the cloud VM creation procedure, they are "
     86                                             "influencing the resulting cloud VM instance.  You can change many of the "
    8787                                             "properties shown by double-clicking on the items and disable others using the "
    8888                                             "check boxes below."));
     
    111111    Assert(fResult);
    112112
    113     /* Give changed VSD back to appliance: */
     113    /* Give changed VSD back: */
    114114    if (fResult)
    115115    {
     
    120120    }
    121121
    122     /* Try to import appliance: */
     122    /* Try to create cloud VM: */
    123123    if (fResult)
    124         fResult = qobject_cast<UIWizardNewCloudVM*>(wizard())->importAppliance();
     124        fResult = qobject_cast<UIWizardNewCloudVM*>(wizard())->createCloudVM();
    125125
    126126    /* Unlock finish button: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageBasic2.h

    r79244 r79256  
    2929class QIRichTextLabel;
    3030
    31 /** UIWizardPageBase extension for 2nd page of the Import Appliance wizard. */
     31/** UIWizardPageBase extension for 2nd page of the New Cloud VM wizard. */
    3232class UIWizardNewCloudVMPage2 : public UIWizardPageBase
    3333{
     
    4444};
    4545
    46 /** UIWizardPage extension for 2nd page of the Import Appliance wizard, extends UIWizardNewCloudVMPage2 as well. */
     46/** UIWizardPage extension for 2nd page of the New Cloud VM wizard, extends UIWizardNewCloudVMPage2 as well. */
    4747class UIWizardNewCloudVMPageBasic2 : public UIWizardPage, public UIWizardNewCloudVMPage2
    4848{
     
    5151public:
    5252
    53     /** Constructs 2nd basic page.
    54       * @param  strFileName  Brings appliance file name. */
     53    /** Constructs 2nd basic page. */
    5554    UIWizardNewCloudVMPageBasic2();
    5655
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageExpert.cpp

    r79247 r79256  
    3232#include "UIWizardNewCloudVMPageExpert.h"
    3333
    34 /* COM includes: */
    35 #include "CVirtualSystemDescription.h"
    36 
    37 
    38 UIWizardNewCloudVMPageExpert::UIWizardNewCloudVMPageExpert(bool fImportFromOCIByDefault)
    39     : UIWizardNewCloudVMPage1(fImportFromOCIByDefault)
    40     , m_pCntSource(0)
     34
     35UIWizardNewCloudVMPageExpert::UIWizardNewCloudVMPageExpert()
     36    : m_pCntDestination(0)
    4137    , m_pSettingsCnt(0)
    4238{
     
    4541    if (pMainLayout)
    4642    {
    47         /* Create source container: */
    48         m_pCntSource = new QGroupBox(this);
    49         if (m_pCntSource)
     43        /* Create destination container: */
     44        m_pCntDestination = new QGroupBox(this);
     45        if (m_pCntDestination)
    5046        {
    51             /* Create source layout: */
    52             m_pSourceLayout = new QGridLayout(m_pCntSource);
    53             if (m_pSourceLayout)
     47            /* Create destination layout: */
     48            m_pDestinationLayout = new QGridLayout(m_pCntDestination);
     49            if (m_pDestinationLayout)
    5450            {
    55                 /* Create source selector: */
    56                 m_pSourceComboBox = new QIComboBox(m_pCntSource);
    57                 if (m_pSourceComboBox)
     51                /* Create destination selector: */
     52                m_pDestinationComboBox = new QIComboBox(m_pCntDestination);
     53                if (m_pDestinationComboBox)
    5854                {
    5955                    /* Add into layout: */
    60                     m_pSourceLayout->addWidget(m_pSourceComboBox, 0, 0);
     56                    m_pDestinationLayout->addWidget(m_pDestinationComboBox, 0, 0);
    6157                }
    6258
     
    7672
    7773                        /* Create account combo-box: */
    78                         m_pAccountComboBox = new QIComboBox(m_pCntSource);
     74                        m_pAccountComboBox = new QIComboBox(m_pCntDestination);
    7975                        if (m_pAccountComboBox)
    8076                        {
     
    8379                        }
    8480                        /* Create account tool-button: */
    85                         m_pAccountToolButton = new QIToolButton(m_pCntSource);
     81                        m_pAccountToolButton = new QIToolButton(m_pCntDestination);
    8682                        if (m_pAccountToolButton)
    8783                        {
     
    9894
    9995                    /* Create profile property table: */
    100                     m_pAccountPropertyTable = new QTableWidget(m_pCntSource);
     96                    m_pAccountPropertyTable = new QTableWidget(m_pCntDestination);
    10197                    if (m_pAccountPropertyTable)
    10298                    {
     
    118114
    119115                    /* Create profile instances table: */
    120                     m_pAccountInstanceList = new QListWidget(m_pCntSource);
    121                     if (m_pAccountInstanceList)
     116                    m_pAccountImageList = new QListWidget(m_pCntDestination);
     117                    if (m_pAccountImageList)
    122118                    {
    123                         const QFontMetrics fm(m_pAccountInstanceList->font());
     119                        const QFontMetrics fm(m_pAccountImageList->font());
    124120                        const int iFontWidth = fm.width('x');
    125121                        const int iTotalWidth = 50 * iFontWidth;
    126122                        const int iFontHeight = fm.height();
    127123                        const int iTotalHeight = 4 * iFontHeight;
    128                         m_pAccountInstanceList->setMinimumSize(QSize(iTotalWidth, iTotalHeight));
    129                         //m_pAccountInstanceList->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    130                         m_pAccountInstanceList->setAlternatingRowColors(true);
     124                        m_pAccountImageList->setMinimumSize(QSize(iTotalWidth, iTotalHeight));
     125                        //m_pAccountImageList->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
     126                        m_pAccountImageList->setAlternatingRowColors(true);
    131127
    132128                        /* Add into layout: */
    133                         m_pCloudContainerLayout->addWidget(m_pAccountInstanceList, 2, 0);
     129                        m_pCloudContainerLayout->addWidget(m_pAccountImageList, 2, 0);
    134130                    }
    135131
    136132                    /* Add into layout: */
    137                     m_pSourceLayout->addLayout(m_pCloudContainerLayout, 1, 0);
     133                    m_pDestinationLayout->addLayout(m_pCloudContainerLayout, 1, 0);
    138134                }
    139135            }
    140136
    141137            /* Add into layout: */
    142             pMainLayout->addWidget(m_pCntSource);
     138            pMainLayout->addWidget(m_pCntDestination);
    143139        }
    144140
     
    165161    }
    166162
    167     /* Populate sources: */
    168     populateSources();
     163    /* Populate destinations: */
     164    populateDestinations();
    169165
    170166    /* Setup connections: */
    171167    if (gpManager)
    172168        connect(gpManager, &UIVirtualBoxManager::sigCloudProfileManagerChange,
    173                 this, &UIWizardNewCloudVMPageExpert::sltHandleSourceChange);
    174     connect(m_pSourceComboBox, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::activated),
    175             this, &UIWizardNewCloudVMPageExpert::sltHandleSourceChange);
     169                this, &UIWizardNewCloudVMPageExpert::sltHandleDestinationChange);
     170    connect(m_pDestinationComboBox, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::activated),
     171            this, &UIWizardNewCloudVMPageExpert::sltHandleDestinationChange);
    176172    connect(m_pAccountComboBox, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::currentIndexChanged),
    177173            this, &UIWizardNewCloudVMPageExpert::sltHandleAccountComboChange);
    178174    connect(m_pAccountToolButton, &QIToolButton::clicked,
    179175            this, &UIWizardNewCloudVMPageExpert::sltHandleAccountButtonClick);
    180     connect(m_pAccountInstanceList, &QListWidget::currentRowChanged,
     176    connect(m_pAccountImageList, &QListWidget::currentRowChanged,
    181177            this, &UIWizardNewCloudVMPageExpert::sltHandleInstanceListChange);
    182178
    183179    /* Register fields: */
    184     registerField("source", this, "source");
    185     registerField("profile", this, "profile");
    186     registerField("appliance", this, "appliance");
     180    registerField("client", this, "client");
     181    registerField("vsd", this, "vsd");
    187182    registerField("vsdForm", this, "vsdForm");
    188     registerField("machineId", this, "machineId");
    189183}
    190184
     
    211205void UIWizardNewCloudVMPageExpert::retranslateUi()
    212206{
    213     /* Translate appliance container: */
    214     m_pCntSource->setTitle(UIWizardNewCloudVM::tr("Source"));
    215 
    216     /* Translate received values of Source combo-box.
     207    /* Translate destination container: */
     208    m_pCntDestination->setTitle(UIWizardNewCloudVM::tr("Destination"));
     209
     210    /* Translate received values of Destination combo-box.
    217211     * We are enumerating starting from 0 for simplicity: */
    218     for (int i = 0; i < m_pSourceComboBox->count(); ++i)
    219     {
    220         m_pSourceComboBox->setItemText(i, m_pSourceComboBox->itemData(i, SourceData_Name).toString());
    221         m_pSourceComboBox->setItemData(i, UIWizardNewCloudVM::tr("Import from cloud service provider."), Qt::ToolTipRole);
     212    for (int i = 0; i < m_pDestinationComboBox->count(); ++i)
     213    {
     214        m_pDestinationComboBox->setItemText(i, m_pDestinationComboBox->itemData(i, DestinationData_Name).toString());
     215        m_pDestinationComboBox->setItemData(i, UIWizardNewCloudVM::tr("Create VM for cloud service provider."), Qt::ToolTipRole);
    222216    }
    223217
     
    226220
    227221    /* Update tool-tips: */
    228     updateSourceComboToolTip();
     222    updateDestinationComboToolTip();
    229223    updateAccountPropertyTableToolTips();
    230224}
     
    235229    if (!m_fPolished)
    236230    {
    237         QMetaObject::invokeMethod(this, "sltHandleSourceChange", Qt::QueuedConnection);
     231        QMetaObject::invokeMethod(this, "sltHandleDestinationChange", Qt::QueuedConnection);
    238232        m_fPolished = true;
    239233    }
     
    249243
    250244    /* Check cloud settings: */
    251     fResult =    !m_comCloudProfile.isNull()
    252               && !m_comCloudClient.isNull()
    253               && !machineId().isNull()
    254               && !m_comAppliance.isNull()
    255               && !m_comVSDForm.isNull();
     245    fResult =    client().isNotNull()
     246              && !imageId().isNull()
     247              && vsd().isNotNull()
     248              && vsdForm().isNotNull();
    256249
    257250    /* Return result: */
     
    272265    Assert(fResult);
    273266
    274     /* Give changed VSD back to appliance: */
     267    /* Give changed VSD back: */
    275268    if (fResult)
    276269    {
     
    281274    }
    282275
    283     /* Try to import appliance: */
     276    /* Try to create cloud VM: */
    284277    if (fResult)
    285         fResult = qobject_cast<UIWizardNewCloudVM*>(wizard())->importAppliance();
     278        fResult = qobject_cast<UIWizardNewCloudVM*>(wizard())->createCloudVM();
    286279
    287280    /* Unlock finish button: */
     
    292285}
    293286
    294 void UIWizardNewCloudVMPageExpert::sltHandleSourceChange()
     287void UIWizardNewCloudVMPageExpert::sltHandleDestinationChange()
    295288{
    296289    /* Update tool-tip: */
    297     updateSourceComboToolTip();
     290    updateDestinationComboToolTip();
    298291
    299292    /* Refresh required settings: */
    300293    populateAccounts();
    301294    populateAccountProperties();
    302     populateAccountInstances();
     295    populateAccountImages();
    303296    populateFormProperties();
    304297    refreshFormPropertiesTable();
     
    310303    /* Refresh required settings: */
    311304    populateAccountProperties();
    312     populateAccountInstances();
     305    populateAccountImages();
    313306    populateFormProperties();
    314307    refreshFormPropertiesTable();
     
    325318void UIWizardNewCloudVMPageExpert::sltHandleInstanceListChange()
    326319{
     320    /* Refresh required settings: */
    327321    populateFormProperties();
    328322    refreshFormPropertiesTable();
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageExpert.h

    r79244 r79256  
    3535{
    3636    Q_OBJECT;
    37     Q_PROPERTY(QString source READ source WRITE setSource);
    38     Q_PROPERTY(CCloudProfile profile READ profile);
    39     Q_PROPERTY(CAppliance appliance READ appliance);
     37    Q_PROPERTY(CCloudClient client READ client);
     38    Q_PROPERTY(CVirtualSystemDescription vsd READ vsd);
    4039    Q_PROPERTY(CVirtualSystemDescriptionForm vsdForm READ vsdForm);
    41     Q_PROPERTY(QString machineId READ machineId);
    4240
    4341public:
    4442
    45     /** Constructs expert page.
    46       * @param  strFileName  Brings appliance file name. */
    47     UIWizardNewCloudVMPageExpert(bool fImportFromOCIByDefault);
     43    /** Constructs expert page. */
     44    UIWizardNewCloudVMPageExpert();
    4845
    4946protected:
     
    6966private slots:
    7067
    71     /** Handles import source change. */
    72     void sltHandleSourceChange();
     68    /** Handles change in destination combo-box. */
     69    void sltHandleDestinationChange();
    7370
    7471    /** Handles change in account combo-box. */
     
    8279private:
    8380
    84     /** Holds the source container instance. */
    85     QGroupBox *m_pCntSource;
     81    /** Holds the destination container instance. */
     82    QGroupBox *m_pCntDestination;
    8683    /** Holds the settings container instance. */
    8784    QGroupBox *m_pSettingsCnt;
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