- Timestamp:
- Aug 9, 2019 1:12:48 PM (5 years ago)
- 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 28 28 29 29 /* COM includes: */ 30 #include "CNATEngine.h" 30 31 #include "CNetworkAdapter.h" 31 #include "CHostNetworkInterface.h"32 #include "CNATNetwork.h"33 34 /* COM includes: */35 #include "CNATEngine.h"36 32 37 33 /* Other VBox includes: */ … … 1058 1054 void UIMachineSettingsNetworkPage::refreshBridgedAdapterList() 1059 1055 { 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(); 1069 1058 } 1070 1059 … … 1075 1064 /* Get internal network names from other VMs: */ 1076 1065 if (fFullRefresh) 1077 m_internalNetworkList << otherInternalNetworkList();1066 m_internalNetworkList << UINetworkAttachmentEditor::internalNetworks(); 1078 1067 /* Append internal network list with names from all the tabs: */ 1079 1068 for (int iTab = 0; iTab < m_pTabWidget->count(); ++iTab) … … 1091 1080 void UIMachineSettingsNetworkPage::refreshHostInterfaceList() 1092 1081 { 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(); 1102 1084 } 1103 1085 … … 1108 1090 /* Get generic driver names from other VMs: */ 1109 1091 if (fFullRefresh) 1110 m_genericDriverList << otherGenericDriverList();1092 m_genericDriverList << UINetworkAttachmentEditor::genericDrivers(); 1111 1093 /* Append generic driver list with names from all the tabs: */ 1112 1094 for (int iTab = 0; iTab < m_pTabWidget->count(); ++iTab) … … 1124 1106 void UIMachineSettingsNetworkPage::refreshNATNetworkList() 1125 1107 { 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(); 1152 1110 } 1153 1111 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h
r76581 r80213 112 112 void refreshNATNetworkList(); 113 113 114 /** Populates a list of known internal networks. */115 static QStringList otherInternalNetworkList();116 /** Populates a list of known generic drivers. */117 static QStringList otherGenericDriverList();118 114 /** Loads generic properties from passed @a adapter. */ 119 115 static QString loadGenericProperties(const CNetworkAdapter &adapter); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINetworkAttachmentEditor.cpp
r80200 r80213 23 23 /* GUI includes: */ 24 24 #include "QIComboBox.h" 25 #include "UICommon.h" 25 26 #include "UIConverter.h" 26 27 #include "UIExtraDataManager.h" 27 28 #include "UINetworkAttachmentEditor.h" 29 30 /* COM includes: */ 31 #include "CHostNetworkInterface.h" 32 #include "CNATNetwork.h" 28 33 29 34 … … 106 111 { 107 112 return m_name.value(enmType); 113 } 114 115 /* static */ 116 QStringList 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 */ 129 QStringList UINetworkAttachmentEditor::internalNetworks() 130 { 131 return QList<QString>::fromVector(uiCommon().virtualBox().GetInternalNetworks()); 132 } 133 134 /* static */ 135 QStringList 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 */ 148 QStringList UINetworkAttachmentEditor::genericDrivers() 149 { 150 return QList<QString>::fromVector(uiCommon().virtualBox().GetGenericNetworkDrivers()); 151 } 152 153 /* static */ 154 QStringList UINetworkAttachmentEditor::natNetworks() 155 { 156 QStringList natNetworkList; 157 foreach (const CNATNetwork &comNetwork, uiCommon().virtualBox().GetNATNetworks()) 158 natNetworkList << comNetwork.GetNetworkName(); 159 return natNetworkList; 108 160 } 109 161 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINetworkAttachmentEditor.h
r80200 r80213 75 75 QString valueName(KNetworkAttachmentType enmType) const; 76 76 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 77 88 protected: 78 89
Note:
See TracChangeset
for help on using the changeset viewer.