Changeset 93541 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Feb 2, 2022 10:07:07 AM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.cpp
r93115 r93541 408 408 } 409 409 } 410 411 412 /********************************************************************************************************************************* 413 * UIWindowsISOImageSelector implementation. * 414 *********************************************************************************************************************************/ 415 416 UIWindowsISOImageSelector::UIWindowsISOImageSelector(QWidget *pParent /* = 0 */) 417 :QIWithRetranslateUI<QGroupBox>(pParent) 418 , m_pComboBox(0) 419 , m_pLabel(0) 420 { 421 prepare(); 422 } 423 424 ulong UIWindowsISOImageSelector::selectedImageIndex() const 425 { 426 if (!m_pComboBox || m_pComboBox->count() == 0) 427 return 0; 428 return m_pComboBox->currentData().value<ulong>(); 429 } 430 431 void UIWindowsISOImageSelector::setImageNamesAndIndices(const QVector<QString> &names, const QVector<ulong> &ids) 432 { 433 AssertReturnVoid(m_pComboBox && names.size() == ids.size()); 434 435 m_pComboBox->clear(); 436 437 for (int i = 0; i < names.size(); ++i) 438 m_pComboBox->addItem(names[i], QVariant::fromValue(ids[i]) /* user data */); 439 } 440 441 bool UIWindowsISOImageSelector::isEmpty() const 442 { 443 if (!m_pComboBox) 444 return true; 445 return m_pComboBox->count() == 0; 446 } 447 448 void UIWindowsISOImageSelector::retranslateUi() 449 { 450 setTitle(UIWizardNewVM::tr("Available OS Versions from ISO")); 451 if (m_pLabel) 452 m_pLabel->setText(UIWizardNewVM::tr("ISO Images")); 453 454 if (m_pComboBox) 455 m_pComboBox->setToolTip(UIWizardNewVM::tr("Select an image to be installed.")); 456 } 457 458 void UIWindowsISOImageSelector::prepare() 459 { 460 QHBoxLayout *pMainLayout = new QHBoxLayout(this); 461 462 m_pComboBox = new QIComboBox; 463 if (m_pComboBox) 464 { 465 pMainLayout->addWidget(m_pComboBox); 466 connect(m_pComboBox, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::currentIndexChanged), 467 this, &UIWindowsISOImageSelector::sltSelectedWindowsImageChanged); 468 } 469 retranslateUi(); 470 } 471 472 473 void UIWindowsISOImageSelector::sltSelectedWindowsImageChanged(int) 474 { 475 emit sigSelectedWindowsImageChanged(selectedImageIndex()); 476 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.h
r93115 r93541 33 33 class QGridLayout; 34 34 class QLabel; 35 class QIComboBox; 35 36 class QILineEdit; 36 37 class UIBaseMemoryEditor; … … 177 178 }; 178 179 180 class UIWindowsISOImageSelector : public QIWithRetranslateUI<QGroupBox> 181 { 182 Q_OBJECT; 183 184 signals: 185 186 void sigSelectedWindowsImageChanged(ulong selectedImageIndex); 187 188 public: 189 190 UIWindowsISOImageSelector(QWidget *pParent = 0); 191 void setImageNamesAndIndices(const QVector<QString> &names, const QVector<ulong> &ids); 192 bool isEmpty() const; 193 ulong selectedImageIndex() const; 194 195 private slots: 196 void sltSelectedWindowsImageChanged(int); 197 private: 198 199 void prepare(); 200 void retranslateUi(); 201 202 QIComboBox *m_pComboBox; 203 QLabel *m_pLabel; 204 205 }; 206 179 207 #endif /* !FEQT_INCLUDED_SRC_wizards_editors_UIWizardNewVMEditors_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
r93540 r93541 832 832 } 833 833 834 void UIWizardNewVM::setDetectedImageNamesAndIndices(const QVector<QString> &names, const QVector< ULONG> &ids)834 void UIWizardNewVM::setDetectedImageNamesAndIndices(const QVector<QString> &names, const QVector<ulong> &ids) 835 835 { 836 836 AssertMsg(names.size() == ids.size(), … … 845 845 } 846 846 847 const QVector< ULONG> &UIWizardNewVM::detectedImageIndices() const847 const QVector<ulong> &UIWizardNewVM::detectedImageIndices() const 848 848 { 849 849 return m_detectedImageIndices; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h
r93540 r93541 171 171 void setEmptyDiskRecommended(bool fEmptyDiskRecommended); 172 172 173 void setDetectedImageNamesAndIndices(const QVector<QString> &names, const QVector< ULONG> &ids);173 void setDetectedImageNamesAndIndices(const QVector<QString> &names, const QVector<ulong> &ids); 174 174 const QVector<QString> &detectedImageNames() const; 175 const QVector< ULONG> &detectedImageIndices() const;175 const QVector<ulong> &detectedImageIndices() const; 176 176 177 177 QVector<KMediumVariant> mediumVariants() const; … … 230 230 /* Name and index lists of the images detected from an ISO. Currently only for Windows ISOs. */ 231 231 QVector<QString> m_detectedImageNames; 232 QVector< ULONG> m_detectedImageIndices;232 QVector<ulong> m_detectedImageIndices; 233 233 234 234 /** Holds the VM OS family ID. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMExpertPage.cpp
r93540 r93541 47 47 , m_pFormatComboBox(0) 48 48 , m_pSizeAndLocationGroup(0) 49 , m_pWindowsISOImageSelector(0) 49 50 , m_pNameAndSystemEditor(0) 50 51 , m_pSkipUnattendedCheckBox(0) … … 152 153 if (UIWizardNewVMNameOSTypeCommon::guessOSTypeDetectedOSTypeString(m_pNameAndSystemEditor, pWizard->detectedOSTypeId())) 153 154 m_userModifiedParameters << "GuestOSTypeFromISO"; 154 else /* Remove GuestOSTypeFromISO from the set if it is there: */155 else /* Remove GuestOSTypeFromISO from the set if it is there: */ 155 156 m_userModifiedParameters.remove("GuestOSTypeFromISO"); 156 157 … … 161 162 if (fileInfo.exists() && fileInfo.isReadable()) 162 163 uiCommon().updateRecentlyUsedMediumListAndFolder(UIMediumDeviceType_DVD, strISOPath); 164 165 /* Populate the windows ISO images selector: */ 166 if (m_pWindowsISOImageSelector) 167 m_pWindowsISOImageSelector->setImageNamesAndIndices(pWizard->detectedImageNames(), pWizard->detectedImageIndices()); 163 168 setSkipCheckBoxEnable(); 164 169 disableEnableUnattendedRelatedWidgets(isUnattendedEnabled()); … … 468 473 AssertReturn(m_pGAInstallationISOContainer, 0); 469 474 pLayout->addWidget(m_pGAInstallationISOContainer, iRow, 0, 1, 4); 475 476 m_pWindowsISOImageSelector = new UIWindowsISOImageSelector; 477 AssertReturn(m_pWindowsISOImageSelector, 0); 478 pLayout->addWidget(m_pWindowsISOImageSelector, iRow, 0, 1, 5); 470 479 471 480 return pContainerWidget; … … 673 682 if (m_pGAInstallationISOContainer) 674 683 m_pGAInstallationISOContainer->setEnabled(fEnabled); 684 if (m_pWindowsISOImageSelector) 685 m_pWindowsISOImageSelector->setEnabled(fEnabled && !m_pWindowsISOImageSelector->isEmpty()); 675 686 m_pAdditionalOptionsContainer->disableEnableProductKeyWidgets(isProductKeyWidgetEnabled()); 676 687 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMExpertPage.h
r93409 r93541 46 46 class UIToolBox; 47 47 class UIUserNamePasswordGroupBox; 48 class UIWindowsISOImageSelector; 48 49 49 50 /** Expert page of the New Virtual Machine wizard. */ … … 133 134 UIDiskFormatsComboBox *m_pFormatComboBox; 134 135 UIMediumSizeAndPathGroupBox *m_pSizeAndLocationGroup; 136 UIWindowsISOImageSelector *m_pWindowsISOImageSelector; 135 137 UINameAndSystemEditor *m_pNameAndSystemEditor; 136 138 QCheckBox *m_pSkipUnattendedCheckBox; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePage.cpp
r93540 r93541 328 328 pWizard->setDetectedOSTypeId(comUnatteded.GetDetectedOSTypeId()); 329 329 330 pWizard->setDetectedImageNamesAndIndices(comUnatteded.GetDetectedImageNames(), 331 comUnatteded.GetDetectedImageIndices()); 330 const QVector<ULONG> &indices = comUnatteded.GetDetectedImageIndices(); 331 QVector<ulong> qIndices; 332 for (int i = 0; i < indices.size(); ++i) 333 qIndices << indices[i]; 334 pWizard->setDetectedImageNamesAndIndices(comUnatteded.GetDetectedImageNames(), qIndices); 332 335 } 333 336
Note:
See TracChangeset
for help on using the changeset viewer.