Phase 4 (list Internal as an option only for the first sound or network card).

This commit is contained in:
OBattler
2023-10-06 05:47:40 +02:00
parent 6d05e8d358
commit 4af09535c3
2 changed files with 8 additions and 32 deletions

View File

@@ -48,7 +48,7 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
intf_cbox->setEnabled(net_type_cbox->currentData().toInt() == NET_TYPE_PCAP);
nic_cbox->setEnabled(adaptersEnabled);
int netCard = nic_cbox->currentData().toInt();
if (netCard == NET_INTERNAL)
if ((i == 0) && (netCard == NET_INTERNAL))
conf_btn->setEnabled(adaptersEnabled && machine_has_flags(machineId, MACHINE_NIC) &&
device_has_config(machine_get_net_device(machineId)));
else
@@ -115,8 +115,8 @@ SettingsNetwork::onCurrentMachineChanged(int machineId)
selectedRow = 0;
while (true) {
/* Skip "internal" if machine doesn't have it. */
if ((c == 1) && (machine_has_flags(machineId, MACHINE_NIC) == 0)) {
/* Skip "internal" if machine doesn't have it or this is not the primary card. */
if ((c == 1) && ((i > 0) || (machine_has_flags(machineId, MACHINE_NIC) == 0))) {
c++;
continue;
}
@@ -205,8 +205,6 @@ SettingsNetwork::on_pushButtonConf2_clicked()
{
int netCard = ui->comboBoxNIC2->currentData().toInt();
auto *device = network_card_getdevice(netCard);
if (netCard == NET_INTERNAL)
device = machine_get_net_device(machineId);
DeviceConfig::ConfigureDevice(device, 2, qobject_cast<Settings *>(Settings::settings));
}
@@ -215,8 +213,6 @@ SettingsNetwork::on_pushButtonConf3_clicked()
{
int netCard = ui->comboBoxNIC3->currentData().toInt();
auto *device = network_card_getdevice(netCard);
if (netCard == NET_INTERNAL)
device = machine_get_net_device(machineId);
DeviceConfig::ConfigureDevice(device, 3, qobject_cast<Settings *>(Settings::settings));
}
@@ -225,7 +221,5 @@ SettingsNetwork::on_pushButtonConf4_clicked()
{
int netCard = ui->comboBoxNIC4->currentData().toInt();
auto *device = network_card_getdevice(netCard);
if (netCard == NET_INTERNAL)
device = machine_get_net_device(machineId);
DeviceConfig::ConfigureDevice(device, 4, qobject_cast<Settings *>(Settings::settings));
}