VirtualBox

Changeset 82551 in vbox


Ignore:
Timestamp:
Dec 11, 2019 2:30:18 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9390: UIWizardCloneVMPageExpert: Get rid of hardcoded clone option types, instead acquire these types through CSystemProperties interface (clone options related to linked clone functionality).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp

    r82550 r82551  
    8080            }
    8181        }
     82        /* Prepare clone-type options container: */
    8283        m_pCloneTypeCnt = new QGroupBox(this);
    83         {
     84        if (m_pCloneTypeCnt)
     85        {
     86            /* Prepare clone-type options button-group: */
    8487            m_pButtonGroup = new QButtonGroup(m_pCloneTypeCnt);
    85             {
     88            if (m_pButtonGroup)
     89            {
     90                /* Prepare clone-type options layout: */
    8691                QVBoxLayout *pCloneTypeCntLayout = new QVBoxLayout(m_pCloneTypeCnt);
    8792                {
     93                    /* Prepare full clone option radio-button: */
    8894                    m_pFullCloneRadio = new QRadioButton(m_pCloneTypeCnt);
     95                    if (m_pFullCloneRadio)
    8996                    {
    9097                        m_pFullCloneRadio->setChecked(true);
     98                        m_pButtonGroup->addButton(m_pFullCloneRadio);
     99                        pCloneTypeCntLayout->addWidget(m_pFullCloneRadio);
    91100                    }
    92                     m_pLinkedCloneRadio = new QRadioButton(m_pCloneTypeCnt);
    93                     pCloneTypeCntLayout->addWidget(m_pFullCloneRadio);
    94                     pCloneTypeCntLayout->addWidget(m_pLinkedCloneRadio);
    95                 }
    96                 m_pButtonGroup->addButton(m_pFullCloneRadio);
    97                 m_pButtonGroup->addButton(m_pLinkedCloneRadio);
     101
     102                    /* Load currently supported clone options: */
     103                    CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties();
     104                    const QVector<KCloneOptions> supportedOptions = comProperties.GetSupportedCloneOptions();
     105                    /* Check whether we support linked clone option at all: */
     106                    const bool fSupportedLinkedClone = supportedOptions.contains(KCloneOptions_Link);
     107
     108                    /* Prepare linked clone option radio-button: */
     109                    if (fSupportedLinkedClone)
     110                    {
     111                        m_pLinkedCloneRadio = new QRadioButton(m_pCloneTypeCnt);
     112                        if (m_pLinkedCloneRadio)
     113                        {
     114                            m_pButtonGroup->addButton(m_pLinkedCloneRadio);
     115                            pCloneTypeCntLayout->addWidget(m_pLinkedCloneRadio);
     116                        }
     117                    }
     118                }
    98119            }
    99120        }
     
    199220void UIWizardCloneVMPageExpert::sltButtonToggled(QAbstractButton *pButton, bool fChecked)
    200221{
    201     if (pButton == m_pLinkedCloneRadio && fChecked)
     222    if (m_pLinkedCloneRadio && pButton == m_pLinkedCloneRadio && fChecked)
    202223    {
    203224        m_pCloneModeCnt->setEnabled(false);
     
    216237    m_pCloneTypeCnt->setTitle(UIWizardCloneVM::tr("Clone type"));
    217238    m_pFullCloneRadio->setText(UIWizardCloneVM::tr("&Full Clone"));
    218     m_pLinkedCloneRadio->setText(UIWizardCloneVM::tr("&Linked Clone"));
     239    if (m_pLinkedCloneRadio)
     240        m_pLinkedCloneRadio->setText(UIWizardCloneVM::tr("&Linked Clone"));
    219241    m_pCloneModeCnt->setTitle(UIWizardCloneVM::tr("Snapshots"));
    220242    m_pMachineRadio->setText(UIWizardCloneVM::tr("Current &machine state"));
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