VirtualBox

Changeset 107130 in vbox


Ignore:
Timestamp:
Nov 25, 2024 2:07:45 PM (8 weeks ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10804: VM settings / System page / Motherboard tab: Make sure IO APIC editor is hidden for non-x86 guests.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors
Files:
2 edited

Legend:

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

    r106061 r107130  
    3636#include "UIMessageCenter.h"
    3737#include "UIMotherboardFeaturesEditor.h"
     38
     39/* COM includes: */
     40#include "KPlatformArchitecture.h"
    3841
    3942
     
    148151}
    149152
     153void UIMotherboardFeaturesEditor::handleFilterChange()
     154{
     155    /* Some options hidden for ARM machines: */
     156    const KPlatformArchitecture enmArch = optionalFlags().contains("arch")
     157                                        ? optionalFlags().value("arch").value<KPlatformArchitecture>()
     158                                        : KPlatformArchitecture_x86;
     159    const bool fARMMachine = enmArch == KPlatformArchitecture_ARM;
     160    if (fARMMachine)
     161    {
     162        if (m_pCheckBoxEnableIoApic)
     163            m_pCheckBoxEnableIoApic->hide();
     164        rebuildLayout();
     165    }
     166}
     167
    150168void UIMotherboardFeaturesEditor::sltRetranslateUI()
    151169{
     
    243261        m_pLabel = new QLabel(this);
    244262        if (m_pLabel)
    245         {
    246263            m_pLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    247             m_pLayout->addWidget(m_pLabel, 0, 0);
    248         }
    249264        /* Prepare 'enable IO APIC' check-box: */
    250265        m_pCheckBoxEnableIoApic = new QCheckBox(this);
    251266        if (m_pCheckBoxEnableIoApic)
    252         {
    253267            connect(m_pCheckBoxEnableIoApic, &QCheckBox::stateChanged,
    254268                    this, &UIMotherboardFeaturesEditor::sigChangedIoApic);
    255             m_pLayout->addWidget(m_pCheckBoxEnableIoApic, 0, 1);
    256         }
    257269        /* Prepare 'enable UTC time' check-box: */
    258270        m_pCheckBoxEnableUtcTime = new QCheckBox(this);
    259271        if (m_pCheckBoxEnableUtcTime)
    260         {
    261272            connect(m_pCheckBoxEnableUtcTime, &QCheckBox::stateChanged,
    262273                    this, &UIMotherboardFeaturesEditor::sigChangedUtcTime);
    263             m_pLayout->addWidget(m_pCheckBoxEnableUtcTime, 1, 1);
    264         }
    265274        /* Prepare 'enable EFI' check-box: */
    266275        m_pCheckBoxEnableEfi = new QCheckBox(this);
    267276        if (m_pCheckBoxEnableEfi)
    268         {
    269277            connect(m_pCheckBoxEnableEfi, &QCheckBox::stateChanged,
    270278                    this, &UIMotherboardFeaturesEditor::sltHandleEnableEfiToggling);
    271             m_pLayout->addWidget(m_pCheckBoxEnableEfi, 2, 1);
    272         }
    273279        /* Prepare 'enable secure boot' check-box: */
    274280        m_pCheckBoxEnableSecureBoot = new QCheckBox(this);
    275281        if (m_pCheckBoxEnableSecureBoot)
    276         {
    277282            connect(m_pCheckBoxEnableSecureBoot, &QCheckBox::stateChanged,
    278283                    this, &UIMotherboardFeaturesEditor::sltHandleEnableSecureBootToggling);
    279             m_pLayout->addWidget(m_pCheckBoxEnableSecureBoot, 3, 1);
    280         }
    281284        /* Prepare 'reset secure boot' tool-button: */
    282285        m_pPushButtonResetSecureBoot = new QPushButton(this);
     
    286289            connect(m_pPushButtonResetSecureBoot, &QPushButton::clicked,
    287290                    this, &UIMotherboardFeaturesEditor::sltResetSecureBoot);
    288             m_pLayout->addWidget(m_pPushButtonResetSecureBoot, 4, 1);
    289291        }
     292
     293        rebuildLayout();
    290294    }
    291295
     
    297301    sltRetranslateUI();
    298302}
     303
     304void UIMotherboardFeaturesEditor::rebuildLayout()
     305{
     306    if (m_pLayout)
     307    {
     308        /* Remove all the widgets from the layout if any: */
     309        m_pLayout->removeWidget(m_pLabel);
     310        m_pLayout->removeWidget(m_pCheckBoxEnableIoApic);
     311        m_pLayout->removeWidget(m_pCheckBoxEnableUtcTime);
     312        m_pLayout->removeWidget(m_pCheckBoxEnableEfi);
     313        m_pLayout->removeWidget(m_pCheckBoxEnableSecureBoot);
     314        m_pLayout->removeWidget(m_pPushButtonResetSecureBoot);
     315
     316        /* Put them back only if they are visible: */
     317        int i = 0;
     318        if (m_pLabel)
     319            m_pLayout->addWidget(m_pLabel, i, 0);
     320        if (m_pCheckBoxEnableIoApic && !m_pCheckBoxEnableIoApic->isHidden())
     321            m_pLayout->addWidget(m_pCheckBoxEnableIoApic, i++, 1);
     322        if (m_pCheckBoxEnableUtcTime && !m_pCheckBoxEnableUtcTime->isHidden())
     323            m_pLayout->addWidget(m_pCheckBoxEnableUtcTime, i++, 1);
     324        if (m_pCheckBoxEnableEfi && !m_pCheckBoxEnableEfi->isHidden())
     325            m_pLayout->addWidget(m_pCheckBoxEnableEfi, i++, 1);
     326        if (m_pCheckBoxEnableSecureBoot && !m_pCheckBoxEnableSecureBoot->isHidden())
     327            m_pLayout->addWidget(m_pCheckBoxEnableSecureBoot, i++, 1);
     328        if (m_pPushButtonResetSecureBoot && !m_pPushButtonResetSecureBoot->isHidden())
     329            m_pLayout->addWidget(m_pPushButtonResetSecureBoot, i++, 1);
     330    }
     331}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIMotherboardFeaturesEditor.h

    r106061 r107130  
    9090    void setMinimumLayoutIndent(int iIndent);
    9191
     92protected:
     93
     94    /** Handles filter change. */
     95    virtual void handleFilterChange() RT_OVERRIDE;
     96
    9297private slots:
    9398
     
    107112    /** Prepares all. */
    108113    void prepare();
     114    /** Rebuilds layout. */
     115    void rebuildLayout();
    109116
    110117    /** @name Values
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