VirtualBox

Changeset 90208 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 15, 2021 9:51:10 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9996. Adding UINewVMHardwareContainer

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.cpp

    r90174 r90208  
    2323/* GUI includes: */
    2424#include "QILineEdit.h"
     25#include "UIBaseMemoryEditor.h"
    2526#include "UICommon.h"
    2627#include "UIHostnameDomainNameEditor.h"
     
    2930#include "UIWizardNewVM.h"
    3031#include "UIWizardNewVMEditors.h"
     32#include "UIVirtualCPUEditor.h"
    3133
    3234/* Other VBox includes: */
     
    313315        m_pProductKeyLineEdit->setEnabled(fEnabled);
    314316}
     317
     318/*********************************************************************************************************************************
     319*   UINewVMHardwareContainer implementation.                                                                                *
     320*********************************************************************************************************************************/
     321
     322UINewVMHardwareContainer::UINewVMHardwareContainer(QWidget *pParent /* = 0 */)
     323    : QIWithRetranslateUI<QWidget>(pParent)
     324    , m_pBaseMemoryEditor(0)
     325    , m_pVirtualCPUEditor(0)
     326    , m_pEFICheckBox(0)
     327{
     328    prepare();
     329}
     330
     331void UINewVMHardwareContainer::setMemorySize(int iSize)
     332{
     333    if (m_pBaseMemoryEditor)
     334        m_pBaseMemoryEditor->setValue(iSize);
     335}
     336
     337void UINewVMHardwareContainer::setEFIEnabled(bool fEnabled)
     338{
     339    if (m_pEFICheckBox)
     340        m_pEFICheckBox->setChecked(fEnabled);
     341}
     342
     343void UINewVMHardwareContainer::prepare()
     344{
     345    QGridLayout *pHardwareLayout = new QGridLayout(this);
     346    pHardwareLayout->setContentsMargins(0, 0, 0, 0);
     347
     348    m_pBaseMemoryEditor = new UIBaseMemoryEditor(0, true);
     349    m_pVirtualCPUEditor = new UIVirtualCPUEditor(0, true);
     350    m_pEFICheckBox      = new QCheckBox;
     351    pHardwareLayout->addWidget(m_pBaseMemoryEditor, 0, 0, 1, 4);
     352    pHardwareLayout->addWidget(m_pVirtualCPUEditor, 1, 0, 1, 4);
     353    pHardwareLayout->addWidget(m_pEFICheckBox, 2, 0, 1, 1);
     354
     355
     356    if (m_pBaseMemoryEditor)
     357        connect(m_pBaseMemoryEditor, &UIBaseMemoryEditor::sigValueChanged,
     358                this, &UINewVMHardwareContainer::sigMemorySizeChanged);
     359    if (m_pVirtualCPUEditor)
     360        connect(m_pVirtualCPUEditor, &UIVirtualCPUEditor::sigValueChanged,
     361            this, &UINewVMHardwareContainer::sigCPUCountChanged);
     362    if (m_pEFICheckBox)
     363        connect(m_pEFICheckBox, &QCheckBox::toggled,
     364                this, &UINewVMHardwareContainer::sigEFIEnabledChanged);
     365
     366
     367    retranslateUi();
     368}
     369
     370void UINewVMHardwareContainer::retranslateUi()
     371{
     372    if (m_pEFICheckBox)
     373    {
     374        m_pEFICheckBox->setText(UIWizardNewVM::tr("&Enable EFI (special OSes only)"));
     375        m_pEFICheckBox->setToolTip(UIWizardNewVM::tr("<p>When checked, the guest will support the "
     376                                                       "Extended Firmware Interface (EFI), which is required to boot certain "
     377                                                       "guest OSes. Non-EFI aware OSes will not be able to boot if this option is activated.</p>"));
     378    }
     379}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/editors/UIWizardNewVMEditors.h

    r90174 r90208  
    3434class QLabel;
    3535class QILineEdit;
     36class UIBaseMemoryEditor;
    3637class UIFilePathSelector;
    3738class UIHostnameDomainNameEditor;
    3839class UIPasswordLineEdit;
    3940class UIUserNamePasswordEditor;
     41class UIVirtualCPUEditor;
    4042
    4143class UIUserNamePasswordGroupBox : public QIWithRetranslateUI<QGroupBox>
     
    141143};
    142144
     145
     146class UINewVMHardwareContainer : public QIWithRetranslateUI<QWidget>
     147{
     148    Q_OBJECT;
     149
     150signals:
     151
     152    void sigMemorySizeChanged(int iSize);
     153    void sigCPUCountChanged(int iCount);
     154    void sigEFIEnabledChanged(bool fEnabled);
     155
     156public:
     157
     158    UINewVMHardwareContainer(QWidget *pParent = 0);
     159
     160    /** @name Wrappers for UIFilePathSelector
     161      * @{ */
     162        void setMemorySize(int size);
     163        void setEFIEnabled(bool fEnabled);
     164    /** @} */
     165
     166private:
     167
     168    void prepare();
     169    virtual void retranslateUi() /* override final */;
     170
     171    UIBaseMemoryEditor *m_pBaseMemoryEditor;
     172    UIVirtualCPUEditor *m_pVirtualCPUEditor;
     173    QCheckBox *m_pEFICheckBox;
     174};
     175
    143176#endif /* !FEQT_INCLUDED_SRC_wizards_editors_UIWizardNewVMEditors_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMHardwarePageBasic.cpp

    r90073 r90208  
    2828#include "UIVirtualCPUEditor.h"
    2929#include "UIWizardNewVM.h"
     30#include "UIWizardNewVMEditors.h"
    3031#include "UIWizardNewVMHardwarePageBasic.h"
    3132#include "UIWizardNewVDPageSizeLocation.h"
     
    3536
    3637UIWizardNewVMHardwarePageBasic::UIWizardNewVMHardwarePageBasic()
    37     : m_pBaseMemoryEditor(0)
    38     , m_pVirtualCPUEditor(0)
    39     , m_pEFICheckBox(0)
    40     , m_pLabel(0)
     38    : m_pLabel(0)
     39    , m_pHardwareWidgetContainer(0)
    4140{
    4241    prepare();
     
    5049    m_pLabel = new QIRichTextLabel(this);
    5150    pMainLayout->addWidget(m_pLabel);
    52     pMainLayout->addWidget(createHardwareWidgets());
     51    m_pHardwareWidgetContainer = new UINewVMHardwareContainer;
     52    AssertReturnVoid(m_pHardwareWidgetContainer);
     53    pMainLayout->addWidget(m_pHardwareWidgetContainer);
    5354
    5455    pMainLayout->addStretch();
     
    5859void UIWizardNewVMHardwarePageBasic::createConnections()
    5960{
    60     if (m_pBaseMemoryEditor)
    61         connect(m_pBaseMemoryEditor, &UIBaseMemoryEditor::sigValueChanged,
     61    if (m_pHardwareWidgetContainer)
     62    {
     63        connect(m_pHardwareWidgetContainer, &UINewVMHardwareContainer::sigMemorySizeChanged,
    6264                this, &UIWizardNewVMHardwarePageBasic::sltMemorySizeChanged);
    63     if (m_pVirtualCPUEditor)
    64         connect(m_pVirtualCPUEditor, &UIVirtualCPUEditor::sigValueChanged,
    65             this, &UIWizardNewVMHardwarePageBasic::sltCPUCountChanged);
    66     if (m_pEFICheckBox)
    67         connect(m_pEFICheckBox, &QCheckBox::toggled,
     65        connect(m_pHardwareWidgetContainer, &UINewVMHardwareContainer::sigCPUCountChanged,
     66                this, &UIWizardNewVMHardwarePageBasic::sltCPUCountChanged);
     67        connect(m_pHardwareWidgetContainer, &UINewVMHardwareContainer::sigEFIEnabledChanged,
    6868                this, &UIWizardNewVMHardwarePageBasic::sltEFIEnabledChanged);
    69 
     69    }
    7070}
    7171
     
    7777        m_pLabel->setText(UIWizardNewVM::tr("<p>You can modify virtual machine's hardware by changing amount of RAM and "
    7878                                            "virtual CPU count. Enabling EFI is also possible.</p>"));
    79 
    80     if (m_pEFICheckBox)
    81     {
    82         m_pEFICheckBox->setText(UIWizardNewVM::tr("&Enable EFI (special OSes only)"));
    83         m_pEFICheckBox->setToolTip(UIWizardNewVM::tr("<p>When checked, the guest will support the "
    84                                                        "Extended Firmware Interface (EFI), which is required to boot certain "
    85                                                        "guest OSes. Non-EFI aware OSes will not be able to boot if this option is activated.</p>"));
    86     }
    8779}
    8880
     
    9284
    9385    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
    94     if (pWizard)
     86    if (pWizard && m_pHardwareWidgetContainer)
    9587    {
    9688        CGuestOSType type = pWizard->guestOSType();
     
    10092            {
    10193                ULONG recommendedRam = type.GetRecommendedRAM();
    102                 if (m_pBaseMemoryEditor)
    103                     m_pBaseMemoryEditor->setValue(recommendedRam);
     94                m_pHardwareWidgetContainer->setMemorySize(recommendedRam);
    10495            }
    10596            if (!m_userModifiedParameters.contains("EFIEnabled"))
    10697            {
    10798                KFirmwareType fwType = type.GetRecommendedFirmware();
    108                 if (m_pEFICheckBox)
    109                     m_pEFICheckBox->setChecked(fwType != KFirmwareType_BIOS);
     99                m_pHardwareWidgetContainer->setEFIEnabled(fwType != KFirmwareType_BIOS);
    110100            }
    111101        }
     
    121111{
    122112    return true;
    123 }
    124 
    125 QWidget *UIWizardNewVMHardwarePageBasic::createHardwareWidgets()
    126 {
    127     QWidget *pHardwareContainer = new QWidget;
    128     QGridLayout *pHardwareLayout = new QGridLayout(pHardwareContainer);
    129     pHardwareLayout->setContentsMargins(0, 0, 0, 0);
    130 
    131     m_pBaseMemoryEditor = new UIBaseMemoryEditor(0, true);
    132     m_pVirtualCPUEditor = new UIVirtualCPUEditor(0, true);
    133     m_pEFICheckBox      = new QCheckBox;
    134     pHardwareLayout->addWidget(m_pBaseMemoryEditor, 0, 0, 1, 4);
    135     pHardwareLayout->addWidget(m_pVirtualCPUEditor, 1, 0, 1, 4);
    136     pHardwareLayout->addWidget(m_pEFICheckBox, 2, 0, 1, 1);
    137 
    138     return pHardwareContainer;
    139113}
    140114
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMHardwarePageBasic.h

    r90073 r90208  
    3838class QIRichTextLabel;
    3939class UIBaseMemoryEditor;
     40class UINewVMHardwareContainer;
    4041class UIVirtualCPUEditor;
    4142class UIWizardNewVM;
     
    7475    void initializePage();
    7576    void cleanupPage();
    76     QWidget *createHardwareWidgets();
    7777    bool isComplete() const;
    7878
    7979    /** @name Widgets
    8080     * @{ */
    81        UIBaseMemoryEditor *m_pBaseMemoryEditor;
    82        UIVirtualCPUEditor *m_pVirtualCPUEditor;
    83        QCheckBox          *m_pEFICheckBox;
    8481       QIRichTextLabel    *m_pLabel;
     82       UINewVMHardwareContainer *m_pHardwareWidgetContainer;
    8583    /** @} */
    8684    /** This set is used to decide if we have to set wizard's parameters
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r90206 r90208  
    5858    , m_pSkipUnattendedCheckBox(0)
    5959    , m_pNameAndSystemLayout(0)
     60    , m_pHardwareWidgetContainer(0)
    6061    , m_pAdditionalOptionsContainer(0)
    6162    , m_pGAInstallationISOContainer(0)
     
    6768        m_pToolBox->insertPage(ExpertToolboxItems_NameAndOSType, createNameOSTypeWidgets(), "");
    6869        m_pToolBox->insertPage(ExpertToolboxItems_Unattended, createUnattendedWidgets(), "");
    69         //m_pToolBox->insertPage(ExpertToolboxItems_Hardware, createHardwareWidgets(), "");
     70        m_pHardwareWidgetContainer = new UINewVMHardwareContainer;
     71        m_pToolBox->insertPage(ExpertToolboxItems_Hardware, m_pHardwareWidgetContainer, "");
    7072        m_pToolBox->insertPage(ExpertToolboxItems_Disk, createNewDiskWidgets(), "");
    7173        m_pToolBox->setCurrentPage(ExpertToolboxItems_NameAndOSType);
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h

    r90206 r90208  
    4747class UIMediumSizeEditor;
    4848class UINameAndSystemEditor;
     49class UINewVMHardwareContainer;
    4950class UIToolBox;
    5051class UIUserNamePasswordGroupBox;
     
    135136        QCheckBox *m_pSkipUnattendedCheckBox;
    136137        QGridLayout *m_pNameAndSystemLayout;
     138        UINewVMHardwareContainer *m_pHardwareWidgetContainer;
    137139        UIAdditionalUnattendedOptions *m_pAdditionalOptionsContainer;
    138140        UIGAInstallationGroupBox *m_pGAInstallationISOContainer;
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