VirtualBox

Changeset 78540 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 16, 2019 9:57:17 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
130585
Message:

FE/Qt: bugref:9446 Caching the restricted network attachment types tp avoid repetitive extra data reads.

File:
1 edited

Legend:

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

    r78519 r78540  
    122122    /** Holds whether the network adapter is connected. */
    123123    bool                              m_fCableConnected;
     124    /** Holds the list of restricted network attachment types. */
     125    UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork m_enmRestrictedNetworkAttachmentTypes;
    124126};
    125127
     
    220222    QString m_strNATNetworkName;
    221223    UIPortForwardingDataList m_portForwardingRules;
     224    /** Holds the list of restricted network attachment types. */
     225    UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork m_enmRestrictedNetworkAttachmentTypes;
    222226};
    223227
     
    304308    for (int i = 0; i < adapterCache.childCount(); ++i)
    305309        m_portForwardingRules << adapterCache.child(i).base();
     310    /* Cache the restricted metwork attachment types to avoid re-reading them from the extra data: */
     311    m_enmRestrictedNetworkAttachmentTypes = oldAdapterData.m_enmRestrictedNetworkAttachmentTypes;
     312    /* Re-apply language settings: */
     313    retranslateUi();
    306314}
    307315
     
    783791
    784792        /* Populate attachments: */
    785         const UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork enmRestrictedNetworkAttachmentTypes =
    786             gEDataManager->restrictedNetworkAttachmentTypes();
    787793        int iAttachmentTypeIndex = 0;
    788794        /* We want some hardcoded order, so prepare a list of enum values: */
     
    794800        {
    795801            const KNetworkAttachmentType enmType = attachmentTypes.at(i);
    796             if (enmRestrictedNetworkAttachmentTypes & toInternalNetworkAdapterEnum(enmType))
     802            if (m_enmRestrictedNetworkAttachmentTypes & toInternalNetworkAdapterEnum(enmType))
    797803                continue;
    798804            m_pAttachmentTypeComboBox->insertItem(iAttachmentTypeIndex, gpConverter->toString(enmType));
     
    10361042    UIDataSettingsMachineNetwork oldNetworkData;
    10371043
     1044    const UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork enmRestrictedNetworkAttachmentTypes =
     1045        gEDataManager->restrictedNetworkAttachmentTypes();
     1046
    10381047    /* For each network adapter: */
    10391048    for (int iSlot = 0; iSlot < m_pTabWidget->count(); ++iSlot)
     
    10601069            oldAdapterData.m_strGenericProperties = loadGenericProperties(comAdapter);
    10611070            oldAdapterData.m_fCableConnected = comAdapter.GetCableConnected();
     1071            oldAdapterData.m_enmRestrictedNetworkAttachmentTypes = enmRestrictedNetworkAttachmentTypes;
    10621072            foreach (const QString &strRedirect, comAdapter.GetNATEngine().GetRedirects())
    10631073            {
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette