Merge pull request #5318 from jriwanek-forks/improvements
General Improvements, Cleanups and additions
This commit is contained in:
@@ -50,13 +50,15 @@ void
|
||||
SettingsSound::save()
|
||||
{
|
||||
for (uint8_t i = 0; i < SOUND_CARD_MAX; ++i) {
|
||||
auto *cbox = findChild<QComboBox *>(QString("comboBoxSoundCard%1").arg(i + 1));
|
||||
sound_card_current[i] = cbox->currentData().toInt();
|
||||
QComboBox *cbox = findChild<QComboBox *>(QString("comboBoxSoundCard%1").arg(i + 1));
|
||||
sound_card_current[i] = cbox->currentData().toInt();
|
||||
}
|
||||
|
||||
midi_output_device_current = ui->comboBoxMidiOut->currentData().toInt();
|
||||
midi_input_device_current = ui->comboBoxMidiIn->currentData().toInt();
|
||||
mpu401_standalone_enable = ui->checkBoxMPU401->isChecked() ? 1 : 0;
|
||||
|
||||
midi_input_device_current = ui->comboBoxMidiIn->currentData().toInt();
|
||||
|
||||
mpu401_standalone_enable = ui->checkBoxMPU401->isChecked() ? 1 : 0;
|
||||
|
||||
sound_is_float = ui->checkBoxFloat32->isChecked() ? 1 : 0;
|
||||
|
||||
@@ -74,12 +76,13 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
|
||||
int c;
|
||||
int selectedRow;
|
||||
|
||||
// Sound Card
|
||||
for (uint8_t i = 0; i < SOUND_CARD_MAX; ++i) {
|
||||
auto * cbox = findChild<QComboBox *>(QString("comboBoxSoundCard%1").arg(i + 1));
|
||||
auto * model = cbox->model();
|
||||
const auto removeRows = model->rowCount();
|
||||
c = 0;
|
||||
selectedRow = 0;
|
||||
QComboBox *cbox = findChild<QComboBox *>(QString("comboBoxSoundCard%1").arg(i + 1));
|
||||
c = 0;
|
||||
auto model = cbox->model();
|
||||
auto removeRows = model->rowCount();
|
||||
selectedRow = 0;
|
||||
|
||||
while (true) {
|
||||
/* Skip "internal" if machine doesn't have it or this is not the primary card. */
|
||||
@@ -88,17 +91,21 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
|
||||
continue;
|
||||
}
|
||||
|
||||
auto name = DeviceConfig::DeviceName(sound_card_getdevice(c), sound_card_get_internal_name(c), 1);
|
||||
const QString name = DeviceConfig::DeviceName(sound_card_getdevice(c), sound_card_get_internal_name(c), 1);
|
||||
if (name.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (sound_card_available(c) && device_is_valid(sound_card_getdevice(c), machineId)) {
|
||||
int row = Models::AddEntry(model, name, c);
|
||||
if (c == sound_card_current[i]) {
|
||||
selectedRow = row - removeRows;
|
||||
if (sound_card_available(c)) {
|
||||
const device_t *sound_dev = sound_card_getdevice(c);
|
||||
if (device_is_valid(sound_dev, machineId)) {
|
||||
int row = Models::AddEntry(model, name, c);
|
||||
if (c == sound_card_current[i]) {
|
||||
selectedRow = row - removeRows;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
c++;
|
||||
}
|
||||
|
||||
@@ -108,12 +115,14 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
|
||||
cbox->setCurrentIndex(selectedRow);
|
||||
}
|
||||
|
||||
auto model = ui->comboBoxMidiOut->model();
|
||||
auto removeRows = model->rowCount();
|
||||
c = 0;
|
||||
selectedRow = 0;
|
||||
// Midi Out
|
||||
c = 0;
|
||||
auto model = ui->comboBoxMidiOut->model();
|
||||
auto removeRows = model->rowCount();
|
||||
selectedRow = 0;
|
||||
|
||||
while (true) {
|
||||
QString name = DeviceConfig::DeviceName(midi_out_device_getdevice(c), midi_out_device_get_internal_name(c), 0);
|
||||
const QString name = DeviceConfig::DeviceName(midi_out_device_getdevice(c), midi_out_device_get_internal_name(c), 0);
|
||||
if (name.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
@@ -124,19 +133,23 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
|
||||
selectedRow = row - removeRows;
|
||||
}
|
||||
}
|
||||
|
||||
c++;
|
||||
}
|
||||
|
||||
model->removeRows(0, removeRows);
|
||||
ui->comboBoxMidiOut->setEnabled(model->rowCount() > 0);
|
||||
ui->comboBoxMidiOut->setCurrentIndex(-1);
|
||||
ui->comboBoxMidiOut->setCurrentIndex(selectedRow);
|
||||
|
||||
// Midi In
|
||||
c = 0;
|
||||
model = ui->comboBoxMidiIn->model();
|
||||
removeRows = model->rowCount();
|
||||
c = 0;
|
||||
selectedRow = 0;
|
||||
|
||||
while (true) {
|
||||
QString name = DeviceConfig::DeviceName(midi_in_device_getdevice(c), midi_in_device_get_internal_name(c), 0);
|
||||
const QString name = DeviceConfig::DeviceName(midi_in_device_getdevice(c), midi_in_device_get_internal_name(c), 0);
|
||||
if (name.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
@@ -150,14 +163,19 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
|
||||
|
||||
c++;
|
||||
}
|
||||
|
||||
model->removeRows(0, removeRows);
|
||||
ui->comboBoxMidiIn->setEnabled(model->rowCount() > 0);
|
||||
ui->comboBoxMidiIn->setCurrentIndex(-1);
|
||||
ui->comboBoxMidiIn->setCurrentIndex(selectedRow);
|
||||
|
||||
// Standalone MPU401
|
||||
ui->checkBoxMPU401->setChecked(mpu401_standalone_enable > 0);
|
||||
|
||||
// Float32 Sound
|
||||
ui->checkBoxFloat32->setChecked(sound_is_float > 0);
|
||||
|
||||
// FM Driver
|
||||
switch (fm_driver) {
|
||||
case FM_DRV_YMFM:
|
||||
ui->radioButtonYMFM->setChecked(true);
|
||||
@@ -193,6 +211,7 @@ SettingsSound::on_comboBoxSoundCard1_currentIndexChanged(int index)
|
||||
return;
|
||||
}
|
||||
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)));
|
||||
@@ -203,8 +222,9 @@ SettingsSound::on_comboBoxSoundCard1_currentIndexChanged(int index)
|
||||
void
|
||||
SettingsSound::on_pushButtonConfigureSoundCard1_clicked()
|
||||
{
|
||||
int sndCard = ui->comboBoxSoundCard1->currentData().toInt();
|
||||
auto *device = sound_card_getdevice(sndCard);
|
||||
int sndCard = ui->comboBoxSoundCard1->currentData().toInt();
|
||||
auto *device = sound_card_getdevice(sndCard);
|
||||
|
||||
if (sndCard == SOUND_INTERNAL)
|
||||
device = machine_get_snd_device(machineId);
|
||||
DeviceConfig::ConfigureDevice(device, 1, qobject_cast<Settings *>(Settings::settings));
|
||||
@@ -216,15 +236,17 @@ SettingsSound::on_comboBoxSoundCard2_currentIndexChanged(int index)
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int sndCard = ui->comboBoxSoundCard2->currentData().toInt();
|
||||
|
||||
ui->pushButtonConfigureSoundCard2->setEnabled(sound_card_has_config(sndCard));
|
||||
}
|
||||
|
||||
void
|
||||
SettingsSound::on_pushButtonConfigureSoundCard2_clicked()
|
||||
{
|
||||
int sndCard = ui->comboBoxSoundCard2->currentData().toInt();
|
||||
auto *device = sound_card_getdevice(sndCard);
|
||||
int sndCard = ui->comboBoxSoundCard2->currentData().toInt();
|
||||
const device_t *device = sound_card_getdevice(sndCard);
|
||||
DeviceConfig::ConfigureDevice(device, 2, qobject_cast<Settings *>(Settings::settings));
|
||||
}
|
||||
|
||||
@@ -234,15 +256,18 @@ SettingsSound::on_comboBoxSoundCard3_currentIndexChanged(int index)
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int sndCard = ui->comboBoxSoundCard3->currentData().toInt();
|
||||
|
||||
ui->pushButtonConfigureSoundCard3->setEnabled(sound_card_has_config(sndCard));
|
||||
}
|
||||
|
||||
void
|
||||
SettingsSound::on_pushButtonConfigureSoundCard3_clicked()
|
||||
{
|
||||
int sndCard = ui->comboBoxSoundCard3->currentData().toInt();
|
||||
auto *device = sound_card_getdevice(sndCard);
|
||||
int sndCard = ui->comboBoxSoundCard3->currentData().toInt();
|
||||
const device_t *device = sound_card_getdevice(sndCard);
|
||||
|
||||
DeviceConfig::ConfigureDevice(device, 3, qobject_cast<Settings *>(Settings::settings));
|
||||
}
|
||||
|
||||
@@ -252,15 +277,18 @@ SettingsSound::on_comboBoxSoundCard4_currentIndexChanged(int index)
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int sndCard = ui->comboBoxSoundCard4->currentData().toInt();
|
||||
|
||||
ui->pushButtonConfigureSoundCard4->setEnabled(sound_card_has_config(sndCard));
|
||||
}
|
||||
|
||||
void
|
||||
SettingsSound::on_pushButtonConfigureSoundCard4_clicked()
|
||||
{
|
||||
int sndCard = ui->comboBoxSoundCard4->currentData().toInt();
|
||||
auto *device = sound_card_getdevice(sndCard);
|
||||
int sndCard = ui->comboBoxSoundCard4->currentData().toInt();
|
||||
const device_t *device = sound_card_getdevice(sndCard);
|
||||
|
||||
DeviceConfig::ConfigureDevice(device, 4, qobject_cast<Settings *>(Settings::settings));
|
||||
}
|
||||
|
||||
@@ -270,6 +298,7 @@ SettingsSound::on_comboBoxMidiOut_currentIndexChanged(int index)
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ui->pushButtonConfigureMidiOut->setEnabled(midi_out_device_has_config(ui->comboBoxMidiOut->currentData().toInt()));
|
||||
ui->checkBoxMPU401->setEnabled(allowMpu401(ui) && (machine_has_bus(machineId, MACHINE_BUS_ISA) || machine_has_bus(machineId, MACHINE_BUS_MCA)));
|
||||
ui->pushButtonConfigureMPU401->setEnabled(allowMpu401(ui) && ui->checkBoxMPU401->isChecked());
|
||||
@@ -288,6 +317,7 @@ SettingsSound::on_comboBoxMidiIn_currentIndexChanged(int index)
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ui->pushButtonConfigureMidiIn->setEnabled(midi_in_device_has_config(ui->comboBoxMidiIn->currentData().toInt()));
|
||||
ui->checkBoxMPU401->setEnabled(allowMpu401(ui) && (machine_has_bus(machineId, MACHINE_BUS_ISA) || machine_has_bus(machineId, MACHINE_BUS_MCA)));
|
||||
ui->pushButtonConfigureMPU401->setEnabled(allowMpu401(ui) && ui->checkBoxMPU401->isChecked());
|
||||
|
||||
@@ -52,8 +52,8 @@ void
|
||||
SettingsStorageControllers::save()
|
||||
{
|
||||
/* Storage devices category */
|
||||
for (int i = 0; i < SCSI_CARD_MAX; ++i) {
|
||||
auto *cbox = findChild<QComboBox *>(QString("comboBoxSCSI%1").arg(i + 1));
|
||||
for (uint8_t i = 0; i < SCSI_CARD_MAX; ++i) {
|
||||
QComboBox *cbox = findChild<QComboBox *>(QString("comboBoxSCSI%1").arg(i + 1));
|
||||
scsi_card_current[i] = cbox->currentData().toInt();
|
||||
}
|
||||
hdc_current[0] = ui->comboBoxHD->currentData().toInt();
|
||||
@@ -71,10 +71,11 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
|
||||
this->machineId = machineId;
|
||||
|
||||
/*HD controller config*/
|
||||
int c = 0;
|
||||
auto *model = ui->comboBoxHD->model();
|
||||
auto removeRows = model->rowCount();
|
||||
int c = 0;
|
||||
int selectedRow = 0;
|
||||
|
||||
while (true) {
|
||||
/* Skip "internal" if machine doesn't have it. */
|
||||
if ((c == 1) && (machine_has_flags(machineId, MACHINE_HDC) == 0)) {
|
||||
@@ -88,7 +89,7 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
|
||||
}
|
||||
|
||||
if (hdc_available(c)) {
|
||||
auto *hdc_dev = hdc_get_device(c);
|
||||
const device_t *hdc_dev = hdc_get_device(c);
|
||||
|
||||
if (device_is_valid(hdc_dev, machineId)) {
|
||||
int row = Models::AddEntry(model, name, c);
|
||||
@@ -124,7 +125,7 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
|
||||
}
|
||||
|
||||
if (fdc_card_available(c)) {
|
||||
auto *fdc_dev = fdc_card_getdevice(c);
|
||||
const device_t *fdc_dev = fdc_card_getdevice(c);
|
||||
|
||||
if (device_is_valid(fdc_dev, machineId)) {
|
||||
int row = Models::AddEntry(model, name, c);
|
||||
@@ -141,10 +142,11 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
|
||||
ui->comboBoxFD->setCurrentIndex(selectedRow);
|
||||
|
||||
/*CD interface controller config*/
|
||||
model = ui->comboBoxCDInterface->model();
|
||||
removeRows = model->rowCount();
|
||||
c = 0;
|
||||
c = 0;
|
||||
model = ui->comboBoxCDInterface->model();
|
||||
removeRows = model->rowCount();
|
||||
selectedRow = 0;
|
||||
|
||||
while (true) {
|
||||
/* Skip "internal" if machine doesn't have it. */
|
||||
QString name = DeviceConfig::DeviceName(cdrom_interface_get_device(c), cdrom_interface_get_internal_name(c), 1);
|
||||
@@ -153,7 +155,7 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
|
||||
}
|
||||
|
||||
if (cdrom_interface_available(c)) {
|
||||
auto *cdrom_interface_dev = cdrom_interface_get_device(c);
|
||||
const device_t *cdrom_interface_dev = cdrom_interface_get_device(c);
|
||||
|
||||
if (device_is_valid(cdrom_interface_dev, machineId)) {
|
||||
int row = Models::AddEntry(model, name, c);
|
||||
@@ -169,21 +171,21 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
|
||||
ui->comboBoxCDInterface->setCurrentIndex(-1);
|
||||
ui->comboBoxCDInterface->setCurrentIndex(selectedRow);
|
||||
|
||||
for (int i = 0; i < SCSI_CARD_MAX; ++i) {
|
||||
auto *cbox = findChild<QComboBox *>(QString("comboBoxSCSI%1").arg(i + 1));
|
||||
model = cbox->model();
|
||||
removeRows = model->rowCount();
|
||||
c = 0;
|
||||
selectedRow = 0;
|
||||
for (uint8_t i = 0; i < SCSI_CARD_MAX; ++i) {
|
||||
QComboBox *cbox = findChild<QComboBox *>(QString("comboBoxSCSI%1").arg(i + 1));
|
||||
c = 0;
|
||||
model = cbox->model();
|
||||
removeRows = model->rowCount();
|
||||
selectedRow = 0;
|
||||
|
||||
while (true) {
|
||||
auto name = DeviceConfig::DeviceName(scsi_card_getdevice(c), scsi_card_get_internal_name(c), 1);
|
||||
QString name = DeviceConfig::DeviceName(scsi_card_getdevice(c), scsi_card_get_internal_name(c), 1);
|
||||
if (name.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (scsi_card_available(c)) {
|
||||
auto *scsi_dev = scsi_card_getdevice(c);
|
||||
const device_t *scsi_dev = scsi_card_getdevice(c);
|
||||
if (device_is_valid(scsi_dev, machineId)) {
|
||||
int row = Models::AddEntry(model, name, c);
|
||||
if (c == scsi_card_current[i]) {
|
||||
@@ -236,7 +238,8 @@ SettingsStorageControllers::on_comboBoxFD_currentIndexChanged(int index)
|
||||
ui->pushButtonFD->setEnabled(hdc_has_config(ui->comboBoxFD->currentData().toInt()) > 0);
|
||||
}
|
||||
|
||||
void SettingsStorageControllers::on_comboBoxCDInterface_currentIndexChanged(int index)
|
||||
void
|
||||
SettingsStorageControllers::on_comboBoxCDInterface_currentIndexChanged(int index)
|
||||
{
|
||||
if (index < 0) {
|
||||
return;
|
||||
@@ -346,14 +349,14 @@ SettingsStorageControllers::on_pushButtonSCSI4_clicked()
|
||||
DeviceConfig::ConfigureDevice(scsi_card_getdevice(ui->comboBoxSCSI4->currentData().toInt()), 4, qobject_cast<Settings *>(Settings::settings));
|
||||
}
|
||||
|
||||
void SettingsStorageControllers::on_checkBoxLbaEnhancer_stateChanged(int arg1)
|
||||
void
|
||||
SettingsStorageControllers::on_checkBoxLbaEnhancer_stateChanged(int arg1)
|
||||
{
|
||||
ui->pushButtonConfigureLbaEnhancer->setEnabled(arg1 != 0);
|
||||
}
|
||||
|
||||
|
||||
void SettingsStorageControllers::on_pushButtonConfigureLbaEnhancer_clicked()
|
||||
void
|
||||
SettingsStorageControllers::on_pushButtonConfigureLbaEnhancer_clicked()
|
||||
{
|
||||
DeviceConfig::ConfigureDevice(&lba_enhancer_device);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user