- Timestamp:
- Feb 8, 2022 8:15:30 AM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.cpp
r93638 r93646 414 414 } 415 415 } 416 417 418 /*********************************************************************************************************************************419 * UIWindowsISOImageSelector implementation. *420 *********************************************************************************************************************************/421 422 UIWindowsISOImageSelector::UIWindowsISOImageSelector(QWidget *pParent /* = 0 */)423 :QIWithRetranslateUI<QGroupBox>(pParent)424 , m_pComboBox(0)425 , m_pLabel(0)426 {427 prepare();428 }429 430 ulong UIWindowsISOImageSelector::selectedImageIndex() const431 {432 if (!m_pComboBox || m_pComboBox->count() == 0)433 return 0;434 return m_pComboBox->currentData().value<ulong>();435 }436 437 void UIWindowsISOImageSelector::setImageNamesAndIndices(const QVector<QString> &names, const QVector<ulong> &ids)438 {439 AssertReturnVoid(m_pComboBox && names.size() == ids.size());440 441 m_pComboBox->clear();442 443 for (int i = 0; i < names.size(); ++i)444 m_pComboBox->addItem(names[i], QVariant::fromValue(ids[i]) /* user data */);445 }446 447 bool UIWindowsISOImageSelector::isEmpty() const448 {449 if (!m_pComboBox)450 return true;451 return m_pComboBox->count() == 0;452 }453 454 void UIWindowsISOImageSelector::retranslateUi()455 {456 setTitle(UIWizardNewVM::tr("Available OS Editions from the ISO"));457 if (m_pLabel)458 m_pLabel->setText(UIWizardNewVM::tr("ISO Images"));459 460 if (m_pComboBox)461 m_pComboBox->setToolTip(UIWizardNewVM::tr("Select an image to be installed."));462 }463 464 void UIWindowsISOImageSelector::prepare()465 {466 QHBoxLayout *pMainLayout = new QHBoxLayout(this);467 468 m_pComboBox = new QIComboBox;469 if (m_pComboBox)470 {471 pMainLayout->addWidget(m_pComboBox);472 connect(m_pComboBox, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::currentIndexChanged),473 this, &UIWindowsISOImageSelector::sltSelectedWindowsImageChanged);474 }475 retranslateUi();476 }477 478 479 void UIWindowsISOImageSelector::sltSelectedWindowsImageChanged(int)480 {481 emit sigSelectedWindowsImageChanged(selectedImageIndex());482 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.h
r93638 r93646 179 179 }; 180 180 181 class UIWindowsISOImageSelector : public QIWithRetranslateUI<QGroupBox>182 {183 Q_OBJECT;184 185 signals:186 187 void sigSelectedWindowsImageChanged(ulong selectedImageIndex);188 189 public:190 191 UIWindowsISOImageSelector(QWidget *pParent = 0);192 void setImageNamesAndIndices(const QVector<QString> &names, const QVector<ulong> &ids);193 bool isEmpty() const;194 ulong selectedImageIndex() const;195 196 private slots:197 void sltSelectedWindowsImageChanged(int);198 private:199 200 void prepare();201 void retranslateUi();202 203 QIComboBox *m_pComboBox;204 QLabel *m_pLabel;205 206 };207 208 181 #endif /* !FEQT_INCLUDED_SRC_wizards_editors_UIWizardNewVMEditors_h */
Note:
See TracChangeset
for help on using the changeset viewer.