VirtualBox

Changeset 103294 in vbox


Ignore:
Timestamp:
Feb 9, 2024 3:20:37 PM (12 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
161588
Message:

FE/Qt: bugref:10513: VM settings / Storage page: Give storage controllers some priorities so that if VM has few of them, Basic experience mode could use the one with higher.

File:
1 edited

Legend:

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

    r103242 r103294  
    51585158    if (pModel->rowCount(currentIndex) > 0)
    51595159    {
    5160         /* Why not select it as well?
    5161          * It contains all the attachments we have (there): */
    5162         currentIndex = pModel->index(0, 0, currentIndex);
     5160        /* Let's enumerate controllers according to their bus type priorities: */
     5161        // For future support we have possibility to show Unknown bus above Low one.
     5162        enum BusPriority { BusPriority_High, BusPriority_Medium, BusPriority_Unknown, BusPriority_Low };
     5163        QMap<BusPriority, int> busPositions;
     5164        for (int i = 0; i < pModel->rowCount(currentIndex); ++i)
     5165        {
     5166            /* Acquire iterated controller bus type: */
     5167            const QModelIndex controllerIndex = pModel->index(i, 0, currentIndex);
     5168            const KStorageBus enmBus = pModel->data(controllerIndex, StorageModel::R_CtrBusType).value<KStorageBus>();
     5169            BusPriority enmBusPriority = BusPriority_Unknown;
     5170            switch (enmBus)
     5171            {
     5172                case KStorageBus_SATA:
     5173                    enmBusPriority = BusPriority_High;
     5174                    break;
     5175                case KStorageBus_IDE:
     5176                case KStorageBus_SCSI:
     5177                case KStorageBus_SAS:
     5178                case KStorageBus_VirtioSCSI:
     5179                    enmBusPriority = BusPriority_Medium;
     5180                    break;
     5181                case KStorageBus_Floppy:
     5182                case KStorageBus_USB:
     5183                case KStorageBus_PCIe:
     5184                    enmBusPriority = BusPriority_Low;
     5185                    break;
     5186                default:
     5187                    break;
     5188            }
     5189            if (!busPositions.contains(enmBusPriority))
     5190                busPositions[enmBusPriority] = i;
     5191        }
     5192        if (!busPositions.isEmpty())
     5193        {
     5194            /* Why not select it as well?
     5195             * It contains all the attachments we have (there): */
     5196            currentIndex = pModel->index(busPositions.first(), 0, currentIndex);
     5197        }
    51635198        /* For Basic experience mode: */
    51645199        if (!m_fInExpertMode)
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