VirtualBox

Changeset 87981 in vbox


Ignore:
Timestamp:
Mar 5, 2021 5:46:36 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9950. Connecting more of the bit and pieces in expert mode

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

Legend:

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

    r87974 r87981  
    1818/* Qt includes: */
    1919#include <QButtonGroup>
     20#include <QCheckBox>
    2021#include <QGridLayout>
    2122#include <QGroupBox>
     
    246247void UIWizardNewVMPageBasic4::createConnections()
    247248{
    248     connect(m_pDiskSourceButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked),
    249             this, &UIWizardNewVMPageBasic4::sltHandleSelectedDiskSourceChange);
    250     connect(m_pDiskSelector, static_cast<void(UIMediaComboBox::*)(int)>(&UIMediaComboBox::currentIndexChanged),
    251             this, &UIWizardNewVMPageBasic4::sltVirtualSelectedDiskSourceChanged);
    252     connect(m_pDiskSelectionButton, &QIToolButton::clicked,
    253             this, &UIWizardNewVMPageBasic4::sltGetWithFileOpenDialog);
    254     connect(m_pSizeEditor, &UIMediumSizeEditor::sigSizeChanged,
    255             this, &UIWizardNewVMPageBasic4::completeChanged);
    256     connect(m_pSizeEditor, &UIMediumSizeEditor::sigSizeChanged,
    257             this, &UIWizardNewVMPageBasic4::sltHandleSizeEditorChange);
    258 }
    259 
    260 void UIWizardNewVMPageBasic4::sltHandleSelectedDiskSourceChange()
     249    if (m_pDiskSourceButtonGroup)
     250        connect(m_pDiskSourceButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked),
     251                this, &UIWizardNewVMPageBasic4::sltSelectedDiskSourceChanged);
     252    if (m_pDiskSelector)
     253        connect(m_pDiskSelector, static_cast<void(UIMediaComboBox::*)(int)>(&UIMediaComboBox::currentIndexChanged),
     254                this, &UIWizardNewVMPageBasic4::sltMediaComboBoxIndexChanged);
     255    if (m_pDiskSelectionButton)
     256        connect(m_pDiskSelectionButton, &QIToolButton::clicked,
     257                this, &UIWizardNewVMPageBasic4::sltGetWithFileOpenDialog);
     258    if (m_pSizeEditor)
     259    {
     260        connect(m_pSizeEditor, &UIMediumSizeEditor::sigSizeChanged,
     261                this, &UIWizardNewVMPageBasic4::completeChanged);
     262        connect(m_pSizeEditor, &UIMediumSizeEditor::sigSizeChanged,
     263                this, &UIWizardNewVMPageBasic4::sltHandleSizeEditorChange);
     264    }
     265}
     266
     267void UIWizardNewVMPageBasic4::sltSelectedDiskSourceChanged()
    261268{
    262269    if (!m_pDiskSourceButtonGroup)
     
    279286}
    280287
    281 void UIWizardNewVMPageBasic4::sltVirtualSelectedDiskSourceChanged()
     288void UIWizardNewVMPageBasic4::sltMediaComboBoxIndexChanged()
    282289{
    283290    /* Make sure to set m_virtualDisk: */
     
    423430}
    424431
    425 void UIWizardNewVMPageBasic4::setEnableNewDiskWidgets(bool )
    426 {
    427     // if (m_pMediumVariantContainer)
    428     //     m_pMediumVariantContainer->setEnabled(fEnable);
    429 
    430     // if (m_pSizeContainer)
    431     //     m_pSizeContainer->setEnabled(fEnable);
    432 }
     432void UIWizardNewVMPageBasic4::setEnableNewDiskWidgets(bool fEnable)
     433{
     434    if (m_pSizeEditor)
     435        m_pSizeEditor->setEnabled(fEnable);
     436    if (m_pSizeEditorLabel)
     437        m_pSizeEditorLabel->setEnabled(fEnable);
     438    if (m_pFixedCheckBox)
     439        m_pFixedCheckBox->setEnabled(fEnable);
     440}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic4.h

    r87956 r87981  
    119119private slots:
    120120
    121     void sltHandleSelectedDiskSourceChange();
    122     void sltVirtualSelectedDiskSourceChanged();
     121    void sltSelectedDiskSourceChanged();
     122    void sltMediaComboBoxIndexChanged();
    123123    void sltGetWithFileOpenDialog();
    124124    void sltHandleSizeEditorChange();
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r87974 r87981  
    7373    /* Register classes: */
    7474    qRegisterMetaType<CMedium>();
     75    qRegisterMetaType<SelectedDiskSource>();
     76
    7577    /* Register fields: */
    7678    registerField("name*", m_pNameAndSystemEditor, "name", SIGNAL(sigNameChanged(const QString &)));
     
    8082    registerField("machineBaseName", this, "machineBaseName");
    8183    registerField("baseMemory", this, "baseMemory");
    82     registerField("virtualDisk", this, "virtualDisk");
    8384    registerField("guestOSFamiyId", this, "guestOSFamiyId");
    8485    registerField("ISOFilePath", this, "ISOFilePath");
     
    9899    registerField("mediumFormat", this, "mediumFormat");
    99100    registerField("mediumSize", this, "mediumSize");
    100 
     101    registerField("selectedDiskSource", this, "selectedDiskSource");
     102    registerField("virtualDisk", this, "virtualDisk");
     103    registerField("mediumVariant", this, "mediumVariant");
    101104
    102105    disableEnableUnattendedRelatedWidgets(isUnattendedEnabled());
     106    setEnableDiskSelectionWidgets(m_enmSelectedDiskSource == SelectedDiskSource_Existing);
     107    setEnableNewDiskWidgets(m_enmSelectedDiskSource == SelectedDiskSource_New);
    103108}
    104109
     
    277282        connect(m_pSizeEditor, &UIMediumSizeEditor::sigSizeChanged,
    278283                this, &UIWizardNewVMPageExpert::sltMediumSizeChanged);
     284
     285    if (m_pDiskSelector)
     286        connect(m_pDiskSelector, static_cast<void(UIMediaComboBox::*)(int)>(&UIMediaComboBox::currentIndexChanged),
     287                this, &UIWizardNewVMPageExpert::sltMediaComboBoxIndexChanged);
     288
     289    if (m_pDiskSourceButtonGroup)
     290        connect(m_pDiskSourceButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked),
     291                this, &UIWizardNewVMPageExpert::sltSelectedDiskSourceChanged);
    279292}
    280293
     
    572585    if (!pSenderWidget)
    573586        return;
    574 
    575587    m_userSetWidgets << pSenderWidget;
    576588}
     
    590602}
    591603
     604void UIWizardNewVMPageExpert::sltMediaComboBoxIndexChanged()
     605{
     606    /* Make sure to set m_virtualDisk: */
     607    setVirtualDiskFromDiskCombo();
     608    emit completeChanged();
     609}
     610
     611void UIWizardNewVMPageExpert::sltSelectedDiskSourceChanged()
     612{
     613    if (!m_pDiskSourceButtonGroup)
     614        return;
     615
     616    if (m_pDiskSourceButtonGroup->checkedButton() == m_pDiskEmpty)
     617        setSelectedDiskSource(SelectedDiskSource_Empty);
     618    else if (m_pDiskSourceButtonGroup->checkedButton() == m_pDiskExisting)
     619    {
     620        setSelectedDiskSource(SelectedDiskSource_Existing);
     621        setVirtualDiskFromDiskCombo();
     622    }
     623    else
     624        setSelectedDiskSource(SelectedDiskSource_New);
     625
     626    setEnableDiskSelectionWidgets(m_enmSelectedDiskSource == SelectedDiskSource_Existing);
     627    setEnableNewDiskWidgets(m_enmSelectedDiskSource == SelectedDiskSource_New);
     628
     629    completeChanged();
     630}
     631
    592632void UIWizardNewVMPageExpert::updateVirtualDiskPathFromMachinePathName()
    593633{
     
    617657    updateLocationEditorAfterFormatChange(comMediumFormat, m_formatExtensions);
    618658}
     659
     660void UIWizardNewVMPageExpert::setEnableNewDiskWidgets(bool fEnable)
     661{
     662    if (m_pSizeEditor)
     663        m_pSizeEditor->setEnabled(fEnable);
     664    if (m_pSizeEditorLabel)
     665        m_pSizeEditorLabel->setEnabled(fEnable);
     666    if (m_pFixedCheckBox)
     667        m_pFixedCheckBox->setEnabled(fEnable);
     668}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h

    r87974 r87981  
    5151    Q_PROPERTY(QString machineBaseName READ machineBaseName WRITE setMachineBaseName);
    5252    Q_PROPERTY(QString machineFilePath READ machineFilePath WRITE setMachineFilePath);
    53     Q_PROPERTY(CMedium virtualDisk READ virtualDisk WRITE setVirtualDisk);
    5453    Q_PROPERTY(int baseMemory READ baseMemory);
    5554    Q_PROPERTY(QString guestOSFamiyId READ guestOSFamiyId);
     
    6867
    6968
    70     // Q_PROPERTY(CMedium virtualDisk READ virtualDisk WRITE setVirtualDisk);
    71     // Q_PROPERTY(SelectedDiskSource selectedDiskSource READ selectedDiskSource WRITE setSelectedDiskSource);
     69    Q_PROPERTY(CMedium virtualDisk READ virtualDisk WRITE setVirtualDisk);
     70    Q_PROPERTY(SelectedDiskSource selectedDiskSource READ selectedDiskSource WRITE setSelectedDiskSource);
    7271    Q_PROPERTY(CMediumFormat mediumFormat READ mediumFormat);
    73     // Q_PROPERTY(qulonglong mediumVariant READ mediumVariant WRITE setMediumVariant);
     72    Q_PROPERTY(qulonglong mediumVariant READ mediumVariant WRITE setMediumVariant);
    7473    Q_PROPERTY(QString mediumPath READ mediumPath);
    7574    Q_PROPERTY(qulonglong mediumSize READ mediumSize WRITE setMediumSize);
     
    103102    void sltMediumFormatChanged();
    104103    void sltMediumSizeChanged();
     104    void sltMediaComboBoxIndexChanged();
     105    void sltSelectedDiskSourceChanged();
    105106
    106107private:
     
    138139    void updateVirtualDiskPathFromMachinePathName();
    139140    void updateWidgetAterMediumFormatChange();
     141    void setEnableNewDiskWidgets(bool fEnable);
    140142
    141143    UIToolBox  *m_pToolBox;
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