Merge pull request #5878 from jriwanek-forks/ns-50
Network Switch Support (devbranched as not finished yet)
This commit is contained in:
@@ -252,6 +252,10 @@ if(EMU_BUILD_NUM)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NETSWITCH)
|
||||
target_compile_definitions(ui PRIVATE USE_NETSWITCH)
|
||||
endif()
|
||||
|
||||
if(RTMIDI)
|
||||
target_compile_definitions(ui PRIVATE USE_RTMIDI)
|
||||
endif()
|
||||
|
||||
@@ -2465,3 +2465,18 @@ msgstr ""
|
||||
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
@@ -2466,6 +2466,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "Controlador de HD:"
|
||||
|
||||
|
||||
@@ -2466,6 +2466,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "Řadič disku:"
|
||||
|
||||
|
||||
@@ -2466,6 +2466,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "HDD-Controller:"
|
||||
|
||||
|
||||
@@ -2466,6 +2466,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "Controladora HD:"
|
||||
|
||||
|
||||
@@ -2466,6 +2466,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "Kiintolevyohjain:"
|
||||
|
||||
|
||||
@@ -2466,6 +2466,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "Contrôleur HD:"
|
||||
|
||||
|
||||
@@ -2466,6 +2466,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "Kontroler tvrdog diska:"
|
||||
|
||||
|
||||
@@ -2463,6 +2463,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "Merevl.-vezérlő:"
|
||||
|
||||
|
||||
@@ -2466,6 +2466,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "Controller HD:"
|
||||
|
||||
|
||||
@@ -2466,6 +2466,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "HDDコントローラー:"
|
||||
|
||||
|
||||
@@ -2463,6 +2463,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "HD 컨트롤러:"
|
||||
|
||||
|
||||
@@ -2466,6 +2466,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "HD-controller:"
|
||||
|
||||
|
||||
@@ -2465,3 +2465,18 @@ msgstr "Pliki ROM"
|
||||
|
||||
msgid "SoundFont files"
|
||||
msgstr "Pliki SoundFont"
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
@@ -2465,3 +2465,18 @@ msgstr "Arquivos de ROM"
|
||||
|
||||
msgid "SoundFont files"
|
||||
msgstr "Arquivos SoundFont"
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
@@ -2466,6 +2466,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "Controlador HD:"
|
||||
|
||||
|
||||
@@ -2466,6 +2466,21 @@ msgstr "Файлы ПЗУ"
|
||||
msgid "SoundFont files"
|
||||
msgstr "Файлы SoundFont"
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr "Локальный коммутатор"
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr "Удалённый коммутатор"
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr "Номер коммутатора:"
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr "Режим концентратора"
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr "Имя хоста:"
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "Контроллер HD:"
|
||||
|
||||
|
||||
@@ -2460,6 +2460,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "Radič disku:"
|
||||
|
||||
|
||||
@@ -2460,6 +2460,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "Krmilnik trdega diska:"
|
||||
|
||||
|
||||
@@ -2460,6 +2460,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "Styrenhet för hårddisk:"
|
||||
|
||||
|
||||
@@ -2460,6 +2460,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "Hard Disk Denetleyicisi:"
|
||||
|
||||
|
||||
@@ -2463,6 +2463,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "Контролер HD:"
|
||||
|
||||
|
||||
@@ -2460,6 +2460,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "Bộ điều khiển ổ cứng:"
|
||||
|
||||
|
||||
@@ -2460,6 +2460,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "硬盘控制器:"
|
||||
|
||||
|
||||
@@ -2460,6 +2460,21 @@ msgstr ""
|
||||
msgid "SoundFont files"
|
||||
msgstr ""
|
||||
|
||||
msgid "Local Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Remote Switch"
|
||||
msgstr ""
|
||||
|
||||
msgid "Switch:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hub Mode"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hostname:"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "HD Controller:"
|
||||
#~ msgstr "硬碟控制器:"
|
||||
|
||||
|
||||
@@ -1181,6 +1181,12 @@ MediaMenu::nicUpdateMenu(int i)
|
||||
case NET_TYPE_TAP:
|
||||
netType = "TAP";
|
||||
break;
|
||||
case NET_TYPE_NMSWITCH:
|
||||
netType = "Local Switch";
|
||||
break;
|
||||
case NET_TYPE_NRSWITCH:
|
||||
netType = "Remote Switch";
|
||||
break;
|
||||
}
|
||||
|
||||
QString devName = DeviceConfig::DeviceName(network_card_getdevice(net_cards_conf[i].device_num), network_card_get_internal_name(net_cards_conf[i].device_num), 1);
|
||||
|
||||
@@ -51,11 +51,43 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
|
||||
auto *option_list_label = findChild<QLabel *>(QString("labelOptionList%1").arg(i + 1));
|
||||
auto *option_list_line = findChild<QWidget *>(QString("lineOptionList%1").arg(i + 1));
|
||||
|
||||
// Switch group
|
||||
auto *switch_group_label = findChild<QLabel *>(QString("labelSwitch%1").arg(i + 1));
|
||||
// auto *switch_group_hlayout = findChild<QHBoxLayout *>(QString("HLayoutSwitch%1").arg(i + 1));
|
||||
// auto *switch_group_hspacer = findChild<QWidget *>(QString("horizontalSpacerSwitch%1").arg(i + 1));
|
||||
auto *switch_group_value = findChild<QSpinBox *>(QString("spinnerSwitch%1").arg(i + 1));
|
||||
switch_group_value->setMinimum(1);
|
||||
switch_group_value->setMaximum(10);
|
||||
|
||||
// Promiscuous option
|
||||
auto *promisc_label = findChild<QLabel *>(QString("labelPromisc%1").arg(i + 1));
|
||||
auto *promisc_value = findChild<QCheckBox *>(QString("boxPromisc%1").arg(i + 1));
|
||||
|
||||
// Remote switch hostname
|
||||
auto *hostname_label = findChild<QLabel *>(QString("labelHostname%1").arg(i + 1));
|
||||
auto *hostname_value = findChild<QLineEdit *>(QString("hostnameSwitch%1").arg(i + 1));
|
||||
|
||||
bridge_line->setEnabled(net_type_cbox->currentData().toInt() == NET_TYPE_TAP);
|
||||
intf_cbox->setEnabled(net_type_cbox->currentData().toInt() == NET_TYPE_PCAP);
|
||||
conf_btn->setEnabled(network_card_has_config(nic_cbox->currentData().toInt()));
|
||||
// net_type_conf_btn->setEnabled(network_type_has_config(netType));
|
||||
|
||||
// NEW STUFF
|
||||
// Make all options invisible by default
|
||||
|
||||
// Switch group
|
||||
switch_group_label->setVisible(false);
|
||||
switch_group_value->setVisible(false);
|
||||
// switch_group_hspacer->setVisible(false);
|
||||
|
||||
// Promiscuous options
|
||||
promisc_label->setVisible(false);
|
||||
promisc_value->setVisible(false);
|
||||
|
||||
// Hostname
|
||||
hostname_label->setVisible(false);
|
||||
hostname_value->setVisible(false);
|
||||
|
||||
// Option list label and line
|
||||
option_list_label->setVisible(false);
|
||||
option_list_line->setVisible(false);
|
||||
@@ -76,6 +108,7 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
|
||||
if(nic_cbox->currentData().toInt() != 0) {
|
||||
// Then only enable as needed based on network type
|
||||
switch (net_type_cbox->currentData().toInt()) {
|
||||
#ifdef HAS_VDE
|
||||
case NET_TYPE_VDE:
|
||||
// option_list_label->setText("VDE Options");
|
||||
option_list_label->setVisible(true);
|
||||
@@ -84,6 +117,7 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
|
||||
vde_socket_label->setVisible(true);
|
||||
socket_line->setVisible(true);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case NET_TYPE_PCAP:
|
||||
// option_list_label->setText("PCAP Options");
|
||||
@@ -105,6 +139,38 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef USE_NETSWITCH
|
||||
case NET_TYPE_NMSWITCH:
|
||||
// option_list_label->setText("Local Switch Options");
|
||||
option_list_label->setVisible(true);
|
||||
option_list_line->setVisible(true);
|
||||
|
||||
// Switch group
|
||||
switch_group_label->setVisible(true);
|
||||
switch_group_value->setVisible(true);
|
||||
// switch_group_hspacer->setVisible(false);
|
||||
|
||||
// Promiscuous options
|
||||
promisc_label->setVisible(true);
|
||||
promisc_value->setVisible(true);
|
||||
break;
|
||||
|
||||
case NET_TYPE_NRSWITCH:
|
||||
// option_list_label->setText("Remote Switch Options");
|
||||
option_list_label->setVisible(true);
|
||||
option_list_line->setVisible(true);
|
||||
|
||||
// Switch group
|
||||
switch_group_label->setVisible(true);
|
||||
switch_group_value->setVisible(true);
|
||||
// switch_group_hspacer->setVisible(false);
|
||||
|
||||
// Hostname
|
||||
hostname_label->setVisible(true);
|
||||
hostname_value->setVisible(true);
|
||||
break;
|
||||
#endif /* USE_NETSWITCH */
|
||||
|
||||
case NET_TYPE_SLIRP:
|
||||
default:
|
||||
break;
|
||||
@@ -141,7 +207,9 @@ SettingsNetwork::save()
|
||||
{
|
||||
for (int i = 0; i < NET_CARD_MAX; ++i) {
|
||||
auto *cbox = findChild<QComboBox *>(QString("comboBoxNIC%1").arg(i + 1));
|
||||
#ifdef HAS_VDE
|
||||
auto *socket_line = findChild<QLineEdit *>(QString("socketVDENIC%1").arg(i + 1));
|
||||
#endif
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
auto *bridge_line = findChild<QLineEdit *>(QString("bridgeTAPNIC%1").arg(i + 1));
|
||||
#endif
|
||||
@@ -149,15 +217,32 @@ SettingsNetwork::save()
|
||||
cbox = findChild<QComboBox *>(QString("comboBoxNet%1").arg(i + 1));
|
||||
net_cards_conf[i].net_type = cbox->currentData().toInt();
|
||||
cbox = findChild<QComboBox *>(QString("comboBoxIntf%1").arg(i + 1));
|
||||
#ifdef USE_NETSWITCH
|
||||
auto *hostname_value = findChild<QLineEdit *>(QString("hostnameSwitch%1").arg(i + 1));
|
||||
auto *promisc_value = findChild<QCheckBox *>(QString("boxPromisc%1").arg(i + 1));
|
||||
auto *switch_group_value = findChild<QSpinBox *>(QString("spinnerSwitch%1").arg(i + 1));
|
||||
#endif /* USE_NETSWITCH */
|
||||
memset(net_cards_conf[i].host_dev_name, '\0', sizeof(net_cards_conf[i].host_dev_name));
|
||||
if (net_cards_conf[i].net_type == NET_TYPE_PCAP)
|
||||
strncpy(net_cards_conf[i].host_dev_name, network_devs[cbox->currentData().toInt()].device, sizeof(net_cards_conf[i].host_dev_name) - 1);
|
||||
#ifdef HAS_VDE
|
||||
else if (net_cards_conf[i].net_type == NET_TYPE_VDE)
|
||||
strncpy(net_cards_conf[i].host_dev_name, socket_line->text().toUtf8().constData(), sizeof(net_cards_conf[i].host_dev_name));
|
||||
#endif
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
else if (net_cards_conf[i].net_type == NET_TYPE_TAP)
|
||||
strncpy(net_cards_conf[i].host_dev_name, bridge_line->text().toUtf8().constData(), sizeof(net_cards_conf[i].host_dev_name));
|
||||
#endif
|
||||
#ifdef USE_NETSWITCH
|
||||
else if (net_cards_conf[i].net_type == NET_TYPE_NRSWITCH) {
|
||||
memset(net_cards_conf[i].nrs_hostname, '\0', sizeof(net_cards_conf[i].nrs_hostname));
|
||||
strncpy(net_cards_conf[i].nrs_hostname, hostname_value->text().toUtf8().constData(), sizeof(net_cards_conf[i].nrs_hostname) - 1);
|
||||
net_cards_conf[i].switch_group = switch_group_value->value() - 1;
|
||||
} else if (net_cards_conf[i].net_type == NET_TYPE_NMSWITCH) {
|
||||
net_cards_conf[i].promisc_mode = promisc_value->isChecked();
|
||||
net_cards_conf[i].switch_group = switch_group_value->value() - 1;
|
||||
}
|
||||
#endif /* USE_NETSWITCH */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,13 +306,22 @@ SettingsNetwork::onCurrentMachineChanged(int machineId)
|
||||
if (network_ndev > 1)
|
||||
Models::AddEntry(model, "PCap", NET_TYPE_PCAP);
|
||||
|
||||
#ifdef HAS_VDE
|
||||
if (network_devmap.has_vde)
|
||||
Models::AddEntry(model, "VDE", NET_TYPE_VDE);
|
||||
#endif
|
||||
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
Models::AddEntry(model, "TAP", NET_TYPE_TAP);
|
||||
#endif
|
||||
|
||||
#ifdef USE_NETSWITCH
|
||||
Models::AddEntry(model, "Local Switch", NET_TYPE_NMSWITCH);
|
||||
#ifdef ENABLE_NET_NRSWITCH
|
||||
Models::AddEntry(model, "Remote Switch", NET_TYPE_NRSWITCH);
|
||||
#endif /* ENABLE_NET_NRSWITCH */
|
||||
#endif /* USE_NETSWITCH */
|
||||
|
||||
model->removeRows(0, removeRows);
|
||||
cbox->setCurrentIndex(cbox->findData(net_cards_conf[i].net_type));
|
||||
|
||||
@@ -249,15 +343,31 @@ SettingsNetwork::onCurrentMachineChanged(int machineId)
|
||||
}
|
||||
|
||||
if (net_cards_conf[i].net_type == NET_TYPE_VDE) {
|
||||
#ifdef HAS_VDE
|
||||
QString currentVdeSocket = net_cards_conf[i].host_dev_name;
|
||||
auto editline = findChild<QLineEdit *>(QString("socketVDENIC%1").arg(i+1));
|
||||
editline->setText(currentVdeSocket);
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
#if defined(__unix__) || defined(__APPLE__)
|
||||
} else if (net_cards_conf[i].net_type == NET_TYPE_TAP) {
|
||||
QString currentTapDevice = net_cards_conf[i].host_dev_name;
|
||||
auto editline = findChild<QLineEdit *>(QString("bridgeTAPNIC%1").arg(i+1));
|
||||
editline->setText(currentTapDevice);
|
||||
#endif
|
||||
#ifdef USE_NETSWITCH
|
||||
} else if (net_cards_conf[i].net_type == NET_TYPE_NMSWITCH) {
|
||||
auto *promisc_value = findChild<QCheckBox *>(QString("promiscBox%1").arg(i + 1));
|
||||
promisc_value->setCheckState(net_cards_conf[i].promisc_mode == 1 ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
|
||||
auto *switch_group_value = findChild<QSpinBox *>(QString("switchSpinner%1").arg(i + 1));
|
||||
switch_group_value->setValue(net_cards_conf[i].switch_group + 1);
|
||||
} else if (net_cards_conf[i].net_type == NET_TYPE_NRSWITCH) {
|
||||
auto *hostname_value = findChild<QLineEdit *>(QString("switchHostname%1").arg(i + 1));
|
||||
hostname_value->setText(net_cards_conf[i].nrs_hostname);
|
||||
auto *switch_group_value = findChild<QSpinBox *>(QString("switchSpinner%1").arg(i + 1));
|
||||
switch_group_value->setValue(net_cards_conf[i].switch_group + 1);
|
||||
#endif /* USE_NETSWITCH */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,69 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="labelSwitch1">
|
||||
<property name="text">
|
||||
<string>Switch:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<layout class="QHBoxLayout" name="HLayoutSwitch1">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinnerSwitch1">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacerSwitch1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="labelPromisc1">
|
||||
<property name="text">
|
||||
<string>Hub Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="boxPromisc1">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="labelHostname1">
|
||||
<property name="text">
|
||||
<string>Hostname:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLineEdit" name="hostnameSwitch1">
|
||||
<property name="maxLength">
|
||||
<number>128</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<spacer name="verticalSpacerNIC1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -322,7 +384,69 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="labelSwitch2">
|
||||
<property name="text">
|
||||
<string>Switch:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<layout class="QHBoxLayout" name="HLayoutSwitch2">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinnerSwitch2">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacerSwitch2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="labelPromisc2">
|
||||
<property name="text">
|
||||
<string>Hub Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="boxPromisc2">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="labelHostname2">
|
||||
<property name="text">
|
||||
<string>Hostname:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLineEdit" name="hostnameSwitch2">
|
||||
<property name="maxLength">
|
||||
<number>128</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<spacer name="verticalSpacerNIC2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -475,7 +599,69 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="labelSwitch3">
|
||||
<property name="text">
|
||||
<string>Switch:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<layout class="QHBoxLayout" name="HLayoutSwitch3">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinnerSwitch3">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacerSwitch3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="labelPromisc3">
|
||||
<property name="text">
|
||||
<string>Hub Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="boxPromisc3">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="labelHostname3">
|
||||
<property name="text">
|
||||
<string>Hostname:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLineEdit" name="hostnameSwitch3">
|
||||
<property name="maxLength">
|
||||
<number>128</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<spacer name="verticalSpacerNIC3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -628,7 +814,69 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="labelSwitch4">
|
||||
<property name="text">
|
||||
<string>Switch:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<layout class="QHBoxLayout" name="HLayoutSwitch4">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinnerSwitch4">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacerSwitch4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="labelPromisc4">
|
||||
<property name="text">
|
||||
<string>Hub Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="boxPromisc4">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="labelHostname4">
|
||||
<property name="text">
|
||||
<string>Hostname:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLineEdit" name="hostnameSwitch4">
|
||||
<property name="maxLength">
|
||||
<number>128</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<spacer name="verticalSpacerNIC4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
||||
@@ -921,6 +921,10 @@ VMManagerSystem::setupVars() {
|
||||
net_type = "SLiRP";
|
||||
else if (net_type == "pcap")
|
||||
net_type = "PCap";
|
||||
else if (net_type == "nmswitch")
|
||||
net_type = tr("Local Switch");
|
||||
else if (net_type == "nrswitch")
|
||||
net_type = tr("Remote Switch");
|
||||
else
|
||||
net_type = net_type.toUpper();
|
||||
nicList.append(nic_name + " (" + net_type + ")");
|
||||
|
||||
Reference in New Issue
Block a user