VirtualBox

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


Ignore:
Timestamp:
Aug 8, 2024 1:52:02 PM (6 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10671: Add Cloud VM wizard: Reworking expert mode to have no UIToolBox; This is not that much accessible content wrapper which isn't really needed in this case.

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

Legend:

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

    r105363 r105626  
    4141#include "UICloudNetworkingStuff.h"
    4242#include "UIIconPool.h"
    43 #include "UIToolBox.h"
    4443#include "UIVirtualBoxEventHandler.h"
    4544#include "UIVirtualBoxManager.h"
     
    5251
    5352UIWizardAddCloudVMPageExpert::UIWizardAddCloudVMPageExpert()
    54     : m_pToolBox(0)
    55     , m_pLayoutProvider(0)
     53    : m_pLayoutProvider(0)
    5654    , m_pProviderLabel(0)
    5755    , m_pProviderComboBox(0)
     
    6260    , m_pSourceInstanceList(0)
    6361{
    64     /* Prepare main layout: */
    65     QVBoxLayout *pLayoutMain = new QVBoxLayout(this);
    66     if (pLayoutMain)
     62    /* Prepare provider layout: */
     63    m_pLayoutProvider = new QGridLayout(this);
     64    if (m_pLayoutProvider)
    6765    {
    68         /* Prepare tool-box: */
    69         m_pToolBox = new UIToolBox(this);
    70         if (m_pToolBox)
     66        m_pLayoutProvider->setContentsMargins(0, 0, 0, 0);
     67        m_pLayoutProvider->setColumnStretch(0, 0);
     68        m_pLayoutProvider->setColumnStretch(1, 1);
     69        m_pLayoutProvider->setRowStretch(2, 0);
     70        m_pLayoutProvider->setRowStretch(3, 1);
     71
     72        /* Prepare provider label: */
     73        m_pProviderLabel = new QLabel(this);
     74        if (m_pProviderLabel)
     75            m_pLayoutProvider->addWidget(m_pProviderLabel, 0, 0, Qt::AlignRight);
     76
     77        /* Prepare provider combo-box: */
     78        m_pProviderComboBox = new QIComboBox(this);
     79        if (m_pProviderComboBox)
    7180        {
    72             /* Prepare location widget: */
    73             QWidget *pWidgetLocation = new QWidget(m_pToolBox);
    74             if (pWidgetLocation)
     81            m_pProviderLabel->setBuddy(m_pProviderComboBox);
     82            m_pLayoutProvider->addWidget(m_pProviderComboBox, 0, 1);
     83        }
     84
     85        /* Prepare profile label: */
     86        m_pProfileLabel = new QLabel(this);
     87        if (m_pProfileLabel)
     88            m_pLayoutProvider->addWidget(m_pProfileLabel, 1, 0, Qt::AlignRight);
     89
     90        /* Prepare profile layout: */
     91        QHBoxLayout *pLayoutProfile = new QHBoxLayout;
     92        if (pLayoutProfile)
     93        {
     94            pLayoutProfile->setContentsMargins(0, 0, 0, 0);
     95            pLayoutProfile->setSpacing(1);
     96
     97            /* Prepare profile combo-box: */
     98            m_pProfileComboBox = new QIComboBox(this);
     99            if (m_pProfileComboBox)
    75100            {
    76                 /* Prepare location layout: */
    77                 QVBoxLayout *pLayoutLocation = new QVBoxLayout(pWidgetLocation);
    78                 if (pLayoutLocation)
    79                 {
    80                     pLayoutLocation->setContentsMargins(0, 0, 0, 0);
    81 
    82                     /* Prepare provider layout: */
    83                     m_pLayoutProvider = new QGridLayout;
    84                     if (m_pLayoutProvider)
    85                     {
    86                         m_pLayoutProvider->setContentsMargins(0, 0, 0, 0);
    87                         m_pLayoutProvider->setColumnStretch(0, 0);
    88                         m_pLayoutProvider->setColumnStretch(1, 1);
    89 
    90                         /* Prepare provider label: */
    91                         m_pProviderLabel = new QLabel(this);
    92                         if (m_pProviderLabel)
    93                             m_pLayoutProvider->addWidget(m_pProviderLabel, 0, 0, Qt::AlignRight);
    94 
    95                         /* Prepare provider combo-box: */
    96                         m_pProviderComboBox = new QIComboBox(pWidgetLocation);
    97                         if (m_pProviderComboBox)
    98                         {
    99                             m_pProviderLabel->setBuddy(m_pProviderComboBox);
    100                             m_pLayoutProvider->addWidget(m_pProviderComboBox, 0, 1);
    101                         }
    102 
    103                         /* Prepare profile label: */
    104                         m_pProfileLabel = new QLabel(this);
    105                         if (m_pProfileLabel)
    106                             m_pLayoutProvider->addWidget(m_pProfileLabel, 1, 0, Qt::AlignRight);
    107 
    108                         /* Prepare profile layout: */
    109                         QHBoxLayout *pLayoutProfile = new QHBoxLayout;
    110                         if (pLayoutProfile)
    111                         {
    112                             pLayoutProfile->setContentsMargins(0, 0, 0, 0);
    113                             pLayoutProfile->setSpacing(1);
    114 
    115                             /* Prepare profile combo-box: */
    116                             m_pProfileComboBox = new QIComboBox(pWidgetLocation);
    117                             if (m_pProfileComboBox)
    118                             {
    119                                 m_pProfileLabel->setBuddy(m_pProfileComboBox);
    120                                 pLayoutProfile->addWidget(m_pProfileComboBox);
    121                             }
    122 
    123                             /* Prepare profile tool-button: */
    124                             m_pProfileToolButton = new QIToolButton(pWidgetLocation);
    125                             if (m_pProfileToolButton)
    126                             {
    127                                 m_pProfileToolButton->setIcon(UIIconPool::iconSet(":/cloud_profile_manager_16px.png",
    128                                                                                   ":/cloud_profile_manager_disabled_16px.png"));
    129                                 pLayoutProfile->addWidget(m_pProfileToolButton);
    130                             }
    131 
    132                             /* Add into layout: */
    133                             m_pLayoutProvider->addLayout(pLayoutProfile, 1, 1);
    134                         }
    135 
    136                         /* Add into layout: */
    137                         pLayoutLocation->addLayout(m_pLayoutProvider);
    138                     }
    139                 }
    140 
    141                 /* Add into tool-box: */
    142                 m_pToolBox->insertPage(0, pWidgetLocation, QString());
     101                m_pProfileLabel->setBuddy(m_pProfileComboBox);
     102                pLayoutProfile->addWidget(m_pProfileComboBox);
    143103            }
    144104
    145             /* Prepare source widget: */
    146             QWidget *pWidgetSource = new QWidget(m_pToolBox);
    147             if (pWidgetSource)
     105            /* Prepare profile tool-button: */
     106            m_pProfileToolButton = new QIToolButton(this);
     107            if (m_pProfileToolButton)
    148108            {
    149                 /* Prepare source layout: */
    150                 QVBoxLayout *pLayoutSource = new QVBoxLayout(pWidgetSource);
    151                 if (pLayoutSource)
    152                 {
    153                     pLayoutSource->setContentsMargins(0, 0, 0, 0);
    154 
    155                     /* Prepare source instances table: */
    156                     m_pSourceInstanceList = new QIListWidget(pWidgetSource);
    157                     if (m_pSourceInstanceList)
    158                     {
    159                         /* A bit of look&feel: */
    160                         m_pSourceInstanceList->setAlternatingRowColors(true);
    161                         /* Allow to select more than one item to add: */
    162                         m_pSourceInstanceList->setSelectionMode(QAbstractItemView::ExtendedSelection);
    163 
    164                         /* Add into layout: */
    165                         pLayoutSource->addWidget(m_pSourceInstanceList);
    166                     }
    167                 }
    168 
    169                 /* Add into tool-box: */
    170                 m_pToolBox->insertPage(1, pWidgetSource, QString());
     109                m_pProfileToolButton->setIcon(UIIconPool::iconSet(":/cloud_profile_manager_16px.png",
     110                                                                  ":/cloud_profile_manager_disabled_16px.png"));
     111                pLayoutProfile->addWidget(m_pProfileToolButton);
    171112            }
    172113
    173114            /* Add into layout: */
    174             pLayoutMain->addWidget(m_pToolBox);
     115            m_pLayoutProvider->addLayout(pLayoutProfile, 1, 1);
     116        }
     117
     118        /* Prepare source instance label: */
     119        m_pSourceInstanceLabel = new QLabel(this);
     120        if (m_pSourceInstanceLabel)
     121            m_pLayoutProvider->addWidget(m_pSourceInstanceLabel, 2, 0, Qt::AlignRight);
     122
     123        /* Prepare source instances table: */
     124        m_pSourceInstanceList = new QIListWidget(this);
     125        if (m_pSourceInstanceList)
     126        {
     127            m_pSourceInstanceLabel->setBuddy(m_pSourceInstanceLabel);
     128            /* Make source image list fit 50 symbols
     129             * horizontally and 8 lines vertically: */
     130            const QFontMetrics fm(m_pSourceInstanceList->font());
     131            const int iFontWidth = fm.horizontalAdvance('x');
     132            const int iTotalWidth = 50 * iFontWidth;
     133            const int iFontHeight = fm.height();
     134            const int iTotalHeight = 8 * iFontHeight;
     135            m_pSourceInstanceList->setMinimumSize(QSize(iTotalWidth, iTotalHeight));
     136            /* A bit of look&feel: */
     137            m_pSourceInstanceList->setAlternatingRowColors(true);
     138            /* Allow to select more than one item to add: */
     139            m_pSourceInstanceList->setSelectionMode(QAbstractItemView::ExtendedSelection);
     140
     141            /* Add into layout: */
     142            m_pLayoutProvider->addWidget(m_pSourceInstanceList, 2, 1, 2, 1);
    175143        }
    176144    }
     
    198166void UIWizardAddCloudVMPageExpert::sltRetranslateUI()
    199167{
    200     /* Translate tool-box: */
    201     if (m_pToolBox)
    202     {
    203         m_pToolBox->setPageTitle(0, UIWizardAddCloudVM::tr("Source"));
    204         m_pToolBox->setPageTitle(1, UIWizardAddCloudVM::tr("Instances"));
    205     }
    206 
    207168    /* Translate provider label: */
    208169    if (m_pProviderLabel)
     
    229190
    230191    /* Translate instances stuff: */
     192    if (m_pSourceInstanceLabel)
     193        m_pSourceInstanceLabel->setText(UIWizardAddCloudVM::tr("&Instances:"));
    231194    if (m_pSourceInstanceList)
    232195        m_pSourceInstanceList->setWhatsThis(UIWizardAddCloudVM::tr("Lists all the cloud VM instances."));
     
    235198void UIWizardAddCloudVMPageExpert::initializePage()
    236199{
    237     /* Choose 1st tool to be chosen initially: */
    238     m_pToolBox->setCurrentPage(0);
    239200    /* Populate providers: */
    240201    populateProviders(m_pProviderComboBox, wizard()->notificationCenter());
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/addcloudvm/UIWizardAddCloudVMPageExpert.h

    r104568 r105626  
    3939class QLabel;
    4040class QIListWidget;
    41 class UIToolBox;
    4241class UIWizardAddCloudVM;
    4342
     
    8584private:
    8685
    87     /** Holds the tool-box instance. */
    88     UIToolBox *m_pToolBox;
    89 
    9086    /** Holds the provider layout instance. */
    9187    QGridLayout  *m_pLayoutProvider;
     
    10096    /** Holds the profile management tool-button instance. */
    10197    QIToolButton *m_pProfileToolButton;
    102 
    10398    /** Holds the source instance label instance. */
    10499    QLabel       *m_pSourceInstanceLabel;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/addcloudvm/UIWizardAddCloudVMPageSource.cpp

    r105363 r105626  
    284284            if (m_pProviderLabel)
    285285                m_pProviderLayout->addWidget(m_pProviderLabel, 0, 0, Qt::AlignRight);
     286
    286287            /* Prepare provider combo-box: */
    287288            m_pProviderComboBox = new QIComboBox(this);
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