VirtualBox

Ignore:
Timestamp:
Jul 3, 2020 12:41:08 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
138958
Message:

FE/Qt: bugref:9515. Merging 3 pages into a single one.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
4 deleted
7 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r85044 r85055  
    650650        src/wizards/newcloudvm/UIWizardNewCloudVMPageExpert.h \
    651651        src/wizards/newvm/UIWizardNewVM.h \
    652         src/wizards/newvm/UIWizardNewVMPageBasicUserNameHostname.h \
    653652        src/wizards/newvm/UIWizardNewVMPageBasic1.h \
    654         src/wizards/newvm/UIWizardNewVMPageBasicGAInstall.h \
     653        src/wizards/newvm/UIWizardNewVMPageBasic2.h \
    655654        src/wizards/newvm/UIWizardNewVMPageBasicHardware.h \
    656         src/wizards/newvm/UIWizardNewVMPageBasicProductKey.h \
    657655        src/wizards/newvm/UIWizardNewVMPageBasicDisk.h \
    658656        src/wizards/newvm/UIWizardNewVMPageExpert.h \
     
    11151113        src/wizards/newcloudvm/UIWizardNewCloudVMPageExpert.cpp \
    11161114        src/wizards/newvm/UIWizardNewVM.cpp \
    1117         src/wizards/newvm/UIWizardNewVMPageBasicUserNameHostname.cpp \
    11181115        src/wizards/newvm/UIWizardNewVMPageBasic1.cpp \
    1119         src/wizards/newvm/UIWizardNewVMPageBasicGAInstall.cpp \
     1116        src/wizards/newvm/UIWizardNewVMPageBasic2.cpp \
    11201117        src/wizards/newvm/UIWizardNewVMPageBasicHardware.cpp \
    1121         src/wizards/newvm/UIWizardNewVMPageBasicProductKey.cpp \
    11221118        src/wizards/newvm/UIWizardNewVMPageBasicDisk.cpp \
    11231119        src/wizards/newvm/UIWizardNewVMPageExpert.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r85044 r85055  
    2020#include "UIWizardNewVM.h"
    2121#include "UIWizardNewVMPageBasic1.h"
     22#include "UIWizardNewVMPageBasic2.h"
    2223#include "UIWizardNewVMPageBasicHardware.h"
    23 #include "UIWizardNewVMPageBasicProductKey.h"
    24 #include "UIWizardNewVMPageBasicGAInstall.h"
    2524#include "UIWizardNewVMPageBasicDisk.h"
    2625#include "UIWizardNewVMPageExpert.h"
    27 #include "UIWizardNewVMPageBasicUserNameHostname.h"
    2826#include "UIMessageCenter.h"
    2927#include "UIMedium.h"
     
    7775        case WizardMode_Basic:
    7876        {
    79             setPage(Page1, new UIWizardNewVMPageBasicNameType(m_strGroup));
    80             setPage(PageUserNameHostname, new UIWizardNewVMPageBasicUserNameHostname);
    81             setPage(PageGAInstall, new UIWizardNewVMPageBasicGAInstall);
    82             setPage(PageProductKey, new UIWizardNewVMPageBasicProductKey);
     77            setPage(Page1, new UIWizardNewVMPageBasic1(m_strGroup));
     78            setPage(Page2, new UIWizardNewVMPageBasic2);
    8379            setPage(PageHardware, new UIWizardNewVMPageBasicHardware);
    8480            setPage(PageDisk, new UIWizardNewVMPageBasicDisk);
     
    406402        case WizardMode_Basic:
    407403        {
    408             UIWizardNewVMPageBasicNameType *pPage = qobject_cast<UIWizardNewVMPageBasicNameType*> (page(Page1));
     404            UIWizardNewVMPageBasic1 *pPage = qobject_cast<UIWizardNewVMPageBasic1*> (page(Page1));
    409405            /* Make sure that we were able to find the page that created the folder. */
    410406            Assert(pPage);
     
    427423void UIWizardNewVM::sltHandleDetectedOSTypeChange()
    428424{
    429     UIWizardNewVMPageBasicNameType *pPage = qobject_cast<UIWizardNewVMPageBasicNameType*>(page(Page1));
     425    UIWizardNewVMPageBasic1 *pPage = qobject_cast<UIWizardNewVMPageBasic1*>(page(Page1));
    430426    if (!pPage)
    431427        return;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r85044 r85055  
    6161    {
    6262        Page1,
    63         PageUserNameHostname,
    64         PageGAInstall,
    65         PageProductKey,
     63        Page2,
    6664        PageHardware,
    6765        PageDisk,
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp

    r85053 r85055  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIWizardNewVMPageBasicNameType class implementation.
     3 * VBox Qt GUI - UIWizardNewVMPageBasic1 class implementation.
    44 */
    55
     
    179179};
    180180
    181 UIWizardNewVMPageNameType::UIWizardNewVMPageNameType(const QString &strGroup)
     181UIWizardNewVMPage1::UIWizardNewVMPage1(const QString &strGroup)
    182182    : m_pButtonSimple(0)
    183183    , m_pButtonUnattended(0)
     
    194194}
    195195
    196 void UIWizardNewVMPageNameType::onNameChanged(QString strNewName)
     196void UIWizardNewVMPage1::onNameChanged(QString strNewName)
    197197{
    198198    /* Do not forget about achitecture bits, if not yet specified: */
     
    214214}
    215215
    216 void UIWizardNewVMPageNameType::onOsTypeChanged()
     216void UIWizardNewVMPage1::onOsTypeChanged()
    217217{
    218218    /* If the user manually edited the OS type, we didn't want our automatic OS type guessing anymore.
     
    222222}
    223223
    224 bool UIWizardNewVMPageNameType::determineOSType(const QString &strISOPath)
     224bool UIWizardNewVMPage1::determineOSType(const QString &strISOPath)
    225225{
    226226    QFileInfo isoFileInfo(strISOPath);
     
    250250}
    251251
    252 void UIWizardNewVMPageNameType::composeMachineFilePath()
     252void UIWizardNewVMPage1::composeMachineFilePath()
    253253{
    254254    if (!m_pNameAndSystemEditor)
     
    270270}
    271271
    272 bool UIWizardNewVMPageNameType::checkISOFile() const
     272bool UIWizardNewVMPage1::checkISOFile() const
    273273{
    274274    if (m_pButtonUnattended && m_pButtonUnattended->isChecked())
     
    281281}
    282282
    283 bool UIWizardNewVMPageNameType::createMachineFolder()
     283bool UIWizardNewVMPage1::createMachineFolder()
    284284{
    285285    if (!m_pNameAndSystemEditor)
     
    319319}
    320320
    321 bool UIWizardNewVMPageNameType::cleanupMachineFolder(bool fWizardCancel /* = false */)
     321bool UIWizardNewVMPage1::cleanupMachineFolder(bool fWizardCancel /* = false */)
    322322{
    323323    /* Make sure folder was previosly created: */
     
    338338}
    339339
    340 QString UIWizardNewVMPageNameType::machineFilePath() const
     340QString UIWizardNewVMPage1::machineFilePath() const
    341341{
    342342    return m_strMachineFilePath;
    343343}
    344344
    345 void UIWizardNewVMPageNameType::setMachineFilePath(const QString &strMachineFilePath)
     345void UIWizardNewVMPage1::setMachineFilePath(const QString &strMachineFilePath)
    346346{
    347347    m_strMachineFilePath = strMachineFilePath;
    348348}
    349349
    350 QString UIWizardNewVMPageNameType::machineFolder() const
     350QString UIWizardNewVMPage1::machineFolder() const
    351351{
    352352    return m_strMachineFolder;
    353353}
    354354
    355 void UIWizardNewVMPageNameType::setMachineFolder(const QString &strMachineFolder)
     355void UIWizardNewVMPage1::setMachineFolder(const QString &strMachineFolder)
    356356{
    357357    m_strMachineFolder = strMachineFolder;
    358358}
    359359
    360 QString UIWizardNewVMPageNameType::machineBaseName() const
     360QString UIWizardNewVMPage1::machineBaseName() const
    361361{
    362362    return m_strMachineBaseName;
    363363}
    364364
    365 void UIWizardNewVMPageNameType::setMachineBaseName(const QString &strMachineBaseName)
     365void UIWizardNewVMPage1::setMachineBaseName(const QString &strMachineBaseName)
    366366{
    367367    m_strMachineBaseName = strMachineBaseName;
    368368}
    369369
    370 QString UIWizardNewVMPageNameType::guestOSFamiyId() const
     370QString UIWizardNewVMPage1::guestOSFamiyId() const
    371371{
    372372    if (!m_pNameAndSystemEditor)
     
    375375}
    376376
    377 QString UIWizardNewVMPageNameType::ISOFilePath() const
     377QString UIWizardNewVMPage1::ISOFilePath() const
    378378{
    379379    if (!m_pISOFilePathSelector)
     
    382382}
    383383
    384 bool UIWizardNewVMPageNameType::isUnattendedEnabled() const
     384bool UIWizardNewVMPage1::isUnattendedEnabled() const
    385385{
    386386    if (!m_pButtonUnattended)
     
    389389}
    390390
    391 bool UIWizardNewVMPageNameType::startHeadless() const
     391bool UIWizardNewVMPage1::startHeadless() const
    392392{
    393393    if (!m_pStartHeadlessCheckBox)
     
    396396}
    397397
    398 const QString &UIWizardNewVMPageNameType::detectedOSTypeId() const
     398const QString &UIWizardNewVMPage1::detectedOSTypeId() const
    399399{
    400400    return m_strDetectedOSTypeId;
    401401}
    402402
    403 UIWizardNewVMPageBasicNameType::UIWizardNewVMPageBasicNameType(const QString &strGroup)
    404     : UIWizardNewVMPageNameType(strGroup)
     403UIWizardNewVMPageBasic1::UIWizardNewVMPageBasic1(const QString &strGroup)
     404    : UIWizardNewVMPage1(strGroup)
    405405{
    406406    prepare();
    407407}
    408408
    409 void UIWizardNewVMPageBasicNameType::prepare()
     409void UIWizardNewVMPageBasic1::prepare()
    410410{
    411411    QGridLayout *pMainLayout = new QGridLayout(this);
     
    439439            pButtonGroup->addButton(m_pButtonUnattended);
    440440            connect(pButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),
    441                     this, &UIWizardNewVMPageBasicNameType::sltUnattendedCheckBoxToggle);
     441                    this, &UIWizardNewVMPageBasic1::sltUnattendedCheckBoxToggle);
    442442        }
    443443
     
    458458            m_pISOFilePathSelector->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    459459            m_pISOFilePathSelector->setEnabled(false);
    460             connect(m_pISOFilePathSelector, &UIFilePathSelector::pathChanged, this, &UIWizardNewVMPageBasicNameType::sltISOPathChanged);
     460            connect(m_pISOFilePathSelector, &UIFilePathSelector::pathChanged, this, &UIWizardNewVMPageBasic1::sltISOPathChanged);
    461461            pMainLayout->addWidget(m_pISOFilePathSelector, 3, 2);
    462462        }
     
    484484        if (m_pNameAndSystemEditor)
    485485        {
    486             connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigNameChanged, this, &UIWizardNewVMPageBasicNameType::sltNameChanged);
    487             connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigPathChanged, this, &UIWizardNewVMPageBasicNameType::sltPathChanged);
    488             connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOsTypeChanged, this, &UIWizardNewVMPageBasicNameType::sltOsTypeChanged);
     486            connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigNameChanged, this, &UIWizardNewVMPageBasic1::sltNameChanged);
     487            connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigPathChanged, this, &UIWizardNewVMPageBasic1::sltPathChanged);
     488            connect(m_pNameAndSystemEditor, &UINameAndSystemEditor::sigOsTypeChanged, this, &UIWizardNewVMPageBasic1::sltOsTypeChanged);
    489489            pMainLayout->addWidget(m_pNameAndSystemEditor, 6, 1, 1, 2);
    490490        }
     
    504504}
    505505
    506 int UIWizardNewVMPageBasicNameType::nextId() const
     506int UIWizardNewVMPageBasic1::nextId() const
    507507{
    508508    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
    509509    if (!pWizard || !pWizard->isUnattendedInstallEnabled())
    510510        return UIWizardNewVM::PageHardware;
    511     return UIWizardNewVM::PageUserNameHostname;
    512 }
    513 
    514 void UIWizardNewVMPageBasicNameType::setTypeByISODetectedOSType(const QString &strDetectedOSType)
     511    return UIWizardNewVM::Page2;
     512}
     513
     514void UIWizardNewVMPageBasic1::setTypeByISODetectedOSType(const QString &strDetectedOSType)
    515515{
    516516    if (!strDetectedOSType.isEmpty())
     
    518518}
    519519
    520 bool UIWizardNewVMPageBasicNameType::isComplete() const
     520bool UIWizardNewVMPageBasic1::isComplete() const
    521521{
    522522    if (m_pNameAndSystemEditor->name().isEmpty())
     
    525525}
    526526
    527 void UIWizardNewVMPageBasicNameType::sltNameChanged(const QString &strNewName)
     527void UIWizardNewVMPageBasic1::sltNameChanged(const QString &strNewName)
    528528{
    529529    onNameChanged(strNewName);
     
    531531}
    532532
    533 void UIWizardNewVMPageBasicNameType::sltPathChanged(const QString &strNewPath)
     533void UIWizardNewVMPageBasic1::sltPathChanged(const QString &strNewPath)
    534534{
    535535    Q_UNUSED(strNewPath);
     
    537537}
    538538
    539 void UIWizardNewVMPageBasicNameType::sltOsTypeChanged()
     539void UIWizardNewVMPageBasic1::sltOsTypeChanged()
    540540{
    541541    /* Call to base-class: */
     
    543543}
    544544
    545 void UIWizardNewVMPageBasicNameType::sltISOPathChanged(const QString &strPath)
     545void UIWizardNewVMPageBasic1::sltISOPathChanged(const QString &strPath)
    546546{
    547547    determineOSType(strPath);
     
    550550}
    551551
    552 void UIWizardNewVMPageBasicNameType::sltUnattendedCheckBoxToggle()
     552void UIWizardNewVMPageBasic1::sltUnattendedCheckBoxToggle()
    553553{
    554554    const bool fEnabled = m_pButtonUnattended->isChecked();
     
    567567
    568568
    569 void UIWizardNewVMPageBasicNameType::retranslateUi()
     569void UIWizardNewVMPageBasic1::retranslateUi()
    570570{
    571571    /* Translate page: */
     
    617617}
    618618
    619 void UIWizardNewVMPageBasicNameType::initializePage()
     619void UIWizardNewVMPageBasic1::initializePage()
    620620{
    621621    /* Translate page: */
     
    625625}
    626626
    627 void UIWizardNewVMPageBasicNameType::cleanupPage()
     627void UIWizardNewVMPageBasic1::cleanupPage()
    628628{
    629629    /* Cleanup: */
     
    633633}
    634634
    635 bool UIWizardNewVMPageBasicNameType::validatePage()
     635bool UIWizardNewVMPageBasic1::validatePage()
    636636{
    637637    /* Try to create machine folder: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h

    r85053 r85055  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIWizardNewVMPageBasicNameType class declaration.
     3 * VBox Qt GUI - UIWizardNewVMPageBasic1 class declaration.
    44 */
    55
     
    1616 */
    1717
    18 #ifndef FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasicNameType_h
    19 #define FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasicNameType_h
     18#ifndef FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasic1_h
     19#define FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasic1_h
    2020#ifndef RT_WITHOUT_PRAGMA_ONCE
    2121# pragma once
     
    3434
    3535/* 1st page of the New Virtual Machine wizard (base part): */
    36 class UIWizardNewVMPageNameType : public UIWizardPageBase
     36class UIWizardNewVMPage1 : public UIWizardPageBase
    3737{
    3838protected:
    3939
    4040    /* Constructor: */
    41     UIWizardNewVMPageNameType(const QString &strGroup);
     41    UIWizardNewVMPage1(const QString &strGroup);
    4242
    4343    /* Handlers: */
     
    117117
    118118/* 1st page of the New Virtual Machine wizard (basic extension): */
    119 class UIWizardNewVMPageBasicNameType : public UIWizardPage, public UIWizardNewVMPageNameType
     119class UIWizardNewVMPageBasic1 : public UIWizardPage, public UIWizardNewVMPage1
    120120{
    121121    Q_OBJECT;
     
    133133
    134134    /* Constructor: */
    135     UIWizardNewVMPageBasicNameType(const QString &strGroup);
     135    UIWizardNewVMPageBasic1(const QString &strGroup);
    136136    virtual int nextId() const /* override */;
    137137    void setTypeByISODetectedOSType(const QString &strDetectedOSType);
     
    170170};
    171171
    172 #endif /* !FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasicNameType_h */
     172#endif /* !FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasic1_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.cpp

    r85054 r85055  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIWizardNewVMPageBasicUserNameHostname class implementation.
     3 * VBox Qt GUI - UIWizardNewVMPageBasic2 class implementation.
    44 */
    55
     
    1717
    1818/* Qt includes: */
     19#include <QCheckBox>
     20#include <QFileInfo>
    1921#include <QGridLayout>
    2022#include <QLabel>
     23#include <QToolBox>
    2124#include <QVBoxLayout>
    2225
    2326/* GUI includes: */
    2427#include "QIRichTextLabel.h"
     28#include "UIFilePathSelector.h"
    2529#include "UIUserNamePasswordEditor.h"
    26 #include "UIWizardNewVMPageBasicUserNameHostname.h"
     30#include "UIWizardNewVMPageBasic2.h"
    2731#include "UIWizardNewVM.h"
    2832
    2933
    30 UIWizardNewVMPageUserNameHostname::UIWizardNewVMPageUserNameHostname()
    31     : m_pUserNamePasswordEditor(0)
     34UIWizardNewVMPage2::UIWizardNewVMPage2()
     35    : m_pToolBox(0)
     36    , m_pUserNamePasswordEditor(0)
    3237    , m_pHostnameLineEdit(0)
    3338    , m_pHostnameLabel(0)
    34 {
    35 }
    36 
    37 QString UIWizardNewVMPageUserNameHostname::userName() const
     39    , m_pInstallGACheckBox(0)
     40    , m_pISOPathLabel(0)
     41    , m_pISOFilePathSelector(0)
     42    , m_pProductKeyLineEdit(0)
     43    , m_pProductKeyLabel(0)
     44
     45{
     46}
     47
     48QString UIWizardNewVMPage2::userName() const
    3849{
    3950    if (m_pUserNamePasswordEditor)
     
    4253}
    4354
    44 void UIWizardNewVMPageUserNameHostname::setUserName(const QString &strName)
     55void UIWizardNewVMPage2::setUserName(const QString &strName)
    4556{
    4657    if (m_pUserNamePasswordEditor)
     
    4859}
    4960
    50 QString UIWizardNewVMPageUserNameHostname::password() const
     61QString UIWizardNewVMPage2::password() const
    5162{
    5263    if (m_pUserNamePasswordEditor)
     
    5566}
    5667
    57 void UIWizardNewVMPageUserNameHostname::setPassword(const QString &strPassword)
     68void UIWizardNewVMPage2::setPassword(const QString &strPassword)
    5869{
    5970    if (m_pUserNamePasswordEditor)
     
    6172}
    6273
    63 QString UIWizardNewVMPageUserNameHostname::hostname() const
     74QString UIWizardNewVMPage2::hostname() const
    6475{
    6576    if (m_pHostnameLineEdit)
     
    6879}
    6980
    70 void UIWizardNewVMPageUserNameHostname::setHostname(const QString &strHostName)
     81void UIWizardNewVMPage2::setHostname(const QString &strHostName)
    7182{
    7283    if (m_pHostnameLineEdit)
     
    7485}
    7586
    76 UIWizardNewVMPageBasicUserNameHostname::UIWizardNewVMPageBasicUserNameHostname()
     87bool UIWizardNewVMPage2::installGuestAdditions() const
     88{
     89    if (!m_pInstallGACheckBox)
     90        return true;
     91    return m_pInstallGACheckBox->isChecked();
     92}
     93
     94void UIWizardNewVMPage2::setInstallGuestAdditions(bool fInstallGA)
     95{
     96    if (m_pInstallGACheckBox)
     97        m_pInstallGACheckBox->setChecked(fInstallGA);
     98}
     99
     100QString UIWizardNewVMPage2::guestAdditionsISOPath() const
     101{
     102    if (!m_pISOFilePathSelector)
     103        return QString();
     104    return m_pISOFilePathSelector->path();
     105}
     106
     107void UIWizardNewVMPage2::setGuestAdditionsISOPath(const QString &strISOPath)
     108{
     109    if (m_pISOFilePathSelector)
     110        m_pISOFilePathSelector->setPath(strISOPath);
     111}
     112
     113QString UIWizardNewVMPage2::productKey() const
     114{
     115    if (!m_pProductKeyLineEdit || !m_pProductKeyLineEdit->hasAcceptableInput())
     116        return QString();
     117    return m_pProductKeyLineEdit->text();
     118}
     119
     120bool UIWizardNewVMPage2::checkGAISOFile() const
     121{
     122    if (m_pInstallGACheckBox && m_pInstallGACheckBox->isChecked())
     123    {
     124        QString strISOFilePath = m_pISOFilePathSelector ? m_pISOFilePathSelector->path() : QString();
     125        if (!QFileInfo(strISOFilePath).exists())
     126            return false;
     127    }
     128    return true;
     129}
     130
     131UIWizardNewVMPageBasic2::UIWizardNewVMPageBasic2()
    77132    : m_pLabel(0)
    78133{
     134    prepare();
     135}
     136
     137void UIWizardNewVMPageBasic2::prepare()
     138{
    79139    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
     140    m_pToolBox = new QToolBox;
     141    pMainLayout->addWidget(m_pToolBox);
     142
    80143    {
    81144        m_pLabel = new QIRichTextLabel(this);
    82         QGridLayout *pGridLayout = new QGridLayout;
    83         {
    84             m_pUserNamePasswordEditor = new UIUserNamePasswordEditor;
    85             pGridLayout->addWidget(m_pUserNamePasswordEditor, 0, 0, 3, 4);
    86             connect(m_pUserNamePasswordEditor, &UIUserNamePasswordEditor::sigSomeTextChanged,
    87                     this, &UIWizardNewVMPageBasicUserNameHostname::completeChanged);
    88             m_pHostnameLabel = new QLabel;
    89             m_pHostnameLineEdit = new QLineEdit;
    90             pGridLayout->addWidget(m_pHostnameLabel, 3, 0, 1, 1, Qt::AlignRight);
    91             pGridLayout->addWidget(m_pHostnameLineEdit, 3, 1, 1, 3);
    92         }
    93145        if (m_pLabel)
    94146            pMainLayout->addWidget(m_pLabel);
    95         pMainLayout->addLayout(pGridLayout);
     147        pMainLayout->addWidget(m_pToolBox);
    96148        pMainLayout->addStretch();
    97149    }
     150
     151    createUserNameHostNameWidgets();
     152    createGAInstallWidgets();
     153    createProductKeyWidgets();
    98154
    99155    registerField("userName", this, "userName");
    100156    registerField("password", this, "password");
    101157    registerField("hostname", this, "hostname");
    102 }
    103 
    104 void UIWizardNewVMPageBasicUserNameHostname::retranslateUi()
     158    registerField("installGuestAdditions", this, "installGuestAdditions");
     159    registerField("guestAdditionsISOPath", this, "guestAdditionsISOPath");
     160    registerField("productKey", this, "productKey");
     161}
     162
     163void UIWizardNewVMPageBasic2::createUserNameHostNameWidgets()
     164{
     165    if (!m_pToolBox)
     166        return;
     167    QWidget *pContainer = new QWidget;
     168    QGridLayout *pGridLayout = new QGridLayout(pContainer);
     169
     170    m_pUserNamePasswordEditor = new UIUserNamePasswordEditor;
     171    pGridLayout->addWidget(m_pUserNamePasswordEditor, 0, 0, 3, 4);
     172    connect(m_pUserNamePasswordEditor, &UIUserNamePasswordEditor::sigSomeTextChanged,
     173            this, &UIWizardNewVMPageBasic2::completeChanged);
     174    m_pHostnameLabel = new QLabel;
     175    m_pHostnameLineEdit = new QLineEdit;
     176    pGridLayout->addWidget(m_pHostnameLabel, 3, 0, 1, 1, Qt::AlignRight);
     177    pGridLayout->addWidget(m_pHostnameLineEdit, 3, 1, 1, 3);
     178
     179    m_pToolBox->insertItem(Tabs_UserNameHostname, pContainer, QString());
     180
     181}
     182
     183void UIWizardNewVMPageBasic2::createGAInstallWidgets()
     184{
     185    if (!m_pToolBox)
     186        return;
     187    QWidget *pContainer = new QWidget;
     188    QGridLayout *pContainerLayout = new QGridLayout(pContainer);
     189
     190    m_pInstallGACheckBox = new QCheckBox;
     191    connect(m_pInstallGACheckBox, &QCheckBox::toggled, this, &UIWizardNewVMPageBasic2::sltInstallGACheckBoxToggle);
     192    m_pISOPathLabel = new QLabel;
     193    {
     194        m_pISOPathLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
     195        m_pISOPathLabel->setEnabled(false);
     196    }
     197    m_pISOFilePathSelector = new UIFilePathSelector;
     198    {
     199        m_pISOFilePathSelector->setResetEnabled(false);
     200        m_pISOFilePathSelector->setMode(UIFilePathSelector::Mode_File_Open);
     201        m_pISOFilePathSelector->setFileDialogFilters("*.iso *.ISO");
     202        m_pISOFilePathSelector->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
     203        m_pISOFilePathSelector->setEnabled(false);
     204        connect(m_pISOFilePathSelector, &UIFilePathSelector::pathChanged, this, &UIWizardNewVMPageBasic2::sltGAISOPathChanged);
     205    }
     206
     207    pContainerLayout->addWidget(m_pInstallGACheckBox, 0, 0, 1, 5);
     208    pContainerLayout->addWidget(m_pISOPathLabel, 1, 1, 1, 1);
     209    pContainerLayout->addWidget(m_pISOFilePathSelector, 1, 2, 1, 4);
     210
     211    m_pToolBox->insertItem(Tabs_GAInstall, pContainer, QString());
     212}
     213
     214void UIWizardNewVMPageBasic2::createProductKeyWidgets()
     215{
     216    if (!m_pToolBox)
     217        return;
     218    QWidget *pContainer = new QWidget;
     219    QGridLayout *pGridLayout = new QGridLayout(pContainer);
     220
     221
     222    m_pProductKeyLabel = new QLabel;
     223    m_pProductKeyLineEdit = new QLineEdit;
     224    m_pProductKeyLineEdit->setInputMask(">NNNNN-NNNNN-NNNNN-NNNNN-NNNNN;#");
     225    pGridLayout->addWidget(m_pProductKeyLabel, 0, 0, 1, 1, Qt::AlignRight);
     226    pGridLayout->addWidget(m_pProductKeyLineEdit, 0, 1, 1, 3);
     227
     228    m_pToolBox->insertItem(Tabs_ProductKey, pContainer, QString());
     229}
     230
     231void UIWizardNewVMPageBasic2::retranslateUi()
    105232{
    106233    setTitle(UIWizardNewVM::tr("User Name/Password and Hostname Settings"));
     
    110237    if (m_pHostnameLabel)
    111238        m_pHostnameLabel->setText(UIWizardNewVM::tr("Hostname:"));
    112 }
    113 
    114 void UIWizardNewVMPageBasicUserNameHostname::initializePage()
     239    if (m_pToolBox)
     240    {
     241        m_pToolBox->setItemText(Tabs_UserNameHostname, UIWizardNewVM::tr("UserName and hostname"));
     242        m_pToolBox->setItemText(Tabs_GAInstall, UIWizardNewVM::tr("Guest additions install"));
     243        m_pToolBox->setItemText(Tabs_ProductKey, UIWizardNewVM::tr("Product key"));
     244    }
     245    if (m_pInstallGACheckBox)
     246        m_pInstallGACheckBox->setText(UIWizardNewVM::tr("Install guest additions"));
     247    if (m_pISOPathLabel)
     248        m_pISOPathLabel->setText(UIWizardNewVM::tr("Installation medium:"));
     249    if (m_pISOFilePathSelector)
     250        m_pISOFilePathSelector->setToolTip(UIWizardNewVM::tr("Please select an installation medium (ISO file)"));
     251    if (m_pProductKeyLabel)
     252        m_pProductKeyLabel->setText(UIWizardNewVM::tr("Product Key:"));
     253}
     254
     255void UIWizardNewVMPageBasic2::initializePage()
    115256{
    116257    retranslateUi();
    117258}
    118259
    119 bool UIWizardNewVMPageBasicUserNameHostname::isComplete() const
    120 {
     260bool UIWizardNewVMPageBasic2::isComplete() const
     261{
     262    if (!checkGAISOFile())
     263        return false;
    121264    if (m_pUserNamePasswordEditor)
    122265        return m_pUserNamePasswordEditor->isComplete();
     
    124267}
    125268
    126 void UIWizardNewVMPageBasicUserNameHostname::cleanupPage()
    127 {
    128 }
     269void UIWizardNewVMPageBasic2::cleanupPage()
     270{
     271}
     272
     273void UIWizardNewVMPageBasic2::showEvent(QShowEvent *pEvent)
     274{
     275    if (m_pToolBox)
     276    {
     277        QWidget *pProductKeyWidget = m_pToolBox->widget(Tabs_ProductKey);
     278        if (pProductKeyWidget)
     279            pProductKeyWidget->setEnabled(isProductKeyWidgetVisible());
     280    }
     281    UIWizardPage::showEvent(pEvent);
     282}
     283
     284void UIWizardNewVMPageBasic2::sltInstallGACheckBoxToggle(bool fEnabled)
     285{
     286    if (m_pISOPathLabel)
     287        m_pISOPathLabel->setEnabled(fEnabled);
     288    if (m_pISOFilePathSelector)
     289        m_pISOFilePathSelector->setEnabled(fEnabled);
     290    emit completeChanged();
     291}
     292
     293void UIWizardNewVMPageBasic2::sltGAISOPathChanged(const QString &strPath)
     294{
     295    Q_UNUSED(strPath);
     296    emit completeChanged();
     297}
     298
     299bool UIWizardNewVMPageBasic2::isProductKeyWidgetVisible() const
     300{
     301    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
     302    if (!pWizard || !pWizard->isUnattendedInstallEnabled() || !pWizard->isGuestOSTypeWindows())
     303        return false;
     304    return true;
     305}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.h

    r85054 r85055  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIWizardNewVMPageBasicUserNameHostname class declaration.
     3 * VBox Qt GUI - UIWizardNewVMPageBasic2 class declaration.
    44 */
    55
     
    1616 */
    1717
    18 #ifndef FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasicUserNameHostname_h
    19 #define FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasicUserNameHostname_h
     18#ifndef FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasic2_h
     19#define FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasic2_h
    2020#ifndef RT_WITHOUT_PRAGMA_ONCE
    2121# pragma once
     
    2727
    2828/* Forward declarations: */
     29class QCheckBox;
    2930class QGridLayout;
    3031class QLabel;
    3132class QLineEdit;
     33class QToolBox;
    3234class QIRichTextLabel;
     35class UIFilePathSelector;
    3336class UIUserNamePasswordEditor;
    3437struct UIUnattendedInstallData;
    3538
    3639
    37 class UIWizardNewVMPageUserNameHostname : public UIWizardPageBase
     40class UIWizardNewVMPage2 : public UIWizardPageBase
    3841{
    3942public:
    4043
    41     UIWizardNewVMPageUserNameHostname();
     44    UIWizardNewVMPage2();
    4245
    4346    /** @name Property getters/setters
     
    4952        QString hostname() const;
    5053        void setHostname(const QString &strHostName);
     54        bool installGuestAdditions() const;
     55        void setInstallGuestAdditions(bool fInstallGA);
     56        QString guestAdditionsISOPath() const;
     57        void setGuestAdditionsISOPath(const QString &strISOPath);
     58        QString productKey() const;
    5159    /** @} */
    5260
    5361protected:
     62    enum Tabs
     63    {
     64        Tabs_UserNameHostname,
     65        Tabs_GAInstall,
     66        Tabs_ProductKey,
     67        Tabs_Max
     68    };
    5469
    55     UIUserNamePasswordEditor *m_pUserNamePasswordEditor;
    56     QLineEdit *m_pHostnameLineEdit;
    57     QLabel  *m_pHostnameLabel;
     70    bool checkGAISOFile() const;
     71
     72    /** @name Widgets
     73      * @{ */
     74        QToolBox *m_pToolBox;
     75        UIUserNamePasswordEditor *m_pUserNamePasswordEditor;
     76        QLineEdit *m_pHostnameLineEdit;
     77        QLabel  *m_pHostnameLabel;
     78        /** Guest additions iso selection widgets. */
     79        QCheckBox *m_pInstallGACheckBox;
     80        QLabel  *m_pISOPathLabel;
     81        UIFilePathSelector *m_pISOFilePathSelector;
     82        /** Product key stuff. */
     83        QLineEdit *m_pProductKeyLineEdit;
     84        QLabel  *m_pProductKeyLabel;
     85    /** @} */
     86
    5887};
    5988
    60 class UIWizardNewVMPageBasicUserNameHostname : public UIWizardPage, public UIWizardNewVMPageUserNameHostname
     89class UIWizardNewVMPageBasic2 : public UIWizardPage, public UIWizardNewVMPage2
    6190{
    6291    Q_OBJECT;
     
    6493    Q_PROPERTY(QString password READ password WRITE setPassword);
    6594    Q_PROPERTY(QString hostname READ hostname WRITE setHostname);
     95    Q_PROPERTY(bool installGuestAdditions READ installGuestAdditions WRITE setInstallGuestAdditions);
     96    Q_PROPERTY(QString guestAdditionsISOPath READ guestAdditionsISOPath WRITE setGuestAdditionsISOPath);
     97    Q_PROPERTY(QString productKey READ productKey);
     98
    6699
    67100public:
    68101
    69     UIWizardNewVMPageBasicUserNameHostname();
     102    UIWizardNewVMPageBasic2();
     103
     104protected:
     105
     106    virtual void showEvent(QShowEvent *pEvent) /* override */;
    70107
    71108private slots:
    72109
     110    void sltInstallGACheckBoxToggle(bool fChecked);
     111    void sltGAISOPathChanged(const QString &strPath);
     112
    73113private:
    74114
     115    void prepare();
     116    void createUserNameHostNameWidgets();
     117    void createGAInstallWidgets();
     118    void createProductKeyWidgets();
    75119    void retranslateUi();
    76120    void initializePage();
    77121    bool isComplete() const;
     122    /** Returns true if we show the widgets for guest os product key. */
     123    bool isProductKeyWidgetVisible() const;
    78124
    79125    /** Override the default behavior which resets the fields to proginal values. */
     
    83129};
    84130
    85 #endif /* !FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasicUserNameHostname_h */
     131#endif /* !FEQT_INCLUDED_SRC_wizards_newvm_UIWizardNewVMPageBasic2_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r84886 r85055  
    4040
    4141UIWizardNewVMPageExpert::UIWizardNewVMPageExpert(const QString &strGroup)
    42     : UIWizardNewVMPageNameType(strGroup)
     42    : UIWizardNewVMPage1(strGroup)
    4343{
    4444    /* Create widgets: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h

    r85044 r85055  
    3232/* Expert page of the New Virtual Machine wizard: */
    3333class UIWizardNewVMPageExpert : public UIWizardPage,
    34                                 public UIWizardNewVMPageNameType,
     34                                public UIWizardNewVMPage1,
    3535                                public UIWizardNewVMPageHardware,
    3636                                public UIWizardNewVMPageDisk
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