VirtualBox

Changeset 97310 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Oct 26, 2022 4:07:46 PM (2 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9647: VM settings: Removing toggling, validating and correlating GUI logic related to possibility of hardware virtualization turned off; It's not a valid case anymore.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp

    r96816 r97310  
    363363        if (uiCommon().virtualBox().GetHost().GetProcessorFeature(KProcessorFeature_HWVirtEx))
    364364        {
    365             /* VT-x/AMD-V: */
    366             if (comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled))
    367             {
    368                 acceleration << QApplication::translate("UIDetails", "VT-x/AMD-V", "details (system)");
    369                 /* Nested Paging (only when hw virt is enabled): */
    370                 if (comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging))
    371                     acceleration << QApplication::translate("UIDetails", "Nested Paging", "details (system)");
    372             }
     365            /* Nested Paging: */
     366            if (comMachine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging))
     367                acceleration << QApplication::translate("UIDetails", "Nested Paging", "details (system)");
    373368        }
    374369        /* PAE/NX: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp

    r97135 r97310  
    462462    if (m_machine.isOk())
    463463    {
    464         UIMachineSettingsGeneral *pGeneralPage =
    465             qobject_cast<UIMachineSettingsGeneral*>(m_pSelector->idToPage(MachineSettingsPageType_General));
    466464        UIMachineSettingsSystem *pSystemPage =
    467465            qobject_cast<UIMachineSettingsSystem*>(m_pSelector->idToPage(MachineSettingsPageType_System));
     
    470468            qobject_cast<UIMachineSettingsDisplay*>(m_pSelector->idToPage(MachineSettingsPageType_Display));
    471469#endif /* VBOX_WITH_3D_ACCELERATION */
    472 
    473         /* Guest OS type & VT-x/AMD-V option correlation auto-fix: */
    474         if (pGeneralPage && pSystemPage &&
    475             pGeneralPage->is64BitOSTypeSelected() && !pSystemPage->isHWVirtExEnabled())
    476             m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_Enabled, true);
    477470
    478471#ifdef VBOX_WITH_3D_ACCELERATION
     
    538531            /* Make changes on 'system' page influent 'general' and 'storage' page: */
    539532            UIMachineSettingsSystem *pSystemPage = qobject_cast<UIMachineSettingsSystem*>(pSettingsPage);
    540             UIMachineSettingsGeneral *pGeneralPage = qobject_cast<UIMachineSettingsGeneral*>(m_pSelector->idToPage(MachineSettingsPageType_General));
    541533            UIMachineSettingsStorage *pStoragePage = qobject_cast<UIMachineSettingsStorage*>(m_pSelector->idToPage(MachineSettingsPageType_Storage));
    542             if (pSystemPage)
    543             {
    544                 if (pGeneralPage)
    545                     pGeneralPage->setHWVirtExEnabled(pSystemPage->isHWVirtExEnabled());
    546                 if (pStoragePage)
    547                     pStoragePage->setChipsetType(pSystemPage->chipsetType());
    548             }
     534            if (pSystemPage && pStoragePage)
     535                pStoragePage->setChipsetType(pSystemPage->chipsetType());
    549536            break;
    550537        }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIAccelerationFeaturesEditor.cpp

    r96407 r97310  
    3838UIAccelerationFeaturesEditor::UIAccelerationFeaturesEditor(QWidget *pParent /* = 0 */)
    3939    : QIWithRetranslateUI<QWidget>(pParent)
    40     , m_fEnableVirtualization(false)
    4140    , m_fEnableNestedPaging(false)
    4241    , m_pLabel(0)
    43     , m_pCheckBoxEnableVirtualization(0)
    4442    , m_pCheckBoxEnableNestedPaging(0)
    4543{
    4644    prepare();
    47 }
    48 
    49 void UIAccelerationFeaturesEditor::setEnableVirtualization(bool fOn)
    50 {
    51     /* Update cached value and
    52      * check-box if value has changed: */
    53     if (m_fEnableVirtualization != fOn)
    54     {
    55         m_fEnableVirtualization = fOn;
    56         if (m_pCheckBoxEnableVirtualization)
    57             m_pCheckBoxEnableVirtualization->setCheckState(m_fEnableVirtualization ? Qt::Checked : Qt::Unchecked);
    58     }
    59 }
    60 
    61 bool UIAccelerationFeaturesEditor::isEnabledVirtualization() const
    62 {
    63     return   m_pCheckBoxEnableVirtualization
    64            ? m_pCheckBoxEnableVirtualization->checkState() == Qt::Checked
    65            : m_fEnableVirtualization;
    66 }
    67 
    68 void UIAccelerationFeaturesEditor::setEnableVirtualizationAvailable(bool fAvailable)
    69 {
    70     m_pCheckBoxEnableVirtualization->setEnabled(fAvailable);
    7145}
    7246
     
    11084    if (m_pLabel)
    11185        m_pLabel->setText(tr("Hardware Virtualization:"));
    112     if (m_pCheckBoxEnableVirtualization)
    113     {
    114         m_pCheckBoxEnableVirtualization->setText(tr("Enable &VT-x/AMD-V"));
    115         m_pCheckBoxEnableVirtualization->setToolTip(tr("When checked, the virtual machine will try to make use of the host "
    116                                                        "CPU's hardware virtualization extensions such as Intel VT-x and AMD-V."));
    117     }
    11886    if (m_pCheckBoxEnableNestedPaging)
    11987    {
     
    133101        m_pLayout->setColumnStretch(1, 1);
    134102
    135         /* Prepare label layout: */
    136         QVBoxLayout *pLayoutLabel = new QVBoxLayout;
    137         if (pLayoutLabel)
     103        /* Prepare virtualization label: */
     104        m_pLabel = new QLabel(this);
     105        if (m_pLabel)
    138106        {
    139             /* Prepare virtualization label: */
    140             m_pLabel = new QLabel(this);
    141             if (m_pLabel)
    142             {
    143                 m_pLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    144                 pLayoutLabel->addWidget(m_pLabel);
    145             }
    146             /* Prepare placeholder: */
    147             QWidget *pWidgetPlaceholder = new QWidget(this);
    148             if (pWidgetPlaceholder)
    149             {
    150 #ifndef VBOX_WITH_RAW_MODE
    151                 /* Hide placeholder when raw-mode is not supported: */
    152                 pWidgetPlaceholder->setVisible(false);
    153 #endif
    154                 pLayoutLabel->addWidget(pWidgetPlaceholder);
    155             }
    156 
    157             m_pLayout->addLayout(pLayoutLabel, 0, 0);
     107            m_pLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     108            m_pLayout->addWidget(m_pLabel, 0, 0);
    158109        }
    159110
    160         /* Prepare widget layout: */
    161         QVBoxLayout *pLayoutWidget = new QVBoxLayout;
    162         if (pLayoutWidget)
     111        /* Prepare 'enable nested virtualization' check-box: */
     112        m_pCheckBoxEnableNestedPaging = new QCheckBox(this);
     113        if (m_pCheckBoxEnableNestedPaging)
    163114        {
    164             /* Prepare 'enable PAE' check-box: */
    165             m_pCheckBoxEnableVirtualization = new QCheckBox(this);
    166             if (m_pCheckBoxEnableVirtualization)
    167             {
    168 #ifndef VBOX_WITH_RAW_MODE
    169                 /* Hide check-box when raw-mode is not supported: */
    170                 m_pCheckBoxEnableVirtualization->setVisible(false);
    171 #endif
    172                 connect(m_pCheckBoxEnableVirtualization, &QCheckBox::stateChanged,
    173                         this, &UIAccelerationFeaturesEditor::sigChangedVirtualization);
    174                 pLayoutWidget->addWidget(m_pCheckBoxEnableVirtualization);
    175             }
    176             /* Prepare 'enable nested virtualization' check-box: */
    177             m_pCheckBoxEnableNestedPaging = new QCheckBox(this);
    178             if (m_pCheckBoxEnableNestedPaging)
    179             {
    180                 connect(m_pCheckBoxEnableNestedPaging, &QCheckBox::stateChanged,
    181                         this, &UIAccelerationFeaturesEditor::sigChangedNestedPaging);
    182                 pLayoutWidget->addWidget(m_pCheckBoxEnableNestedPaging);
    183             }
    184 
    185             m_pLayout->addLayout(pLayoutWidget, 0, 1);
     115            connect(m_pCheckBoxEnableNestedPaging, &QCheckBox::stateChanged,
     116                    this, &UIAccelerationFeaturesEditor::sigChangedNestedPaging);
     117            m_pLayout->addWidget(m_pCheckBoxEnableNestedPaging, 0, 1);
    186118        }
    187119    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIAccelerationFeaturesEditor.h

    r96407 r97310  
    4747signals:
    4848
    49     /** Notifies listeners about virtualization change. */
    50     void sigChangedVirtualization();
    5149    /** Notifies listeners about nested paging change. */
    5250    void sigChangedNestedPaging();
     
    5654    /** Constructs editor passing @a pParent to the base-class. */
    5755    UIAccelerationFeaturesEditor(QWidget *pParent = 0);
    58 
    59     /** Defines whether 'enable virtualization' feature in @a fOn. */
    60     void setEnableVirtualization(bool fOn);
    61     /** Returns 'enable virtualization' feature value. */
    62     bool isEnabledVirtualization() const;
    63     /** Defines whether 'enable virtualization' option @a fAvailable. */
    64     void setEnableVirtualizationAvailable(bool fAvailable);
    6556
    6657    /** Defines whether 'enable nested paging' feature in @a fOn. */
     
    8879    /** @name Values
    8980     * @{ */
    90         /** Holds the 'enable virtualization' feature value. */
    91         bool  m_fEnableVirtualization;
    9281        /** Holds the 'enable nested paging' feature value. */
    9382        bool  m_fEnableNestedPaging;
     
    10089        /** Holds the label instance. */
    10190        QLabel      *m_pLabel;
    102         /** Holds the 'enable virtualization' check-box instance. */
    103         QCheckBox   *m_pCheckBoxEnableVirtualization;
    10491        /** Holds the 'enable nested paging' check-box instance. */
    10592        QCheckBox   *m_pCheckBoxEnableNestedPaging;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp

    r97128 r97310  
    130130
    131131UIMachineSettingsGeneral::UIMachineSettingsGeneral()
    132     : m_fHWVirtExEnabled(false)
    133     , m_fEncryptionCipherChanged(false)
     132    : m_fEncryptionCipherChanged(false)
    134133    , m_fEncryptionPasswordChanged(false)
    135134    , m_pCache(0)
     
    158157    AssertPtrReturn(m_pEditorNameAndSystem, CGuestOSType());
    159158    return m_pEditorNameAndSystem->type();
    160 }
    161 
    162 bool UIMachineSettingsGeneral::is64BitOSTypeSelected() const
    163 {
    164     AssertPtrReturn(m_pEditorNameAndSystem, false);
    165     return   m_pEditorNameAndSystem->type().isNotNull()
    166            ? m_pEditorNameAndSystem->type().GetIs64Bit()
    167            : false;
    168 }
    169 
    170 void UIMachineSettingsGeneral::setHWVirtExEnabled(bool fEnabled)
    171 {
    172     /* Make sure hardware virtualization extension has changed: */
    173     if (m_fHWVirtExEnabled == fEnabled)
    174         return;
    175 
    176     /* Update hardware virtualization extension value: */
    177     m_fHWVirtExEnabled = fEnabled;
    178 
    179     /* Revalidate: */
    180     revalidate();
    181159}
    182160
     
    401379        message.second << tr("No name specified for the virtual machine.");
    402380        fPass = false;
    403     }
    404 
    405     /* OS type & VT-x/AMD-v correlation: */
    406     if (is64BitOSTypeSelected() && !m_fHWVirtExEnabled)
    407     {
    408         message.second << tr("The virtual machine operating system hint is set to a 64-bit type. "
    409                              "64-bit guest systems require hardware virtualization, "
    410                              "so this will be enabled automatically if you confirm the changes.");
    411381    }
    412382
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h

    r96407 r97310  
    6060    /** Returns the VM OS type ID. */
    6161    CGuestOSType guestOSType() const;
    62     /** Returns whether 64bit OS type ID is selected. */
    63     bool is64BitOSTypeSelected() const;
    64 
    65     /** Defines whether HW virtualization extension is enabled. */
    66     void setHWVirtExEnabled(bool fEnabled);
    6762
    6863protected:
     
    134129    bool saveEncryptionData();
    135130
    136     /** Holds whether HW virtualization extension is enabled. */
    137     bool  m_fHWVirtExEnabled;
    138 
    139131    /** Holds whether the encryption cipher was changed.
    140132      * We are holding that argument here because we do not know
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r96967 r97310  
    8383        /* Acceleration data: */
    8484        , m_paravirtProvider(KParavirtProvider_None)
    85         , m_fEnabledHwVirtEx(false)
    8685        , m_fEnabledNestedPaging(false)
    8786    {}
     
    115114               /* Acceleration data: */
    116115               && (m_paravirtProvider == other.m_paravirtProvider)
    117                && (m_fEnabledHwVirtEx == other.m_fEnabledHwVirtEx)
    118116               && (m_fEnabledNestedPaging == other.m_fEnabledNestedPaging)
    119117               ;
     
    168166    /** Holds the paravirtualization provider. */
    169167    KParavirtProvider  m_paravirtProvider;
    170     /** Holds whether the HW Virt Ex is enabled. */
    171     bool               m_fEnabledHwVirtEx;
    172168    /** Holds whether the Nested Paging is enabled. */
    173169    bool               m_fEnabledNestedPaging;
     
    208204}
    209205
    210 bool UIMachineSettingsSystem::isHWVirtExEnabled() const
    211 {
    212     return m_pEditorAccelerationFeatures->isEnabledVirtualization();
    213 }
    214 
    215206bool UIMachineSettingsSystem::isNestedPagingSupported() const
    216207{
     
    309300    /* Gather old 'Acceleration' data: */
    310301    oldSystemData.m_paravirtProvider = m_machine.GetParavirtProvider();
    311     oldSystemData.m_fEnabledHwVirtEx = m_machine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled);
    312302    oldSystemData.m_fEnabledNestedPaging = m_machine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging);
    313303
     
    362352        m_pEditorParavirtProvider->setValue(oldSystemData.m_paravirtProvider);
    363353    if (m_pEditorAccelerationFeatures)
    364     {
    365         m_pEditorAccelerationFeatures->setEnableVirtualization(oldSystemData.m_fEnabledHwVirtEx);
    366354        m_pEditorAccelerationFeatures->setEnableNestedPaging(oldSystemData.m_fEnabledNestedPaging);
    367     }
    368355
    369356    /* Polish page finally: */
     
    429416    if (m_pEditorParavirtProvider)
    430417        newSystemData.m_paravirtProvider = m_pEditorParavirtProvider->value();
    431     /* Enable HW Virt Ex automatically if it's supported and
    432      * 1. multiple CPUs, 2. Nested Paging or 3. Nested HW Virt Ex is requested. */
    433     if (m_pEditorVCPU)
    434         newSystemData.m_fEnabledHwVirtEx =    isHWVirtExEnabled()
    435                                            || (   isHWVirtExSupported()
    436                                                && (   m_pEditorVCPU->value() > 1
    437                                                    || isNestedPagingEnabled()
    438                                                    || isNestedHWVirtExEnabled()));
    439418    /* Enable Nested Paging automatically if it's supported and
    440419     * Nested HW Virt Ex is requested. */
     
    544523                "This is needed to support more than one virtual processor. "
    545524                "It will be enabled automatically if you confirm your changes.");
    546         }
    547 
    548         /* VCPU: */
    549         if (m_pEditorVCPU->value() > 1)
    550         {
    551             /* HW Virt Ex test: */
    552             if (isHWVirtExSupported() && !isHWVirtExEnabled())
    553             {
    554                 message.second << tr(
    555                     "The hardware virtualization is not currently enabled in the Acceleration section of the System page. "
    556                     "This is needed to support more than one virtual processor. "
    557                     "It will be enabled automatically if you confirm your changes.");
    558             }
    559525        }
    560526
     
    582548        if (isNestedHWVirtExEnabled())
    583549        {
    584             /* HW Virt Ex test: */
    585             if (isHWVirtExSupported() && !isHWVirtExEnabled())
    586             {
    587                 message.second << tr(
    588                     "The hardware virtualization is not currently enabled in the Acceleration section of the System page. "
    589                     "This is needed to support nested hardware virtualization. "
    590                     "It will be enabled automatically if you confirm your changes.");
    591             }
    592 
    593550            /* Nested Paging test: */
    594551            if (isHWVirtExSupported() && isNestedPagingSupported() && !isNestedPagingEnabled())
     
    604561        if (!message.second.isEmpty())
    605562            messages << message;
    606     }
    607 
    608     /* Acceleration tab: */
    609     {
    610         /* Prepare message: */
    611         UIValidationMessage message;
    612         message.first = UITranslator::removeAccelMark(m_pTabWidget->tabText(2));
    613 
    614         /* Nested Paging: */
    615         if (isNestedPagingEnabled())
    616         {
    617             /* HW Virt Ex test: */
    618             if (isHWVirtExSupported() && !isHWVirtExEnabled())
    619             {
    620                 message.second << tr(
    621                     "The hardware virtualization is not currently enabled in the Acceleration section of the System page. "
    622                     "This is needed for nested paging support. "
    623                     "It will be enabled automatically if you confirm your changes.");
    624             }
    625         }
    626 
    627         /* Serialize message: */
    628         if (!message.second.isEmpty())
    629             messages << message;
    630 
    631563    }
    632564
     
    714646    m_pEditorParavirtProvider->setEnabled(isMachineOffline());
    715647    m_pEditorAccelerationFeatures->setEnabled(isMachineOffline());
    716     m_pEditorAccelerationFeatures->setEnableVirtualizationAvailable(   (systemData.m_fSupportedHwVirtEx && isMachineOffline())
    717                                                                     || (systemData.m_fEnabledHwVirtEx && isMachineOffline()));
    718     m_pEditorAccelerationFeatures->setEnableNestedPagingAvailable(   m_pEditorAccelerationFeatures->isEnabledVirtualization()
    719                                                                   && (   (systemData.m_fSupportedNestedPaging && isMachineOffline())
    720                                                                       || (systemData.m_fEnabledNestedPaging && isMachineOffline())));
    721 }
    722 
    723 void UIMachineSettingsSystem::sltHandleHwVirtExToggle()
    724 {
    725     /* Update Nested Paging checkbox: */
    726     AssertPtrReturnVoid(m_pCache);
    727     m_pEditorAccelerationFeatures->setEnableNestedPagingAvailable(   m_pEditorAccelerationFeatures->isEnabledVirtualization()
    728                                                                   && (   (m_pCache->base().m_fSupportedNestedPaging && isMachineOffline())
    729                                                                       || (m_pCache->base().m_fEnabledNestedPaging && isMachineOffline())));
    730 
    731     /* Revalidate: */
    732     revalidate();
     648    m_pEditorAccelerationFeatures->setEnableNestedPagingAvailable(   (systemData.m_fSupportedNestedPaging && isMachineOffline())
     649                                                                  || (systemData.m_fEnabledNestedPaging && isMachineOffline()));
    733650}
    734651
     
    899816
    900817    /* Configure 'Acceleration' connections: */
    901     connect(m_pEditorAccelerationFeatures, &UIAccelerationFeaturesEditor::sigChangedVirtualization,
    902             this, &UIMachineSettingsSystem::sltHandleHwVirtExToggle);
    903818    connect(m_pEditorAccelerationFeatures, &UIAccelerationFeaturesEditor::sigChangedNestedPaging,
    904819            this, &UIMachineSettingsSystem::revalidate);
     
    11201035            fSuccess = m_machine.isOk();
    11211036        }
    1122         /* Save whether the hardware virtualization extension is enabled: */
    1123         if (fSuccess && isMachineOffline() && newSystemData.m_fEnabledHwVirtEx != oldSystemData.m_fEnabledHwVirtEx)
    1124         {
    1125             m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_Enabled, newSystemData.m_fEnabledHwVirtEx);
    1126             fSuccess = m_machine.isOk();
    1127         }
    11281037        /* Save whether the nested paging is enabled: */
    11291038        if (fSuccess && isMachineOffline() && newSystemData.m_fEnabledNestedPaging != oldSystemData.m_fEnabledNestedPaging)
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h

    r96669 r97310  
    6565    /** Returns whether the HW Virt Ex is supported. */
    6666    bool isHWVirtExSupported() const;
    67     /** Returns whether the HW Virt Ex is enabled. */
    68     bool isHWVirtExEnabled() const;
    6967
    7068    /** Returns whether the Nested Paging is supported. */
     
    117115    /** Performs final page polishing. */
    118116    virtual void polishPage() RT_OVERRIDE;
    119 
    120 private slots:
    121 
    122     /** Handles HW Virt Ex check-box toggling. */
    123     void sltHandleHwVirtExToggle();
    124117
    125118private:
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