VirtualBox

Changeset 82825 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 22, 2020 12:15:10 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9611: UIMachineSettingsUSB: Get rid of hardcoded USB controller types, instead acquire these types through CSystemProperties interface; This isn't the same trivial like with other controls since radio-buttons for all types already pre-created, so we are showing missed types instead of creating them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp

    r80720 r82825  
    416416    const UIDataSettingsMachineUSB &oldUsbData = m_pCache->base();
    417417
     418    /* Load currently supported USB controllers: */
     419    CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties();
     420    QVector<KUSBControllerType> supportedTypes = comProperties.GetSupportedUSBControllerTypes();
     421    /* Take currently requested type into account if it's sane: */
     422    if (!supportedTypes.contains(oldUsbData.m_USBControllerType) && oldUsbData.m_USBControllerType != KUSBControllerType_Null)
     423        supportedTypes.prepend(oldUsbData.m_USBControllerType);
     424
     425    /* Adjust radio-button visibility: */
     426    mRbUSB1->setVisible(supportedTypes.contains(KUSBControllerType_OHCI));
     427    mRbUSB2->setVisible(supportedTypes.contains(KUSBControllerType_EHCI));
     428    mRbUSB3->setVisible(supportedTypes.contains(KUSBControllerType_XHCI));
     429
    418430    /* Load old USB data from the cache: */
    419431    mGbUSB->setChecked(oldUsbData.m_fUSBEnabled);
     
    803815    Ui::UIMachineSettingsUSB::setupUi(this);
    804816
     817    /* Hide radio-button initially: */
     818    mRbUSB1->setVisible(false);
     819    mRbUSB2->setVisible(false);
     820    mRbUSB3->setVisible(false);
     821
    805822    /* Prepare cache: */
    806823    m_pCache = new UISettingsCacheMachineUSB;
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