VirtualBox

Changeset 90280 in vbox


Ignore:
Timestamp:
Jul 22, 2021 7:50:38 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145822
Message:

FE/Qt: bugref:9996. Preserving user's virtual medium source selection

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

Legend:

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

    r90276 r90280  
    235235{
    236236    AssertReturnVoid(m_pDiskSelector && m_pDiskSourceButtonGroup);
    237 
     237    m_userModifiedParameters << "SelectedDiskSource";
    238238    if (m_pDiskSourceButtonGroup->checkedButton() == m_pDiskEmpty)
    239239        m_enmSelectedDiskSource = SelectedDiskSource_Empty;
     
    255255{
    256256    AssertReturnVoid(m_pDiskSelector);
     257    m_userModifiedParameters << "SelectedExistingMediumIndex";
    257258    newVMWizardPropertySet(VirtualDisk, m_pDiskSelector->id());
    258259    emit completeChanged();
     
    326327    LONG64 iRecommendedSize = 0;
    327328    CGuestOSType type = pWizard->guestOSType();
    328     if (!type.isNull())
     329    if (!type.isNull() && !m_userModifiedParameters.contains("SelectedDiskSource"))
    329330    {
    330331        iRecommendedSize = type.GetRecommendedHDD();
     
    351352    }
    352353
    353     if (m_pDiskSelector)
     354    if (m_pDiskSelector && !m_userModifiedParameters.contains("SelectedExistingMediumIndex"))
    354355        m_pDiskSelector->setCurrentIndex(0);
    355356    setEnableDiskSelectionWidgets(m_enmSelectedDiskSource == SelectedDiskSource_Existing);
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMDiskPageBasic.h

    r90276 r90280  
    6464}
    6565
    66 //     SelectedDiskSource selectedDiskSource() const;
    67 //     void setSelectedDiskSource(SelectedDiskSource enmSelectedDiskSource);
    68 //     bool getWithNewVirtualDiskWizard();
    69 //     virtual QWidget *createDiskWidgets();
    70 //     virtual QWidget *createNewDiskWidgets();
    71 //     void getWithFileOpenDialog();
    72 //     void retranslateWidgets();
    73 //     void setEnableDiskSelectionWidgets(bool fEnable);
    7466
    7567class UIWizardNewVMDiskPageBasic : public UINativeWizardPage
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePageBasic.cpp

    r90233 r90280  
    179179};
    180180
    181 void UIWizardNewVMNameOSTypePage::guessOSTypeFromName(UINameAndSystemEditor *pNameAndSystemEditor, QString strNewName)
     181bool UIWizardNewVMNameOSTypePage::guessOSTypeFromName(UINameAndSystemEditor *pNameAndSystemEditor, QString strNewName)
    182182{
    183183    CHost host = uiCommon().host();
     
    191191    /* Search for a matching OS type based on the string the user typed already. */
    192192    for (size_t i = 0; i < RT_ELEMENTS(gs_OSTypePattern); ++i)
     193    {
    193194        if (strNewName.contains(gs_OSTypePattern[i].pattern))
    194195        {
    195196            if (pNameAndSystemEditor)
    196197                pNameAndSystemEditor->setType(uiCommon().vmGuestOSType(gs_OSTypePattern[i].pcstId));
    197             break;
     198            return true;
    198199        }
     200    }
     201    return false;
    199202}
    200203
     
    367370{
    368371    if (!m_userModifiedParameters.contains("GuestOSType"))
    369         UIWizardNewVMNameOSTypePage::guessOSTypeFromName(m_pNameAndSystemEditor, strNewName);
     372    {
     373        m_pNameAndSystemEditor->blockSignals(true);
     374        if (UIWizardNewVMNameOSTypePage::guessOSTypeFromName(m_pNameAndSystemEditor, strNewName))
     375            newVMWizardPropertySet(GuestOSType, m_pNameAndSystemEditor->type());
     376        m_pNameAndSystemEditor->blockSignals(false);
     377    }
    370378    UIWizardNewVMNameOSTypePage::composeMachineFilePath(m_pNameAndSystemEditor, qobject_cast<UIWizardNewVM*>(wizard()));
    371379    emit completeChanged();
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePageBasic.h

    r90223 r90280  
    4040namespace UIWizardNewVMNameOSTypePage
    4141{
    42     void guessOSTypeFromName(UINameAndSystemEditor *pNameAndSystemEditor, QString strNewName);
     42    bool guessOSTypeFromName(UINameAndSystemEditor *pNameAndSystemEditor, QString strNewName);
    4343    bool createMachineFolder(UINameAndSystemEditor *pNameAndSystemEditor,
    4444                             UINativeWizardPage *pCaller,
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r90276 r90280  
    9595void UIWizardNewVMPageExpert::sltNameChanged(const QString &strNewName)
    9696{
    97     if (!m_userModifiedParameters.contains("GuestOSType"))
    98         UIWizardNewVMNameOSTypePage::guessOSTypeFromName(m_pNameAndSystemEditor, strNewName);
     97    if (!m_userModifiedParameters.contains("GuestOSType") && m_pNameAndSystemEditor)
     98    {
     99        m_pNameAndSystemEditor->blockSignals(true);
     100        if (UIWizardNewVMNameOSTypePage::guessOSTypeFromName(m_pNameAndSystemEditor, strNewName))
     101        {
     102            newVMWizardPropertySet(GuestOSType, m_pNameAndSystemEditor->type());
     103            /* Since the type `possibly` changed: */
     104            setOSTypeDependedValues();
     105        }
     106        m_pNameAndSystemEditor->blockSignals(false);
     107    }
    99108    UIWizardNewVMNameOSTypePage::composeMachineFilePath(m_pNameAndSystemEditor, qobject_cast<UIWizardNewVM*>(wizard()));
    100109    if (!m_userModifiedParameters.contains("MediumPath"))
     
    118127    if (m_pNameAndSystemEditor)
    119128        newVMWizardPropertySet(GuestOSType, m_pNameAndSystemEditor->type());
    120     //setOSTypeDependedValues() ??!!!
     129    setOSTypeDependedValues();
    121130}
    122131
     
    253262    }
    254263
     264    /* Virtual disk related connections: */
    255265    if (m_pDiskSourceButtonGroup)
    256266        connect(m_pDiskSourceButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked),
    257267                this, &UIWizardNewVMPageExpert::sltSelectedDiskSourceChanged);
    258268
    259     connect(m_pSkipUnattendedCheckBox, &QCheckBox::toggled, this, &UIWizardNewVMPageExpert::sltSkipUnattendedCheckBoxChecked);
     269    if (m_pSkipUnattendedCheckBox)
     270        connect(m_pSkipUnattendedCheckBox, &QCheckBox::toggled,
     271        this, &UIWizardNewVMPageExpert::sltSkipUnattendedCheckBoxChecked);
    260272
    261273    if (m_pSizeAndLocationGroup)
     
    266278                this, &UIWizardNewVMPageExpert::sltMediumPathChanged);
    267279
    268     // /* Virtual disk related connections: */
    269 
    270     // if (m_pDiskSelectionButton)
    271     //     connect(m_pDiskSelectionButton, &QIToolButton::clicked,
    272     //             this, &UIWizardNewVMPageExpert::sltGetWithFileOpenDialog);
     280    if (m_pDiskSelectionButton)
     281        connect(m_pDiskSelectionButton, &QIToolButton::clicked,
     282               this, &UIWizardNewVMPageExpert::sltGetWithFileOpenDialog);
    273283
    274284    // if (m_pDiskSelector)
     
    308318    }
    309319    LONG64 iRecommendedDiskSize = type.GetRecommendedHDD();
     320
    310321    /* Prepare initial disk choice: */
    311322    if (!m_userModifiedParameters.contains("SelectedDiskSource"))
Note: See TracChangeset for help on using the changeset viewer.

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