VirtualBox

Changeset 87612 in vbox


Ignore:
Timestamp:
Feb 4, 2021 6:55:43 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9515

  • Adding a checkbox to enable EFI
  • Making sure that once user modifies a widget it won't be affected by OS type change (expert mode).
Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIBaseMemoryEditor.cpp

    r86086 r87612  
    393393{
    394394    if (m_pSlider)
     395    {
    395396        emit sigValidChanged(m_pSlider->value() < (int)m_pSlider->maxRAMAlw());
     397        emit sigValueChanged(m_pSlider->value());
     398    }
    396399}
    397400
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIBaseMemoryEditor.h

    r86089 r87612  
    4343    /** Notifies listeners about value has became @a fValid. */
    4444    void sigValidChanged(bool fValid);
     45    void sigValueChanged(int iValue);
    4546
    4647public:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r87610 r87612  
    154154    if (iVPUCount > 1)
    155155        m_machine.GetBIOSSettings().SetIOAPICEnabled(true);
     156
     157    /* Set recommended firmware type: */
     158    m_machine.SetFirmwareType(getBoolFieldValue("EFIEnabled") ? KFirmwareType_EFI : KFirmwareType_BIOS);
    156159#endif
    157160
     
    281284
    282285    /* Set recommended firmware type: */
    283     KFirmwareType fwType = comGuestType.GetRecommendedFirmware();
    284     m_machine.SetFirmwareType(fwType);
     286    m_machine.SetFirmwareType(getBoolFieldValue("EFIEnabled") ? KFirmwareType_EFI : KFirmwareType_BIOS);
    285287
    286288    /* Set recommended human interface device types: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp

    r87575 r87612  
    1717
    1818/* Qt includes: */
     19#include <QCheckBox>
    1920#include <QGridLayout>
    2021#include <QMetaType>
    21 #include <QRadioButton>
    2222#include <QVBoxLayout>
    2323
    2424/* GUI includes: */
    2525#include "QIRichTextLabel.h"
    26 #include "QIToolButton.h"
    2726#include "UIBaseMemoryEditor.h"
    28 #include "UIIconPool.h"
    29 #include "UIMediaComboBox.h"
    30 #include "UIMedium.h"
    31 #include "UIMediumSelector.h"
    32 #include "UIMessageCenter.h"
    3327#include "UIVirtualCPUEditor.h"
    34 #include "UIWizardNewVD.h"
    3528#include "UIWizardNewVM.h"
    3629#include "UIWizardNewVMPageBasic3.h"
     30
     31/* COM includes: */
     32#include "CGuestOSType.h"
    3733
    3834UIWizardNewVMPage3::UIWizardNewVMPage3()
    3935    : m_pBaseMemoryEditor(0)
    4036    , m_pVirtualCPUEditor(0)
     37    , m_pEFICheckBox(0)
    4138{
    4239}
     
    5653}
    5754
     55bool UIWizardNewVMPage3::EFIEnabled() const
     56{
     57    if (!m_pEFICheckBox)
     58        return false;
     59    return m_pEFICheckBox->isChecked();
     60}
     61
    5862void UIWizardNewVMPage3::retranslateWidgets()
    5963{
     64    if (m_pEFICheckBox)
     65    {
     66        m_pEFICheckBox->setText(UIWizardNewVM::tr("Enable &EFI (special OSes only)"));
     67        m_pEFICheckBox->setWhatsThis(UIWizardNewVM::tr("When checked, the guest will support the "
     68                                                       "Extended Firmware Interface (EFI), which is required to boot certain "
     69                                                       "guest OSes. Non-EFI aware OSes will not be able to boot if this option is activated."));
     70    }
    6071}
    6172
     
    6778    m_pBaseMemoryEditor = new UIBaseMemoryEditor(0, true);
    6879    m_pVirtualCPUEditor = new UIVirtualCPUEditor(0, true);
     80    m_pEFICheckBox      = new QCheckBox;
    6981    pHardwareLayout->addWidget(m_pBaseMemoryEditor, 0, 0, 1, 4);
    7082    pHardwareLayout->addWidget(m_pVirtualCPUEditor, 1, 0, 1, 4);
     83    pHardwareLayout->addWidget(m_pEFICheckBox, 2, 0, 1, 1);
     84
    7185    return pHardwareContainer;
    7286}
     
    7993    registerField("baseMemory", this, "baseMemory");
    8094    registerField("VCPUCount", this, "VCPUCount");
     95    registerField("EFIEnabled", this, "EFIEnabled");
    8196}
    8297
     
    95110void UIWizardNewVMPageBasic3::createConnections()
    96111{
    97 
    98112}
    99 
    100113
    101114void UIWizardNewVMPageBasic3::retranslateUi()
     
    122135        m_pBaseMemoryEditor->setValue(recommendedRam);
    123136
     137    KFirmwareType fwType = type.GetRecommendedFirmware();
     138    if (m_pEFICheckBox)
     139        m_pEFICheckBox->setChecked(fwType != KFirmwareType_BIOS);
    124140}
    125141
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.h

    r87575 r87612  
    3434/* Forward declarations: */
    3535class QRadioButton;
     36class QCheckBox;
    3637class QIRichTextLabel;
    37 class QIToolButton;
    3838class UIBaseMemoryEditor;
    39 class UIMediaComboBox;
    4039class UIVirtualCPUEditor;
    4140
     
    5453       int baseMemory() const;
    5554       int VCPUCount() const;
     55       bool EFIEnabled() const;
    5656    /** @} */
    5757
     
    6565       UIBaseMemoryEditor *m_pBaseMemoryEditor;
    6666       UIVirtualCPUEditor *m_pVirtualCPUEditor;
     67       QCheckBox          *m_pEFICheckBox;
    6768    /** @} */
    6869
     
    7576    Q_PROPERTY(int baseMemory READ baseMemory);
    7677    Q_PROPERTY(int VCPUCount READ VCPUCount);
     78    Q_PROPERTY(bool EFIEnabled READ EFIEnabled);
    7779
    7880public:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r87608 r87612  
    8989    registerField("productKey", this, "productKey");
    9090    registerField("VCPUCount", this, "VCPUCount");
     91    registerField("EFIEnabled", this, "EFIEnabled");
    9192
    9293    const QPalette pal = palette();
     
    137138    onOsTypeChanged();
    138139
    139     /* Fetch recommended RAM value: */
    140     CGuestOSType type = m_pNameAndSystemEditor->type();
    141     m_pBaseMemoryEditor->setValue(type.GetRecommendedRAM());
     140    setOSTypeDependedValues();
    142141
    143142    /* Broadcast complete-change: */
     
    242241    /* Connections for disk and hardware stuff: */
    243242    if (m_pDiskSkip)
     243    {
    244244        connect(m_pDiskSkip, &QRadioButton::toggled,
    245245                this, &UIWizardNewVMPageExpert::sltVirtualDiskSourceChanged);
     246        connect(m_pDiskSkip, &QRadioButton::toggled,
     247                this, &UIWizardNewVMPageExpert::sltValueModified);
     248    }
    246249    if (m_pDiskCreate)
     250    {
    247251        connect(m_pDiskCreate, &QRadioButton::toggled,
    248252                this, &UIWizardNewVMPageExpert::sltVirtualDiskSourceChanged);
     253        connect(m_pDiskCreate, &QRadioButton::toggled,
     254                this, &UIWizardNewVMPageExpert::sltValueModified);
     255    }
    249256    if (m_pDiskPresent)
     257    {
    250258        connect(m_pDiskPresent, &QRadioButton::toggled,
    251259                this, &UIWizardNewVMPageExpert::sltVirtualDiskSourceChanged);
     260        connect(m_pDiskPresent, &QRadioButton::toggled,
     261                this, &UIWizardNewVMPageExpert::sltValueModified);
     262    }
    252263    if (m_pDiskSelector)
    253264        connect(m_pDiskSelector, static_cast<void(UIMediaComboBox::*)(int)>(&UIMediaComboBox::currentIndexChanged),
     
    256267        connect(m_pVMMButton, &QIToolButton::clicked,
    257268                this, &UIWizardNewVMPageExpert::sltGetWithFileOpenDialog);
    258 }
    259 
    260 void UIWizardNewVMPageExpert::initializePage()
    261 {
    262     /* Translate page: */
    263     retranslateUi();
    264 
     269    if (m_pBaseMemoryEditor)
     270        connect(m_pBaseMemoryEditor, &UIBaseMemoryEditor::sigValueChanged,
     271                this, &UIWizardNewVMPageExpert::sltValueModified);
     272    if (m_pEFICheckBox)
     273        connect(m_pEFICheckBox, &QCheckBox::toggled,
     274                this, &UIWizardNewVMPageExpert::sltValueModified);
     275}
     276
     277void UIWizardNewVMPageExpert::setOSTypeDependedValues()
     278{
    265279    if (!field("type").canConvert<CGuestOSType>())
    266280        return;
     
    269283    CGuestOSType type = field("type").value<CGuestOSType>();
    270284    ULONG recommendedRam = type.GetRecommendedRAM();
    271     m_pBaseMemoryEditor->setValue(recommendedRam);
     285
     286    if (m_pBaseMemoryEditor && !m_userSetWidgets.contains(m_pBaseMemoryEditor))
     287    {
     288        m_pBaseMemoryEditor->blockSignals(true);
     289        m_pBaseMemoryEditor->setValue(recommendedRam);
     290        m_pBaseMemoryEditor->blockSignals(false);
     291    }
     292
     293    KFirmwareType fwType = type.GetRecommendedFirmware();
     294    if (m_pEFICheckBox && !m_userSetWidgets.contains(m_pEFICheckBox))
     295    {
     296        m_pEFICheckBox->blockSignals(true);
     297        m_pEFICheckBox->setChecked(fwType != KFirmwareType_BIOS);
     298        m_pEFICheckBox->blockSignals(false);
     299    }
    272300
    273301    /* Prepare initial disk choice: */
    274     if (type.GetRecommendedHDD() != 0)
    275     {
    276         if (m_pDiskCreate)
    277         {
    278             m_pDiskCreate->setFocus();
    279             m_pDiskCreate->setChecked(true);
    280         }
    281         m_fRecommendedNoDisk = false;
    282     }
    283     else
    284     {
    285         if (m_pDiskSkip)
    286         {
    287             m_pDiskSkip->setFocus();
    288             m_pDiskSkip->setChecked(true);
    289         }
    290         m_fRecommendedNoDisk = true;
    291     }
    292     if (m_pDiskSelector)
    293         m_pDiskSelector->setCurrentIndex(0);
    294 
    295     disableEnableUnattendedRelatedWidgets(isUnattendedEnabled());
     302    if (!m_userSetWidgets.contains(m_pDiskCreate) &&
     303        !m_userSetWidgets.contains(m_pDiskCreate) &&
     304        !m_userSetWidgets.contains(m_pDiskPresent))
     305    {
     306        if (type.GetRecommendedHDD() != 0)
     307        {
     308            if (m_pDiskCreate)
     309            {
     310                m_pDiskCreate->setFocus();
     311                m_pDiskCreate->setChecked(true);
     312            }
     313            m_fRecommendedNoDisk = false;
     314        }
     315        else
     316        {
     317            if (m_pDiskSkip)
     318            {
     319                m_pDiskSkip->setFocus();
     320                m_pDiskSkip->setChecked(true);
     321            }
     322            m_fRecommendedNoDisk = true;
     323        }
     324        if (m_pDiskSelector)
     325            m_pDiskSelector->setCurrentIndex(0);
     326    }
     327
    296328    if (m_pProductKeyLabel)
    297329        m_pProductKeyLabel->setEnabled(isProductKeyWidgetEnabled());
    298330    if (m_pProductKeyLineEdit)
    299331        m_pProductKeyLineEdit->setEnabled(isProductKeyWidgetEnabled());
     332}
     333
     334void UIWizardNewVMPageExpert::initializePage()
     335{
     336    /* Translate page: */
     337    retranslateUi();
     338    setOSTypeDependedValues();
     339    disableEnableUnattendedRelatedWidgets(isUnattendedEnabled());
    300340}
    301341
     
    458498    disableEnableGAWidgets(isGAInstallEnabled());
    459499}
     500
     501void UIWizardNewVMPageExpert::sltValueModified()
     502{
     503    QWidget *pSenderWidget = qobject_cast<QWidget*>(sender());
     504    if (!pSenderWidget)
     505        return;
     506
     507    m_userSetWidgets << pSenderWidget;
     508}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h

    r87589 r87612  
    2121# pragma once
    2222#endif
     23
     24/* Qt includes: */
     25#include <QSet>
    2326
    2427/* Local includes: */
     
    6063    Q_PROPERTY(QString productKey READ productKey);
    6164    Q_PROPERTY(int VCPUCount READ VCPUCount);
     65    Q_PROPERTY(bool EFIEnabled READ EFIEnabled);
    6266
    6367public:
     
    8892    void sltInstallGACheckBoxToggle(bool fEnabled);
    8993
     94    void sltValueModified();
     95
    9096private:
    9197
     
    104110    void createConnections();
    105111    void initializePage();
     112    void initializeWidgets();
     113    /** Set the values of the widget if they depend on OS
     114      * type like recommended RAM size. The widgets whose values are
     115      * are explicitly modified are exempt from this. */
     116    void setOSTypeDependedValues();
    106117    void cleanupPage();
    107118
     
    117128    UIToolBox  *m_pToolBox;
    118129    QGroupBox *m_pInstallationISOContainer;
     130
     131    /** Set of widgets which user explicitly modified their values. They are exempt from
     132      * adjusting when OS type changes. */
     133    QSet<QWidget*> m_userSetWidgets;
    119134};
    120135
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