Proper UI support for internal devices, phase 1.

This commit is contained in:
OBattler
2023-10-06 05:28:26 +02:00
parent b624e65380
commit 79e5a1dfbb
5 changed files with 52 additions and 12 deletions

View File

@@ -138,7 +138,11 @@ SettingsDisplay::on_comboBoxVideo_currentIndexChanged(int index)
}
auto curVideoCard_2 = videoCard[1];
videoCard[0] = ui->comboBoxVideo->currentData().toInt();
ui->pushButtonConfigure->setEnabled(video_card_has_config(videoCard[0]) > 0);
if (videoCard[0] == VID_INTERNAL)
ui->pushButtonConfigure->setEnabled(machine_has_flags(machineId, MACHINE_VIDEO) &&
device_has_config(machine_get_vid_device(machineId)));
else
ui->pushButtonConfigure->setEnabled(video_card_has_config(videoCard[0]) > 0);
bool machineHasPci = machine_has_bus(machineId, MACHINE_BUS_PCI) > 0;
ui->checkBoxVoodoo->setEnabled(machineHasPci);
if (machineHasPci) {

View File

@@ -47,7 +47,12 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui)
intf_cbox->setEnabled(net_type_cbox->currentData().toInt() == NET_TYPE_PCAP);
nic_cbox->setEnabled(adaptersEnabled);
conf_btn->setEnabled(adaptersEnabled && network_card_has_config(nic_cbox->currentData().toInt()));
int netCard = nic_cbox->currentData().toInt();
if (netCard == NET_INTERNAL)
conf_btn->setEnabled(adaptersEnabled && machine_has_flags(machineId, MACHINE_NIC) &&
device_has_config(machine_get_net_device(machineId)));
else
conf_btn->setEnabled(adaptersEnabled && network_card_has_config(nic_cbox->currentData().toInt()));
socket_line->setEnabled(net_type_cbox->currentData().toInt() == NET_TYPE_VDE);
}
}

View File

@@ -192,7 +192,12 @@ SettingsSound::on_comboBoxSoundCard1_currentIndexChanged(int index)
if (index < 0) {
return;
}
ui->pushButtonConfigureSoundCard1->setEnabled(sound_card_has_config(ui->comboBoxSoundCard1->currentData().toInt()));
int sndCard = ui->comboBoxSoundCard1->currentData().toInt();
if (sndCard == SOUND_INTERNAL)
ui->pushButtonConfigureSoundCard1->setEnabled(machine_has_flags(machineId, MACHINE_SOUND) &&
device_has_config(machine_get_snd_device(machineId)));
else
ui->pushButtonConfigureSoundCard1->setEnabled(sound_card_has_config(sndCard));
}
void
@@ -207,7 +212,12 @@ SettingsSound::on_comboBoxSoundCard2_currentIndexChanged(int index)
if (index < 0) {
return;
}
ui->pushButtonConfigureSoundCard2->setEnabled(sound_card_has_config(ui->comboBoxSoundCard2->currentData().toInt()));
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()));
}
void
@@ -222,7 +232,12 @@ SettingsSound::on_comboBoxSoundCard3_currentIndexChanged(int index)
if (index < 0) {
return;
}
ui->pushButtonConfigureSoundCard3->setEnabled(sound_card_has_config(ui->comboBoxSoundCard3->currentData().toInt()));
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()));
}
void
@@ -237,7 +252,12 @@ SettingsSound::on_comboBoxSoundCard4_currentIndexChanged(int index)
if (index < 0) {
return;
}
ui->pushButtonConfigureSoundCard4->setEnabled(sound_card_has_config(ui->comboBoxSoundCard4->currentData().toInt()));
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()));
}
void