VirtualBox

Changeset 74628 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 5, 2018 1:06:48 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9620: UIApplianceImportEditorWidget: A bit of fixes for options layout; coding-style fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceImportEditorWidget.cpp

    r74626 r74628  
    7474void UIApplianceImportEditorWidget::prepareWidgets()
    7575{
     76    /* Create path selector label: */
    7677    m_pPathSelectorLabel = new QIRichTextLabel(this);
    7778    if (m_pPathSelectorLabel)
    7879    {
     80        /* Add into layout: */
    7981        m_pLayout->addWidget(m_pPathSelectorLabel);
    8082    }
     83
     84    /* Create path selector editor: */
    8185    m_pPathSelector = new UIFilePathSelector(this);
    8286    if (m_pPathSelector)
     
    8690        m_pPathSelector->setPath(vboxGlobal().virtualBox().GetSystemProperties().GetDefaultMachineFolder());
    8791        connect(m_pPathSelector, &UIFilePathSelector::pathChanged, this, &UIApplianceImportEditorWidget::sltHandlePathChanged);
     92
     93        /* Add into layout: */
    8894        m_pLayout->addWidget(m_pPathSelector);
    8995    }
    9096
     97    /* Create options layout: */
    9198    m_pOptionsLayout = new QGridLayout;
    92 
    93     m_pMACComboBox = new QComboBox;
    94     if (m_pMACComboBox)
    95     {
    96         m_pMACComboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
     99    if (m_pOptionsLayout)
     100    {
     101        m_pOptionsLayout->setColumnStretch(0, 0);
     102        m_pOptionsLayout->setColumnStretch(1, 1);
     103
     104        /* Create MAC address policy label: */
     105        m_pMACComboBoxLabel = new QLabel;
     106        if (m_pMACComboBoxLabel)
     107        {
     108            m_pMACComboBoxLabel->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
     109
     110            /* Add into layout: */
     111            m_pOptionsLayout->addWidget(m_pMACComboBoxLabel, 0, 0);
     112        }
     113
     114        /* Create MAC address policy combo: */
     115        m_pMACComboBox = new QComboBox;
     116        if (m_pMACComboBox)
     117        {
     118            m_pMACComboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
     119            m_pMACComboBoxLabel->setBuddy(m_pMACComboBox);
     120
     121            /* Add into layout: */
     122            m_pOptionsLayout->addWidget(m_pMACComboBox, 0, 1, 1, 2);
     123        }
     124
     125        /* Create additional options label: */
     126        m_pAdditionalOptionsLabel = new QLabel;
     127        if (m_pAdditionalOptionsLabel)
     128        {
     129            m_pAdditionalOptionsLabel->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
     130
     131            /* Add into layout: */
     132            m_pOptionsLayout->addWidget(m_pAdditionalOptionsLabel, 1, 0);
     133        }
     134
     135        /* Create import HDs as VDIs checkbox: */
     136        m_pImportHDsAsVDI = new QCheckBox;
     137        {
     138            m_pImportHDsAsVDI->setCheckState(Qt::Checked);
     139
     140            /* Add into layout: */
     141            m_pOptionsLayout->addWidget(m_pImportHDsAsVDI, 1, 1);
     142        }
     143
    97144        /* Add into layout: */
    98         m_pOptionsLayout->addWidget(m_pMACComboBox, 0, 1);
    99     }
    100 
    101         /* Create format combo-box label: */
    102     m_pMACComboBoxLabel = new QLabel;
    103     if (m_pMACComboBoxLabel)
    104     {
    105         m_pMACComboBoxLabel->setAlignment(Qt::AlignLeft | Qt::AlignTrailing | Qt::AlignVCenter);
    106         /* Add into layout: */
    107         m_pOptionsLayout->addWidget(m_pMACComboBoxLabel, 0, 0);
    108     }
    109 
    110     if (m_pMACComboBoxLabel)
    111         m_pMACComboBoxLabel->setBuddy(m_pMACComboBox);
    112 
    113     m_pAdditionalOptionsLabel = new QLabel;
    114     if (m_pAdditionalOptionsLabel)
    115     {
    116         m_pAdditionalOptionsLabel->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
    117         m_pOptionsLayout->addWidget(m_pAdditionalOptionsLabel, 2, 0, 1, 1);
    118     }
    119 
    120     m_pImportHDsAsVDI = new QCheckBox;
    121     {
    122         m_pOptionsLayout->addWidget(m_pImportHDsAsVDI, 2, 1);
    123         m_pImportHDsAsVDI->setCheckState(Qt::Checked);
    124     }
    125 
    126 
    127     m_pLayout->addLayout(m_pOptionsLayout);
     145        m_pLayout->addLayout(m_pOptionsLayout);
     146    }
     147
     148    /* Populate MAC address import combo: */
    128149    populateMACAddressImportPolicies();
     150    /* And connect this combo' signals afterwards: */
    129151    connect(m_pMACComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
    130152            this, &UIApplianceImportEditorWidget::sltHandleMACAddressImportPolicyComboChange);
     153
     154    /* Apply language settings: */
    131155    retranslateUi();
    132156}
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