VirtualBox

Changeset 87057 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 9, 2020 7:53:33 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
141822
Message:

FE/Qt: bugref:9515. Repositioning widgets.

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

    r85168 r87057  
    186186    , m_pStartHeadlessLabel(0)
    187187    , m_pStartHeadlessCheckBox(0)
    188     , m_pNameAndSystemEditor(0)
     188    , m_pNameAndFolderEditor(0)
     189    , m_pSystemTypeEditor(0)
    189190    , m_pUnattendedLabel(0)
    190191    , m_pNameOSTypeLabel(0)
     
    206207        if (strNewName.contains(gs_OSTypePattern[i].pattern))
    207208        {
    208             if (m_pNameAndSystemEditor)
    209                 m_pNameAndSystemEditor->setType(uiCommon().vmGuestOSType(gs_OSTypePattern[i].pcstId));
     209            if (m_pSystemTypeEditor)
     210                m_pSystemTypeEditor->setType(uiCommon().vmGuestOSType(gs_OSTypePattern[i].pcstId));
    210211            break;
    211212        }
     
    216217    /* If the user manually edited the OS type, we didn't want our automatic OS type guessing anymore.
    217218     * So simply disconnect the text-edit signal. */
    218     if (m_pNameAndSystemEditor)
    219         m_pNameAndSystemEditor->disconnect(SIGNAL(sigNameChanged(const QString &)), thisImp(), SLOT(sltNameChanged(const QString &)));
     219    if (m_pNameAndFolderEditor)
     220        m_pNameAndFolderEditor->disconnect(SIGNAL(sigNameChanged(const QString &)), thisImp(), SLOT(sltNameChanged(const QString &)));
    220221}
    221222
     
    250251void UIWizardNewVMPage1::composeMachineFilePath()
    251252{
    252     if (!m_pNameAndSystemEditor)
     253    if (!m_pNameAndFolderEditor)
    253254        return;
    254     if (m_pNameAndSystemEditor->name().isEmpty() || m_pNameAndSystemEditor->path().isEmpty())
     255    if (m_pNameAndFolderEditor->name().isEmpty() || m_pNameAndFolderEditor->path().isEmpty())
    255256        return;
    256257    /* Get VBox: */
     
    258259
    259260    /* Compose machine filename: */
    260     m_strMachineFilePath = vbox.ComposeMachineFilename(m_pNameAndSystemEditor->name(),
     261    m_strMachineFilePath = vbox.ComposeMachineFilename(m_pNameAndFolderEditor->name(),
    261262                                                       m_strGroup,
    262263                                                       QString(),
    263                                                        m_pNameAndSystemEditor->path());
     264                                                       m_pNameAndFolderEditor->path());
    264265    /* Compose machine folder/basename: */
    265266    const QFileInfo fileInfo(m_strMachineFilePath);
     
    283284    if (pGridLayout)
    284285    {
     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
    285298        if (fCreateLabels)
    286299        {
    287300            m_pUnattendedLabel = new QIRichTextLabel;
    288301            if (m_pUnattendedLabel)
    289                 pGridLayout->addWidget(m_pUnattendedLabel, 0, 0, 1, 3);
     302                pGridLayout->addWidget(m_pUnattendedLabel, iLayoutRow++, 0, 1, 3);
    290303        }
    291304
     
    297310            {
    298311                m_pButtonSimple->setChecked(true);
    299                 pGridLayout->addWidget(m_pButtonSimple, 1, 0, 1, 3);
     312                pGridLayout->addWidget(m_pButtonSimple, iLayoutRow++, 0, 1, 3);
    300313            }
    301314            m_pButtonUnattended = new QRadioButton;
    302315            if (m_pButtonUnattended)
    303316            {
    304                 QStyleOptionButton options;
    305                 options.initFrom(m_pButtonUnattended);
    306                 const int iWidth = m_pButtonUnattended->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth,
    307                                                                              &options, m_pButtonUnattended);
    308                 pGridLayout->setColumnMinimumWidth(0, iWidth);
    309                 pGridLayout->addWidget(m_pButtonUnattended, 2, 0, 1, 3);
     317                // QStyleOptionButton options;
     318                // options.initFrom(m_pButtonUnattended);
     319                // const int iWidth = m_pButtonUnattended->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth,
     320                //                                                              &options, m_pButtonUnattended);
     321                // pGridLayout->setColumnMinimumWidth(0, iWidth);
     322                pGridLayout->addWidget(m_pButtonUnattended, iLayoutRow++, 0, 1, 3);
    310323            }
    311324
     
    320333            m_pISOSelectorLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    321334            m_pISOSelectorLabel->setEnabled(false);
    322             pGridLayout->addWidget(m_pISOSelectorLabel, 3, 1);
     335            pGridLayout->addWidget(m_pISOSelectorLabel, iLayoutRow++, 1);
    323336        }
    324337        m_pISOFilePathSelector = new UIFilePathSelector;
     
    330343            m_pISOFilePathSelector->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    331344            m_pISOFilePathSelector->setEnabled(false);
    332             pGridLayout->addWidget(m_pISOFilePathSelector, 3, 2);
     345            pGridLayout->addWidget(m_pISOFilePathSelector, iLayoutRow++, 2);
    333346        }
    334347
     
    339352            m_pStartHeadlessLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    340353            m_pStartHeadlessLabel->setEnabled(false);
    341             pGridLayout->addWidget(m_pStartHeadlessLabel, 4, 1);
     354            pGridLayout->addWidget(m_pStartHeadlessLabel, iLayoutRow++, 1);
    342355        }
    343356        m_pStartHeadlessCheckBox = new QCheckBox;
     
    345358        {
    346359            m_pStartHeadlessCheckBox->setEnabled(false);
    347             pGridLayout->addWidget(m_pStartHeadlessCheckBox, 4, 2);
    348         }
    349 
    350         if (fCreateLabels)
    351         {
    352             m_pNameOSTypeLabel = new QIRichTextLabel;
    353             if (m_pNameOSTypeLabel)
    354                 pGridLayout->addWidget(m_pNameOSTypeLabel, 5, 0, 1, 3);
    355         }
    356 
    357         m_pNameAndSystemEditor = new UINameAndSystemEditor(0, true, true, true);
    358         if (m_pNameAndSystemEditor)
    359         {
    360             pGridLayout->addWidget(m_pNameAndSystemEditor, 6, 1, 1, 2);
    361         }
     360            pGridLayout->addWidget(m_pStartHeadlessCheckBox, iLayoutRow++, 2);
     361        }
     362
     363        m_pSystemTypeEditor = new UINameAndSystemEditor(0, false, false, true);
     364        if (m_pSystemTypeEditor)
     365            pGridLayout->addWidget(m_pSystemTypeEditor, iLayoutRow++, 1, 1, 2);
    362366    }
    363367}
     
    365369bool UIWizardNewVMPage1::createMachineFolder()
    366370{
    367     if (!m_pNameAndSystemEditor)
     371    if (!m_pNameAndFolderEditor)
    368372        return false;
    369373    /* Cleanup previosly created folder if any: */
     
    452456QString UIWizardNewVMPage1::guestOSFamiyId() const
    453457{
    454     if (!m_pNameAndSystemEditor)
     458    if (!m_pSystemTypeEditor)
    455459        return QString();
    456     return m_pNameAndSystemEditor->familyId();
     460    return m_pSystemTypeEditor->familyId();
    457461}
    458462
     
    493497    if (m_pISOFilePathSelector)
    494498        m_pISOFilePathSelector->mark(!isISOFileSelectorComplete());
    495     if (m_pNameAndSystemEditor)
    496         m_pNameAndSystemEditor->markNameLineEdit(m_pNameAndSystemEditor->name().isEmpty());
     499    if (m_pNameAndFolderEditor)
     500        m_pNameAndFolderEditor->markNameLineEdit(m_pNameAndFolderEditor->name().isEmpty());
    497501}
    498502
     
    509513    {
    510514        m_pButtonSimple->setText(UIWizardNewVM::tr("Leave Disk Empty"));
    511         m_pButtonSimple->setToolTip(UIWizardNewVM::tr("When checked, no guest OS will be installed after this wizard is closed thereby leaving the virtual machine's disk empty."));
     515        m_pButtonSimple->setToolTip(UIWizardNewVM::tr("When checked, no guest OS will be installed after this wizard is closed"
     516                                                      " thereby leaving the virtual machine's disk empty."));
    512517    }
    513518    if (m_pButtonUnattended)
    514519    {
    515520        m_pButtonUnattended->setText(UIWizardNewVM::tr("Unattended Install"));
    516         m_pButtonUnattended->setToolTip(UIWizardNewVM::tr("When checked, an unattended guest OS installation will be started after this wizard is closed."));
     521        m_pButtonUnattended->setToolTip(UIWizardNewVM::tr("When checked, an unattended guest OS installation will be started "
     522                                                          "after this wizard is closed."));
    517523    }
    518524
     
    525531    {
    526532        m_pStartHeadlessCheckBox->setText(UIWizardNewVM::tr("Start VM Headless"));
    527         m_pStartHeadlessCheckBox->setToolTip(UIWizardNewVM::tr("When checked, the unattended install will start the virtual machine in headless mode."));
     533        m_pStartHeadlessCheckBox->setToolTip(UIWizardNewVM::tr("When checked, the unattended install will start the virtual "
     534                                                               "machine in headless mode after the guest OS install."));
    528535    }
    529536
     
    539546{
    540547    QGridLayout *pMainLayout = new QGridLayout(this);;
    541     createNameOSTypeWidgets(pMainLayout);
     548    createNameOSTypeWidgets(pMainLayout, false);
    542549    createConnections();
    543550    /* Register fields: */
    544     registerField("name*", m_pNameAndSystemEditor, "name", SIGNAL(sigNameChanged(const QString &)));
    545     registerField("type", m_pNameAndSystemEditor, "type", SIGNAL(sigOsTypeChanged()));
     551    registerField("name*", m_pNameAndFolderEditor, "name", SIGNAL(sigNameChanged(const QString &)));
     552    registerField("type", m_pSystemTypeEditor, "type", SIGNAL(sigOsTypeChanged()));
    546553    registerField("machineFilePath", this, "machineFilePath");
    547554    registerField("machineFolder", this, "machineFolder");
     
    559566            this, &UIWizardNewVMPageBasic1::sltUnattendedCheckBoxToggle);
    560567    connect(m_pISOFilePathSelector, &UIFilePathSelector::pathChanged, this, &UIWizardNewVMPageBasic1::sltISOPathChanged);
    561     connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigNameChanged, this, &UIWizardNewVMPageBasic1::sltNameChanged);
    562     connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigPathChanged, this, &UIWizardNewVMPageBasic1::sltPathChanged);
    563     connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOsTypeChanged, this, &UIWizardNewVMPageBasic1::sltOsTypeChanged);
     568    connect(m_pNameAndFolderEditor, &UINameAndSystemEditor::sigNameChanged, this, &UIWizardNewVMPageBasic1::sltNameChanged);
     569    connect(m_pNameAndFolderEditor, &UINameAndSystemEditor::sigPathChanged, this, &UIWizardNewVMPageBasic1::sltPathChanged);
     570    connect(m_pSystemTypeEditor, &UINameAndSystemEditor::sigOsTypeChanged, this, &UIWizardNewVMPageBasic1::sltOsTypeChanged);
    564571}
    565572
     
    575582{
    576583    markWidgets();
    577     if (m_pNameAndSystemEditor->name().isEmpty())
     584    if (m_pNameAndFolderEditor->name().isEmpty())
    578585        return false;
    579586    return isISOFileSelectorComplete();
     
    627634
    628635    if (m_pUnattendedLabel)
    629         m_pUnattendedLabel->setText(UIWizardNewVM::tr("Please choose whether you want to start an unattended guest os install "
    630                                              "in which case you will have to select a valid installation medium. If not "
    631                                              "your virtual disk will have an empty virtual hard disk. "
    632                                              "Additionally you can choose to start the unattended install as a headless vm process."));
     636        m_pUnattendedLabel->setText(UIWizardNewVM::tr("Please decide whether you want to start an unattended guest os install "
     637                                             "in which case you will have to select a valid installation medium. If not, "
     638                                             "your virtual disk will have an empty virtual hard disk."));
    633639
    634640
     
    639645                                             "to identify this machine."));
    640646
    641     if (   m_pNameAndSystemEditor
     647    if (   m_pNameAndFolderEditor
     648           && m_pSystemTypeEditor
    642649        && m_pISOSelectorLabel
    643650        && m_pStartHeadlessLabel)
     
    646653        iMinWidthHint = qMax(iMinWidthHint, m_pISOSelectorLabel->minimumSizeHint().width());
    647654        iMinWidthHint = qMax(iMinWidthHint, m_pStartHeadlessLabel->minimumSizeHint().width());
    648         m_pNameAndSystemEditor->setMinimumLayoutIndent(iMinWidthHint);
     655        m_pNameAndFolderEditor->setMinimumLayoutIndent(iMinWidthHint);
     656        m_pSystemTypeEditor->setMinimumLayoutIndent(iMinWidthHint);
    649657    }
    650658}
     
    654662    /* Translate page: */
    655663    retranslateUi();
    656     if (m_pNameAndSystemEditor)
    657         m_pNameAndSystemEditor->setFocus();
     664    if (m_pNameAndFolderEditor)
     665        m_pNameAndFolderEditor->setFocus();
    658666}
    659667
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h

    r85168 r87057  
    9797       QCheckBox *m_pStartHeadlessCheckBox;
    9898       /** Provides a path selector and a line edit field for path and name entry. */
    99        UINameAndSystemEditor *m_pNameAndSystemEditor;
     99       UINameAndSystemEditor *m_pNameAndFolderEditor;
     100       UINameAndSystemEditor *m_pSystemTypeEditor;
    100101       QIRichTextLabel *m_pUnattendedLabel;
    101102       QIRichTextLabel *m_pNameOSTypeLabel;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r86086 r87057  
    7373    qRegisterMetaType<CMedium>();
    7474    /* Register fields: */
    75     registerField("name*", m_pNameAndSystemEditor, "name", SIGNAL(sigNameChanged(const QString &)));
    76     registerField("type", m_pNameAndSystemEditor, "type", SIGNAL(sigOsTypeChanged()));
     75    registerField("name*", m_pNameAndFolderEditor, "name", SIGNAL(sigNameChanged(const QString &)));
     76    registerField("type", m_pSystemTypeEditor, "type", SIGNAL(sigOsTypeChanged()));
    7777    registerField("machineFilePath", this, "machineFilePath");
    7878    registerField("machineFolder", this, "machineFolder");
     
    107107    onNameChanged(strNewText);
    108108
    109     /* Fetch recommended RAM value: */
    110     CGuestOSType type = m_pNameAndSystemEditor->type();
    111 
    112109    composeMachineFilePath();
    113110    /* Broadcast complete-change: */
     
    127124
    128125    /* Fetch recommended RAM value: */
    129     CGuestOSType type = m_pNameAndSystemEditor->type();
     126    CGuestOSType type = m_pSystemTypeEditor->type();
    130127    m_pBaseMemoryEditor->setValue(type.GetRecommendedRAM());
    131128
     
    204201{
    205202    /* Connections for Name, OS Type, and unattended install stuff: */
    206     if (m_pNameAndSystemEditor)
    207     {
    208         connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigNameChanged,
     203    if (m_pNameAndFolderEditor)
     204    {
     205        connect(m_pNameAndFolderEditor, &UINameAndSystemEditor::sigNameChanged,
    209206                this, &UIWizardNewVMPageExpert::sltNameChanged);
    210         connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigPathChanged,
     207        connect(m_pNameAndFolderEditor, &UINameAndSystemEditor::sigPathChanged,
    211208                this, &UIWizardNewVMPageExpert::sltPathChanged);
    212         connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOsTypeChanged,
     209    }
     210    if (m_pSystemTypeEditor)
     211    {
     212        connect(m_pSystemTypeEditor, &UINameAndSystemEditor::sigOsTypeChanged,
    213213                this, &UIWizardNewVMPageExpert::sltOsTypeChanged);
    214         connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOSFamilyChanged,
     214        connect(m_pSystemTypeEditor, &UINameAndSystemEditor::sigOSFamilyChanged,
    215215                this, &UIWizardNewVMPageExpert::sltOSFamilyTypeChanged);
    216216    }
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