VirtualBox

Changeset 93541 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Feb 2, 2022 10:07:07 AM (3 years ago)
Author:
vboxsync
Message:

FE/Qt, Main/Unattended. ​bugref:9515, ​bugref:9781. Adding a widget to the new wizard expert page to select windows image from the ISO. Connections etc. are not there yet.

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  
    408408    }
    409409}
     410
     411
     412/*********************************************************************************************************************************
     413*   UIWindowsISOImageSelector implementation.                                                                                   *
     414*********************************************************************************************************************************/
     415
     416UIWindowsISOImageSelector::UIWindowsISOImageSelector(QWidget *pParent /* = 0 */)
     417    :QIWithRetranslateUI<QGroupBox>(pParent)
     418    , m_pComboBox(0)
     419    , m_pLabel(0)
     420{
     421    prepare();
     422}
     423
     424ulong UIWindowsISOImageSelector::selectedImageIndex() const
     425{
     426    if (!m_pComboBox || m_pComboBox->count() == 0)
     427        return 0;
     428    return m_pComboBox->currentData().value<ulong>();
     429}
     430
     431void 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
     441bool UIWindowsISOImageSelector::isEmpty() const
     442{
     443    if (!m_pComboBox)
     444        return true;
     445    return m_pComboBox->count() == 0;
     446}
     447
     448void 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
     458void 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
     473void UIWindowsISOImageSelector::sltSelectedWindowsImageChanged(int)
     474{
     475    emit sigSelectedWindowsImageChanged(selectedImageIndex());
     476}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.h

    r93115 r93541  
    3333class QGridLayout;
    3434class QLabel;
     35class QIComboBox;
    3536class QILineEdit;
    3637class UIBaseMemoryEditor;
     
    177178};
    178179
     180class UIWindowsISOImageSelector : public QIWithRetranslateUI<QGroupBox>
     181{
     182    Q_OBJECT;
     183
     184signals:
     185
     186    void sigSelectedWindowsImageChanged(ulong selectedImageIndex);
     187
     188public:
     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
     195private slots:
     196    void sltSelectedWindowsImageChanged(int);
     197private:
     198
     199    void prepare();
     200    void retranslateUi();
     201
     202    QIComboBox *m_pComboBox;
     203    QLabel     *m_pLabel;
     204
     205};
     206
    179207#endif /* !FEQT_INCLUDED_SRC_wizards_editors_UIWizardNewVMEditors_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r93540 r93541  
    832832}
    833833
    834 void UIWizardNewVM::setDetectedImageNamesAndIndices(const QVector<QString> &names, const QVector<ULONG> &ids)
     834void UIWizardNewVM::setDetectedImageNamesAndIndices(const QVector<QString> &names, const QVector<ulong> &ids)
    835835{
    836836    AssertMsg(names.size() == ids.size(),
     
    845845}
    846846
    847 const QVector<ULONG> &UIWizardNewVM::detectedImageIndices() const
     847const QVector<ulong> &UIWizardNewVM::detectedImageIndices() const
    848848{
    849849    return m_detectedImageIndices;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r93540 r93541  
    171171        void setEmptyDiskRecommended(bool fEmptyDiskRecommended);
    172172
    173         void setDetectedImageNamesAndIndices(const QVector<QString> &names, const QVector<ULONG> &ids);
     173        void setDetectedImageNamesAndIndices(const QVector<QString> &names, const QVector<ulong> &ids);
    174174        const QVector<QString> &detectedImageNames() const;
    175         const QVector<ULONG> &detectedImageIndices() const;
     175        const QVector<ulong> &detectedImageIndices() const;
    176176
    177177        QVector<KMediumVariant> mediumVariants() const;
     
    230230       /* Name and index lists of the images detected from an ISO. Currently only for Windows ISOs. */
    231231       QVector<QString> m_detectedImageNames;
    232        QVector<ULONG> m_detectedImageIndices;
     232       QVector<ulong> m_detectedImageIndices;
    233233
    234234       /** Holds the VM OS family ID. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMExpertPage.cpp

    r93540 r93541  
    4747    , m_pFormatComboBox(0)
    4848    , m_pSizeAndLocationGroup(0)
     49    , m_pWindowsISOImageSelector(0)
    4950    , m_pNameAndSystemEditor(0)
    5051    , m_pSkipUnattendedCheckBox(0)
     
    152153    if (UIWizardNewVMNameOSTypeCommon::guessOSTypeDetectedOSTypeString(m_pNameAndSystemEditor, pWizard->detectedOSTypeId()))
    153154        m_userModifiedParameters << "GuestOSTypeFromISO";
    154     else /* Remove GuestOSTypeFromISO fromthe set if it is there: */
     155    else /* Remove GuestOSTypeFromISO from the set if it is there: */
    155156        m_userModifiedParameters.remove("GuestOSTypeFromISO");
    156157
     
    161162    if (fileInfo.exists() && fileInfo.isReadable())
    162163        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());
    163168    setSkipCheckBoxEnable();
    164169    disableEnableUnattendedRelatedWidgets(isUnattendedEnabled());
     
    468473    AssertReturn(m_pGAInstallationISOContainer, 0);
    469474    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);
    470479
    471480    return pContainerWidget;
     
    673682    if (m_pGAInstallationISOContainer)
    674683        m_pGAInstallationISOContainer->setEnabled(fEnabled);
     684    if (m_pWindowsISOImageSelector)
     685        m_pWindowsISOImageSelector->setEnabled(fEnabled && !m_pWindowsISOImageSelector->isEmpty());
    675686    m_pAdditionalOptionsContainer->disableEnableProductKeyWidgets(isProductKeyWidgetEnabled());
    676687}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMExpertPage.h

    r93409 r93541  
    4646class UIToolBox;
    4747class UIUserNamePasswordGroupBox;
     48class UIWindowsISOImageSelector;
    4849
    4950/** Expert page of the New Virtual Machine wizard. */
     
    133134        UIDiskFormatsComboBox *m_pFormatComboBox;
    134135        UIMediumSizeAndPathGroupBox *m_pSizeAndLocationGroup;
     136        UIWindowsISOImageSelector *m_pWindowsISOImageSelector;
    135137        UINameAndSystemEditor *m_pNameAndSystemEditor;
    136138        QCheckBox *m_pSkipUnattendedCheckBox;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePage.cpp

    r93540 r93541  
    328328    pWizard->setDetectedOSTypeId(comUnatteded.GetDetectedOSTypeId());
    329329
    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);
    332335}
    333336
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette