Changeset 82355 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Dec 3, 2019 7:33:45 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r82351 r82355 195 195 KChipsetType UIMachineSettingsSystem::chipsetType() const 196 196 { 197 return (KChipsetType)m_pComboChipsetType->itemData(m_pComboChipsetType->currentIndex()).toInt();197 return m_pComboChipsetType->currentData().value<KChipsetType>(); 198 198 } 199 199 … … 267 267 /* We are doing that *now* because these combos have 268 268 * dynamical content which depends on cashed value: */ 269 repopulateComboChipsetType(); 269 270 repopulateComboPointingHIDType(); 270 271 repopulateComboParavirtProviderType(); … … 314 315 newSystemData.m_iMemorySize = m_pBaseMemoryEditor->value(); 315 316 newSystemData.m_bootItems = m_pBootOrderEditor->value(); 316 newSystemData.m_chipsetType = (KChipsetType)m_pComboChipsetType->itemData(m_pComboChipsetType->currentIndex()).toInt();317 newSystemData.m_chipsetType = m_pComboChipsetType->currentData().value<KChipsetType>(); 317 318 newSystemData.m_pointingHIDType = m_pComboPointingHIDType->currentData().value<KPointingHIDType>(); 318 newSystemData.m_fEnabledIoApic = m_pCheckBoxApic->isChecked() || m_pSliderCPUCount->value() > 1 || 319 (KChipsetType)m_pComboChipsetType->itemData(m_pComboChipsetType->currentIndex()).toInt() == KChipsetType_ICH9; 319 newSystemData.m_fEnabledIoApic = m_pCheckBoxApic->isChecked() 320 || m_pSliderCPUCount->value() > 1 321 || m_pComboChipsetType->currentData().value<KChipsetType>() == KChipsetType_ICH9; 320 322 newSystemData.m_fEnabledEFI = m_pCheckBoxEFI->isChecked(); 321 323 newSystemData.m_fEnabledUTC = m_pCheckBoxUseUTC->isChecked(); … … 390 392 391 393 /* Chipset type vs IO-APIC test: */ 392 if ( (KChipsetType)m_pComboChipsetType->itemData(m_pComboChipsetType->currentIndex()).toInt() == KChipsetType_ICH9 && !m_pCheckBoxApic->isChecked())394 if (m_pComboChipsetType->currentData().value<KChipsetType>() == KChipsetType_ICH9 && !m_pCheckBoxApic->isChecked()) 393 395 { 394 396 message.second << tr( … … 740 742 { 741 743 /* Configure combo-box: */ 742 m_pComboChipsetType->addItem(gpConverter->toString(KChipsetType_PIIX3), QVariant(KChipsetType_PIIX3)); 743 m_pComboChipsetType->addItem(gpConverter->toString(KChipsetType_ICH9), QVariant(KChipsetType_ICH9)); 744 m_pComboChipsetType->setSizeAdjustPolicy(QComboBox::AdjustToContents); 744 745 } 745 746 … … 835 836 /* Configure 'Motherboard' connections: */ 836 837 connect(m_pComboChipsetType, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 837 this, &UIMachineSettingsSystem::revalidate);838 this, &UIMachineSettingsSystem::revalidate); 838 839 connect(m_pComboPointingHIDType, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 839 840 this, &UIMachineSettingsSystem::revalidate); … … 864 865 } 865 866 867 void UIMachineSettingsSystem::repopulateComboChipsetType() 868 { 869 /* Chipset Type combo-box created in the .ui file. */ 870 AssertPtrReturnVoid(m_pComboChipsetType); 871 { 872 /* Clear combo first of all: */ 873 m_pComboChipsetType->clear(); 874 875 /* Load currently supported chipset types: */ 876 CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties(); 877 QVector<KChipsetType> chipsetTypes = comProperties.GetSupportedChipsetTypes(); 878 /* Take into account currently cached value: */ 879 const KChipsetType enmCachedValue = m_pCache->base().m_chipsetType; 880 if (!chipsetTypes.contains(enmCachedValue)) 881 chipsetTypes.prepend(enmCachedValue); 882 883 /* Populate combo finally: */ 884 foreach (const KChipsetType &enmType, chipsetTypes) 885 m_pComboChipsetType->addItem(gpConverter->toString(enmType), QVariant::fromValue(enmType)); 886 } 887 } 888 866 889 void UIMachineSettingsSystem::repopulateComboPointingHIDType() 867 890 { … … 910 933 void UIMachineSettingsSystem::retranslateComboChipsetType() 911 934 { 912 /* For each the element in KChipsetType enum: */ 913 for (int iIndex = (int)KChipsetType_Null; iIndex < (int)KChipsetType_Max; ++iIndex) 914 { 915 /* Cast to the corresponding type: */ 916 const KChipsetType enmType = (KChipsetType)iIndex; 917 /* Look for the corresponding item: */ 918 const int iCorrespondingIndex = m_pComboChipsetType->findData((int)enmType); 919 /* Re-translate if corresponding item was found: */ 920 if (iCorrespondingIndex != -1) 921 m_pComboChipsetType->setItemText(iCorrespondingIndex, gpConverter->toString(enmType)); 935 /* For each the element in m_pComboChipsetType: */ 936 for (int iIndex = 0; iIndex < m_pComboChipsetType->count(); ++iIndex) 937 { 938 /* Apply retranslated text: */ 939 const KChipsetType enmType = m_pComboChipsetType->currentData().value<KChipsetType>(); 940 m_pComboChipsetType->setItemText(iIndex, gpConverter->toString(enmType)); 922 941 } 923 942 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h
r82289 r82355 128 128 void cleanup(); 129 129 130 /** Repopulates Chipset type combo-box. */ 131 void repopulateComboChipsetType(); 130 132 /** Repopulates Pointing HID type combo-box. */ 131 133 void repopulateComboPointingHIDType();
Note:
See TracChangeset
for help on using the changeset viewer.