VirtualBox

Changeset 87060 in vbox for trunk


Ignore:
Timestamp:
Dec 9, 2020 10:05:23 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9515. Replacing radio buttons with a check box

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

Legend:

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

    r87057 r87060  
    180180
    181181UIWizardNewVMPage1::UIWizardNewVMPage1(const QString &strGroup)
    182     : m_pButtonSimple(0)
    183     , m_pButtonUnattended(0)
    184     , m_pISOSelectorLabel(0)
     182    : m_pISOSelectorLabel(0)
    185183    , m_pISOFilePathSelector(0)
    186184    , m_pStartHeadlessLabel(0)
     185    , m_pEnableUnattendedInstallCheckBox(0)
    187186    , m_pStartHeadlessCheckBox(0)
    188187    , m_pNameAndFolderEditor(0)
     
    271270bool UIWizardNewVMPage1::checkISOFile() const
    272271{
    273     if (m_pButtonUnattended && m_pButtonUnattended->isChecked())
     272    if (m_pEnableUnattendedInstallCheckBox && m_pEnableUnattendedInstallCheckBox->isChecked())
    274273    {
    275274        QString strISOFilePath = m_pISOFilePathSelector ? m_pISOFilePathSelector->path() : QString();
     
    303302        }
    304303
    305         m_pButtonGroup = new QButtonGroup;
    306         if (m_pButtonGroup)
    307         {
    308             m_pButtonSimple = new QRadioButton;
    309             if (m_pButtonSimple)
    310             {
    311                 m_pButtonSimple->setChecked(true);
    312                 pGridLayout->addWidget(m_pButtonSimple, iLayoutRow++, 0, 1, 3);
    313             }
    314             m_pButtonUnattended = new QRadioButton;
    315             if (m_pButtonUnattended)
    316             {
    317                 // QStyleOptionButton options;
    318                 // options.initFrom(m_pButtonUnattended);
    319                 // const int iWidth = m_pButtonUnattended->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth,
    320                 //                                                              &options, m_pButtonUnattended);
    321                 // pGridLayout->setColumnMinimumWidth(0, iWidth);
    322                 pGridLayout->addWidget(m_pButtonUnattended, iLayoutRow++, 0, 1, 3);
    323             }
    324 
    325             m_pButtonGroup->addButton(m_pButtonSimple);
    326             m_pButtonGroup->addButton(m_pButtonUnattended);
    327         }
     304        m_pEnableUnattendedInstallCheckBox = new QCheckBox;
     305        pGridLayout->addWidget(m_pEnableUnattendedInstallCheckBox, iLayoutRow++, 0, 1, 3);
    328306
    329307        m_pISOSelectorLabel = new QLabel;
     
    470448bool UIWizardNewVMPage1::isUnattendedEnabled() const
    471449{
    472     if (!m_pButtonUnattended)
    473         return false;
    474     return m_pButtonUnattended->isChecked();
     450    if (!m_pEnableUnattendedInstallCheckBox)
     451        return false;
     452    return m_pEnableUnattendedInstallCheckBox->isChecked();
    475453}
    476454
     
    510488void UIWizardNewVMPage1::retranslateWidgets()
    511489{
    512     if (m_pButtonSimple)
    513     {
    514         m_pButtonSimple->setText(UIWizardNewVM::tr("Leave Disk Empty"));
    515         m_pButtonSimple->setToolTip(UIWizardNewVM::tr("When checked, no guest OS will be installed after this wizard is closed"
    516                                                       " thereby leaving the virtual machine's disk empty."));
    517     }
    518     if (m_pButtonUnattended)
    519     {
    520         m_pButtonUnattended->setText(UIWizardNewVM::tr("Unattended Install"));
    521         m_pButtonUnattended->setToolTip(UIWizardNewVM::tr("When checked, an unattended guest OS installation will be started "
    522                                                           "after this wizard is closed."));
     490    if (m_pEnableUnattendedInstallCheckBox)
     491    {
     492        m_pEnableUnattendedInstallCheckBox->setText(UIWizardNewVM::tr("Unattended Install"));
     493        m_pEnableUnattendedInstallCheckBox->setToolTip(UIWizardNewVM::tr("When checked, an unattended guest OS installation will be started "
     494                                                          "after this wizard is closed if not the virtual machine's disk will "
     495                                                          "be left empty."));
    523496    }
    524497
     
    563536void UIWizardNewVMPageBasic1::createConnections()
    564537{
    565     connect(m_pButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),
    566             this, &UIWizardNewVMPageBasic1::sltUnattendedCheckBoxToggle);
     538    connect(m_pEnableUnattendedInstallCheckBox, &QCheckBox::clicked, this, &UIWizardNewVMPageBasic1::sltUnattendedCheckBoxToggle);
    567539    connect(m_pISOFilePathSelector, &UIFilePathSelector::pathChanged, this, &UIWizardNewVMPageBasic1::sltISOPathChanged);
    568540    connect(m_pNameAndFolderEditor, &UINameAndSystemEditor::sigNameChanged, this, &UIWizardNewVMPageBasic1::sltNameChanged);
     
    612584}
    613585
    614 void UIWizardNewVMPageBasic1::sltUnattendedCheckBoxToggle()
    615 {
    616     const bool fEnabled = m_pButtonUnattended->isChecked();
     586void UIWizardNewVMPageBasic1::sltUnattendedCheckBoxToggle(bool fEnabled)
     587{
    617588    if (m_pISOSelectorLabel)
    618589        m_pISOSelectorLabel->setEnabled(fEnabled);
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h

    r87057 r87060  
    8484    /** @name Widgets
    8585     * @{ */
    86        /** Holds the simple variant button instance. */
    87        QRadioButton *m_pButtonSimple;
    88        /** Holds the unattended variant button instance. */
    89        QRadioButton *m_pButtonUnattended;
    90        /** Holds the ISO selector label instance. */
    9186       QLabel *m_pISOSelectorLabel;
    9287       /** Holds the ISO selector editor instance. */
    9388       mutable UIFilePathSelector *m_pISOFilePathSelector;
    94        /** Holds the headless start label instance. */
    9589       QLabel *m_pStartHeadlessLabel;
    96        /** Holds the headless start checkbox instance. */
     90       QCheckBox *m_pEnableUnattendedInstallCheckBox;
    9791       QCheckBox *m_pStartHeadlessCheckBox;
    98        /** Provides a path selector and a line edit field for path and name entry. */
     92       /** We have two UINameAndSystemEditor instance since name/vm path fields and OS type fields
     93        * are separated. */
    9994       UINameAndSystemEditor *m_pNameAndFolderEditor;
    10095       UINameAndSystemEditor *m_pSystemTypeEditor;
    10196       QIRichTextLabel *m_pUnattendedLabel;
    10297       QIRichTextLabel *m_pNameOSTypeLabel;
    103        QButtonGroup *m_pButtonGroup;
    10498    /** @} */
    10599
     
    162156    void sltOsTypeChanged();
    163157    void sltISOPathChanged(const QString &strPath);
    164     void sltUnattendedCheckBoxToggle();
     158    void sltUnattendedCheckBoxToggle(bool fEnable);
    165159
    166160private:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r87057 r87060  
    9898    //m_pToolBox->setStyleSheet("QToolBox::tab:hover { font: bold; }");
    9999    //qApp->setStyleSheet("QWidget#bla {  background: blue; }");
    100     if (m_pButtonUnattended)
    101         disableEnableUnattendedRelatedWidgets(m_pButtonUnattended->isChecked());
     100    if (m_pEnableUnattendedInstallCheckBox)
     101        disableEnableUnattendedRelatedWidgets(m_pEnableUnattendedInstallCheckBox->isChecked());
    102102}
    103103
     
    146146}
    147147
    148 void UIWizardNewVMPageExpert::sltUnattendedCheckBoxToggle()
    149 {
    150     if (m_pButtonUnattended)
    151         disableEnableUnattendedRelatedWidgets(m_pButtonUnattended->isChecked());
     148void UIWizardNewVMPageExpert::sltUnattendedCheckBoxToggle(bool fEnabled)
     149{
     150    disableEnableUnattendedRelatedWidgets(fEnabled);
    152151    emit completeChanged();
    153152}
     
    215214                this, &UIWizardNewVMPageExpert::sltOSFamilyTypeChanged);
    216215    }
    217     if (m_pButtonGroup)
    218         connect(m_pButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),
     216    if (m_pEnableUnattendedInstallCheckBox)
     217        connect(m_pEnableUnattendedInstallCheckBox, &QCheckBox::clicked,
    219218                this, &UIWizardNewVMPageExpert::sltUnattendedCheckBoxToggle);
    220219    if (m_pISOFilePathSelector)
     
    286285        m_pDiskSelector->setCurrentIndex(0);
    287286
    288     if (m_pButtonUnattended)
    289         disableEnableUnattendedRelatedWidgets(m_pButtonUnattended->isChecked());
     287    if (m_pEnableUnattendedInstallCheckBox)
     288        disableEnableUnattendedRelatedWidgets(m_pEnableUnattendedInstallCheckBox->isChecked());
    290289    m_pProductKeyLabel->setEnabled(isProductKeyWidgetEnabled());
    291290    m_pProductKeyLineEdit->setEnabled(isProductKeyWidgetEnabled());
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h

    r85157 r87060  
    7979    void sltVirtualDiskSourceChanged();
    8080    void sltGetWithFileOpenDialog();
    81     void sltUnattendedCheckBoxToggle();
     81    void sltUnattendedCheckBoxToggle(bool fEnable);
    8282    void sltISOPathChanged(const QString &strPath);
    8383    void sltInstallGACheckBoxToggle(bool fChecked);
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