VirtualBox

Changeset 88038 in vbox


Ignore:
Timestamp:
Mar 9, 2021 9:11:02 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9950. Refactoring

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp

    r87972 r88038  
    5454    , m_pLocationEditor(0)
    5555    , m_pLocationOpenButton(0)
    56     , m_pSizeEditor(0)
    57     , m_pSizeEditorLabel(0)
     56    , m_pMediumSizeEditor(0)
     57    , m_pMediumSizeEditorLabel(0)
    5858    , m_pLocationLabel(0)
    5959    , m_pSizeLabel(0)
     
    6666    , m_pLocationEditor(0)
    6767    , m_pLocationOpenButton(0)
    68     , m_pSizeEditor(0)
    69     , m_pSizeEditorLabel(0)
     68    , m_pMediumSizeEditor(0)
     69    , m_pMediumSizeEditorLabel(0)
    7070    , m_pLocationLabel(0)
    7171    , m_pSizeLabel(0)
     
    222222qulonglong UIWizardNewVDPage3::mediumSize() const
    223223{
    224     return m_pSizeEditor ? m_pSizeEditor->mediumSize() : 0;
     224    return m_pMediumSizeEditor ? m_pMediumSizeEditor->mediumSize() : 0;
    225225}
    226226
    227227void UIWizardNewVDPage3::setMediumSize(qulonglong uMediumSize)
    228228{
    229     if (m_pSizeEditor)
    230         m_pSizeEditor->setMediumSize(uMediumSize);
     229    if (m_pMediumSizeEditor)
     230        m_pMediumSizeEditor->setMediumSize(uMediumSize);
    231231}
    232232
     
    280280                                                "This size is the limit on the amount of file data "
    281281                                                "that a virtual machine will be able to store on the hard disk."));
    282     if (m_pSizeEditorLabel)
    283         m_pSizeEditorLabel->setText(UIWizardNewVD::tr("D&isk size:"));
     282    if (m_pMediumSizeEditorLabel)
     283        m_pMediumSizeEditorLabel->setText(UIWizardNewVD::tr("D&isk size:"));
    284284}
    285285
     
    303303        }
    304304        m_pSizeLabel = new QIRichTextLabel(this);
    305         m_pSizeEditor = new UIMediumSizeEditor;
     305        m_pMediumSizeEditor = new UIMediumSizeEditor;
    306306        setMediumSize(uDefaultSize);
    307307        pMainLayout->addWidget(m_pLocationLabel);
    308308        pMainLayout->addLayout(pLocationLayout);
    309309        pMainLayout->addWidget(m_pSizeLabel);
    310         pMainLayout->addWidget(m_pSizeEditor);
     310        pMainLayout->addWidget(m_pMediumSizeEditor);
    311311        pMainLayout->addStretch();
    312312    }
     
    315315    connect(m_pLocationEditor, &QLineEdit::textChanged,    this, &UIWizardNewVDPageBasic3::completeChanged);
    316316    connect(m_pLocationOpenButton, &QIToolButton::clicked, this, &UIWizardNewVDPageBasic3::sltSelectLocationButtonClicked);
    317     connect(m_pSizeEditor, &UIMediumSizeEditor::sigSizeChanged, this, &UIWizardNewVDPageBasic3::completeChanged);
     317    connect(m_pMediumSizeEditor, &UIMediumSizeEditor::sigSizeChanged, this, &UIWizardNewVDPageBasic3::completeChanged);
    318318
    319319    /* Register fields: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.h

    r87972 r88038  
    8080       QLineEdit *m_pLocationEditor;
    8181       QIToolButton *m_pLocationOpenButton;
    82        UIMediumSizeEditor *m_pSizeEditor;
    83        QLabel          *m_pSizeEditorLabel;
     82       UIMediumSizeEditor *m_pMediumSizeEditor;
     83       QLabel          *m_pMediumSizeEditorLabel;
    8484       QIRichTextLabel *m_pLocationLabel;
    8585       QIRichTextLabel *m_pSizeLabel;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp

    r87973 r88038  
    7676            QVBoxLayout *pSizeGroupBoxLayout = new QVBoxLayout(m_pSizeGroupBox);
    7777            {
    78                 m_pSizeEditor = new UIMediumSizeEditor;
     78                m_pMediumSizeEditor = new UIMediumSizeEditor;
    7979                {
    80                     pSizeGroupBoxLayout->addWidget(m_pSizeEditor);
     80                    pSizeGroupBoxLayout->addWidget(m_pMediumSizeEditor);
    8181                }
    8282            }
     
    118118    connect(m_pLocationOpenButton, &QIToolButton::clicked,
    119119            this, &UIWizardNewVDPageExpert::sltSelectLocationButtonClicked);
    120     connect(m_pSizeEditor, &UIMediumSizeEditor::sigSizeChanged,
     120    connect(m_pMediumSizeEditor, &UIMediumSizeEditor::sigSizeChanged,
    121121            this, &UIWizardNewVDPageExpert::completeChanged);
    122122
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r88019 r88038  
    112112    bool getBoolFieldValue(const QString &strFieldName) const;
    113113
    114     /* Who will be able to create virtual-machine: */
    115114    friend class UIWizardNewVMPageBasic4;
    116     friend class UIWizardNewVMPageBasic8;
    117115    friend class UIWizardNewVMPageExpert;
    118116
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.cpp

    r87941 r88038  
    2424#include <QLineEdit>
    2525#include <QSpacerItem>
    26 #include <QToolBox>
    2726#include <QVBoxLayout>
    2827
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp

    r87941 r88038  
    1818/* Qt includes: */
    1919#include <QCheckBox>
    20 #include <QFileInfo>
    2120#include <QGridLayout>
    2221#include <QMetaType>
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic4.cpp

    r88019 r88038  
    209209    pSizeLayout->setContentsMargins(0, 0, 0, 0);
    210210    /* Hard disk size relate widgets: */
    211     m_pSizeEditor = new UIMediumSizeEditor;
    212     m_pSizeEditorLabel = new QLabel;
    213     if (m_pSizeEditorLabel)
    214     {
    215         pSizeLayout->addWidget(m_pSizeEditorLabel);
    216         m_pSizeEditorLabel->setBuddy(m_pSizeEditor);
    217     }
    218     pSizeLayout->addWidget(m_pSizeEditor);
     211    m_pMediumSizeEditor = new UIMediumSizeEditor;
     212    m_pMediumSizeEditorLabel = new QLabel;
     213    if (m_pMediumSizeEditorLabel)
     214    {
     215        pSizeLayout->addWidget(m_pMediumSizeEditorLabel);
     216        m_pMediumSizeEditorLabel->setBuddy(m_pMediumSizeEditor);
     217    }
     218    pSizeLayout->addWidget(m_pMediumSizeEditor);
    219219    pLayout->addLayout(pSizeLayout);
    220220    /* Hard disk variant (dynamic vs. fixed) widgets: */
     
    235235        connect(m_pDiskSelectionButton, &QIToolButton::clicked,
    236236                this, &UIWizardNewVMPageBasic4::sltGetWithFileOpenDialog);
    237     if (m_pSizeEditor)
    238     {
    239         connect(m_pSizeEditor, &UIMediumSizeEditor::sigSizeChanged,
     237    if (m_pMediumSizeEditor)
     238    {
     239        connect(m_pMediumSizeEditor, &UIMediumSizeEditor::sigSizeChanged,
    240240                this, &UIWizardNewVMPageBasic4::completeChanged);
    241         connect(m_pSizeEditor, &UIMediumSizeEditor::sigSizeChanged,
     241        connect(m_pMediumSizeEditor, &UIMediumSizeEditor::sigSizeChanged,
    242242                this, &UIWizardNewVMPageBasic4::sltHandleSizeEditorChange);
    243243    }
     
    329329    m_strDefaultPath = fieldImp("machineFolder").toString();
    330330    /* Set the recommended disk size if user has already not done so: */
    331     if (m_pSizeEditor && !m_fUserSetSize)
    332     {
    333         m_pSizeEditor->blockSignals(true);
     331    if (m_pMediumSizeEditor && !m_fUserSetSize)
     332    {
     333        m_pMediumSizeEditor->blockSignals(true);
    334334        setMediumSize(fieldImp("type").value<CGuestOSType>().GetRecommendedHDD());
    335         m_pSizeEditor->blockSignals(false);
     335        m_pMediumSizeEditor->blockSignals(false);
    336336    }
    337337}
     
    419419void UIWizardNewVMPageBasic4::setEnableNewDiskWidgets(bool fEnable)
    420420{
    421     if (m_pSizeEditor)
    422         m_pSizeEditor->setEnabled(fEnable);
    423     if (m_pSizeEditorLabel)
    424         m_pSizeEditorLabel->setEnabled(fEnable);
     421    if (m_pMediumSizeEditor)
     422        m_pMediumSizeEditor->setEnabled(fEnable);
     423    if (m_pMediumSizeEditorLabel)
     424        m_pMediumSizeEditorLabel->setEnabled(fEnable);
    425425    if (m_pFixedCheckBox)
    426426        m_pFixedCheckBox->setEnabled(fEnable);
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r88020 r88038  
    2525#include <QLineEdit>
    2626#include <QRadioButton>
    27 #include <QSpinBox>
    2827#include <QVBoxLayout>
    2928
     
    6463        m_pToolBox->insertPage(ExpertToolboxItems_Hardware, createHardwareWidgets(), "");
    6564        m_pToolBox->insertPage(ExpertToolboxItems_Disk, createDiskWidgets(), "");
    66 
    6765        m_pToolBox->setCurrentPage(ExpertToolboxItems_NameAndOSType);
    6866        pMainLayout->addWidget(m_pToolBox);
    69 
    7067        pMainLayout->addStretch();
    7168    }
     
    9794    registerField("VCPUCount", this, "VCPUCount");
    9895    registerField("EFIEnabled", this, "EFIEnabled");
    99 
    10096    registerField("mediumPath", this, "mediumPath");
    10197    registerField("mediumFormat", this, "mediumFormat");
     
    127123}
    128124
    129 
    130125void UIWizardNewVMPageExpert::sltGetWithFileOpenDialog()
    131126{
     
    143138    if (fileInfo.exists() && fileInfo.isReadable())
    144139        uiCommon().updateRecentlyUsedMediumListAndFolder(UIMediumDeviceType_DVD, strPath);
    145 
    146140    emit completeChanged();
    147141}
     
    244238                this, &UIWizardNewVMPageExpert::sltMediumFormatChanged);
    245239
    246     if (m_pSizeEditor)
    247         connect(m_pSizeEditor, &UIMediumSizeEditor::sigSizeChanged,
     240    /* Virtual disk related connections: */
     241    if (m_pMediumSizeEditor)
     242        connect(m_pMediumSizeEditor, &UIMediumSizeEditor::sigSizeChanged,
    248243                this, &UIWizardNewVMPageExpert::sltMediumSizeChanged);
    249244
     
    310305    }
    311306
    312     if (m_pSizeEditor  && !m_userSetWidgets.contains(m_pSizeEditor))
    313     {
    314         m_pSizeEditor->blockSignals(true);
     307    if (m_pMediumSizeEditor  && !m_userSetWidgets.contains(m_pMediumSizeEditor))
     308    {
     309        m_pMediumSizeEditor->blockSignals(true);
    315310        setMediumSize(recommendedDiskSize);
    316         m_pSizeEditor->blockSignals(false);
     311        m_pMediumSizeEditor->blockSignals(false);
    317312    }
    318313
     
    401396
    402397    /* Disk file size widgets: */
    403     m_pSizeEditorLabel = new QLabel;
    404     m_pSizeEditorLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
    405     m_pSizeEditor = new UIMediumSizeEditor;
    406     m_pSizeEditorLabel->setBuddy(m_pSizeEditor);
     398    m_pMediumSizeEditorLabel = new QLabel;
     399    m_pMediumSizeEditorLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
     400    m_pMediumSizeEditor = new UIMediumSizeEditor;
     401    m_pMediumSizeEditorLabel->setBuddy(m_pMediumSizeEditor);
    407402
    408403    /* Disk file format widgets: */
    409404    m_pDiskFormatGroupBox = new QGroupBox;
    410405    QHBoxLayout *pDiskFormatLayout = new QHBoxLayout(m_pDiskFormatGroupBox);
    411     m_pSizeEditor = new UIMediumSizeEditor;
     406    m_pMediumSizeEditor = new UIMediumSizeEditor;
    412407    pDiskFormatLayout->addWidget(createFormatButtonGroup(true));
    413408
     
    421416    pDiskContainerLayout->addWidget(m_pLocationOpenButton, 0, 3, 1, 1);
    422417
    423     pDiskContainerLayout->addWidget(m_pSizeEditorLabel, 1, 0, 1, 1);
    424     pDiskContainerLayout->addWidget(m_pSizeEditor, 1, 1, 1, 3);
     418    pDiskContainerLayout->addWidget(m_pMediumSizeEditorLabel, 1, 0, 1, 1);
     419    pDiskContainerLayout->addWidget(m_pMediumSizeEditor, 1, 1, 1, 3);
    425420
    426421    pDiskContainerLayout->addWidget(m_pDiskFormatGroupBox, 2, 0, 1, 2);
     
    577572void UIWizardNewVMPageExpert::sltMediumSizeChanged()
    578573{
    579     if (!m_pSizeEditor)
     574    if (!m_pMediumSizeEditor)
    580575        return;
    581     m_userSetWidgets << m_pSizeEditor;
     576    m_userSetWidgets << m_pMediumSizeEditor;
    582577    completeChanged();
    583578}
     
    641636void UIWizardNewVMPageExpert::setEnableNewDiskWidgets(bool fEnable)
    642637{
    643     if (m_pSizeEditor)
    644         m_pSizeEditor->setEnabled(fEnable);
    645     if (m_pSizeEditorLabel)
    646         m_pSizeEditorLabel->setEnabled(fEnable);
     638    if (m_pMediumSizeEditor)
     639        m_pMediumSizeEditor->setEnabled(fEnable);
     640    if (m_pMediumSizeEditorLabel)
     641        m_pMediumSizeEditorLabel->setEnabled(fEnable);
    647642    if (m_pDiskFormatGroupBox)
    648643        m_pDiskFormatGroupBox->setEnabled(fEnable);
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h

    r88014 r88038  
    139139    void setVirtualDiskFromDiskCombo();
    140140
    141     UIToolBox  *m_pToolBox;
    142     QGroupBox *m_pInstallationISOGroupBox;
    143     QGroupBox *m_pDiskFormatGroupBox;
    144     QGroupBox *m_pDiskVariantGroupBox;
    145     QLabel *m_pLocationLabel;
    146     /** Set of widgets which user explicitly modified their values. They are exempt from
    147       * adjusting when OS type changes. */
    148     QSet<QWidget*> m_userSetWidgets;
     141    /** @name Variables
     142     * @{ */
     143       UIToolBox  *m_pToolBox;
     144       QGroupBox *m_pInstallationISOGroupBox;
     145       QGroupBox *m_pDiskFormatGroupBox;
     146       QGroupBox *m_pDiskVariantGroupBox;
     147       QLabel *m_pLocationLabel;
     148       /** Set of widgets which user explicitly modified their values. They are exempt from
     149         * adjusting when OS type changes. */
     150       QSet<QWidget*> m_userSetWidgets;
     151    /** @} */
    149152};
    150153
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