VirtualBox

Changeset 87929 in vbox


Ignore:
Timestamp:
Mar 3, 2021 8:45:46 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9950. Converting radio button pair into a check box in new hdd wizard.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd
Files:
3 edited

Legend:

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

    r87912 r87929  
    3131
    3232UIWizardNewVDPage2::UIWizardNewVDPage2()
    33     : m_pVariantButtonGroup(0)
    34     , m_pDynamicalButton(0)
    35     , m_pFixedButton(0)
     33    : m_pFixedCheckBox(0)
    3634    , m_pSplitBox(0)
    3735    , m_pDescriptionLabel(0)
     
    5856        if (pVariantLayout)
    5957        {
    60             m_pVariantButtonGroup = new QButtonGroup;
    61             {
    62                 m_pDynamicalButton = new QRadioButton;
    63                 {
    64                     m_pDynamicalButton->click();
    65                     m_pDynamicalButton->setFocus();
    66                 }
    67                 m_pFixedButton = new QRadioButton;
    68                 m_pVariantButtonGroup->addButton(m_pDynamicalButton, 0);
    69                 m_pVariantButtonGroup->addButton(m_pFixedButton, 1);
    70             }
     58            m_pFixedCheckBox = new QCheckBox;
    7159            m_pSplitBox = new QCheckBox;
    72             pVariantLayout->addWidget(m_pDynamicalButton);
    73             pVariantLayout->addWidget(m_pFixedButton);
     60            pVariantLayout->addWidget(m_pFixedCheckBox);
    7461            pVariantLayout->addWidget(m_pSplitBox);
    7562        }
     
    9481
    9582    /* Exclusive options: */
    96     if (m_pDynamicalButton && m_pDynamicalButton->isChecked())
     83    if (m_pFixedCheckBox && m_pFixedCheckBox->isChecked())
     84        uMediumVariant = (qulonglong)KMediumVariant_Fixed;
     85    else
    9786        uMediumVariant = (qulonglong)KMediumVariant_Standard;
    98     else if (m_pFixedButton && m_pFixedButton->isChecked())
    99         uMediumVariant = (qulonglong)KMediumVariant_Fixed;
    10087
    10188    /* Additional options: */
     
    11299    if (uMediumVariant & (qulonglong)KMediumVariant_Fixed)
    113100    {
    114         m_pFixedButton->click();
    115         m_pFixedButton->setFocus();
    116     }
    117     else
    118     {
    119         m_pDynamicalButton->click();
    120         m_pDynamicalButton->setFocus();
     101        m_pFixedCheckBox->click();
     102        m_pFixedCheckBox->setFocus();
    121103    }
    122104
     
    127109void UIWizardNewVDPage2::retranslateWidgets()
    128110{
    129     if (m_pDynamicalButton)
    130         m_pDynamicalButton->setText(UIWizardNewVD::tr("&Dynamically allocated"));
    131     if (m_pFixedButton)
    132         m_pFixedButton->setText(UIWizardNewVD::tr("&Fixed size"));
     111    if (m_pFixedCheckBox)
     112        m_pFixedCheckBox->setText(UIWizardNewVD::tr("&Fixed size"));
    133113    if (m_pSplitBox)
    134114        m_pSplitBox->setText(UIWizardNewVD::tr("&Split into files of less than 2GB"));
     
    164144    bool fIsCreateFixedPossible = uCapabilities & KMediumFormatCapabilities_CreateFixed;
    165145    bool fIsCreateSplitPossible = uCapabilities & KMediumFormatCapabilities_CreateSplit2G;
     146    if (m_pFixedCheckBox)
     147    {
     148        if (!fIsCreateDynamicPossible)
     149        {
     150            m_pFixedCheckBox->setChecked(true);
     151            m_pFixedCheckBox->setEnabled(false);
     152        }
     153        if (!fIsCreateFixedPossible)
     154        {
     155            m_pFixedCheckBox->setChecked(false);
     156            m_pFixedCheckBox->setEnabled(false);
     157        }
     158    }
    166159    if (m_pDynamicLabel)
    167160        m_pDynamicLabel->setHidden(!fIsCreateDynamicPossible);
    168     if (m_pDynamicalButton)
    169         m_pDynamicalButton->setHidden(!fIsCreateDynamicPossible);
    170161    if (m_pFixedLabel)
    171162        m_pFixedLabel->setHidden(!fIsCreateFixedPossible);
    172     if (m_pFixedButton)
    173         m_pFixedButton->setHidden(!fIsCreateFixedPossible);
     163    if (m_pFixedCheckBox)
     164        m_pFixedCheckBox->setHidden(!fIsCreateFixedPossible);
    174165    if (m_pSplitLabel)
    175166        m_pSplitLabel->setHidden(!fIsCreateSplitPossible);
     
    186177
    187178    /* Setup connections: */
    188     connect(m_pVariantButtonGroup,static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),
     179    connect(m_pFixedCheckBox, &QAbstractButton::toggled,
    189180            this, &UIWizardNewVDPageBasic2::completeChanged);
    190181    connect(m_pSplitBox, &QCheckBox::stateChanged,
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic2.h

    r87891 r87929  
    2828class CMediumFormat;
    2929class QButtonGroup;
    30 class QRadioButton;
    3130class QCheckBox;
    3231class QIRichTextLabel;
     
    4948    /** @name Widgets
    5049     * @{ */
    51         QButtonGroup *m_pVariantButtonGroup;
    52         QRadioButton *m_pDynamicalButton;
    53         QRadioButton *m_pFixedButton;
     50        QCheckBox    *m_pFixedCheckBox;
    5451        QCheckBox *m_pSplitBox;
    5552    /** @} */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp

    r87891 r87929  
    9393            QVBoxLayout *pVariantGroupBoxLayout = new QVBoxLayout(m_pVariantGroupBox);
    9494            {
    95                 m_pVariantButtonGroup = new QButtonGroup(m_pVariantGroupBox);
    96                 {
    97                     m_pDynamicalButton = new QRadioButton(m_pVariantGroupBox);
    98                     {
    99                         m_pDynamicalButton->click();
    100                         m_pDynamicalButton->setFocus();
    101                     }
    102                     m_pFixedButton = new QRadioButton(m_pVariantGroupBox);
    103                     m_pVariantButtonGroup->addButton(m_pDynamicalButton, 0);
    104                     m_pVariantButtonGroup->addButton(m_pFixedButton, 1);
    105                 }
     95                m_pFixedCheckBox = new QCheckBox;
    10696                m_pSplitBox = new QCheckBox(m_pVariantGroupBox);
    107                 pVariantGroupBoxLayout->addWidget(m_pDynamicalButton);
    108                 pVariantGroupBoxLayout->addWidget(m_pFixedButton);
     97                pVariantGroupBoxLayout->addWidget(m_pFixedCheckBox);
    10998                pVariantGroupBoxLayout->addWidget(m_pSplitBox);
    11099            }
     
    121110    connect(m_pFormatButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),
    122111            this, &UIWizardNewVDPageExpert::sltMediumFormatChanged);
    123     connect(m_pVariantButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),
     112    connect(m_pFixedCheckBox, &QAbstractButton::toggled,
    124113            this, &UIWizardNewVDPageExpert::completeChanged);
    125114    connect(m_pSplitBox, &QCheckBox::stateChanged,
     
    167156    bool fIsCreateFixedPossible = uCapabilities & KMediumFormatCapabilities_CreateFixed;
    168157    bool fIsCreateSplitPossible = uCapabilities & KMediumFormatCapabilities_CreateSplit2G;
    169     m_pDynamicalButton->setEnabled(fIsCreateDynamicPossible);
    170     m_pFixedButton->setEnabled(fIsCreateFixedPossible);
     158
     159    if (m_pFixedCheckBox)
     160    {
     161        if (!fIsCreateDynamicPossible)
     162        {
     163            m_pFixedCheckBox->setEnabled(false);
     164            m_pFixedCheckBox->setChecked(true);
     165        }
     166        if (!fIsCreateFixedPossible)
     167        {
     168            m_pFixedCheckBox->setEnabled(false);
     169            m_pFixedCheckBox->setChecked(false);
     170        }
     171    }
    171172    m_pSplitBox->setEnabled(fIsCreateSplitPossible);
    172173
     
    219220    if (m_pVariantGroupBox)
    220221        m_pVariantGroupBox->setTitle(UIWizardNewVD::tr("Storage on physical hard disk"));
    221     if (m_pDynamicalButton)
    222         m_pDynamicalButton->setText(UIWizardNewVD::tr("&Dynamically allocated"));
    223     if (m_pFixedButton)
    224         m_pFixedButton->setText(UIWizardNewVD::tr("&Fixed size"));
     222    if (m_pFixedCheckBox)
     223        m_pFixedCheckBox->setText(UIWizardNewVD::tr("&Fixed size"));
    225224    if (m_pSplitBox)
    226225        m_pSplitBox->setText(UIWizardNewVD::tr("&Split into files of less than 2GB"));
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