Changeset 82267 in vbox
- Timestamp:
- Nov 28, 2019 2:54:36 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 135085
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r82250 r82267 497 497 /** Updates possible buses. */ 498 498 void updateBusInfo(); 499 /** Updates possible types. */ 500 void updateTypeInfo(); 499 501 /** Updates pixmaps of possible buses. */ 500 502 void updatePixmaps(); … … 511 513 512 514 /** Holds the possible buses. */ 513 ControllerBusList m_buses; 515 ControllerBusList m_buses; 516 /** Holds the possible types on per bus basis. */ 517 QMap<KStorageBus, ControllerTypeList> m_types; 514 518 /** Holds the pixmaps of possible buses. */ 515 QList<PixmapType> m_pixmaps;519 QList<PixmapType> m_pixmaps; 516 520 517 521 /** Holds the current port count. */ … … 1251 1255 1252 1256 updateBusInfo(); 1257 updateTypeInfo(); 1253 1258 updatePixmaps(); 1254 1259 … … 1282 1287 1283 1288 updateBusInfo(); 1289 updateTypeInfo(); 1284 1290 updatePixmaps(); 1285 1291 } … … 1298 1304 { 1299 1305 m_enmType = enmType; 1306 1307 updateTypeInfo(); 1300 1308 } 1301 1309 … … 1307 1315 ControllerTypeList ControllerItem::types(KStorageBus enmBus) const 1308 1316 { 1309 ControllerTypeList types; 1310 1311 KStorageControllerType enmFirstType = KStorageControllerType_Null; 1312 uint cAmount = 0; 1313 switch (enmBus) 1314 { 1315 case KStorageBus_IDE: enmFirstType = KStorageControllerType_PIIX3; cAmount = 3; break; 1316 case KStorageBus_SATA: enmFirstType = KStorageControllerType_IntelAhci; cAmount = 1; break; 1317 case KStorageBus_SCSI: enmFirstType = KStorageControllerType_LsiLogic; cAmount = 2; break; 1318 case KStorageBus_Floppy: enmFirstType = KStorageControllerType_I82078; cAmount = 1; break; 1319 case KStorageBus_SAS: enmFirstType = KStorageControllerType_LsiLogicSas; cAmount = 1; break; 1320 case KStorageBus_USB: enmFirstType = KStorageControllerType_USB; cAmount = 1; break; 1321 case KStorageBus_PCIe: enmFirstType = KStorageControllerType_NVMe; cAmount = 1; break; 1322 case KStorageBus_VirtioSCSI: enmFirstType = KStorageControllerType_VirtioSCSI; cAmount = 1; break; 1323 default: break; 1324 } 1325 AssertMsgReturn(enmFirstType != KStorageControllerType_Null, ("Invalid bus: %d!\n", (int)enmBus), types); 1326 1327 for (uint i = enmFirstType; i < enmFirstType + cAmount; ++i) 1328 types << static_cast<KStorageControllerType>(i); 1329 1330 return types; 1317 return m_types.value(enmBus); 1331 1318 } 1332 1319 … … 1478 1465 /* And prepend current bus finally: */ 1479 1466 m_buses.prepend(m_enmBus); 1467 } 1468 1469 void ControllerItem::updateTypeInfo() 1470 { 1471 /* Clear the types initially: */ 1472 m_types.clear(); 1473 1474 /* Load currently supported storage buses & types: */ 1475 CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties(); 1476 const QVector<KStorageBus> supportedBuses = comProperties.GetSupportedStorageBuses(); 1477 const QVector<KStorageControllerType> supportedTypes = comProperties.GetSupportedStorageControllerTypes(); 1478 1479 /* We update the list with all supported buses 1480 * and remove the current one from that list. */ 1481 ControllerBusList possibleBuses = supportedBuses.toList(); 1482 possibleBuses.removeAll(m_enmBus); 1483 1484 /* And prepend current bus finally: */ 1485 possibleBuses.prepend(m_enmBus); 1486 1487 /* Enumerate possible buses: */ 1488 foreach (const KStorageBus &enmBus, possibleBuses) 1489 { 1490 /* This is hardcoded hell, we will get rid of it one day .. */ 1491 KStorageControllerType enmFirstType = KStorageControllerType_Null; 1492 uint cAmount = 0; 1493 switch (enmBus) 1494 { 1495 case KStorageBus_IDE: enmFirstType = KStorageControllerType_PIIX3; cAmount = 3; break; 1496 case KStorageBus_SATA: enmFirstType = KStorageControllerType_IntelAhci; cAmount = 1; break; 1497 case KStorageBus_SCSI: enmFirstType = KStorageControllerType_LsiLogic; cAmount = 2; break; 1498 case KStorageBus_Floppy: enmFirstType = KStorageControllerType_I82078; cAmount = 1; break; 1499 case KStorageBus_SAS: enmFirstType = KStorageControllerType_LsiLogicSas; cAmount = 1; break; 1500 case KStorageBus_USB: enmFirstType = KStorageControllerType_USB; cAmount = 1; break; 1501 case KStorageBus_PCIe: enmFirstType = KStorageControllerType_NVMe; cAmount = 1; break; 1502 case KStorageBus_VirtioSCSI: enmFirstType = KStorageControllerType_VirtioSCSI; cAmount = 1; break; 1503 default: break; 1504 } 1505 1506 /* Check whether type is supported or already selected before adding it: */ 1507 for (uint i = enmFirstType; i < enmFirstType + cAmount; ++i) 1508 { 1509 const KStorageControllerType enmType = static_cast<KStorageControllerType>(i); 1510 if (supportedTypes.contains(enmType) || enmType == m_enmType) 1511 m_types[enmBus] << enmType; 1512 } 1513 } 1480 1514 } 1481 1515
Note:
See TracChangeset
for help on using the changeset viewer.