VirtualBox

Changeset 101868 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 6, 2023 1:08:45 PM (13 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10543: VM Settings / Storage pages: Make sure whole the contents and logic is affected by chosen platform architecture; That affects a list of supported controller and attachment types, maximum ports/slots and other platform related things.

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

Legend:

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

    r101563 r101868  
    328328
    329329    /** Constructs sub-level item passing @a pParentItem to the base-class.
    330       * @param  strName  Brings the name.
    331       * @param  enmBus   Brings the bus.
    332       * @param  enmType  Brings the type. */
    333     ControllerItem(AbstractItem *pParentItem, const QString &strName,
     330      * @param  pStorageModel Brings the storage model this item belongs to.
     331      * @param  strName       Brings the name.
     332      * @param  enmBus        Brings the bus.
     333      * @param  enmType       Brings the type. */
     334    ControllerItem(StorageModel *pStorageModel,
     335                   AbstractItem *pParentItem, const QString &strName,
    334336                   KStorageBus enmBus, KStorageControllerType enmType);
    335337    /** Destructs item. */
    336338    virtual ~ControllerItem() RT_OVERRIDE;
     339
     340    /** Returns platform architecture. */
     341    KPlatformArchitecture arch() const;
    337342
    338343    /** Defines current @a strName. */
     
    413418    /** Updates pixmaps of possible buses. */
    414419    void updatePixmaps();
     420
     421    /** Holds the storage model this item belongs to. */
     422    StorageModel *m_pStorageModel;
    415423
    416424    /** Holds the current name. */
     
    671679    };
    672680
    673     /** Constructs storage model passing @a pParentTree to the base-class. */
    674     StorageModel(QITreeView *pParentTree);
     681    /** Constructs storage model passing @a pParentTree to the base-class.
     682      * @param  pParentEditor  Brings the parent editor this model belongs to. */
     683    StorageModel(QITreeView *pParentTree, UIStorageSettingsEditor *pParentEditor);
    675684    /** Destructs storage model. */
    676685    virtual ~StorageModel() RT_OVERRIDE;
     686
     687    /** Returns platform architecture. */
     688    KPlatformArchitecture arch() const;
    677689
    678690    /** Returns row count for the passed @a parentIndex. */
     
    741753    /** Returns model flags for @a specifiedIndex. */
    742754    Qt::ItemFlags flags(const QModelIndex &specifiedIndex) const;
     755
     756    /** Holds the parent editor this model belongs to. */
     757    UIStorageSettingsEditor *m_pParentEditor;
    743758
    744759    /** Holds the root item instance. */
     
    11581173*********************************************************************************************************************************/
    11591174
    1160 ControllerItem::ControllerItem(AbstractItem *pParentItem, const QString &strName,
     1175ControllerItem::ControllerItem(StorageModel *pStorageModel,
     1176                               AbstractItem *pParentItem, const QString &strName,
    11611177                               KStorageBus enmBus, KStorageControllerType enmType)
    11621178    : AbstractItem(pParentItem)
     1179    , m_pStorageModel(pStorageModel)
    11631180    , m_strName(strName)
    11641181    , m_enmBus(enmBus)
     
    11861203}
    11871204
     1205KPlatformArchitecture ControllerItem::arch() const
     1206{
     1207    return m_pStorageModel ? m_pStorageModel->arch() : KPlatformArchitecture_x86;
     1208}
     1209
    11881210void ControllerItem::setName(const QString &strName)
    11891211{
     
    12351257{
    12361258    /* Limit maximum port count: */
    1237     CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     1259    CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch());
    12381260    m_uPortCount = qMin(uPortCount, (uint)comProperties.GetMaxPortCountForStorageBus(bus()));
    12391261}
     
    12531275uint ControllerItem::maxPortCount()
    12541276{
    1255     CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     1277    CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch());
    12561278    return (uint)comProperties.GetMaxPortCountForStorageBus(bus());
    12571279}
     
    12701292{
    12711293    SlotsList allSlots;
    1272     CPlatformProperties comProps = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     1294    CPlatformProperties comProps = uiCommon().virtualBox().GetPlatformProperties(arch());
    12731295    for (ULONG i = 0; i < comProps.GetMaxPortCountForStorageBus(bus()); ++ i)
    12741296        for (ULONG j = 0; j < comProps.GetMaxDevicesPerPortForStorageBus(bus()); ++ j)
     
    12871309DeviceTypeList ControllerItem::deviceTypeList() const
    12881310{
    1289     CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     1311    CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch());
    12901312    return comProperties.GetDeviceTypesForStorageBus(m_enmBus).toList();
    12911313}
     
    13681390
    13691391    /* Load currently supported storage buses: */
    1370     CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     1392    CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch());
    13711393    const QVector<KStorageBus> supportedBuses = comProperties.GetSupportedStorageBuses();
    13721394
     
    13901412
    13911413    /* Load currently supported storage buses & types: */
    1392     CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     1414    CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch());
    13931415    const QVector<KStorageBus> supportedBuses = comProperties.GetSupportedStorageBuses();
    13941416    const QVector<KStorageControllerType> supportedTypes = comProperties.GetSupportedStorageControllerTypes();
     
    17081730*********************************************************************************************************************************/
    17091731
    1710 StorageModel::StorageModel(QITreeView *pParentTree)
     1732StorageModel::StorageModel(QITreeView *pParentTree, UIStorageSettingsEditor *pParentEditor)
    17111733    : QAbstractItemModel(pParentTree)
     1734    , m_pParentEditor(pParentEditor)
    17121735    , m_pRootItem(new RootItem(pParentTree))
    17131736    , m_enmToolTipType(ToolTipType_Default)
     
    17201743{
    17211744    delete m_pRootItem;
     1745}
     1746
     1747KPlatformArchitecture StorageModel::arch() const
     1748{
     1749    return m_pParentEditor ? m_pParentEditor->arch() : KPlatformArchitecture_x86;
    17221750}
    17231751
     
    18831911        case R_IsMoreIDEControllersPossible:
    18841912        {
    1885             CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     1913            CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch());
    18861914            return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) &&
    18871915                   (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_IDE) <
     
    18901918        case R_IsMoreSATAControllersPossible:
    18911919        {
    1892             CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     1920            CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch());
    18931921            return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) &&
    18941922                   (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_SATA) <
     
    18971925        case R_IsMoreSCSIControllersPossible:
    18981926        {
    1899             CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     1927            CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch());
    19001928            return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) &&
    19011929                   (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_SCSI) <
     
    19041932        case R_IsMoreFloppyControllersPossible:
    19051933        {
    1906             CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     1934            CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch());
    19071935            return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) &&
    19081936                   (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_Floppy) <
     
    19111939        case R_IsMoreSASControllersPossible:
    19121940        {
    1913             CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     1941            CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch());
    19141942            return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) &&
    19151943                   (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_SAS) <
     
    19181946        case R_IsMoreUSBControllersPossible:
    19191947        {
    1920             CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     1948            CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch());
    19211949            return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) &&
    19221950                   (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_USB) <
     
    19251953        case R_IsMoreNVMeControllersPossible:
    19261954        {
    1927             CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     1955            CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch());
    19281956            return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) &&
    19291957                   (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_PCIe) <
     
    19321960        case R_IsMoreVirtioSCSIControllersPossible:
    19331961        {
    1934             CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     1962            CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch());
    19351963            return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) &&
    19361964                   (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_VirtioSCSI) <
     
    19441972                {
    19451973                    ControllerItem *pItemController = qobject_cast<ControllerItem*>(pItem);
    1946                     CPlatformProperties comProps = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     1974                    CPlatformProperties comProps = uiCommon().virtualBox().GetPlatformProperties(arch());
    19471975                    const bool fIsMoreAttachmentsPossible = (ULONG)rowCount(specifiedIndex) <
    19481976                                                            (comProps.GetMaxPortCountForStorageBus(pItemController->bus()) *
     
    22902318
    22912319                    /* Lets make sure there is enough of place for all the remaining attachments: */
    2292                     CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     2320                    CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch());
    22932321                    const uint uMaxPortCount =
    22942322                        (uint)comProperties.GetMaxPortCountForStorageBus(enmNewCtrBusType);
     
    24452473{
    24462474    beginInsertRows(root(), m_pRootItem->childCount(), m_pRootItem->childCount());
    2447     new ControllerItem(m_pRootItem, aCtrName, enmBus, enmType);
     2475    new ControllerItem(this, m_pRootItem, aCtrName, enmBus, enmType);
    24482476    endInsertRows();
    24492477    return index(m_pRootItem->childCount() - 1, 0, root());
     
    26892717{
    26902718    QMap<KStorageBus, int> maximumMap;
    2691     CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     2719    CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch());
    26922720    for (int iStorageBusType = KStorageBus_IDE; iStorageBusType < KStorageBus_Max; ++iStorageBusType)
    26932721        maximumMap.insert((KStorageBus)iStorageBusType,
     
    29873015}
    29883016
     3017KPlatformArchitecture UIStorageSettingsEditor::arch() const
     3018{
     3019    return   optionalFlags().contains("arch")
     3020           ? optionalFlags().value("arch").value<KPlatformArchitecture>()
     3021           : KPlatformArchitecture_x86;
     3022}
     3023
    29893024void UIStorageSettingsEditor::setActionPool(UIActionPool *pActionPool)
    29903025{
     
    33593394{
    33603395    /* Load currently supported storage buses and types: */
    3361     CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(KPlatformArchitecture_x86);
     3396    CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch());
    33623397    const QVector<KStorageBus> supportedBuses = comProperties.GetSupportedStorageBuses();
    33633398    const QVector<KStorageControllerType> supportedTypes = comProperties.GetSupportedStorageControllerTypes();
     
    44344469
    44354470        /* Prepare storage model: */
    4436         m_pModelStorage = new StorageModel(m_pTreeViewStorage);
     4471        m_pModelStorage = new StorageModel(m_pTreeViewStorage, this);
    44374472        if (m_pModelStorage)
    44384473        {
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIStorageSettingsEditor.h

    r101331 r101868  
    180180    /** Destructs editor. */
    181181    virtual ~UIStorageSettingsEditor() RT_OVERRIDE;
     182
     183    /** Returns platform architecture. */
     184    KPlatformArchitecture arch() const;
    182185
    183186    /** Defines @a pActionPool. */
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