VirtualBox

Ignore:
Timestamp:
Nov 9, 2010 3:16:17 PM (14 years ago)
Author:
vboxsync
Message:

FE/Qt4: Move the single adapter page creation to the ctor, cause we need the
content for the calculation of the overall size of the whole dialog.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp

    r33882 r33906  
    634634     */
    635635    mDisableStaticControls = aDisableStaticControls;
     636
     637    /* How many adapters to display */
     638    ulong uCount = qMin((ULONG)4, vboxGlobal().virtualBox().GetSystemProperties().GetNetworkAdapterCount());
     639    /* Add the tab pages to parent tab widget. Needed for space calculations. */
     640    for (ulong iSlot = 0; iSlot < uCount; ++iSlot)
     641    {
     642        /* Creating adapter's page: */
     643        UIMachineSettingsNetwork *pPage = new UIMachineSettingsNetwork(this, mDisableStaticControls);
     644
     645        /* Attach adapter's page to Tab Widget: */
     646        mTwAdapters->addTab(pPage, pPage->pageTitle());
     647
     648        /* Disable tab page of disabled adapter if it is being configured dynamically: */
     649        if (mDisableStaticControls && !m_cache.m_items[iSlot].m_fAdapterEnabled)
     650            mTwAdapters->setTabEnabled(iSlot, false);
     651    }
    636652}
    637653
     
    823839    QWidget *pLastFocusWidget = mTwAdapters->focusProxy();
    824840
    825     /* Apply internal variables data to QWidget(s): */
    826     for (int iSlot = 0; iSlot < m_cache.m_items.size(); ++iSlot)
    827     {
    828         /* Creating adapter's page: */
    829         UIMachineSettingsNetwork *pPage = new UIMachineSettingsNetwork(this, mDisableStaticControls);
     841    int uCount = qMin(mTwAdapters->count(), m_cache.m_items.size());
     842    for (int iSlot = 0; iSlot < uCount; ++iSlot)
     843    {
     844        UIMachineSettingsNetwork *pPage =
     845            qobject_cast<UIMachineSettingsNetwork *>(mTwAdapters->widget(iSlot));
     846        Assert(pPage);
    830847
    831848        /* Loading adapter's data into page: */
    832849        pPage->fetchAdapterData(m_cache.m_items[iSlot]);
    833 
    834         /* Attach adapter's page to Tab Widget: */
    835         mTwAdapters->addTab(pPage, pPage->pageTitle());
    836850
    837851        /* Disable tab page of disabled adapter if it is being configured dynamically: */
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