VirtualBox

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


Ignore:
Timestamp:
Apr 24, 2019 2:53:31 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9434: Import Appliance wizard: 2nd basic page: Rework layout for appliance widget and form editor to make it stacked, to be reused from the export wizard page; Also, rework label translation technique to make it similar to 1st page.

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

Legend:

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

    r78274 r78275  
    1919#include <QLabel>
    2020#include <QPointer>
     21#include <QStackedLayout>
    2122#include <QVBoxLayout>
    2223
     
    3940
    4041UIWizardImportAppPage2::UIWizardImportAppPage2()
     42    : m_pSettingsCntLayout(0)
    4143{
    4244}
     
    4749    if (comForm.isNotNull())
    4850        m_pFormEditor->setVirtualSystemDescriptionForm(comForm);
     51}
     52
     53void UIWizardImportAppPage2::updatePageAppearance()
     54{
     55    /* Check whether there was cloud source selected: */
     56    const bool fIsSourceCloudOne = fieldImp("isSourceCloudOne").toBool();
     57
     58    /* Update page appearance according to chosen source: */
     59    m_pSettingsCntLayout->setCurrentIndex((int)fIsSourceCloudOne);
    4960}
    5061
     
    6980        }
    7081
    71         /* Create appliance widget: */
    72         m_pApplianceWidget = new UIApplianceImportEditorWidget(this);
     82        /* Create settings container layout: */
     83        m_pSettingsCntLayout = new QStackedLayout;
     84        if (m_pSettingsCntLayout)
    7385        {
    74             m_pApplianceWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
    75             m_pApplianceWidget->setFile(strFileName);
     86            /* Create appliance widget container: */
     87            QWidget *pApplianceWidgetCnt = new QWidget(this);
     88            if (pApplianceWidgetCnt)
     89            {
     90                /* Create appliance widget layout: */
     91                QVBoxLayout *pApplianceWidgetLayout = new QVBoxLayout(pApplianceWidgetCnt);
     92                if (pApplianceWidgetLayout)
     93                {
     94                    pApplianceWidgetLayout->setContentsMargins(0, 0, 0, 0);
     95
     96                    /* Create appliance widget: */
     97                    m_pApplianceWidget = new UIApplianceImportEditorWidget(pApplianceWidgetCnt);
     98                    if (m_pApplianceWidget)
     99                    {
     100                        m_pApplianceWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
     101                        m_pApplianceWidget->setFile(strFileName);
     102
     103                        /* Add into layout: */
     104                        pApplianceWidgetLayout->addWidget(m_pApplianceWidget);
     105                    }
     106
     107                    /* Create certificate label: */
     108                    m_pCertLabel = new QLabel(QString(), pApplianceWidgetCnt);
     109                    if (m_pCertLabel)
     110                    {
     111                        /* Add into layout: */
     112                        pApplianceWidgetLayout->addWidget(m_pCertLabel);
     113                    }
     114                }
     115
     116                /* Add into layout: */
     117                m_pSettingsCntLayout->addWidget(pApplianceWidgetCnt);
     118            }
     119
     120            /* Create form editor container: */
     121            QWidget *pFormEditorCnt = new QWidget(this);
     122            if (pFormEditorCnt)
     123            {
     124                /* Create form editor layout: */
     125                QVBoxLayout *pFormEditorLayout = new QVBoxLayout(pFormEditorCnt);
     126                if (pFormEditorLayout)
     127                {
     128                    pFormEditorLayout->setContentsMargins(0, 0, 0, 0);
     129
     130                    /* Create form editor widget: */
     131                    m_pFormEditor = new UIFormEditorWidget(pFormEditorCnt);
     132                    if (m_pFormEditor)
     133                    {
     134                        /* Add into layout: */
     135                        pFormEditorLayout->addWidget(m_pFormEditor);
     136                    }
     137                }
     138
     139                /* Add into layout: */
     140                m_pSettingsCntLayout->addWidget(pFormEditorCnt);
     141            }
    76142
    77143            /* Add into layout: */
    78             pMainLayout->addWidget(m_pApplianceWidget);
    79         }
    80 
    81         /* Create form editor widget: */
    82         m_pFormEditor = new UIFormEditorWidget(this);
    83         if (m_pFormEditor)
    84         {
    85             /* Add into layout: */
    86             pMainLayout->addWidget(m_pFormEditor);
    87         }
    88 
    89         /* Create certificate label: */
    90         m_pCertLabel = new QLabel("<cert label>", this);
    91         if (m_pCertLabel)
    92         {
    93             /* Add into layout: */
    94             pMainLayout->addWidget(m_pCertLabel);
     144            pMainLayout->addLayout(m_pSettingsCntLayout);
    95145        }
    96146    }
     
    107157    setTitle(UIWizardImportApp::tr("Appliance settings"));
    108158
    109     /* Translate the description label: */
    110     const bool fIsSourceCloudOne = field("isSourceCloudOne").toBool();
    111     if (fIsSourceCloudOne)
    112         m_pLabel->setText(UIWizardImportApp::tr("These are the the suggested settings of the cloud VM import "
    113                                                 "procedure, they are influencing the resulting local VM instance. "
    114                                                 "You can change many of the properties shown by double-clicking "
    115                                                 "on the items and disable others using the check boxes below."));
    116     else
    117         m_pLabel->setText(UIWizardImportApp::tr("These are the virtual machines contained in the appliance "
    118                                                 "and the suggested settings of the imported VirtualBox machines. "
    119                                                 "You can change many of the properties shown by double-clicking "
    120                                                 "on the items and disable others using the check boxes below."));
     159    /* Update page appearance: */
     160    updatePageAppearance();
    121161
    122162    /* Translate the certificate label: */
     
    155195void UIWizardImportAppPageBasic2::initializePage()
    156196{
     197    /* Update widget visibility: */
     198    updatePageAppearance();
     199
    157200    /* Check whether there was cloud source selected: */
    158201    const bool fIsSourceCloudOne = field("isSourceCloudOne").toBool();
    159 
    160     /* Update widget visibility: */
    161     m_pFormEditor->setVisible(fIsSourceCloudOne);
    162     m_pApplianceWidget->setVisible(!fIsSourceCloudOne);
    163     m_pCertLabel->setVisible(!fIsSourceCloudOne);
    164202
    165203    if (fIsSourceCloudOne)
     
    260298    return fResult;
    261299}
     300
     301void UIWizardImportAppPageBasic2::updatePageAppearance()
     302{
     303    /* Call to base-class: */
     304    UIWizardImportAppPage2::updatePageAppearance();
     305
     306    /* Check whether there was cloud source selected: */
     307    const bool fIsSourceCloudOne = field("isSourceCloudOne").toBool();
     308    if (fIsSourceCloudOne)
     309    {
     310        m_pLabel->setText(UIWizardImportApp::tr("These are the the suggested settings of the cloud VM import "
     311                                                "procedure, they are influencing the resulting local VM instance. "
     312                                                "You can change many of the properties shown by double-clicking "
     313                                                "on the items and disable others using the check boxes below."));
     314        m_pFormEditor->setFocus();
     315    }
     316    else
     317    {
     318        m_pLabel->setText(UIWizardImportApp::tr("These are the virtual machines contained in the appliance "
     319                                                "and the suggested settings of the imported VirtualBox machines. "
     320                                                "You can change many of the properties shown by double-clicking "
     321                                                "on the items and disable others using the check boxes below."));
     322        m_pApplianceWidget->setFocus();
     323    }
     324}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.h

    r78274 r78275  
    2929/* Forward declarations: */
    3030class QLabel;
     31class QStackedLayout;
    3132class QIRichTextLabel;
    3233
     
    4243    void populateFormPropertiesTable();
    4344
     45    /** Updates page appearance. */
     46    virtual void updatePageAppearance();
     47
    4448    /** Returns appliance widget instance. */
    4549    ImportAppliancePointer applianceWidget() const { return m_pApplianceWidget; }
     50
     51    /** Holds the settings container layout instance. */
     52    QStackedLayout *m_pSettingsCntLayout;
    4653
    4754    /** Holds the appliance widget instance. */
     
    8289    virtual bool validatePage() /* override */;
    8390
     91    /** Updates page appearance. */
     92    virtual void updatePageAppearance() /* override */;
     93
    8494private:
    8595
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