VirtualBox

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


Ignore:
Timestamp:
Dec 9, 2020 10:46:58 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
141827
Message:

FE/Qt: bugref:9515. Refactoring the first page.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp

    r87060 r87062  
    182182    : m_pISOSelectorLabel(0)
    183183    , m_pISOFilePathSelector(0)
    184     , m_pStartHeadlessLabel(0)
    185184    , m_pEnableUnattendedInstallCheckBox(0)
    186185    , m_pStartHeadlessCheckBox(0)
     
    279278}
    280279
    281 void UIWizardNewVMPage1::createNameOSTypeWidgets(QGridLayout *pGridLayout, bool fCreateLabels /* = true */)
    282 {
    283     if (pGridLayout)
    284     {
    285         int iLayoutRow = 0;
    286         if (fCreateLabels)
    287         {
    288             m_pNameOSTypeLabel = new QIRichTextLabel;
    289             if (m_pNameOSTypeLabel)
    290                 pGridLayout->addWidget(m_pNameOSTypeLabel, iLayoutRow++, 0, 1, 3);
    291         }
    292 
    293         m_pNameAndFolderEditor = new UINameAndSystemEditor(0, true, true, false);
    294         if (m_pNameAndFolderEditor)
    295             pGridLayout->addWidget(m_pNameAndFolderEditor, iLayoutRow++, 1, 1, 2);
    296 
    297         if (fCreateLabels)
    298         {
    299             m_pUnattendedLabel = new QIRichTextLabel;
    300             if (m_pUnattendedLabel)
    301                 pGridLayout->addWidget(m_pUnattendedLabel, iLayoutRow++, 0, 1, 3);
    302         }
    303 
    304         m_pEnableUnattendedInstallCheckBox = new QCheckBox;
    305         pGridLayout->addWidget(m_pEnableUnattendedInstallCheckBox, iLayoutRow++, 0, 1, 3);
    306 
    307         m_pISOSelectorLabel = new QLabel;
    308         if (m_pISOSelectorLabel)
    309         {
    310             m_pISOSelectorLabel->setAlignment(Qt::AlignRight);
    311             m_pISOSelectorLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    312             m_pISOSelectorLabel->setEnabled(false);
    313             pGridLayout->addWidget(m_pISOSelectorLabel, iLayoutRow++, 1);
    314         }
    315         m_pISOFilePathSelector = new UIFilePathSelector;
    316         if (m_pISOFilePathSelector)
    317         {
    318             m_pISOFilePathSelector->setResetEnabled(false);
    319             m_pISOFilePathSelector->setMode(UIFilePathSelector::Mode_File_Open);
    320             m_pISOFilePathSelector->setFileDialogFilters("*.iso *.ISO");
    321             m_pISOFilePathSelector->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    322             m_pISOFilePathSelector->setEnabled(false);
    323             pGridLayout->addWidget(m_pISOFilePathSelector, iLayoutRow++, 2);
    324         }
    325 
    326         m_pStartHeadlessLabel = new QLabel;
    327         if (m_pStartHeadlessLabel)
    328         {
    329             m_pStartHeadlessLabel->setAlignment(Qt::AlignRight);
    330             m_pStartHeadlessLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    331             m_pStartHeadlessLabel->setEnabled(false);
    332             pGridLayout->addWidget(m_pStartHeadlessLabel, iLayoutRow++, 1);
    333         }
    334         m_pStartHeadlessCheckBox = new QCheckBox;
    335         if (m_pStartHeadlessCheckBox)
    336         {
    337             m_pStartHeadlessCheckBox->setEnabled(false);
    338             pGridLayout->addWidget(m_pStartHeadlessCheckBox, iLayoutRow++, 2);
    339         }
    340 
    341         m_pSystemTypeEditor = new UINameAndSystemEditor(0, false, false, true);
    342         if (m_pSystemTypeEditor)
    343             pGridLayout->addWidget(m_pSystemTypeEditor, iLayoutRow++, 1, 1, 2);
    344     }
     280void UIWizardNewVMPage1::createNameOSTypeWidgets(QWidget *pContainerWidget, bool fCreateLabels /* = true */)
     281{
     282    AssertReturnVoid(pContainerWidget);
     283    QGridLayout *pGridLayout = new QGridLayout(pContainerWidget);
     284    AssertReturnVoid(pGridLayout);
     285
     286    int iLayoutRow = 0;
     287    if (fCreateLabels)
     288    {
     289        m_pNameOSTypeLabel = new QIRichTextLabel;
     290        if (m_pNameOSTypeLabel)
     291            pGridLayout->addWidget(m_pNameOSTypeLabel, iLayoutRow++, 0, 1, 3);
     292    }
     293
     294    m_pNameAndFolderEditor = new UINameAndSystemEditor(0, true, true, false);
     295    if (m_pNameAndFolderEditor)
     296        pGridLayout->addWidget(m_pNameAndFolderEditor, iLayoutRow++, 1, 1, 2);
     297
     298    if (fCreateLabels)
     299    {
     300        m_pUnattendedLabel = new QIRichTextLabel;
     301        if (m_pUnattendedLabel)
     302            pGridLayout->addWidget(m_pUnattendedLabel, iLayoutRow++, 0, 1, 3);
     303    }
     304
     305    m_pEnableUnattendedInstallCheckBox = new QCheckBox;
     306    pGridLayout->addWidget(m_pEnableUnattendedInstallCheckBox, iLayoutRow++, 0, 1, 3);
     307
     308    m_pISOSelectorLabel = new QLabel;
     309    if (m_pISOSelectorLabel)
     310    {
     311        m_pISOSelectorLabel->setAlignment(Qt::AlignRight);
     312        m_pISOSelectorLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
     313        m_pISOSelectorLabel->setEnabled(false);
     314        pGridLayout->addWidget(m_pISOSelectorLabel, iLayoutRow, 1);
     315    }
     316    m_pISOFilePathSelector = new UIFilePathSelector;
     317    if (m_pISOFilePathSelector)
     318    {
     319        m_pISOFilePathSelector->setResetEnabled(false);
     320        m_pISOFilePathSelector->setMode(UIFilePathSelector::Mode_File_Open);
     321        m_pISOFilePathSelector->setFileDialogFilters("*.iso *.ISO");
     322        m_pISOFilePathSelector->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
     323        m_pISOFilePathSelector->setEnabled(false);
     324        pGridLayout->addWidget(m_pISOFilePathSelector, iLayoutRow++, 2);
     325    }
     326
     327    m_pStartHeadlessCheckBox = new QCheckBox;
     328    if (m_pStartHeadlessCheckBox)
     329    {
     330        m_pStartHeadlessCheckBox->setEnabled(false);
     331        pGridLayout->addWidget(m_pStartHeadlessCheckBox, iLayoutRow++, 2);
     332    }
     333
     334    m_pSystemTypeEditor = new UINameAndSystemEditor(0, false, false, true);
     335    if (m_pSystemTypeEditor)
     336        pGridLayout->addWidget(m_pSystemTypeEditor, iLayoutRow++, 1, 1, 2);
    345337}
    346338
     
    497489
    498490    if (m_pISOSelectorLabel)
    499         m_pISOSelectorLabel->setText(UIWizardNewVM::tr("Image:"));
    500 
    501     if (m_pStartHeadlessLabel)
    502         m_pStartHeadlessLabel->setText(UIWizardNewVM::tr("Options:"));
     491        m_pISOSelectorLabel->setText(UIWizardNewVM::tr("Installation Medium:"));
     492
    503493    if (m_pStartHeadlessCheckBox)
    504494    {
     
    507497                                                               "machine in headless mode after the guest OS install."));
    508498    }
    509 
    510499}
    511500
     
    518507void UIWizardNewVMPageBasic1::prepare()
    519508{
    520     QGridLayout *pMainLayout = new QGridLayout(this);;
    521     createNameOSTypeWidgets(pMainLayout, false);
     509    QWidget *pContainerWidget = new QWidget;
     510    QVBoxLayout *pPageLayout = new QVBoxLayout(this);
     511    pPageLayout->addWidget(pContainerWidget);
     512    createNameOSTypeWidgets(pContainerWidget, false);
     513    pPageLayout->addStretch();
    522514    createConnections();
    523515    /* Register fields: */
     
    590582    if (m_pISOFilePathSelector)
    591583        m_pISOFilePathSelector->setEnabled(fEnabled);
    592     if (m_pStartHeadlessLabel)
    593         m_pStartHeadlessLabel->setEnabled(fEnabled);
    594584    if (m_pStartHeadlessCheckBox)
    595585        m_pStartHeadlessCheckBox->setEnabled(fEnabled);
     
    618608    if (   m_pNameAndFolderEditor
    619609           && m_pSystemTypeEditor
    620         && m_pISOSelectorLabel
    621         && m_pStartHeadlessLabel)
     610           && m_pISOSelectorLabel)
    622611    {
    623612        int iMinWidthHint = 0;
    624613        iMinWidthHint = qMax(iMinWidthHint, m_pISOSelectorLabel->minimumSizeHint().width());
    625         iMinWidthHint = qMax(iMinWidthHint, m_pStartHeadlessLabel->minimumSizeHint().width());
    626         m_pNameAndFolderEditor->setMinimumLayoutIndent(iMinWidthHint);
    627         m_pSystemTypeEditor->setMinimumLayoutIndent(iMinWidthHint);
     614        // m_pNameAndFolderEditor->setMinimumLayoutIndent(iMinWidthHint);
     615        // m_pSystemTypeEditor->setMinimumLayoutIndent(iMinWidthHint);
    628616    }
    629617}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h

    r87060 r87062  
    7575    void composeMachineFilePath();
    7676    /** Creates the page widgets and adds them into the @p pGridLayout. */
    77     void createNameOSTypeWidgets(QGridLayout *pGridLayout, bool fCreateLabels = true);
     77    void createNameOSTypeWidgets(QWidget *pContainerWidget, bool fCreateLabels = true);
    7878    void setTypeByISODetectedOSType(const QString &strDetectedOSType);
    7979    /** Colors the widgets red if they cause isComplete to fail. */
     
    8787       /** Holds the ISO selector editor instance. */
    8888       mutable UIFilePathSelector *m_pISOFilePathSelector;
    89        QLabel *m_pStartHeadlessLabel;
    9089       QCheckBox *m_pEnableUnattendedInstallCheckBox;
    9190       QCheckBox *m_pStartHeadlessCheckBox;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r87060 r87062  
    5252        m_pToolBox = new QToolBox;
    5353        m_pNameAndSystemContainer = new QWidget(this);
    54         QGridLayout *pNameContainerLayout = new QGridLayout(m_pNameAndSystemContainer);
    55         createNameOSTypeWidgets(pNameContainerLayout, false);
     54        createNameOSTypeWidgets(m_pNameAndSystemContainer, false);
    5655        m_pGAInstallContainer = createGAInstallWidgets();
    5756        m_pUsernameHostnameContainer = createUserNameHostNameWidgets();
     
    419418    if (m_pISOFilePathSelector)
    420419        m_pISOFilePathSelector->setEnabled(fEnabled);
    421     if (m_pStartHeadlessLabel)
    422         m_pStartHeadlessLabel->setEnabled(fEnabled);
    423420    if (m_pStartHeadlessCheckBox)
    424421        m_pStartHeadlessCheckBox->setEnabled(fEnabled);
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