VirtualBox

Changeset 90233 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 16, 2021 3:57:59 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9996. Fixig disk source selection related stuff in the expert page

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePageBasic.cpp

    r90225 r90233  
    469469void UIWizardNewVMNameOSTypePageBasic::sltSkipUnattendedInstallChanged(bool fSkip)
    470470{
     471    m_userModifiedParameters << "SkipUnattendedInstall";
    471472    newVMWizardPropertySet(SkipUnattendedInstall, fSkip);
    472473}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r90232 r90233  
    4747#include "UIWizardNewVMPageExpert.h"
    4848#include "UIWizardNewVMNameOSTypePageBasic.h"
    49 #include "UIWizardNewVMDiskPageBasic.h"
     49
    5050
    5151/* COM includes: */
     
    6969    , m_pDiskSelector(0)
    7070    , m_pDiskSelectionButton(0)
     71    , m_enmSelectedDiskSource(SelectedDiskSource_New)
     72    , m_fRecommendedNoDisk(false)
    7173{
    7274    /* Create widgets: */
     
    167169        uiCommon().updateRecentlyUsedMediumListAndFolder(UIMediumDeviceType_DVD, strISOPath);
    168170    setSkipCheckBoxEnable();
    169     disableEnableUnattendedRelatedWidgets(pWizard->isUnattendedEnabled());
     171    disableEnableUnattendedRelatedWidgets(isUnattendedEnabled());
    170172    emit completeChanged();
    171173}
     
    279281    }
    280282
     283    if (m_pDiskSourceButtonGroup)
     284        connect(m_pDiskSourceButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked),
     285                this, &UIWizardNewVMPageExpert::sltSelectedDiskSourceChanged);
     286
     287    connect(m_pSkipUnattendedCheckBox, &QCheckBox::toggled, this, &UIWizardNewVMPageExpert::sltSkipUnattendedCheckBoxChecked);
    281288
    282289    // if (m_pFormatButtonGroup)
     
    297304    //             this, &UIWizardNewVMPageExpert::sltMediaComboBoxIndexChanged);
    298305
    299     // if (m_pDiskSourceButtonGroup)
    300     // {
    301     //     connect(m_pDiskSourceButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked),
    302     //             this, &UIWizardNewVMPageExpert::sltSelectedDiskSourceChanged);
    303     //     connect(m_pDiskSourceButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked),
    304     //             this, &UIWizardNewVMPageExpert::sltValueModified);
    305     // }
    306     // connect(m_pSkipUnattendedCheckBox, &QCheckBox::toggled, this, &UIWizardNewVMPageExpert::sltSkipUnattendedCheckBoxChecked);
    307306
    308307    // if (m_pLocationOpenButton)
     
    331330        m_pHardwareWidgetContainer->blockSignals(false);
    332331    }
    333     // LONG64 recommendedDiskSize = type.GetRecommendedHDD();
    334     // /* Prepare initial disk choice: */
    335     // if (!m_userSetWidgets.contains(m_pDiskSourceButtonGroup))
    336     // {
    337     //     if (recommendedDiskSize != 0)
    338     //     {
    339     //         if (m_pDiskNew)
    340     //             m_pDiskNew->setChecked(true);
    341     //         setSelectedDiskSource(SelectedDiskSource_New);
    342     //         setEnableDiskSelectionWidgets(false);
    343     //         setEnableNewDiskWidgets(true);
    344     //         m_fRecommendedNoDisk = false;
    345     //     }
    346     //     else
    347     //     {
    348     //         if (m_pDiskEmpty)
    349     //             m_pDiskEmpty->setChecked(true);
    350     //         setSelectedDiskSource(SelectedDiskSource_Empty);
    351     //         setEnableDiskSelectionWidgets(false);
    352     //         setEnableNewDiskWidgets(false);
    353     //         m_fRecommendedNoDisk = true;
    354     //     }
    355     //     if (m_pDiskSelector)
    356     //         m_pDiskSelector->setCurrentIndex(0);
    357     // }
     332    LONG64 recommendedDiskSize = type.GetRecommendedHDD();
     333    /* Prepare initial disk choice: */
     334    if (!m_userModifiedParameters.contains("SelectedDiskSource"))
     335    {
     336        if (recommendedDiskSize != 0)
     337        {
     338            if (m_pDiskNew)
     339                m_pDiskNew->setChecked(true);
     340            m_enmSelectedDiskSource = SelectedDiskSource_New;
     341            setEnableDiskSelectionWidgets(false);
     342            setEnableNewDiskWidgets(true);
     343            m_fRecommendedNoDisk = false;
     344        }
     345        else
     346        {
     347            if (m_pDiskEmpty)
     348                m_pDiskEmpty->setChecked(true);
     349            m_enmSelectedDiskSource = SelectedDiskSource_Empty;
     350            setEnableDiskSelectionWidgets(false);
     351            setEnableNewDiskWidgets(false);
     352            m_fRecommendedNoDisk = true;
     353        }
     354        if (m_pDiskSelector)
     355            m_pDiskSelector->setCurrentIndex(0);
     356    }
    358357
    359358    // if (m_pMediumSizeEditor  && !m_userSetWidgets.contains(m_pMediumSizeEditor))
     
    405404
    406405
    407     // disableEnableUnattendedRelatedWidgets(isUnattendedEnabled());
    408406    setOSTypeDependedValues();
    409     // disableEnableUnattendedRelatedWidgets(isUnattendedEnabled());
    410 
    411 
     407    disableEnableUnattendedRelatedWidgets(isUnattendedEnabled());
    412408    // updateWidgetAterMediumFormatChange();
    413409    // setSkipCheckBoxEnable();
     
    625621{
    626622    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
    627     if (!pWizard || !pWizard->isUnattendedEnabled() || !pWizard->isGuestOSTypeWindows())
     623    if (!pWizard || !isUnattendedEnabled() || !pWizard->isGuestOSTypeWindows())
    628624        return false;
    629625    return true;
     
    632628void UIWizardNewVMPageExpert::disableEnableUnattendedRelatedWidgets(bool fEnabled)
    633629{
    634     Q_UNUSED(fEnabled);
    635 
    636     // if (m_pUserNameContainer)
    637     //     m_pUserNameContainer->setEnabled(fEnabled);
    638     // if (m_pAdditionalOptionsContainer)
    639     //     m_pAdditionalOptionsContainer->setEnabled(fEnabled);
    640     // if (m_pGAInstallationISOContainer)
    641     //     m_pGAInstallationISOContainer->setEnabled(fEnabled);
    642     // disableEnableProductKeyWidgets(isProductKeyWidgetEnabled());
    643 }
    644 
    645 void UIWizardNewVMPageExpert::sltSkipUnattendedCheckBoxChecked()
    646 {
    647     //disableEnableUnattendedRelatedWidgets(isUnattendedEnabled());
     630    if (m_pUserNamePasswordGroupBox)
     631        m_pUserNamePasswordGroupBox->setEnabled(fEnabled);
     632    if (m_pAdditionalOptionsContainer)
     633        m_pAdditionalOptionsContainer->setEnabled(fEnabled);
     634    if (m_pGAInstallationISOContainer)
     635        m_pGAInstallationISOContainer->setEnabled(fEnabled);
     636    m_pAdditionalOptionsContainer->disableEnableProductKeyWidgets(isProductKeyWidgetEnabled());
     637}
     638
     639void UIWizardNewVMPageExpert::sltSkipUnattendedCheckBoxChecked(bool fSkip)
     640{
     641    m_userModifiedParameters << "SkipUnattendedInstall";
     642    newVMWizardPropertySet(SkipUnattendedInstall, fSkip);
     643    disableEnableUnattendedRelatedWidgets(isUnattendedEnabled());
     644    emit completeChanged();
    648645}
    649646
     
    668665void UIWizardNewVMPageExpert::sltSelectedDiskSourceChanged()
    669666{
    670     // if (!m_pDiskSourceButtonGroup)
    671     //     return;
    672     // m_userSetWidgets << m_pDiskSourceButtonGroup;
    673     // if (m_pDiskSourceButtonGroup->checkedButton() == m_pDiskEmpty)
    674     //     setSelectedDiskSource(SelectedDiskSource_Empty);
    675     // else if (m_pDiskSourceButtonGroup->checkedButton() == m_pDiskExisting)
    676     // {
    677     //     setSelectedDiskSource(SelectedDiskSource_Existing);
    678     //     setVirtualDiskFromDiskCombo();
    679     // }
    680     // else
    681     //     setSelectedDiskSource(SelectedDiskSource_New);
    682 
    683     // setEnableDiskSelectionWidgets(m_enmSelectedDiskSource == SelectedDiskSource_Existing);
    684     // setEnableNewDiskWidgets(m_enmSelectedDiskSource == SelectedDiskSource_New);
    685 
    686     // completeChanged();
     667    if (!m_pDiskSourceButtonGroup)
     668        return;
     669    m_userModifiedParameters << "SelectedDiskSource";
     670    if (m_pDiskSourceButtonGroup->checkedButton() == m_pDiskEmpty)
     671        m_enmSelectedDiskSource = SelectedDiskSource_Empty;
     672    else if (m_pDiskSourceButtonGroup->checkedButton() == m_pDiskExisting)
     673    {
     674        m_enmSelectedDiskSource = SelectedDiskSource_Existing;
     675        setVirtualDiskFromDiskCombo();
     676    }
     677    else
     678        m_enmSelectedDiskSource = SelectedDiskSource_New;
     679
     680    setEnableDiskSelectionWidgets(m_enmSelectedDiskSource == SelectedDiskSource_Existing);
     681    setEnableNewDiskWidgets(m_enmSelectedDiskSource == SelectedDiskSource_New);
     682
     683    emit completeChanged();
    687684}
    688685
     
    841838    m_pAdditionalOptionsContainer->blockSignals(false);
    842839}
     840
     841bool UIWizardNewVMPageExpert::isUnattendedEnabled() const
     842{
     843    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
     844    AssertReturn(pWizard, false);
     845    return pWizard->isUnattendedEnabled();
     846}
     847
     848void UIWizardNewVMPageExpert::setEnableDiskSelectionWidgets(bool fEnabled)
     849{
     850    if (!m_pDiskSelector || !m_pDiskSelectionButton)
     851        return;
     852
     853    m_pDiskSelector->setEnabled(fEnabled);
     854    m_pDiskSelectionButton->setEnabled(fEnabled);
     855}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h

    r90232 r90233  
    2525#include <QSet>
    2626
     27/* GUI includes: */
    2728#include "UINativeWizardPage.h"
     29#include "UIWizardNewVMDiskPageBasic.h"
    2830
    2931#include "COMEnums.h"
     
    7981    void sltOSFamilyTypeChanged(const QString &strGuestOSFamilyType);
    8082    void sltInstallGACheckBoxToggle(bool fEnabled);
    81     void sltSkipUnattendedCheckBoxChecked();
     83    void sltSkipUnattendedCheckBoxChecked(bool fSkip);
    8284    void sltMediumFormatChanged();
    8385    void sltMediumSizeChanged();
     
    137139    void setVirtualDiskFromDiskCombo();
    138140    void setSkipCheckBoxEnable();
     141    bool isUnattendedEnabled() const;
     142    void setEnableDiskSelectionWidgets(bool fEnabled);
    139143
    140144    /** @name Variables
     
    158162        QIToolButton *m_pDiskSelectionButton;
    159163        QSet<QString> m_userModifiedParameters;
     164        SelectedDiskSource m_enmSelectedDiskSource;
     165    bool m_fRecommendedNoDisk;
    160166    /** @} */
    161167};
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