VirtualBox

Changeset 90060 in vbox for trunk


Ignore:
Timestamp:
Jul 6, 2021 12:12:10 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145555
Message:

FE/Qt: bugref:9996: Working on the 1st page's functionality.

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

Legend:

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

    r90040 r90060  
    6464    , m_fStartHeadless(false)
    6565    , m_fSkipUnattendedInstall(false)
     66    , m_iCPUCount(1)
     67    , m_iMemoryAmount(0)
     68
    6669{
    6770#ifndef VBOX_WS_MAC
     
    8588        {
    8689            addPage(new UIWizardNewVMNameOSTypePageBasic);
    87             addPage(new UIWizardNewVMUnattendedPageBasic);
    88             addPage(new UIWizardNewVMHardwarePageBasic);
    89             addPage(new UIWizardNewVMDiskPageBasic);
     90            // addPage(new UIWizardNewVMUnattendedPageBasic);
     91            // addPage(new UIWizardNewVMHardwarePageBasic);
     92            // addPage(new UIWizardNewVMDiskPageBasic);
    9093            break;
    9194        }
     
    758761}
    759762
     763int UIWizardNewVM::CPUCount() const
     764{
     765    return m_iCPUCount;
     766}
     767
     768void UIWizardNewVM::setCPUCount(int iCPUCount)
     769{
     770    m_iCPUCount = iCPUCount;
     771}
     772
     773int UIWizardNewVM::memoryAmount() const
     774{
     775    return m_iMemoryAmount;
     776}
     777
     778void UIWizardNewVM::setMemoryCount(int iMemory)
     779{
     780    m_iMemoryAmount = iMemory;
     781}
     782
    760783const UIUnattendedInstallData &UIWizardNewVM::unattendedInstallData() const
    761784{
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r90041 r90060  
    2929#include "CMachine.h"
    3030#include "CMedium.h"
     31
     32#define parentWizardSet(functionName, value)                         \
     33    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard()); \
     34    if (pWizard)                                                     \
     35        pWizard->functionName(value);
    3136
    3237/** Container for unattended install related data. */
     
    129134    void setProductKey(const QString &productKey);
    130135
     136    int CPUCount() const;
     137    void setCPUCount(int iCPUCount);
     138
     139    int memoryAmount() const;
     140    void setMemoryCount(int iMemory);
     141
    131142protected:
    132143
     
    195206    QString m_strHostname;
    196207    QString m_strProductKey;
     208
     209    int m_iCPUCount;
     210    int m_iMemoryAmount;
    197211};
    198212
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMHardwarePageBasic.cpp

    r90003 r90060  
    3434#include "CGuestOSType.h"
    3535
    36 // UIWizardNewVMHardwarePage::UIWizardNewVMHardwarePage()
    37 // {
    38 // }
    39 
    40 // int UIWizardNewVMHardwarePage::baseMemory() const
    41 // {
    42 //     if (!m_pBaseMemoryEditor)
    43 //         return 0;
    44 //     return m_pBaseMemoryEditor->value();
    45 // }
    46 
    47 // int UIWizardNewVMHardwarePage::VCPUCount() const
    48 // {
    49 //     if (!m_pVirtualCPUEditor)
    50 //         return 1;
    51 //     return m_pVirtualCPUEditor->value();
    52 // }
    53 
    54 // bool UIWizardNewVMHardwarePage::EFIEnabled() const
    55 // {
    56 //     if (!m_pEFICheckBox)
    57 //         return false;
    58 //     return m_pEFICheckBox->isChecked();
    59 // }
    60 
    61 
    6236UIWizardNewVMHardwarePageBasic::UIWizardNewVMHardwarePageBasic()
    6337    : m_pBaseMemoryEditor(0)
     
    6640    , m_pLabel(0)
    6741{
     42    m_pWizard = qobject_cast<UIWizardNewVM*>(wizard());
    6843    prepare();
    6944    qRegisterMetaType<CMedium>();
     
    7954
    8055    pMainLayout->addStretch();
    81     // createConnections();
     56    createConnections();
    8257}
    8358
    8459void UIWizardNewVMHardwarePageBasic::createConnections()
    8560{
     61    connect(m_pBaseMemoryEditor, &UIBaseMemoryEditor::sigValueChanged,
     62            this, &UIWizardNewVMHardwarePageBasic::sltMemoryAmountChanged);
     63
     64
    8665}
    8766
     
    145124    return pHardwareContainer;
    146125}
     126
     127void UIWizardNewVMHardwarePageBasic::sltMemoryAmountChanged(int iValue)
     128{
     129    Q_UNUSED(iValue);
     130}
     131
     132void UIWizardNewVMHardwarePageBasic::sltCPUCountChanged(int iCount)
     133{
     134    Q_UNUSED(iCount);
     135}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMHardwarePageBasic.h

    r90003 r90060  
    3838class UIBaseMemoryEditor;
    3939class UIVirtualCPUEditor;
     40class UIWizardNewVM;
    4041
    41 /** 3rd page of the New Virtual Machine wizard (base part). */
    42 // class UIWizardNewVMHardwarePage : public UIWizardPageBase
    43 // {
    44 
    45 // protected:
    46 
    47 //     /** Constructor. */
    48 //     UIWizardNewVMHardwarePage();
    49 
    50 
    51 //     /** @name Property getters/setters
    52 //      * @{ */
     42namespace UIWizardNewVMHardwarePage
     43{
     44}
    5345//        int baseMemory() const;
    5446//        int VCPUCount() const;
    5547//        bool EFIEnabled() const;
    56 //     /** @} */
    57 
    58 //     QWidget *createHardwareWidgets();
    59 //     void retranslateWidgets();
    6048
    6149
    62 
    63 
    64 // };
    65 
    66 /** 3rd page of the New Virtual Machine wizard (basic extension). */
    6750class UIWizardNewVMHardwarePageBasic : public UINativeWizardPage
    6851{
     
    7154public:
    7255
    73     /** Constructor. */
    7456    UIWizardNewVMHardwarePageBasic();
    7557
     
    7961private slots:
    8062
     63    void sltMemoryAmountChanged(int iValue);
     64    void sltCPUCountChanged(int iCount);
    8165
    8266private:
    83 
    8467
    8568    /** Prepare stuff. */
     
    9174    QWidget *createHardwareWidgets();
    9275    bool isComplete() const;
     76
     77    UIWizardNewVM *m_pWizard;
    9378
    9479    /** @name Widgets
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePageBasic.cpp

    r90037 r90060  
    3838#include "CSystemProperties.h"
    3939#include "CUnattended.h"
     40
    4041
    4142/* Defines some patterns to guess the right OS type. Should be in sync with
     
    344345    , m_pNameOSTypeLabel(0)
    345346{
    346     m_pWizard = qobject_cast<UIWizardNewVM*>(wizard());
    347347    prepare();
    348348}
     
    400400{
    401401    UIWizardNewVMNameOSTypePage::onNameChanged(m_pNameAndSystemEditor, strNewName);
    402     UIWizardNewVMNameOSTypePage::composeMachineFilePath(m_pNameAndSystemEditor, m_pWizard);
     402    UIWizardNewVMNameOSTypePage::composeMachineFilePath(m_pNameAndSystemEditor, qobject_cast<UIWizardNewVM*>(wizard()));
     403    emit completeChanged();
    403404}
    404405
     
    406407{
    407408    Q_UNUSED(strNewPath);
    408     UIWizardNewVMNameOSTypePage::composeMachineFilePath(m_pNameAndSystemEditor, m_pWizard);
     409    UIWizardNewVMNameOSTypePage::composeMachineFilePath(m_pNameAndSystemEditor, qobject_cast<UIWizardNewVM*>(wizard()));
    409410}
    410411
     
    457458{
    458459    /* Try to create machine folder: */
    459     return UIWizardNewVMNameOSTypePage::createMachineFolder(m_pNameAndSystemEditor, this, m_pWizard);
     460    return UIWizardNewVMNameOSTypePage::createMachineFolder(m_pNameAndSystemEditor, this, qobject_cast<UIWizardNewVM*>(wizard()));
    460461}
    461462
    462463void UIWizardNewVMNameOSTypePageBasic::sltISOPathChanged(const QString &strPath)
    463464{
    464     UIWizardNewVMNameOSTypePage::determineOSType(strPath, m_pWizard);
    465     if (m_pWizard)
    466     {
    467         if (!m_pWizard->detectedOSTypeId().isEmpty())
    468             UIWizardNewVMNameOSTypePage::onNameChanged(m_pNameAndSystemEditor, m_pWizard->detectedOSTypeId());
    469         m_pWizard->setISOFilePath(strPath);
     465    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(this->wizard());
     466    UIWizardNewVMNameOSTypePage::determineOSType(strPath, pWizard);
     467    if (pWizard)
     468    {
     469        if (!pWizard->detectedOSTypeId().isEmpty())
     470            UIWizardNewVMNameOSTypePage::onNameChanged(m_pNameAndSystemEditor, pWizard->detectedOSTypeId());
     471        pWizard->setISOFilePath(strPath);
    470472    }
    471473    /* Update the global recent ISO path: */
     
    479481void UIWizardNewVMNameOSTypePageBasic::sltGuestOSFamilChanged(const QString &strGuestOSFamilyId)
    480482{
    481     if (m_pWizard)
    482         m_pWizard->setGuestOSFamilyId(strGuestOSFamilyId);
     483    parentWizardSet(setGuestOSFamilyId, strGuestOSFamilyId);
    483484}
    484485
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePageBasic.h

    r90037 r90060  
    101101    bool isUnattendedEnabled() const;
    102102
    103     UIWizardNewVM *m_pWizard;
    104 
    105103    /** @name Widgets
    106104     * @{ */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMUnattendedPageBasic.cpp

    r90040 r90060  
    6868    , m_pProductKeyLabel(0)
    6969{
    70     m_pWizard = qobject_cast<UIWizardNewVM*>(wizard());
    7170    prepare();
    7271}
     
    159158{
    160159    markWidgets();
    161     if (m_pWizard && m_pWizard->installGuestAdditions() &&
     160    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
     161    if (pWizard && pWizard->installGuestAdditions() &&
    162162        !UIWizardNewVMUnattendedPage::checkGAISOFile(m_pGAISOFilePathSelector))
    163163        return false;
     
    179179{
    180180    disableEnableGAWidgets(fEnabled);
    181     if (m_pWizard)
    182         m_pWizard->setInstallGuestAdditions(fEnabled);
     181    parentWizardSet(setInstallGuestAdditions, fEnabled);
    183182    emit completeChanged();
    184183}
     
    186185void UIWizardNewVMUnattendedPageBasic::sltGAISOPathChanged(const QString &strPath)
    187186{
    188     if (m_pWizard)
    189         m_pWizard->setGuestAdditionsISOPath(strPath);
     187    parentWizardSet(setGuestAdditionsISOPath, strPath);
    190188    emit completeChanged();
    191189}
     
    193191void UIWizardNewVMUnattendedPageBasic::sltPasswordChanged(const QString &strPassword)
    194192{
    195     if (m_pWizard)
    196         m_pWizard->setPassword(strPassword);
     193    parentWizardSet(setPassword, strPassword);
    197194    emit completeChanged();
    198195}
     
    200197void UIWizardNewVMUnattendedPageBasic::sltUserNameChanged(const QString &strUserName)
    201198{
    202     if (m_pWizard)
    203         m_pWizard->setUserName(strUserName);
     199    parentWizardSet(setUserName, strUserName);
    204200    emit completeChanged();
    205201}
     
    207203bool UIWizardNewVMUnattendedPageBasic::isProductKeyWidgetEnabled() const
    208204{
    209     if (!m_pWizard || !m_pWizard->isUnattendedEnabled() || !m_pWizard->isGuestOSTypeWindows())
     205    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
     206    if (!pWizard || !pWizard->isUnattendedEnabled() || !pWizard->isGuestOSTypeWindows())
    210207        return false;
    211208    return true;
     
    214211void UIWizardNewVMUnattendedPageBasic::sltHostnameChanged(const QString &strHostname)
    215212{
    216     if (m_pWizard)
    217         m_pWizard->setHostname(strHostname);
     213    parentWizardSet(setHostname, strHostname);
    218214}
    219215
    220216void UIWizardNewVMUnattendedPageBasic::sltProductKeyChanged(const QString &strProductKey)
    221217{
    222     if (m_pWizard)
    223         m_pWizard->setProductKey(strProductKey);
     218    parentWizardSet(setProductKey, strProductKey);
    224219}
    225220
    226221void UIWizardNewVMUnattendedPageBasic::sltStartHeadlessChanged(bool fStartHeadless)
    227222{
    228     if (m_pWizard)
    229         m_pWizard->setStartHeadless(fStartHeadless);
     223    parentWizardSet(setStartHeadless, fStartHeadless);
    230224}
    231225
     
    355349void UIWizardNewVMUnattendedPageBasic::markWidgets() const
    356350{
    357     if (m_pWizard && m_pWizard->installGuestAdditions())
     351    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
     352    if (pWizard && pWizard->installGuestAdditions())
    358353        m_pGAISOFilePathSelector->mark(!UIWizardNewVMUnattendedPage::checkGAISOFile(m_pGAISOFilePathSelector));
    359354}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMUnattendedPageBasic.h

    r90040 r90060  
    3535class UIFilePathSelector;
    3636class UIUserNamePasswordEditor;
    37 class UIWizardNewVM;
    3837struct UIUnattendedInstallData;
    3938
     
    8685    void markWidgets() const;
    8786
    88     UIWizardNewVM *m_pWizard;
    89 
    9087    /** @name Widgets
    9188      * @{ */
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