Changeset 101711 in vbox
- Timestamp:
- Nov 2, 2023 9:42:03 AM (15 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/UINameAndSystemEditor.cpp
r101710 r101711 71 71 , m_pLabelEdition(0) 72 72 , m_pComboEdition(0) 73 // widgets/ family, subtype, type73 // widgets/ family, distribution, type 74 74 , m_pLabelFamily(0) 75 75 , m_pComboFamily(0) 76 , m_pLabel Subtype(0)77 , m_pCombo Subtype(0)76 , m_pLabelDistribution(0) 77 , m_pComboDistribution(0) 78 78 , m_pLabelType(0) 79 79 , m_pComboType(0) … … 192 192 if (iFamilyComboIndex == -1) 193 193 return false; 194 /* Set the family combo's index. This will cause subtypecombo to be populated accordingly: */194 /* Set the family combo's index. This will cause distribution combo to be populated accordingly: */ 195 195 m_pComboFamily->setCurrentIndex(iFamilyComboIndex); 196 196 197 /* If subtypeis not empty then try to select correct index. This will populate type combo: */198 QString str Subtype= uiCommon().guestOSTypeManager().getSubtype(strTypeId);199 if (!str Subtype.isEmpty())197 /* If distribution is not empty then try to select correct index. This will populate type combo: */ 198 QString strDistribution = uiCommon().guestOSTypeManager().getSubtype(strTypeId); 199 if (!strDistribution.isEmpty()) 200 200 { 201 201 int index = -1; 202 for (int i = 0; i < m_pCombo Subtype->count() && index == -1; ++i)203 { 204 if (str Subtype == m_pComboSubtype->itemText(i))202 for (int i = 0; i < m_pComboDistribution->count() && index == -1; ++i) 203 { 204 if (strDistribution == m_pComboDistribution->itemText(i)) 205 205 index = i; 206 206 } 207 207 if (index != -1) 208 m_pCombo Subtype->setCurrentIndex(index);208 m_pComboDistribution->setCurrentIndex(index); 209 209 else 210 210 return false; … … 273 273 if (m_pLabelFamily) 274 274 m_pLabelFamily->setText(tr("&Type:")); 275 if (m_pLabel Subtype)276 m_pLabel Subtype->setText(tr("&Subtype:"));275 if (m_pLabelDistribution) 276 m_pLabelDistribution->setText(tr("&Subtype:")); 277 277 if (m_pLabelType) 278 278 m_pLabelType->setText(tr("&Version:")); … … 303 303 /* Sanity check: */ 304 304 AssertPtrReturnVoid(m_pComboFamily); 305 AssertPtrReturnVoid(m_pCombo Subtype);305 AssertPtrReturnVoid(m_pComboDistribution); 306 306 307 307 /* Acquire new family ID: */ … … 309 309 AssertReturnVoid(!m_strFamilyId.isEmpty()); 310 310 311 m_pCombo Subtype->blockSignals(true);312 m_pLabel Subtype->setEnabled(true);313 314 m_pCombo Subtype->setEnabled(true);315 m_pCombo Subtype->clear();316 317 const QStringList subtypeList = uiCommon().guestOSTypeManager().getSubtypeListForFamilyId(m_strFamilyId);318 319 if ( subtypeList.isEmpty())320 { 321 m_pCombo Subtype->setEnabled(false);322 m_pLabel Subtype->setEnabled(false);311 m_pComboDistribution->blockSignals(true); 312 m_pLabelDistribution->setEnabled(true); 313 314 m_pComboDistribution->setEnabled(true); 315 m_pComboDistribution->clear(); 316 317 const QStringList distributionList = uiCommon().guestOSTypeManager().getSubtypeListForFamilyId(m_strFamilyId); 318 319 if (distributionList.isEmpty()) 320 { 321 m_pComboDistribution->setEnabled(false); 322 m_pLabelDistribution->setEnabled(false); 323 323 /* If subtype list is empty the all the types of the family are added to typ selection combo: */ 324 324 populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForFamilyId(m_strFamilyId)); … … 326 326 else 327 327 { 328 /* Populate subtypecombo: */328 /* Populate distribution combo: */ 329 329 /* If family is Linux then select Oracle Linux as subtype: */ 330 330 int iOracleIndex = -1; 331 foreach (const QString &str Subtype, subtypeList)332 { 333 m_pCombo Subtype->addItem(strSubtype);334 if (str Subtype.contains(QRegularExpression("Oracle.*Linux")))335 iOracleIndex = m_pCombo Subtype->count() - 1;331 foreach (const QString &strDistribution, distributionList) 332 { 333 m_pComboDistribution->addItem(strDistribution); 334 if (strDistribution.contains(QRegularExpression("Oracle.*Linux"))) 335 iOracleIndex = m_pComboDistribution->count() - 1; 336 336 } 337 337 if (iOracleIndex != -1) 338 m_pCombo Subtype->setCurrentIndex(iOracleIndex);339 340 populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForSubtype(m_pCombo Subtype->currentText()));341 } 342 m_pCombo Subtype->blockSignals(false);338 m_pComboDistribution->setCurrentIndex(iOracleIndex); 339 340 populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForSubtype(m_pComboDistribution->currentText())); 341 } 342 m_pComboDistribution->blockSignals(false); 343 343 344 344 /* Notify listeners about this change: */ … … 346 346 } 347 347 348 void UINameAndSystemEditor::slt SubtypeChanged(const QString &strSubtype)349 { 350 /* Save new subtype: */351 m_str Subtype = strSubtype;348 void UINameAndSystemEditor::sltDistributionChanged(const QString &strDistribution) 349 { 350 /* Save new distribution: */ 351 m_strDistribution = strDistribution; 352 352 353 353 /* Populate type combo: */ 354 populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForSubtype(str Subtype));354 populateTypeCombo(uiCommon().guestOSTypeManager().getTypeListForSubtype(strDistribution)); 355 355 } 356 356 … … 502 502 ++iRow; 503 503 504 /* Prepare VM OS subtypelabel: */505 m_pLabel Subtype= new QLabel(this);506 if (m_pLabel Subtype)507 { 508 m_pLabel Subtype->setAlignment(Qt::AlignRight);509 m_pLabel Subtype->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);510 m_pLayout->addWidget(m_pLabel Subtype, iRow, 0);511 } 512 /* Prepare VM OS subtypecombo: */513 m_pCombo Subtype= new QComboBox(this);514 if (m_pCombo Subtype)515 { 516 m_pLabel Subtype->setBuddy(m_pComboSubtype);517 m_pLayout->addWidget(m_pCombo Subtype, iRow, 1);504 /* Prepare VM OS distribution label: */ 505 m_pLabelDistribution = new QLabel(this); 506 if (m_pLabelDistribution) 507 { 508 m_pLabelDistribution->setAlignment(Qt::AlignRight); 509 m_pLabelDistribution->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 510 m_pLayout->addWidget(m_pLabelDistribution, iRow, 0); 511 } 512 /* Prepare VM OS distribution combo: */ 513 m_pComboDistribution = new QComboBox(this); 514 if (m_pComboDistribution) 515 { 516 m_pLabelDistribution->setBuddy(m_pComboDistribution); 517 m_pLayout->addWidget(m_pComboDistribution, iRow, 1); 518 518 } 519 519 ++iRow; … … 589 589 connect(m_pComboFamily, &QComboBox::currentIndexChanged, 590 590 this, &UINameAndSystemEditor::sltFamilyChanged); 591 if (m_pCombo Subtype)592 connect(m_pCombo Subtype, &QComboBox::currentTextChanged,593 this, &UINameAndSystemEditor::slt SubtypeChanged);591 if (m_pComboDistribution) 592 connect(m_pComboDistribution, &QComboBox::currentTextChanged, 593 this, &UINameAndSystemEditor::sltDistributionChanged); 594 594 if (m_pComboType) 595 595 connect(m_pComboType, &QComboBox::currentIndexChanged, … … 667 667 } 668 668 } 669 /* Oracle Linux for Oracle subtype: */670 else if (m_str Subtype== "Oracle")669 /* Oracle Linux for Oracle distribution: */ 670 else if (m_strDistribution == "Oracle") 671 671 { 672 672 const QString strDefaultID = GUEST_OS_ID_STR_X64("Oracle"); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h
r101710 r101711 150 150 /** Handles VM OS family @a iIndex change. */ 151 151 void sltFamilyChanged(int iIndex); 152 /** Handles VM OS @a str Subtypechange. */153 void slt SubtypeChanged(const QString &strSubtype);152 /** Handles VM OS @a strDistribution change. */ 153 void sltDistributionChanged(const QString &strDistribution); 154 154 /** Handles VM OS type @a iIndex change. */ 155 155 void sltTypeChanged(int iIndex); … … 194 194 /** Holds the VM OS family ID. */ 195 195 QString m_strFamilyId; 196 /** Holds the VM OS subtype. */197 QString m_str Subtype;196 /** Holds the VM OS distribution. */ 197 QString m_strDistribution; 198 198 /** Holds the VM OS type ID. */ 199 199 QString m_strTypeId; … … 232 232 /** Holds the VM OS family combo instance. */ 233 233 QComboBox *m_pComboFamily; 234 /** Holds the VM OS subtypelabel instance. */235 QLabel *m_pLabel Subtype;236 /** Holds the VM OS subtypecombo instance. */237 QComboBox *m_pCombo Subtype;234 /** Holds the VM OS distribution label instance. */ 235 QLabel *m_pLabelDistribution; 236 /** Holds the VM OS distribution combo instance. */ 237 QComboBox *m_pComboDistribution; 238 238 /** Holds the VM OS type label instance. */ 239 239 QLabel *m_pLabelType;
Note:
See TracChangeset
for help on using the changeset viewer.