Changeset 33932 in vbox
- Timestamp:
- Nov 10, 2010 12:33:46 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 67590
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r33882 r33932 892 892 #endif /* !VBOX_OSE */ 893 893 894 if (pPage == m_pSelector->idToPage(VMSettingsPage_Storage)) 895 { 896 /* Get System & Storage pages: */ 897 UIMachineSettingsSystem *pSystemPage = 898 qobject_cast<UIMachineSettingsSystem*>(m_pSelector->idToPage(VMSettingsPage_System)); 899 UIMachineSettingsStorage *pStoragePage = 900 qobject_cast<UIMachineSettingsStorage*>(m_pSelector->idToPage(VMSettingsPage_Storage)); 901 if (pSystemPage && pStoragePage) 902 { 903 /* Update chiset type for the Storage settings page: */ 904 if (pStoragePage->chipsetType() != pSystemPage->chipsetType()) 905 pStoragePage->setChipsetType(pSystemPage->chipsetType()); 906 /* Check for excessive controllers on Storage page controllers list: */ 907 QStringList excessiveList; 908 QMap<KStorageBus, int> currentType = pStoragePage->currentControllerTypes(); 909 QMap<KStorageBus, int> maximumType = pStoragePage->maximumControllerTypes(); 910 for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_SAS; ++iStorageBusType) 911 { 912 if (currentType[(KStorageBus)iStorageBusType] > maximumType[(KStorageBus)iStorageBusType]) 913 { 914 QString strExcessiveRecord = QString("%1 (%2)"); 915 strExcessiveRecord = strExcessiveRecord.arg(QString("<b>%1</b>").arg(vboxGlobal().toString((KStorageBus)iStorageBusType))); 916 strExcessiveRecord = strExcessiveRecord.arg(maximumType[(KStorageBus)iStorageBusType] == 1 ? 917 tr("at most one supported") : 918 tr("up to %1 supported").arg(maximumType[(KStorageBus)iStorageBusType])); 919 excessiveList << strExcessiveRecord; 920 } 921 } 922 if (!excessiveList.isEmpty()) 923 { 924 strWarning = tr( 925 "you are currently using more storage controllers than a %1 chipset supports. " 926 "Please change the chipset type on the System settings page or reduce the number " 927 "of the following storage controllers on the Storage settings page: %2.") 928 .arg(vboxGlobal().toString(pStoragePage->chipsetType())) 929 .arg(excessiveList.join(", ")); 930 return false; 931 } 932 } 933 } 934 894 935 return true; 895 936 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r33930 r33932 1507 1507 } 1508 1508 1509 KChipsetType StorageModel::chipsetType() const 1510 { 1511 return m_chipsetType; 1512 } 1513 1514 void StorageModel::setChipsetType(KChipsetType type) 1515 { 1516 m_chipsetType = type; 1517 } 1518 1519 QMap<KStorageBus, int> StorageModel::currentControllerTypes() const 1520 { 1521 QMap<KStorageBus, int> currentMap; 1522 for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_SAS; ++iStorageBusType) 1523 { 1524 currentMap.insert((KStorageBus)iStorageBusType, 1525 static_cast<RootItem*>(mRootItem)->childCount((KStorageBus)iStorageBusType)); 1526 } 1527 return currentMap; 1528 } 1529 1530 QMap<KStorageBus, int> StorageModel::maximumControllerTypes() const 1531 { 1532 QMap<KStorageBus, int> maximumMap; 1533 for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_SAS; ++iStorageBusType) 1534 { 1535 maximumMap.insert((KStorageBus)iStorageBusType, 1536 vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), (KStorageBus)iStorageBusType)); 1537 } 1538 return maximumMap; 1539 } 1540 1509 1541 Qt::ItemFlags StorageModel::flags (const QModelIndex &aIndex) const 1510 1542 { 1511 1543 return !aIndex.isValid() ? QAbstractItemModel::flags (aIndex) : 1512 1544 Qt::ItemIsEnabled | Qt::ItemIsSelectable; 1513 }1514 1515 KChipsetType StorageModel::chipsetType() const1516 {1517 CMachine machine = vboxGlobal().virtualBox().FindMachine(mRootItem->machineId());1518 Assert(!machine.isNull());1519 return machine.GetChipsetType();1520 1545 } 1521 1546 … … 1797 1822 } 1798 1823 1824 KChipsetType UIMachineSettingsStorage::chipsetType() const 1825 { 1826 return mStorageModel->chipsetType(); 1827 } 1828 1829 void UIMachineSettingsStorage::setChipsetType(KChipsetType type) 1830 { 1831 mStorageModel->setChipsetType(type); 1832 updateActionsState(); 1833 } 1834 1835 QMap<KStorageBus, int> UIMachineSettingsStorage::currentControllerTypes() const 1836 { 1837 return mStorageModel->currentControllerTypes(); 1838 } 1839 1840 QMap<KStorageBus, int> UIMachineSettingsStorage::maximumControllerTypes() const 1841 { 1842 return mStorageModel->maximumControllerTypes(); 1843 } 1844 1799 1845 /* Load data to cashe from corresponding external object(s), 1800 1846 * this task COULD be performed in other than GUI thread: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r33923 r33932 498 498 QModelIndex attachmentBySlot(QModelIndex controllerIndex, StorageSlot attachmentStorageSlot); 499 499 500 KChipsetType chipsetType() const; 501 void setChipsetType(KChipsetType type); 502 503 QMap<KStorageBus, int> currentControllerTypes() const; 504 QMap<KStorageBus, int> maximumControllerTypes() const; 505 500 506 private: 501 507 502 508 Qt::ItemFlags flags (const QModelIndex &aIndex) const; 503 504 KChipsetType chipsetType() const;505 509 506 510 AbstractItem *mRootItem; … … 513 517 514 518 ToolTipType mToolTipType; 519 520 KChipsetType m_chipsetType; 515 521 }; 516 522 Q_DECLARE_METATYPE (StorageModel::ToolTipType); … … 568 574 569 575 UIMachineSettingsStorage(); 576 577 KChipsetType chipsetType() const; 578 void setChipsetType(KChipsetType type); 579 580 QMap<KStorageBus, int> currentControllerTypes() const; 581 QMap<KStorageBus, int> maximumControllerTypes() const; 570 582 571 583 signals: -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r33882 r33932 158 158 { 159 159 return mCbUseAbsHID->isChecked(); 160 } 161 162 KChipsetType UIMachineSettingsSystem::chipsetType() const 163 { 164 return (KChipsetType)mCbChipset->itemData(mCbChipset->currentIndex()).toInt(); 160 165 } 161 166 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h
r33882 r33932 62 62 int cpuCount() const; 63 63 bool isHIDEnabled() const; 64 KChipsetType chipsetType() const; 64 65 65 66 signals:
Note:
See TracChangeset
for help on using the changeset viewer.