Clean QT Sound UI
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
* Jasmine Iwanek <jriwanek@gmail.com>
|
||||
*
|
||||
* Copyright 2021 Joakim L. Gilje
|
||||
* Copyright 2022-2023 Jasmine Iwanek
|
||||
* Copyright 2022-2025 Jasmine Iwanek
|
||||
*/
|
||||
#include "qt_settingssound.hpp"
|
||||
#include "ui_qt_settingssound.h"
|
||||
@@ -76,8 +76,8 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
|
||||
int c;
|
||||
int selectedRow;
|
||||
|
||||
// Sound Card
|
||||
QComboBox * cbox[SOUND_CARD_MAX] = { 0 };
|
||||
// Sound Cards
|
||||
QComboBox *cbox[SOUND_CARD_MAX] = { 0 };
|
||||
QAbstractItemModel *models[SOUND_CARD_MAX] = { 0 };
|
||||
int removeRows_[SOUND_CARD_MAX] = { 0 };
|
||||
int selectedRows[SOUND_CARD_MAX] = { 0 };
|
||||
@@ -89,7 +89,7 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
|
||||
removeRows_[i] = models[i]->rowCount();
|
||||
}
|
||||
|
||||
c = 0;
|
||||
c = 0;
|
||||
while (true) {
|
||||
const QString name = DeviceConfig::DeviceName(sound_card_getdevice(c),
|
||||
sound_card_get_internal_name(c), 1);
|
||||
@@ -110,7 +110,7 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
|
||||
}
|
||||
}
|
||||
|
||||
c++;
|
||||
c++;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < SOUND_CARD_MAX; ++i) {
|
||||
@@ -122,21 +122,19 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
|
||||
|
||||
// Midi Out
|
||||
c = 0;
|
||||
auto model = ui->comboBoxMidiOut->model();
|
||||
auto *model = ui->comboBoxMidiOut->model();
|
||||
auto removeRows = model->rowCount();
|
||||
selectedRow = 0;
|
||||
|
||||
while (true) {
|
||||
const QString name = DeviceConfig::DeviceName(midi_out_device_getdevice(c), midi_out_device_get_internal_name(c), 0);
|
||||
if (name.isEmpty()) {
|
||||
if (name.isEmpty())
|
||||
break;
|
||||
}
|
||||
|
||||
if (midi_out_device_available(c)) {
|
||||
int row = Models::AddEntry(model, name, c);
|
||||
if (c == midi_output_device_current) {
|
||||
if (c == midi_output_device_current)
|
||||
selectedRow = row - removeRows;
|
||||
}
|
||||
}
|
||||
|
||||
c++;
|
||||
@@ -155,15 +153,13 @@ SettingsSound::onCurrentMachineChanged(const int machineId)
|
||||
|
||||
while (true) {
|
||||
const QString name = DeviceConfig::DeviceName(midi_in_device_getdevice(c), midi_in_device_get_internal_name(c), 0);
|
||||
if (name.isEmpty()) {
|
||||
if (name.isEmpty())
|
||||
break;
|
||||
}
|
||||
|
||||
if (midi_in_device_available(c)) {
|
||||
int row = Models::AddEntry(model, name, c);
|
||||
if (c == midi_input_device_current) {
|
||||
if (c == midi_input_device_current)
|
||||
selectedRow = row - removeRows;
|
||||
}
|
||||
}
|
||||
|
||||
c++;
|
||||
@@ -198,13 +194,11 @@ allowMpu401(Ui::SettingsSound *ui)
|
||||
QString midiOut = midi_out_device_get_internal_name(ui->comboBoxMidiOut->currentData().toInt());
|
||||
QString midiIn = midi_in_device_get_internal_name(ui->comboBoxMidiIn->currentData().toInt());
|
||||
|
||||
if (midiOut.isEmpty()) {
|
||||
if (midiOut.isEmpty())
|
||||
return false;
|
||||
}
|
||||
|
||||
if (midiOut == QStringLiteral("none") && midiIn == QStringLiteral("none")) {
|
||||
if (midiOut == QStringLiteral("none") && midiIn == QStringLiteral("none"))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -212,9 +206,9 @@ allowMpu401(Ui::SettingsSound *ui)
|
||||
void
|
||||
SettingsSound::on_comboBoxSoundCard1_currentIndexChanged(int index)
|
||||
{
|
||||
if (index < 0) {
|
||||
if (index < 0)
|
||||
return;
|
||||
}
|
||||
|
||||
int sndCard = ui->comboBoxSoundCard1->currentData().toInt();
|
||||
|
||||
if (sndCard == SOUND_INTERNAL)
|
||||
@@ -238,9 +232,8 @@ SettingsSound::on_pushButtonConfigureSoundCard1_clicked()
|
||||
void
|
||||
SettingsSound::on_comboBoxSoundCard2_currentIndexChanged(int index)
|
||||
{
|
||||
if (index < 0) {
|
||||
if (index < 0)
|
||||
return;
|
||||
}
|
||||
|
||||
int sndCard = ui->comboBoxSoundCard2->currentData().toInt();
|
||||
|
||||
@@ -258,9 +251,8 @@ SettingsSound::on_pushButtonConfigureSoundCard2_clicked()
|
||||
void
|
||||
SettingsSound::on_comboBoxSoundCard3_currentIndexChanged(int index)
|
||||
{
|
||||
if (index < 0) {
|
||||
if (index < 0)
|
||||
return;
|
||||
}
|
||||
|
||||
int sndCard = ui->comboBoxSoundCard3->currentData().toInt();
|
||||
|
||||
@@ -279,9 +271,8 @@ SettingsSound::on_pushButtonConfigureSoundCard3_clicked()
|
||||
void
|
||||
SettingsSound::on_comboBoxSoundCard4_currentIndexChanged(int index)
|
||||
{
|
||||
if (index < 0) {
|
||||
if (index < 0)
|
||||
return;
|
||||
}
|
||||
|
||||
int sndCard = ui->comboBoxSoundCard4->currentData().toInt();
|
||||
|
||||
@@ -300,9 +291,8 @@ SettingsSound::on_pushButtonConfigureSoundCard4_clicked()
|
||||
void
|
||||
SettingsSound::on_comboBoxMidiOut_currentIndexChanged(int index)
|
||||
{
|
||||
if (index < 0) {
|
||||
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)));
|
||||
@@ -318,9 +308,8 @@ SettingsSound::on_pushButtonConfigureMidiOut_clicked()
|
||||
void
|
||||
SettingsSound::on_comboBoxMidiIn_currentIndexChanged(int index)
|
||||
{
|
||||
if (index < 0) {
|
||||
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)));
|
||||
|
||||
@@ -20,20 +20,26 @@ public slots:
|
||||
void onCurrentMachineChanged(int machineId);
|
||||
|
||||
private slots:
|
||||
void on_pushButtonConfigureMPU401_clicked();
|
||||
void on_checkBoxMPU401_stateChanged(int arg1);
|
||||
void on_pushButtonConfigureMidiIn_clicked();
|
||||
void on_pushButtonConfigureMidiOut_clicked();
|
||||
void on_comboBoxMidiIn_currentIndexChanged(int index);
|
||||
void on_comboBoxMidiOut_currentIndexChanged(int index);
|
||||
void on_pushButtonConfigureSoundCard1_clicked();
|
||||
void on_comboBoxSoundCard1_currentIndexChanged(int index);
|
||||
void on_pushButtonConfigureSoundCard2_clicked();
|
||||
void on_pushButtonConfigureSoundCard1_clicked();
|
||||
|
||||
void on_comboBoxSoundCard2_currentIndexChanged(int index);
|
||||
void on_pushButtonConfigureSoundCard3_clicked();
|
||||
void on_pushButtonConfigureSoundCard2_clicked();
|
||||
|
||||
void on_comboBoxSoundCard3_currentIndexChanged(int index);
|
||||
void on_pushButtonConfigureSoundCard4_clicked();
|
||||
void on_pushButtonConfigureSoundCard3_clicked();
|
||||
|
||||
void on_comboBoxSoundCard4_currentIndexChanged(int index);
|
||||
void on_pushButtonConfigureSoundCard4_clicked();
|
||||
|
||||
void on_comboBoxMidiOut_currentIndexChanged(int index);
|
||||
void on_pushButtonConfigureMidiOut_clicked();
|
||||
|
||||
void on_comboBoxMidiIn_currentIndexChanged(int index);
|
||||
void on_pushButtonConfigureMidiIn_clicked();
|
||||
|
||||
void on_checkBoxMPU401_stateChanged(int arg1);
|
||||
void on_pushButtonConfigureMPU401_clicked();
|
||||
|
||||
private:
|
||||
Ui::SettingsSound *ui;
|
||||
|
||||
@@ -26,17 +26,23 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelSoundCard1">
|
||||
<property name="text">
|
||||
<string>MIDI In Device:</string>
|
||||
<string>Sound card #1:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Sound card #1:</string>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBoxSoundCard1">
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -48,12 +54,25 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<widget class="QLabel" name="labelSoundCard2">
|
||||
<property name="text">
|
||||
<string>Sound card #2:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBoxSoundCard2">
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="pushButtonConfigureSoundCard2">
|
||||
<property name="text">
|
||||
@@ -62,12 +81,25 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<widget class="QLabel" name="labelSoundCard3">
|
||||
<property name="text">
|
||||
<string>Sound card #3:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxSoundCard3">
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QPushButton" name="pushButtonConfigureSoundCard3">
|
||||
<property name="text">
|
||||
@@ -75,14 +107,26 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<widget class="QLabel" name="labelSoundCard4">
|
||||
<property name="text">
|
||||
<string>Sound card #4:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxSoundCard4">
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QPushButton" name="pushButtonConfigureSoundCard4">
|
||||
<property name="text">
|
||||
@@ -90,49 +134,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="comboBoxMidiIn">
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="labelMidiOut">
|
||||
<property name="text">
|
||||
<string>MIDI Out Device:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="checkBoxMPU401">
|
||||
<property name="text">
|
||||
<string>Standalone MPU-401</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QPushButton" name="pushButtonConfigureMPU401">
|
||||
<property name="text">
|
||||
<string>Configure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QPushButton" name="pushButtonConfigureMidiIn">
|
||||
<property name="text">
|
||||
<string>Configure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="comboBoxMidiOut">
|
||||
<property name="maxVisibleItems">
|
||||
@@ -153,6 +161,47 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="labelMidiIn">
|
||||
<property name="text">
|
||||
<string>MIDI In Device:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="comboBoxMidiIn">
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QPushButton" name="pushButtonConfigureMidiIn">
|
||||
<property name="text">
|
||||
<string>Configure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="checkBoxMPU401">
|
||||
<property name="text">
|
||||
<string>Standalone MPU-401</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QPushButton" name="pushButtonConfigureMPU401">
|
||||
<property name="text">
|
||||
<string>Configure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QCheckBox" name="checkBoxFloat32">
|
||||
<property name="text">
|
||||
@@ -171,7 +220,7 @@
|
||||
<property name="title">
|
||||
<string>FM synth driver</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_1">
|
||||
<layout class="QVBoxLayout" name="verticalLayoutFM">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonNuked">
|
||||
<property name="text">
|
||||
@@ -202,58 +251,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBoxSoundCard1">
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBoxSoundCard2">
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxSoundCard3">
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxSoundCard4">
|
||||
<property name="maxVisibleItems">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
||||
Reference in New Issue
Block a user