VirtualBox

Changeset 93219 in vbox


Ignore:
Timestamp:
Jan 13, 2022 10:44:20 AM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9996: UIWizardAddCloudVM: Reworking expert page to be based on UIToolBox; This is required to save horizontal space and to have watermark.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/addcloudvm/UIWizardAddCloudVMPageExpert.cpp

    r93115 r93219  
    1717
    1818/* Qt includes: */
    19 #include <QGroupBox>
    2019#include <QHBoxLayout>
    2120#include <QHeaderView>
    2221#include <QListWidget>
    2322#include <QTableWidget>
     23#include <QVBoxLayout>
    2424
    2525/* GUI includes: */
     
    2828#include "UICloudNetworkingStuff.h"
    2929#include "UIIconPool.h"
     30#include "UIToolBox.h"
    3031#include "UIVirtualBoxEventHandler.h"
    3132#include "UIVirtualBoxManager.h"
     
    3839
    3940UIWizardAddCloudVMPageExpert::UIWizardAddCloudVMPageExpert()
    40     : m_pCntProvider(0)
    41     , m_pProviderLayout(0)
     41    : m_pToolBox(0)
    4242    , m_pProviderLabel(0)
    4343    , m_pProviderComboBox(0)
    44     , m_pOptionsLayout(0)
    4544    , m_pProfileLabel(0)
    4645    , m_pProfileComboBox(0)
     
    5049{
    5150    /* Prepare main layout: */
    52     QHBoxLayout *pLayoutMain = new QHBoxLayout(this);
     51    QVBoxLayout *pLayoutMain = new QVBoxLayout(this);
    5352    if (pLayoutMain)
    5453    {
    55         /* Prepare provider container: */
    56         m_pCntProvider = new QGroupBox(this);
    57         if (m_pCntProvider)
     54        /* Prepare tool-box: */
     55        m_pToolBox = new UIToolBox(this);
     56        if (m_pToolBox)
    5857        {
    59             /* Prepare provider layout: */
    60             m_pProviderLayout = new QGridLayout(m_pCntProvider);
    61             if (m_pProviderLayout)
     58            /* Prepare location widget: */
     59            QWidget *pWidgetLocation = new QWidget(m_pToolBox);
     60            if (pWidgetLocation)
    6261            {
    63                 /* Prepare provider selector: */
    64                 m_pProviderComboBox = new QIComboBox(m_pCntProvider);
    65                 if (m_pProviderComboBox)
    66                     m_pProviderLayout->addWidget(m_pProviderComboBox, 0, 0);
    67 
    68                 /* Prepare options layout: */
    69                 m_pOptionsLayout = new QGridLayout;
    70                 if (m_pOptionsLayout)
     62                /* Prepare location layout: */
     63                QVBoxLayout *pLayoutLocation = new QVBoxLayout(pWidgetLocation);
     64                if (pLayoutLocation)
    7165                {
    72                     m_pOptionsLayout->setContentsMargins(0, 0, 0, 0);
    73                     m_pOptionsLayout->setRowStretch(1, 1);
    74 
    75                     /* Prepare sub-layout: */
    76                     QHBoxLayout *pSubLayout = new QHBoxLayout;
    77                     if (pSubLayout)
     66                    pLayoutLocation->setContentsMargins(0, 0, 0, 0);
     67
     68                    /* Prepare provider combo-box: */
     69                    m_pProviderComboBox = new QIComboBox(pWidgetLocation);
     70                    if (m_pProviderComboBox)
     71                        pLayoutLocation->addWidget(m_pProviderComboBox);
     72
     73                    /* Prepare profile layout: */
     74                    QHBoxLayout *pLayoutProfile = new QHBoxLayout;
     75                    if (pLayoutProfile)
    7876                    {
    79                         pSubLayout->setContentsMargins(0, 0, 0, 0);
    80                         pSubLayout->setSpacing(1);
     77                        pLayoutProfile->setContentsMargins(0, 0, 0, 0);
     78                        pLayoutProfile->setSpacing(1);
    8179
    8280                        /* Prepare profile combo-box: */
    83                         m_pProfileComboBox = new QIComboBox(m_pCntProvider);
     81                        m_pProfileComboBox = new QIComboBox(pWidgetLocation);
    8482                        if (m_pProfileComboBox)
    85                             pSubLayout->addWidget(m_pProfileComboBox);
     83                            pLayoutProfile->addWidget(m_pProfileComboBox);
    8684
    8785                        /* Prepare profile tool-button: */
    88                         m_pProfileToolButton = new QIToolButton(m_pCntProvider);
     86                        m_pProfileToolButton = new QIToolButton(pWidgetLocation);
    8987                        if (m_pProfileToolButton)
    9088                        {
    9189                            m_pProfileToolButton->setIcon(UIIconPool::iconSet(":/cloud_profile_manager_16px.png",
    9290                                                                              ":/cloud_profile_manager_disabled_16px.png"));
    93                             pSubLayout->addWidget(m_pProfileToolButton);
     91                            pLayoutProfile->addWidget(m_pProfileToolButton);
    9492                        }
    9593
    9694                        /* Add into layout: */
    97                         m_pOptionsLayout->addLayout(pSubLayout, 0, 0);
     95                        pLayoutLocation->addLayout(pLayoutProfile);
    9896                    }
     97                }
     98
     99                /* Add into tool-box: */
     100                m_pToolBox->insertPage(0, pWidgetLocation, QString());
     101            }
     102
     103            /* Prepare source widget: */
     104            QWidget *pWidgetSource = new QWidget(m_pToolBox);
     105            if (pWidgetSource)
     106            {
     107                /* Prepare source layout: */
     108                QVBoxLayout *pLayoutSource = new QVBoxLayout(pWidgetSource);
     109                if (pLayoutSource)
     110                {
     111                    pLayoutSource->setContentsMargins(0, 0, 0, 0);
    99112
    100113                    /* Prepare source instances table: */
    101                     m_pSourceInstanceList = new QListWidget(m_pCntProvider);
     114                    m_pSourceInstanceList = new QListWidget(pWidgetSource);
    102115                    if (m_pSourceInstanceList)
    103116                    {
     
    114127
    115128                        /* Add into layout: */
    116                         m_pOptionsLayout->addWidget(m_pSourceInstanceList, 1, 0);
     129                        pLayoutSource->addWidget(m_pSourceInstanceList, 1, 0);
    117130                    }
    118 
    119                     /* Add into layout: */
    120                     m_pProviderLayout->addLayout(m_pOptionsLayout, 1, 0);
    121131                }
     132
     133                /* Add into tool-box: */
     134                m_pToolBox->insertPage(1, pWidgetSource, QString());
    122135            }
    123136
    124137            /* Add into layout: */
    125             pLayoutMain->addWidget(m_pCntProvider);
     138            pLayoutMain->addWidget(m_pToolBox);
    126139        }
    127140    }
     
    149162void UIWizardAddCloudVMPageExpert::retranslateUi()
    150163{
    151     /* Translate source container: */
    152     m_pCntProvider->setTitle(UIWizardAddCloudVM::tr("Source"));
     164    /* Translate tool-box: */
     165    if (m_pToolBox)
     166    {
     167        m_pToolBox->setPageTitle(0, UIWizardAddCloudVM::tr("Location"));
     168        m_pToolBox->setPageTitle(1, UIWizardAddCloudVM::tr("Source"));
     169    }
    153170
    154171    /* Translate profile stuff: */
    155     m_pProfileToolButton->setToolTip(UIWizardAddCloudVM::tr("Open Cloud Profile Manager..."));
     172    if (m_pProfileToolButton)
     173        m_pProfileToolButton->setToolTip(UIWizardAddCloudVM::tr("Open Cloud Profile Manager..."));
    156174
    157175    /* Translate received values of Source combo-box.
    158176     * We are enumerating starting from 0 for simplicity: */
    159     for (int i = 0; i < m_pProviderComboBox->count(); ++i)
    160     {
    161         m_pProviderComboBox->setItemText(i, m_pProviderComboBox->itemData(i, ProviderData_Name).toString());
    162         m_pProviderComboBox->setItemData(i, UIWizardAddCloudVM::tr("Add VM from cloud service provider."), Qt::ToolTipRole);
    163     }
     177    if (m_pProviderComboBox)
     178        for (int i = 0; i < m_pProviderComboBox->count(); ++i)
     179        {
     180            m_pProviderComboBox->setItemText(i, m_pProviderComboBox->itemData(i, ProviderData_Name).toString());
     181            m_pProviderComboBox->setItemData(i, UIWizardAddCloudVM::tr("Add VM from cloud service provider."), Qt::ToolTipRole);
     182        }
    164183
    165184    /* Update tool-tips: */
     
    169188void UIWizardAddCloudVMPageExpert::initializePage()
    170189{
     190    /* Choose 1st tool to be chosen initially: */
     191    m_pToolBox->setCurrentPage(0);
    171192    /* Populate providers: */
    172193    populateProviders(m_pProviderComboBox, wizard()->notificationCenter());
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/addcloudvm/UIWizardAddCloudVMPageExpert.h

    r93115 r93219  
    2626
    2727/* Forward declarations: */
    28 class QGroupBox;
     28class UIToolBox;
    2929class UIWizardAddCloudVM;
    3030
     
    7272private:
    7373
    74     /** Holds the provider container instance. */
    75     QGroupBox *m_pCntProvider;
     74    /** Holds the tool-box instance. */
     75    UIToolBox *m_pToolBox;
    7676
    77     /** Holds the provider layout instance. */
    78     QGridLayout *m_pProviderLayout;
    7977    /** Holds the provider type label instance. */
    8078    QLabel      *m_pProviderLabel;
     
    8280    QIComboBox  *m_pProviderComboBox;
    8381
    84     /** Holds the options layout instance. */
    85     QGridLayout  *m_pOptionsLayout;
    8682    /** Holds the profile label instance. */
    8783    QLabel       *m_pProfileLabel;
     
    9086    /** Holds the profile management tool-button instance. */
    9187    QIToolButton *m_pProfileToolButton;
     88
    9289    /** Holds the source instance label instance. */
    9390    QLabel       *m_pSourceInstanceLabel;
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