VirtualBox

Changeset 80213 in vbox for trunk/src


Ignore:
Timestamp:
Aug 9, 2019 1:12:48 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:7720: VM settings / Network page: Move more of network page related stuff to UINetworkAttachmentEditor.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

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

    r80200 r80213  
    2828
    2929/* COM includes: */
     30#include "CNATEngine.h"
    3031#include "CNetworkAdapter.h"
    31 #include "CHostNetworkInterface.h"
    32 #include "CNATNetwork.h"
    33 
    34 /* COM includes: */
    35 #include "CNATEngine.h"
    3632
    3733/* Other VBox includes: */
     
    10581054void UIMachineSettingsNetworkPage::refreshBridgedAdapterList()
    10591055{
    1060     /* Reload bridged interface list: */
    1061     m_bridgedAdapterList.clear();
    1062     const CHostNetworkInterfaceVector &ifaces = uiCommon().host().GetNetworkInterfaces();
    1063     for (int i = 0; i < ifaces.size(); ++i)
    1064     {
    1065         const CHostNetworkInterface &iface = ifaces[i];
    1066         if (iface.GetInterfaceType() == KHostNetworkInterfaceType_Bridged && !m_bridgedAdapterList.contains(iface.GetName()))
    1067             m_bridgedAdapterList << iface.GetName();
    1068     }
     1056    /* Reload bridged adapters: */
     1057    m_bridgedAdapterList = UINetworkAttachmentEditor::bridgedAdapters();
    10691058}
    10701059
     
    10751064    /* Get internal network names from other VMs: */
    10761065    if (fFullRefresh)
    1077         m_internalNetworkList << otherInternalNetworkList();
     1066        m_internalNetworkList << UINetworkAttachmentEditor::internalNetworks();
    10781067    /* Append internal network list with names from all the tabs: */
    10791068    for (int iTab = 0; iTab < m_pTabWidget->count(); ++iTab)
     
    10911080void UIMachineSettingsNetworkPage::refreshHostInterfaceList()
    10921081{
    1093     /* Reload host-only interface list: */
    1094     m_hostInterfaceList.clear();
    1095     const CHostNetworkInterfaceVector &ifaces = uiCommon().host().GetNetworkInterfaces();
    1096     for (int i = 0; i < ifaces.size(); ++i)
    1097     {
    1098         const CHostNetworkInterface &iface = ifaces[i];
    1099         if (iface.GetInterfaceType() == KHostNetworkInterfaceType_HostOnly && !m_hostInterfaceList.contains(iface.GetName()))
    1100             m_hostInterfaceList << iface.GetName();
    1101     }
     1082    /* Reload host interfaces: */
     1083    m_bridgedAdapterList = UINetworkAttachmentEditor::hostInterfaces();
    11021084}
    11031085
     
    11081090    /* Get generic driver names from other VMs: */
    11091091    if (fFullRefresh)
    1110         m_genericDriverList << otherGenericDriverList();
     1092        m_genericDriverList << UINetworkAttachmentEditor::genericDrivers();
    11111093    /* Append generic driver list with names from all the tabs: */
    11121094    for (int iTab = 0; iTab < m_pTabWidget->count(); ++iTab)
     
    11241106void UIMachineSettingsNetworkPage::refreshNATNetworkList()
    11251107{
    1126     /* Reload NAT network list: */
    1127     m_natNetworkList.clear();
    1128     const CNATNetworkVector &nws = uiCommon().virtualBox().GetNATNetworks();
    1129     for (int i = 0; i < nws.size(); ++i)
    1130     {
    1131         const CNATNetwork &nw = nws[i];
    1132         m_natNetworkList << nw.GetNetworkName();
    1133     }
    1134 }
    1135 
    1136 /* static */
    1137 QStringList UIMachineSettingsNetworkPage::otherInternalNetworkList()
    1138 {
    1139     /* Load total internal network list of all VMs: */
    1140     const CVirtualBox vbox = uiCommon().virtualBox();
    1141     const QStringList otherInternalNetworks(QList<QString>::fromVector(vbox.GetInternalNetworks()));
    1142     return otherInternalNetworks;
    1143 }
    1144 
    1145 /* static */
    1146 QStringList UIMachineSettingsNetworkPage::otherGenericDriverList()
    1147 {
    1148     /* Load total generic driver list of all VMs: */
    1149     const CVirtualBox vbox = uiCommon().virtualBox();
    1150     const QStringList otherGenericDrivers(QList<QString>::fromVector(vbox.GetGenericNetworkDrivers()));
    1151     return otherGenericDrivers;
     1108    /* Reload nat networks: */
     1109    m_natNetworkList = UINetworkAttachmentEditor::natNetworks();
    11521110}
    11531111
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h

    r76581 r80213  
    112112    void refreshNATNetworkList();
    113113
    114     /** Populates a list of known internal networks. */
    115     static QStringList otherInternalNetworkList();
    116     /** Populates a list of known generic drivers. */
    117     static QStringList otherGenericDriverList();
    118114    /** Loads generic properties from passed @a adapter. */
    119115    static QString loadGenericProperties(const CNetworkAdapter &adapter);
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINetworkAttachmentEditor.cpp

    r80200 r80213  
    2323/* GUI includes: */
    2424#include "QIComboBox.h"
     25#include "UICommon.h"
    2526#include "UIConverter.h"
    2627#include "UIExtraDataManager.h"
    2728#include "UINetworkAttachmentEditor.h"
     29
     30/* COM includes: */
     31#include "CHostNetworkInterface.h"
     32#include "CNATNetwork.h"
    2833
    2934
     
    106111{
    107112    return m_name.value(enmType);
     113}
     114
     115/* static */
     116QStringList UINetworkAttachmentEditor::bridgedAdapters()
     117{
     118    QStringList bridgedAdapterList;
     119    foreach (const CHostNetworkInterface &comInterface, uiCommon().host().GetNetworkInterfaces())
     120    {
     121        if (   comInterface.GetInterfaceType() == KHostNetworkInterfaceType_Bridged
     122            && !bridgedAdapterList.contains(comInterface.GetName()))
     123            bridgedAdapterList << comInterface.GetName();
     124    }
     125    return bridgedAdapterList;
     126}
     127
     128/* static */
     129QStringList UINetworkAttachmentEditor::internalNetworks()
     130{
     131    return QList<QString>::fromVector(uiCommon().virtualBox().GetInternalNetworks());
     132}
     133
     134/* static */
     135QStringList UINetworkAttachmentEditor::hostInterfaces()
     136{
     137    QStringList hostInterfaceList;
     138    foreach (const CHostNetworkInterface &comInterface, uiCommon().host().GetNetworkInterfaces())
     139    {
     140        if (   comInterface.GetInterfaceType() == KHostNetworkInterfaceType_HostOnly
     141            && !hostInterfaceList.contains(comInterface.GetName()))
     142            hostInterfaceList << comInterface.GetName();
     143    }
     144    return hostInterfaceList;
     145}
     146
     147/* static */
     148QStringList UINetworkAttachmentEditor::genericDrivers()
     149{
     150    return QList<QString>::fromVector(uiCommon().virtualBox().GetGenericNetworkDrivers());
     151}
     152
     153/* static */
     154QStringList UINetworkAttachmentEditor::natNetworks()
     155{
     156    QStringList natNetworkList;
     157    foreach (const CNATNetwork &comNetwork, uiCommon().virtualBox().GetNATNetworks())
     158        natNetworkList << comNetwork.GetNetworkName();
     159    return natNetworkList;
    108160}
    109161
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINetworkAttachmentEditor.h

    r80200 r80213  
    7575    QString valueName(KNetworkAttachmentType enmType) const;
    7676
     77    /** Returns bridged adapter list. */
     78    static QStringList bridgedAdapters();
     79    /** Returns internal network list. */
     80    static QStringList internalNetworks();
     81    /** Returns host-only interface list. */
     82    static QStringList hostInterfaces();
     83    /** Returns generic driver list. */
     84    static QStringList genericDrivers();
     85    /** Returns NAT network list. */
     86    static QStringList natNetworks();
     87
    7788protected:
    7889
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