VirtualBox

Changeset 90073 in vbox


Ignore:
Timestamp:
Jul 7, 2021 6:38:10 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145570
Message:

FE/Qt: bugref:9996: Some initilization fixes.

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

Legend:

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

    r90072 r90073  
    6464    , m_fStartHeadless(false)
    6565    , m_fSkipUnattendedInstall(false)
     66    , m_fEFIEnabled(false)
    6667    , m_iCPUCount(1)
    6768    , m_iMemorySize(0)
     
    672673}
    673674
     675const CGuestOSType &UIWizardNewVM::guestOSType() const
     676{
     677    return m_comGuestOSType;;
     678}
     679
     680void UIWizardNewVM::setGuestOSType(const CGuestOSType &guestOSType)
     681{
     682    m_comGuestOSType= guestOSType;
     683}
     684
    674685bool UIWizardNewVM::installGuestAdditions() const
    675686{
     
    702713    /* We hide/show unattended install page depending on the value of isUnattendedEnabled: */
    703714    setUnattendedPageVisible(isUnattendedEnabled());
     715}
     716
     717bool UIWizardNewVM::EFIEnabled() const
     718{
     719    return m_fEFIEnabled;
     720}
     721
     722void UIWizardNewVM::setEFIEnabled(bool fEnabled)
     723{
     724    m_fEFIEnabled = fEnabled;
    704725}
    705726
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r90072 r90073  
    2929#include "CMachine.h"
    3030#include "CMedium.h"
     31#include "CGuestOSType.h"
    3132
    3233#define newVMWizardPropertySet(functionName, value)                     \
     
    112113    void setGuestOSFamilyId(const QString &strGuestOSFamilyId);
    113114
     115    const CGuestOSType &guestOSType() const;
     116    void setGuestOSType(const CGuestOSType &guestOSType);
     117
    114118    bool installGuestAdditions() const;
    115119    void setInstallGuestAdditions(bool fInstallGA);
     
    120124    bool skipUnattendedInstall() const;
    121125    void setSkipUnattendedInstall(bool fSkipUnattendedInstall);
     126
     127    bool EFIEnabled() const;
     128    void setEFIEnabled(bool fEnabled);
    122129
    123130    const QString &ISOFilePath() const;
     
    201208    /** Holds the VM OS family ID. */
    202209    QString  m_strGuestOSFamilyId;
     210    /** Holds the VM OS type. */
     211    CGuestOSType m_comGuestOSType;
    203212
    204213    /** True if guest additions are to be installed during unattended install. */
     
    206215    bool m_fStartHeadless;
    207216    bool m_fSkipUnattendedInstall;
     217    bool m_fEFIEnabled;
    208218
    209219    QString m_strUserName;
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMHardwarePageBasic.cpp

    r90066 r90073  
    6464        connect(m_pVirtualCPUEditor, &UIVirtualCPUEditor::sigValueChanged,
    6565            this, &UIWizardNewVMHardwarePageBasic::sltCPUCountChanged);
     66    if (m_pEFICheckBox)
     67        connect(m_pEFICheckBox, &QCheckBox::toggled,
     68                this, &UIWizardNewVMHardwarePageBasic::sltEFIEnabledChanged);
    6669
    6770}
     
    8891    retranslateUi();
    8992
    90     // if (!field("type").canConvert<CGuestOSType>())
    91     //     return;
    92 
    93     // CGuestOSType type = field("type").value<CGuestOSType>();
    94     // ULONG recommendedRam = type.GetRecommendedRAM();
    95     // if (m_pBaseMemoryEditor)
    96     //     m_pBaseMemoryEditor->setValue(recommendedRam);
    97 
    98     // KFirmwareType fwType = type.GetRecommendedFirmware();
    99     // if (m_pEFICheckBox)
    100     //     m_pEFICheckBox->setChecked(fwType != KFirmwareType_BIOS);
     93    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
     94    if (pWizard)
     95    {
     96        CGuestOSType type = pWizard->guestOSType();
     97        if (!type.isNull())
     98        {
     99            if (!m_userModifiedParameters.contains("MemorySize"))
     100            {
     101                ULONG recommendedRam = type.GetRecommendedRAM();
     102                if (m_pBaseMemoryEditor)
     103                    m_pBaseMemoryEditor->setValue(recommendedRam);
     104            }
     105            if (!m_userModifiedParameters.contains("EFIEnabled"))
     106            {
     107                KFirmwareType fwType = type.GetRecommendedFirmware();
     108                if (m_pEFICheckBox)
     109                    m_pEFICheckBox->setChecked(fwType != KFirmwareType_BIOS);
     110            }
     111        }
     112    }
    101113}
    102114
     
    130142{
    131143    newVMWizardPropertySet(MemorySize, iValue);
     144    m_userModifiedParameters << "MemorySize";
    132145}
    133146
     
    136149    newVMWizardPropertySet(CPUCount, iCount);
    137150}
     151
     152void UIWizardNewVMHardwarePageBasic::sltEFIEnabledChanged(bool fEnabled)
     153{
     154    newVMWizardPropertySet(EFIEnabled, fEnabled);
     155    m_userModifiedParameters << "EFIEnabled";
     156}
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMHardwarePageBasic.h

    r90066 r90073  
    2323
    2424/* Qt includes: */
     25#include <QSet>
    2526#include <QVariant>
    2627
     
    6364    void sltMemorySizeChanged(int iValue);
    6465    void sltCPUCountChanged(int iCount);
     66    void sltEFIEnabledChanged(bool fEnabled);
    6567
    6668private:
     
    8284       QIRichTextLabel    *m_pLabel;
    8385    /** @} */
     86    /** This set is used to decide if we have to set wizard's parameters
     87      * some default values or not. When user modifies a value through a widget we
     88      * no longer touch user set value during page initilization. see initializePage. */
     89    QSet<QString> m_userModifiedParameters;
    8490};
    8591
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePageBasic.cpp

    r90072 r90073  
    412412     * So simply disconnect the text-edit signal. */
    413413    if (m_pNameAndSystemEditor)
     414    {
    414415        m_pNameAndSystemEditor->disconnect(SIGNAL(sigNameChanged(const QString &)), this, SLOT(sltNameChanged(const QString &)));
     416        newVMWizardPropertySet(GuestOSType, m_pNameAndSystemEditor->type());
     417    }
    415418}
    416419
     
    440443    retranslateUi();
    441444
    442     /* Make sure parameters are initialized correctly: */
    443     if (m_pNameAndSystemEditor)
    444         newVMWizardPropertySet(GuestOSFamilyId, m_pNameAndSystemEditor->familyId());
    445 
    446     if (m_pNameAndSystemEditor)
    447         m_pNameAndSystemEditor->setFocus();
    448     setSkipCheckBoxEnable();
     445    /* Initialize this page's widgets etc: */
     446    {
     447        if (m_pNameAndSystemEditor)
     448            m_pNameAndSystemEditor->setFocus();
     449        setSkipCheckBoxEnable();
     450    }
     451
     452    /* Initialize some of the wizard's parameters: */
     453    {
     454        if (m_pNameAndSystemEditor)
     455        {
     456            newVMWizardPropertySet(GuestOSFamilyId, m_pNameAndSystemEditor->familyId());
     457            newVMWizardPropertySet(GuestOSType, m_pNameAndSystemEditor->type());
     458            /* Vm name, folder, file path etc. will be initilized by composeMachineFilePath: */
     459        }
     460    }
    449461}
    450462
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