VirtualBox

Changeset 87912 in vbox for trunk


Ignore:
Timestamp:
Mar 2, 2021 12:46:18 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9950. Merging hdd pages. part 2

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

Legend:

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

    r87890 r87912  
    8383        pMainLayout->addLayout(pVariantLayout);
    8484        pMainLayout->addStretch();
     85        pMainLayout->setContentsMargins(0, 0, 0, 0);
    8586    }
    8687    return pContainerWidget;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic4.cpp

    r87907 r87912  
    1919#include <QButtonGroup>
    2020#include <QGridLayout>
     21#include <QGroupBox>
    2122#include <QMetaType>
    2223#include <QRadioButton>
     
    4647    , m_pDiskSelector(0)
    4748    , m_pDiskSelectionButton(0)
     49    , m_pMediumVariantContainer(0)
     50    , m_pSizeContainer(0)
    4851    , m_enmSelectedDiskSource(SelectedDiskSource_New)
    4952{
     
    138141    if (m_pDiskSelectionButton)
    139142        m_pDiskSelectionButton->setToolTip(UIWizardNewVM::tr("Choose a virtual hard disk file..."));
     143    if (m_pMediumVariantContainer)
     144        m_pMediumVariantContainer->setTitle(UIWizardNewVM::tr("Storage on physical hard disk"));
     145    if (m_pSizeContainer)
     146        m_pSizeContainer->setTitle(UIWizardNewVM::tr("File size"));
    140147}
    141148
     
    147154    m_pDiskSelector->setEnabled(fEnabled);
    148155    m_pDiskSelectionButton->setEnabled(fEnabled);
     156}
     157
     158QWidget *UIWizardNewVMPage4::createDiskVariantAndSizeWidgets()
     159{
     160    return new QWidget();
    149161}
    150162
     
    174186        m_pDiskSelectionButton->setIcon(UIIconPool::iconSet(":/select_file_16px.png", ":/select_file_disabled_16px.png"));
    175187    }
    176     pDiskLayout->addWidget(m_pDiskEmpty, 0, 0, 1, 3);
    177     pDiskLayout->addWidget(m_pDiskNew, 1, 0, 1, 3);
    178     pDiskLayout->addWidget(m_pDiskExisting, 2, 0, 1, 3);
    179     pDiskLayout->addWidget(m_pDiskSelector, 3, 1);
    180     pDiskLayout->addWidget(m_pDiskSelectionButton, 3, 2);
     188    pDiskLayout->addWidget(m_pDiskEmpty, 0, 0, 1, 4);
     189    pDiskLayout->addWidget(m_pDiskNew, 1, 0, 1, 4);
     190    pDiskLayout->addWidget(createDiskVariantAndSizeWidgets(), 2, 1, 3, 3);
     191    pDiskLayout->addWidget(m_pDiskExisting, 5, 0, 1, 4);
     192    pDiskLayout->addWidget(m_pDiskSelector, 6, 1, 1, 2);
     193    pDiskLayout->addWidget(m_pDiskSelectionButton, 6, 3, 1, 1);
    181194    return pDiskContainer;
    182195}
     
    246259    pMainLayout->addStretch();
    247260    setEnableDiskSelectionWidgets(m_enmSelectedDiskSource == SelectedDiskSource_Existing);
    248 
    249 
    250     pMainLayout->addWidget(createMediumVariantWidgets(true));
    251 
     261    setEnableNewDiskWidgets(m_enmSelectedDiskSource == SelectedDiskSource_New);
     262
     263    createConnections();
     264}
     265
     266QWidget *UIWizardNewVMPageBasic4::createDiskVariantAndSizeWidgets()
     267{
     268
     269    QWidget *pWidget = new QWidget;
     270    QHBoxLayout *pLayout = new QHBoxLayout(pWidget);
     271    pLayout->setContentsMargins(0, 0, 0, 0);
     272
     273    m_pMediumVariantContainer = new QGroupBox;
     274    QVBoxLayout *pMediumVariantLayout = new QVBoxLayout(m_pMediumVariantContainer);
     275    pMediumVariantLayout->addWidget(createMediumVariantWidgets(false /* no labels */));
     276    pLayout->addWidget(m_pMediumVariantContainer);
     277
     278    m_pSizeContainer = new QGroupBox;
     279    QVBoxLayout *pSizeLayout = new QVBoxLayout(m_pSizeContainer);
    252280    m_pSizeLabel = new QIRichTextLabel;
    253281    m_pSizeEditor = new UIMediumSizeEditor;
    254 
    255     pMainLayout->addWidget(m_pSizeLabel);
    256     pMainLayout->addWidget(m_pSizeEditor);
    257 
    258     createConnections();
     282    pSizeLayout->addWidget(m_pSizeLabel);
     283    pSizeLayout->addWidget(m_pSizeEditor);
     284    pSizeLayout->addStretch();
     285    pLayout->addWidget(m_pSizeContainer);
     286
     287    return pWidget;
    259288}
    260289
     
    286315
    287316    setEnableDiskSelectionWidgets(m_enmSelectedDiskSource == SelectedDiskSource_Existing);
     317    setEnableNewDiskWidgets(m_enmSelectedDiskSource == SelectedDiskSource_New);
     318
    288319    completeChanged();
    289320}
     
    373404bool UIWizardNewVMPageBasic4::isComplete() const
    374405{
    375     if (!m_pDiskEmpty)
    376         return false;
    377     return m_pDiskEmpty->isChecked() ||
    378         !m_pDiskExisting->isChecked() ||
    379         !uiCommon().medium(m_pDiskSelector->id()).isNull();
     406    if (selectedDiskSource() == SelectedDiskSource_New)
     407        return mediumSize() >= m_uMediumSizeMin && mediumSize() <= m_uMediumSizeMax;
     408    if (selectedDiskSource() == SelectedDiskSource_Existing)
     409        return m_virtualDisk.isNull();
     410    return true;
    380411}
    381412
     
    396427    m_fUserSetSize = true;
    397428}
     429
     430void UIWizardNewVMPageBasic4::setEnableNewDiskWidgets(bool fEnable)
     431{
     432    if (m_pMediumVariantContainer)
     433        m_pMediumVariantContainer->setEnabled(fEnable);
     434
     435    if (m_pSizeContainer)
     436        m_pSizeContainer->setEnabled(fEnable);
     437}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic4.h

    r87907 r87912  
    3838/* Forward declarations: */
    3939class QButtonGroup;
     40class QGroupBox;
    4041class QRadioButton;
    4142class QIRichTextLabel;
     
    6465
    6566    QWidget *createDiskWidgets();
     67    virtual QWidget *createDiskVariantAndSizeWidgets();
    6668
    6769    void ensureNewVirtualDiskDeleted();
     
    8486       UIMediaComboBox *m_pDiskSelector;
    8587       QIToolButton *m_pDiskSelectionButton;
     88       QGroupBox *m_pMediumVariantContainer;
     89       QGroupBox *m_pSizeContainer;
    8690    /** @} */
    8791    SelectedDiskSource m_enmSelectedDiskSource;
     
    129133private:
    130134
    131 
    132135    void prepare();
    133136    void createConnections();
     137    QWidget *createDiskVariantAndSizeWidgets();
    134138    void retranslateUi();
    135139    void initializePage();
    136140    void cleanupPage();
     141    void setEnableNewDiskWidgets(bool fEnable);
    137142
    138143    bool isComplete() const;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r87892 r87912  
    5353        m_pToolBox->insertPage(ExpertToolboxItems_NameAndOSType, createNameOSTypeWidgets(/* fCreateLabels */ false), "");
    5454        m_pToolBox->insertPage(ExpertToolboxItems_Unattended, createUnattendedWidgets(), "", false);
    55         m_pToolBox->insertPage(ExpertToolboxItems_Disk, createDiskWidgets(), "");
     55        //m_pToolBox->insertPage(ExpertToolboxItems_Disk, createDiskWidgets(), "");
    5656        m_pToolBox->insertPage(ExpertToolboxItems_Hardware, createHardwareWidgets(), "");
    5757
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