Changeset 101868 in vbox for trunk/src/VBox
- Timestamp:
- Nov 6, 2023 1:08:45 PM (13 months ago)
- 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 328 328 329 329 /** 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, 334 336 KStorageBus enmBus, KStorageControllerType enmType); 335 337 /** Destructs item. */ 336 338 virtual ~ControllerItem() RT_OVERRIDE; 339 340 /** Returns platform architecture. */ 341 KPlatformArchitecture arch() const; 337 342 338 343 /** Defines current @a strName. */ … … 413 418 /** Updates pixmaps of possible buses. */ 414 419 void updatePixmaps(); 420 421 /** Holds the storage model this item belongs to. */ 422 StorageModel *m_pStorageModel; 415 423 416 424 /** Holds the current name. */ … … 671 679 }; 672 680 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); 675 684 /** Destructs storage model. */ 676 685 virtual ~StorageModel() RT_OVERRIDE; 686 687 /** Returns platform architecture. */ 688 KPlatformArchitecture arch() const; 677 689 678 690 /** Returns row count for the passed @a parentIndex. */ … … 741 753 /** Returns model flags for @a specifiedIndex. */ 742 754 Qt::ItemFlags flags(const QModelIndex &specifiedIndex) const; 755 756 /** Holds the parent editor this model belongs to. */ 757 UIStorageSettingsEditor *m_pParentEditor; 743 758 744 759 /** Holds the root item instance. */ … … 1158 1173 *********************************************************************************************************************************/ 1159 1174 1160 ControllerItem::ControllerItem(AbstractItem *pParentItem, const QString &strName, 1175 ControllerItem::ControllerItem(StorageModel *pStorageModel, 1176 AbstractItem *pParentItem, const QString &strName, 1161 1177 KStorageBus enmBus, KStorageControllerType enmType) 1162 1178 : AbstractItem(pParentItem) 1179 , m_pStorageModel(pStorageModel) 1163 1180 , m_strName(strName) 1164 1181 , m_enmBus(enmBus) … … 1186 1203 } 1187 1204 1205 KPlatformArchitecture ControllerItem::arch() const 1206 { 1207 return m_pStorageModel ? m_pStorageModel->arch() : KPlatformArchitecture_x86; 1208 } 1209 1188 1210 void ControllerItem::setName(const QString &strName) 1189 1211 { … … 1235 1257 { 1236 1258 /* Limit maximum port count: */ 1237 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);1259 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch()); 1238 1260 m_uPortCount = qMin(uPortCount, (uint)comProperties.GetMaxPortCountForStorageBus(bus())); 1239 1261 } … … 1253 1275 uint ControllerItem::maxPortCount() 1254 1276 { 1255 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);1277 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch()); 1256 1278 return (uint)comProperties.GetMaxPortCountForStorageBus(bus()); 1257 1279 } … … 1270 1292 { 1271 1293 SlotsList allSlots; 1272 CPlatformProperties comProps = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);1294 CPlatformProperties comProps = uiCommon().virtualBox().GetPlatformProperties(arch()); 1273 1295 for (ULONG i = 0; i < comProps.GetMaxPortCountForStorageBus(bus()); ++ i) 1274 1296 for (ULONG j = 0; j < comProps.GetMaxDevicesPerPortForStorageBus(bus()); ++ j) … … 1287 1309 DeviceTypeList ControllerItem::deviceTypeList() const 1288 1310 { 1289 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);1311 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch()); 1290 1312 return comProperties.GetDeviceTypesForStorageBus(m_enmBus).toList(); 1291 1313 } … … 1368 1390 1369 1391 /* Load currently supported storage buses: */ 1370 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);1392 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch()); 1371 1393 const QVector<KStorageBus> supportedBuses = comProperties.GetSupportedStorageBuses(); 1372 1394 … … 1390 1412 1391 1413 /* Load currently supported storage buses & types: */ 1392 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);1414 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch()); 1393 1415 const QVector<KStorageBus> supportedBuses = comProperties.GetSupportedStorageBuses(); 1394 1416 const QVector<KStorageControllerType> supportedTypes = comProperties.GetSupportedStorageControllerTypes(); … … 1708 1730 *********************************************************************************************************************************/ 1709 1731 1710 StorageModel::StorageModel(QITreeView *pParentTree )1732 StorageModel::StorageModel(QITreeView *pParentTree, UIStorageSettingsEditor *pParentEditor) 1711 1733 : QAbstractItemModel(pParentTree) 1734 , m_pParentEditor(pParentEditor) 1712 1735 , m_pRootItem(new RootItem(pParentTree)) 1713 1736 , m_enmToolTipType(ToolTipType_Default) … … 1720 1743 { 1721 1744 delete m_pRootItem; 1745 } 1746 1747 KPlatformArchitecture StorageModel::arch() const 1748 { 1749 return m_pParentEditor ? m_pParentEditor->arch() : KPlatformArchitecture_x86; 1722 1750 } 1723 1751 … … 1883 1911 case R_IsMoreIDEControllersPossible: 1884 1912 { 1885 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);1913 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch()); 1886 1914 return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) && 1887 1915 (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_IDE) < … … 1890 1918 case R_IsMoreSATAControllersPossible: 1891 1919 { 1892 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);1920 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch()); 1893 1921 return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) && 1894 1922 (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_SATA) < … … 1897 1925 case R_IsMoreSCSIControllersPossible: 1898 1926 { 1899 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);1927 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch()); 1900 1928 return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) && 1901 1929 (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_SCSI) < … … 1904 1932 case R_IsMoreFloppyControllersPossible: 1905 1933 { 1906 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);1934 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch()); 1907 1935 return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) && 1908 1936 (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_Floppy) < … … 1911 1939 case R_IsMoreSASControllersPossible: 1912 1940 { 1913 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);1941 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch()); 1914 1942 return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) && 1915 1943 (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_SAS) < … … 1918 1946 case R_IsMoreUSBControllersPossible: 1919 1947 { 1920 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);1948 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch()); 1921 1949 return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) && 1922 1950 (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_USB) < … … 1925 1953 case R_IsMoreNVMeControllersPossible: 1926 1954 { 1927 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);1955 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch()); 1928 1956 return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) && 1929 1957 (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_PCIe) < … … 1932 1960 case R_IsMoreVirtioSCSIControllersPossible: 1933 1961 { 1934 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);1962 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch()); 1935 1963 return (m_enmConfigurationAccessLevel == ConfigurationAccessLevel_Full) && 1936 1964 (qobject_cast<RootItem*>(m_pRootItem)->childCount(KStorageBus_VirtioSCSI) < … … 1944 1972 { 1945 1973 ControllerItem *pItemController = qobject_cast<ControllerItem*>(pItem); 1946 CPlatformProperties comProps = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);1974 CPlatformProperties comProps = uiCommon().virtualBox().GetPlatformProperties(arch()); 1947 1975 const bool fIsMoreAttachmentsPossible = (ULONG)rowCount(specifiedIndex) < 1948 1976 (comProps.GetMaxPortCountForStorageBus(pItemController->bus()) * … … 2290 2318 2291 2319 /* 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()); 2293 2321 const uint uMaxPortCount = 2294 2322 (uint)comProperties.GetMaxPortCountForStorageBus(enmNewCtrBusType); … … 2445 2473 { 2446 2474 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); 2448 2476 endInsertRows(); 2449 2477 return index(m_pRootItem->childCount() - 1, 0, root()); … … 2689 2717 { 2690 2718 QMap<KStorageBus, int> maximumMap; 2691 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);2719 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch()); 2692 2720 for (int iStorageBusType = KStorageBus_IDE; iStorageBusType < KStorageBus_Max; ++iStorageBusType) 2693 2721 maximumMap.insert((KStorageBus)iStorageBusType, … … 2987 3015 } 2988 3016 3017 KPlatformArchitecture UIStorageSettingsEditor::arch() const 3018 { 3019 return optionalFlags().contains("arch") 3020 ? optionalFlags().value("arch").value<KPlatformArchitecture>() 3021 : KPlatformArchitecture_x86; 3022 } 3023 2989 3024 void UIStorageSettingsEditor::setActionPool(UIActionPool *pActionPool) 2990 3025 { … … 3359 3394 { 3360 3395 /* Load currently supported storage buses and types: */ 3361 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties( KPlatformArchitecture_x86);3396 CPlatformProperties comProperties = uiCommon().virtualBox().GetPlatformProperties(arch()); 3362 3397 const QVector<KStorageBus> supportedBuses = comProperties.GetSupportedStorageBuses(); 3363 3398 const QVector<KStorageControllerType> supportedTypes = comProperties.GetSupportedStorageControllerTypes(); … … 4434 4469 4435 4470 /* Prepare storage model: */ 4436 m_pModelStorage = new StorageModel(m_pTreeViewStorage );4471 m_pModelStorage = new StorageModel(m_pTreeViewStorage, this); 4437 4472 if (m_pModelStorage) 4438 4473 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIStorageSettingsEditor.h
r101331 r101868 180 180 /** Destructs editor. */ 181 181 virtual ~UIStorageSettingsEditor() RT_OVERRIDE; 182 183 /** Returns platform architecture. */ 184 KPlatformArchitecture arch() const; 182 185 183 186 /** Defines @a pActionPool. */
Note:
See TracChangeset
for help on using the changeset viewer.