VirtualBox

Changeset 78094 in vbox


Ignore:
Timestamp:
Apr 10, 2019 3:12:14 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129950
Message:

FE/Qt: bugref:9434: Import Appliance wizard: 1st basic page: Integrate hidden for now cloud account machine instance control.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance
Files:
2 edited

Legend:

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

    r78087 r78094  
    2020#include <QHeaderView>
    2121#include <QLabel>
     22#include <QListWidget>
    2223#include <QStackedLayout>
    2324#include <QTableWidget>
     
    3738#include "UIWizardImportAppPageBasic2.h"
    3839
     40/* COM includes: */
     41#include "CCloudClient.h"
     42
    3943
    4044/*********************************************************************************************************************************
     
    5458    , m_pAccountToolButton(0)
    5559    , m_pAccountPropertyTable(0)
     60    , m_pAccountInstanceLabel(0)
     61    , m_pAccountInstanceList(0)
    5662{
    5763}
     
    258264}
    259265
     266void UIWizardImportAppPage1::populateAccountInstances()
     267{
     268    /* Clear list initially: */
     269    m_pAccountInstanceList->clear();
     270
     271    /* If profile chosen: */
     272    if (!m_comCloudProfile.isNull())
     273    {
     274        /* Create Cloud Client: */
     275        CCloudClient comCloudClient = m_comCloudProfile.CreateCloudClient();
     276        /* Show error message if necessary: */
     277        if (!m_comCloudProfile.isOk())
     278            msgCenter().cannotCreateCloudClient(m_comCloudProfile);
     279        else
     280        {
     281            /* Read Cloud Client instances: */
     282            QVector<QString> vmNames;
     283            /*const QVector<QString> vmIDs =*/
     284            comCloudClient.ListInstances(KCloudMachineState_Running, vmNames);
     285            /* Show error message if necessary: */
     286            if (!comCloudClient.isOk())
     287                msgCenter().cannotAcquireCloudClientParameter(comCloudClient);
     288            else
     289            {
     290                /* Push acquired names to list rows: */
     291                for (int i = 0; i < vmNames.size(); ++i)
     292                {
     293                    /* Create list item: */
     294                    QListWidgetItem *pItem = new QListWidgetItem(vmNames.at(i), m_pAccountInstanceList);
     295                    if (pItem)
     296                    {
     297                        /* Make item non-editable: */
     298                        pItem->setFlags(pItem->flags() & ~Qt::ItemIsEditable);
     299                    }
     300                }
     301            }
     302        }
     303    }
     304}
     305
    260306void UIWizardImportAppPage1::updatePageAppearance()
    261307{
     
    441487                    m_pCloudContainerLayout->setColumnStretch(0, 0);
    442488                    m_pCloudContainerLayout->setColumnStretch(1, 1);
     489                    m_pCloudContainerLayout->setRowStretch(2, 0);
     490                    m_pCloudContainerLayout->setRowStretch(3, 1);
    443491
    444492                    /* Create account label: */
     
    501549                        m_pCloudContainerLayout->addWidget(m_pAccountPropertyTable, 1, 1);
    502550                    }
     551
     552                    /* Create account instance label: */
     553                    m_pAccountInstanceLabel = new QLabel;
     554                    if (m_pAccountInstanceLabel)
     555                    {
     556                        /* Add into layout: */
     557                        m_pCloudContainerLayout->addWidget(m_pAccountInstanceLabel, 2, 0, Qt::AlignRight);
     558                    }
     559
     560                    /* Create profile instances table: */
     561                    m_pAccountInstanceList = new QListWidget;
     562                    if (m_pAccountInstanceList)
     563                    {
     564                        m_pAccountInstanceLabel->setBuddy(m_pAccountInstanceLabel);
     565                        const QFontMetrics fm(m_pAccountInstanceList->font());
     566                        const int iFontWidth = fm.width('x');
     567                        const int iTotalWidth = 50 * iFontWidth;
     568                        const int iFontHeight = fm.height();
     569                        const int iTotalHeight = 4 * iFontHeight;
     570                        m_pAccountInstanceList->setMinimumSize(QSize(iTotalWidth, iTotalHeight));
     571//                        m_pAccountInstanceList->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
     572                        m_pAccountInstanceList->setAlternatingRowColors(true);
     573
     574                        /* Add into layout: */
     575                        m_pCloudContainerLayout->addWidget(m_pAccountInstanceList, 2, 1, 2, 1);
     576                    }
    503577                }
    504578
     
    521595    /* Populate account properties: */
    522596    populateAccountProperties();
     597    /* Populate account instances: */
     598    populateAccountInstances();
    523599
    524600    /* Setup connections: */
     
    590666    m_pFileSelector->setFileFilters(UIWizardImportApp::tr("Open Virtualization Format (%1)").arg("*.ova *.ovf"));
    591667
    592     /* Translate Account label: */
     668    /* Translate Account labels: */
    593669    m_pAccountLabel->setText(UIWizardImportApp::tr("&Account:"));
     670    m_pAccountInstanceLabel->setText(UIWizardImportApp::tr("&Machines:"));
    594671
    595672    /* Adjust label widths: */
     
    597674    labels << m_pSourceLabel;
    598675    labels << m_pAccountLabel;
     676    labels << m_pAccountInstanceLabel;
    599677    int iMaxWidth = 0;
    600678    foreach (QWidget *pLabel, labels)
     
    666744    populateAccounts();
    667745    populateAccountProperties();
     746    populateAccountInstances();
    668747    emit completeChanged();
    669748}
     
    673752    /* Refresh required settings: */
    674753    populateAccountProperties();
     754    populateAccountInstances();
    675755}
    676756
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.h

    r78082 r78094  
    3434/* Forward declarations: */
    3535class QLabel;
     36class QListWidget;
    3637class QTableWidget;
    3738class QStackedLayout;
     
    7071    /** Populates account properties. */
    7172    void populateAccountProperties();
     73    /** Populates account instances. */
     74    void populateAccountInstances();
    7275
    7376    /** Updates page appearance. */
     
    128131    /** Holds the account property table instance. */
    129132    QTableWidget *m_pAccountPropertyTable;
     133    /** Holds the account instance label instance. */
     134    QLabel       *m_pAccountInstanceLabel;
     135    /** Holds the account instance list instance. */
     136    QListWidget  *m_pAccountInstanceList;
    130137};
    131138
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