VirtualBox

Changeset 73011 in vbox


Ignore:
Timestamp:
Jul 9, 2018 1:48:34 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9152: Export Appliance wizard: Storage page: Reworking layout to be stacked-widget with pages depending on storage type.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp

    r73010 r73011  
    2727# include <QLabel>
    2828# include <QLineEdit>
     29# include <QStackedWidget>
    2930# include <QVBoxLayout>
    3031
     
    4546
    4647UIWizardExportAppPage3::UIWizardExportAppPage3()
    47     : m_pFileSelectorLabel(0)
     48    : m_pSettingsWidget(0)
     49    , m_pFileSelectorLabel(0)
    4850    , m_pFileSelector(0)
    4951    , m_pFormatComboBoxLabel(0)
     
    8486    /* Update page appearance according to chosen storage-type: */
    8587    const StorageType enmStorageType = fieldImp("storageType").value<StorageType>();
    86     switch (enmStorageType)
    87     {
    88         case LocalFilesystem:
    89         {
    90             m_pFileSelectorLabel->setVisible(true);
    91             m_pFileSelector->setVisible(true);
    92             m_pFormatComboBoxLabel->setVisible(true);
    93             m_pFormatComboBox->setVisible(true);
    94             m_pAdditionalLabel->setVisible(true);
    95             m_pManifestCheckbox->setVisible(true);
    96             m_pProviderComboBoxLabel->setVisible(false);
    97             m_pProviderComboBox->setVisible(false);
    98             break;
    99         }
    100         case CloudProvider:
    101         {
    102             m_pFileSelectorLabel->setVisible(false);
    103             m_pFileSelector->setVisible(false);
    104             m_pFormatComboBoxLabel->setVisible(false);
    105             m_pFormatComboBox->setVisible(false);
    106             m_pAdditionalLabel->setVisible(false);
    107             m_pManifestCheckbox->setVisible(false);
    108             m_pProviderComboBoxLabel->setVisible(true);
    109             m_pProviderComboBox->setVisible(true);
    110             break;
    111         }
    112     }
     88    m_pSettingsWidget->setCurrentIndex((int)enmStorageType);
    11389}
    11490
     
    243219
    244220        /* Create settings layout: */
    245         QGridLayout *pSettingsLayout = new QGridLayout;
    246         if (pSettingsLayout)
     221        m_pSettingsWidget = new QStackedWidget;
     222        if (m_pSettingsWidget)
    247223        {
    248             pSettingsLayout->setContentsMargins(0, 0, 0, 0);
    249             pSettingsLayout->setColumnStretch(0, 0);
    250             pSettingsLayout->setColumnStretch(1, 1);
    251 
    252             /* Create file selector: */
    253             m_pFileSelector = new UIEmptyFilePathSelector;
    254             if (m_pFileSelector)
     224            /* Create settings pane 1: */
     225            QWidget *pSettingsPane1 = new QWidget;
     226            if (pSettingsPane1)
    255227            {
    256                 m_pFileSelector->setMode(UIEmptyFilePathSelector::Mode_File_Save);
    257                 m_pFileSelector->setEditable(true);
    258                 m_pFileSelector->setButtonPosition(UIEmptyFilePathSelector::RightPosition);
    259                 m_pFileSelector->setDefaultSaveExt("ova");
     228                /* Create settings layout 1: */
     229                QGridLayout *pSettingsLayout1 = new QGridLayout(pSettingsPane1);
     230                if (pSettingsLayout1)
     231                {
     232                    pSettingsLayout1->setContentsMargins(0, 0, 0, 0);
     233                    pSettingsLayout1->setColumnStretch(0, 0);
     234                    pSettingsLayout1->setColumnStretch(1, 1);
     235
     236                    /* Create file selector: */
     237                    m_pFileSelector = new UIEmptyFilePathSelector;
     238                    if (m_pFileSelector)
     239                    {
     240                        m_pFileSelector->setMode(UIEmptyFilePathSelector::Mode_File_Save);
     241                        m_pFileSelector->setEditable(true);
     242                        m_pFileSelector->setButtonPosition(UIEmptyFilePathSelector::RightPosition);
     243                        m_pFileSelector->setDefaultSaveExt("ova");
     244
     245                        /* Add into layout: */
     246                        pSettingsLayout1->addWidget(m_pFileSelector, 0, 1);
     247                    }
     248                    /* Create file selector label: */
     249                    m_pFileSelectorLabel = new QLabel;
     250                    if (m_pFileSelectorLabel)
     251                    {
     252                        m_pFileSelectorLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
     253                        m_pFileSelectorLabel->setBuddy(m_pFileSelector);
     254
     255                        /* Add into layout: */
     256                        pSettingsLayout1->addWidget(m_pFileSelectorLabel, 0, 0);
     257                    }
     258
     259                    /* Create format combo-box: */
     260                    m_pFormatComboBox = new QComboBox;
     261                    if (m_pFormatComboBox)
     262                    {
     263                        const QString strFormatOVF09("ovf-0.9");
     264                        const QString strFormatOVF10("ovf-1.0");
     265                        const QString strFormatOVF20("ovf-2.0");
     266                        const QString strFormatOPC10("opc-1.0");
     267                        m_pFormatComboBox->addItem(strFormatOVF09, strFormatOVF09);
     268                        m_pFormatComboBox->addItem(strFormatOVF10, strFormatOVF10);
     269                        m_pFormatComboBox->addItem(strFormatOVF20, strFormatOVF20);
     270                        m_pFormatComboBox->addItem(strFormatOPC10, strFormatOPC10);
     271
     272                        /* Add into layout: */
     273                        pSettingsLayout1->addWidget(m_pFormatComboBox, 1, 1);
     274                    }
     275                    /* Create format combo-box label: */
     276                    m_pFormatComboBoxLabel = new QLabel;
     277                    if (m_pFormatComboBoxLabel)
     278                    {
     279                        m_pFormatComboBoxLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
     280                        m_pFormatComboBoxLabel->setBuddy(m_pFormatComboBox);
     281
     282                        /* Add into layout: */
     283                        pSettingsLayout1->addWidget(m_pFormatComboBoxLabel, 1, 0);
     284                    }
     285
     286                    /* Create advanced label: */
     287                    m_pAdditionalLabel = new QLabel;
     288                    if (m_pAdditionalLabel)
     289                    {
     290                        m_pAdditionalLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
     291
     292                        /* Add into layout: */
     293                        pSettingsLayout1->addWidget(m_pAdditionalLabel, 2, 0);
     294                    }
     295                    /* Create manifest check-box: */
     296                    m_pManifestCheckbox = new QCheckBox;
     297                    if (m_pManifestCheckbox)
     298                    {
     299                        /* Add into layout: */
     300                        pSettingsLayout1->addWidget(m_pManifestCheckbox, 2, 1);
     301                    }
     302
     303                    /* Create placeholder: */
     304                    QWidget *pPlaceholder = new QWidget;
     305                    if (pPlaceholder)
     306                    {
     307                        /* Add into layout: */
     308                        pSettingsLayout1->addWidget(pPlaceholder, 3, 0, 1, 2);
     309                    }
     310                }
    260311
    261312                /* Add into layout: */
    262                 pSettingsLayout->addWidget(m_pFileSelector, 0, 1);
     313                m_pSettingsWidget->addWidget(pSettingsPane1);
    263314            }
    264             /* Create file selector label: */
    265             m_pFileSelectorLabel = new QLabel;
    266             if (m_pFileSelectorLabel)
     315
     316            /* Create settings pane 2: */
     317            QWidget *pSettingsPane2 = new QWidget;;
     318            if (pSettingsPane2)
    267319            {
    268                 m_pFileSelectorLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    269                 m_pFileSelectorLabel->setBuddy(m_pFileSelector);
     320                /* Create settings layout 2: */
     321                QGridLayout *pSettingsLayout2 = new QGridLayout(pSettingsPane2);
     322                if (pSettingsLayout2)
     323                {
     324                    pSettingsLayout2->setContentsMargins(0, 0, 0, 0);
     325                    pSettingsLayout2->setColumnStretch(0, 0);
     326                    pSettingsLayout2->setColumnStretch(1, 1);
     327
     328                    /* Create provider combo-box: */
     329                    m_pProviderComboBox = new QComboBox;
     330                    if (m_pProviderComboBox)
     331                    {
     332                        /* Add into layout: */
     333                        pSettingsLayout2->addWidget(m_pProviderComboBox, 0, 1);
     334                    }
     335                    /* Create provider label: */
     336                    m_pProviderComboBoxLabel = new QLabel;
     337                    if (m_pProviderComboBoxLabel)
     338                    {
     339                        m_pProviderComboBoxLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
     340                        m_pProviderComboBoxLabel->setBuddy(m_pProviderComboBox);
     341
     342                        /* Add into layout: */
     343                        pSettingsLayout2->addWidget(m_pProviderComboBoxLabel, 0, 0);
     344                    }
     345
     346                    /* Create placeholder: */
     347                    QWidget *pPlaceholder = new QWidget;
     348                    if (pPlaceholder)
     349                    {
     350                        /* Add into layout: */
     351                        pSettingsLayout2->addWidget(pPlaceholder, 1, 0, 1, 2);
     352                    }
     353                }
    270354
    271355                /* Add into layout: */
    272                 pSettingsLayout->addWidget(m_pFileSelectorLabel, 0, 0);
     356                m_pSettingsWidget->addWidget(pSettingsPane2);
    273357            }
    274358
    275             /* Create format combo-box: */
    276             m_pFormatComboBox = new QComboBox;
    277             if (m_pFormatComboBox)
    278             {
    279                 const QString strFormatOVF09("ovf-0.9");
    280                 const QString strFormatOVF10("ovf-1.0");
    281                 const QString strFormatOVF20("ovf-2.0");
    282                 const QString strFormatOPC10("opc-1.0");
    283                 m_pFormatComboBox->addItem(strFormatOVF09, strFormatOVF09);
    284                 m_pFormatComboBox->addItem(strFormatOVF10, strFormatOVF10);
    285                 m_pFormatComboBox->addItem(strFormatOVF20, strFormatOVF20);
    286                 m_pFormatComboBox->addItem(strFormatOPC10, strFormatOPC10);
    287 
    288                 /* Add into layout: */
    289                 pSettingsLayout->addWidget(m_pFormatComboBox, 1, 1);
    290             }
    291             /* Create format combo-box label: */
    292             m_pFormatComboBoxLabel = new QLabel;
    293             if (m_pFormatComboBoxLabel)
    294             {
    295                 m_pFormatComboBoxLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    296                 m_pFormatComboBoxLabel->setBuddy(m_pFormatComboBox);
    297 
    298                 /* Add into layout: */
    299                 pSettingsLayout->addWidget(m_pFormatComboBoxLabel, 1, 0);
    300             }
    301 
    302             /* Create advanced label: */
    303             m_pAdditionalLabel = new QLabel;
    304             if (m_pAdditionalLabel)
    305             {
    306                 m_pAdditionalLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    307 
    308                 /* Add into layout: */
    309                 pSettingsLayout->addWidget(m_pAdditionalLabel, 2, 0);
    310             }
    311             /* Create manifest check-box: */
    312             m_pManifestCheckbox = new QCheckBox;
    313             if (m_pManifestCheckbox)
    314             {
    315                 /* Add into layout: */
    316                 pSettingsLayout->addWidget(m_pManifestCheckbox, 2, 1);
    317             }
    318 
    319             /* Create provider combo-box: */
    320             m_pProviderComboBox = new QComboBox;
    321             if (m_pProviderComboBox)
    322             {
    323                 /* Add into layout: */
    324                 pSettingsLayout->addWidget(m_pProviderComboBox, 3, 1);
    325             }
    326             /* Create provider label: */
    327             m_pProviderComboBoxLabel = new QLabel;
    328             if (m_pProviderComboBoxLabel)
    329             {
    330                 m_pProviderComboBoxLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    331                 m_pProviderComboBoxLabel->setBuddy(m_pProviderComboBox);
    332 
    333                 /* Add into layout: */
    334                 pSettingsLayout->addWidget(m_pProviderComboBoxLabel, 3, 0);
    335             }
    336 
    337359            /* Add into layout: */
    338             pMainLayout->addLayout(pSettingsLayout);
     360            pMainLayout->addWidget(m_pSettingsWidget);
    339361        }
    340362
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h

    r73009 r73011  
    3030class QLabel;
    3131class QLineEdit;
     32class QStackedWidget;
    3233class QIRichTextLabel;
    3334class UIEmptyFilePathSelector;
     
    8182    /** Holds the default appliance name. */
    8283    QString  m_strDefaultApplianceName;
     84
     85    /** Holds the settings widget instance. */
     86    QStackedWidget *m_pSettingsWidget;
    8387
    8488    /** Holds the file selector label instance. */
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