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));
}

View File

@@ -82,8 +82,8 @@ SettingsSound::onCurrentMachineChanged(int machineId)
selectedRow = 0;
while (true) {
/* Skip "internal" if machine doesn't have it. */
if ((c == 1) && (machine_has_flags(machineId, MACHINE_SOUND) == 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_SOUND) == 0))) {
c++;
continue;
}
@@ -217,11 +217,7 @@ SettingsSound::on_comboBoxSoundCard2_currentIndexChanged(int index)
return;
}
int sndCard = ui->comboBoxSoundCard2->currentData().toInt();
if (sndCard == SOUND_INTERNAL)
ui->pushButtonConfigureSoundCard2->setEnabled(machine_has_flags(machineId, MACHINE_SOUND) &&
device_has_config(machine_get_snd_device(machineId)));
else
ui->pushButtonConfigureSoundCard2->setEnabled(sound_card_has_config(ui->comboBoxSoundCard2->currentData().toInt()));
ui->pushButtonConfigureSoundCard2->setEnabled(sound_card_has_config(sndCard));
}
void
@@ -229,8 +225,6 @@ SettingsSound::on_pushButtonConfigureSoundCard2_clicked()
{
int sndCard = ui->comboBoxSoundCard2->currentData().toInt();
auto *device = sound_card_getdevice(sndCard);
if (sndCard == SOUND_INTERNAL)
device = machine_get_snd_device(machineId);
DeviceConfig::ConfigureDevice(device, 0, qobject_cast<Settings *>(Settings::settings));
}
@@ -241,11 +235,7 @@ SettingsSound::on_comboBoxSoundCard3_currentIndexChanged(int index)
return;
}
int sndCard = ui->comboBoxSoundCard3->currentData().toInt();
if (sndCard == SOUND_INTERNAL)
ui->pushButtonConfigureSoundCard3->setEnabled(machine_has_flags(machineId, MACHINE_SOUND) &&
device_has_config(machine_get_snd_device(machineId)));
else
ui->pushButtonConfigureSoundCard3->setEnabled(sound_card_has_config(ui->comboBoxSoundCard3->currentData().toInt()));
ui->pushButtonConfigureSoundCard3->setEnabled(sound_card_has_config(sndCard));
}
void
@@ -253,8 +243,6 @@ SettingsSound::on_pushButtonConfigureSoundCard3_clicked()
{
int sndCard = ui->comboBoxSoundCard3->currentData().toInt();
auto *device = sound_card_getdevice(sndCard);
if (sndCard == SOUND_INTERNAL)
device = machine_get_snd_device(machineId);
DeviceConfig::ConfigureDevice(device, 0, qobject_cast<Settings *>(Settings::settings));
}
@@ -265,11 +253,7 @@ SettingsSound::on_comboBoxSoundCard4_currentIndexChanged(int index)
return;
}
int sndCard = ui->comboBoxSoundCard4->currentData().toInt();
if (sndCard == SOUND_INTERNAL)
ui->pushButtonConfigureSoundCard4->setEnabled(machine_has_flags(machineId, MACHINE_SOUND) &&
device_has_config(machine_get_snd_device(machineId)));
else
ui->pushButtonConfigureSoundCard4->setEnabled(sound_card_has_config(ui->comboBoxSoundCard4->currentData().toInt()));
ui->pushButtonConfigureSoundCard4->setEnabled(sound_card_has_config(sndCard));
}
void
@@ -277,8 +261,6 @@ SettingsSound::on_pushButtonConfigureSoundCard4_clicked()
{
int sndCard = ui->comboBoxSoundCard4->currentData().toInt();
auto *device = sound_card_getdevice(sndCard);
if (sndCard == SOUND_INTERNAL)
device = machine_get_snd_device(machineId);
DeviceConfig::ConfigureDevice(device, 0, qobject_cast<Settings *>(Settings::settings));
}