Merge pull request #5292 from lemondrops/qt-serial-fix
Fixes for the ports page of the settings dialog
This commit is contained in:
@@ -153,6 +153,8 @@ Settings::Settings(QWidget *parent)
|
|||||||
&SettingsSound::onCurrentMachineChanged);
|
&SettingsSound::onCurrentMachineChanged);
|
||||||
connect(machine, &SettingsMachine::currentMachineChanged, network,
|
connect(machine, &SettingsMachine::currentMachineChanged, network,
|
||||||
&SettingsNetwork::onCurrentMachineChanged);
|
&SettingsNetwork::onCurrentMachineChanged);
|
||||||
|
connect(machine, &SettingsMachine::currentMachineChanged, ports,
|
||||||
|
&SettingsPorts::onCurrentMachineChanged);
|
||||||
connect(machine, &SettingsMachine::currentMachineChanged, storageControllers,
|
connect(machine, &SettingsMachine::currentMachineChanged, storageControllers,
|
||||||
&SettingsStorageControllers::onCurrentMachineChanged);
|
&SettingsStorageControllers::onCurrentMachineChanged);
|
||||||
connect(machine, &SettingsMachine::currentMachineChanged, otherPeripherals,
|
connect(machine, &SettingsMachine::currentMachineChanged, otherPeripherals,
|
||||||
|
|||||||
@@ -38,51 +38,7 @@ SettingsPorts::SettingsPorts(QWidget *parent)
|
|||||||
, ui(new Ui::SettingsPorts)
|
, ui(new Ui::SettingsPorts)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
onCurrentMachineChanged(machine);
|
||||||
for (int i = 0; i < PARALLEL_MAX; i++) {
|
|
||||||
auto *cbox = findChild<QComboBox *>(QString("comboBoxLpt%1").arg(i + 1));
|
|
||||||
auto *model = cbox->model();
|
|
||||||
int c = 0;
|
|
||||||
int selectedRow = 0;
|
|
||||||
while (true) {
|
|
||||||
const char *lptName = lpt_device_get_name(c);
|
|
||||||
if (lptName == nullptr) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Models::AddEntry(model, tr(lptName), c);
|
|
||||||
if (c == lpt_ports[i].device) {
|
|
||||||
selectedRow = c;
|
|
||||||
}
|
|
||||||
c++;
|
|
||||||
}
|
|
||||||
cbox->setCurrentIndex(selectedRow);
|
|
||||||
|
|
||||||
auto *checkBox = findChild<QCheckBox *>(QString("checkBoxParallel%1").arg(i + 1));
|
|
||||||
if (checkBox != NULL)
|
|
||||||
checkBox->setChecked(lpt_ports[i].enabled > 0);
|
|
||||||
if (cbox != NULL)
|
|
||||||
cbox->setEnabled(lpt_ports[i].enabled > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < SERIAL_MAX; i++) {
|
|
||||||
auto *checkBox = findChild<QCheckBox *>(QString("checkBoxSerial%1").arg(i + 1));
|
|
||||||
auto *checkBoxPass = findChild<QCheckBox *>(QString("checkBoxSerialPassThru%1").arg(i + 1));
|
|
||||||
if (checkBox != NULL)
|
|
||||||
checkBox->setChecked(com_ports[i].enabled > 0);
|
|
||||||
if (checkBoxPass != NULL)
|
|
||||||
checkBoxPass->setChecked(serial_passthrough_enabled[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->pushButtonSerialPassThru1->setEnabled(serial_passthrough_enabled[0]);
|
|
||||||
ui->pushButtonSerialPassThru2->setEnabled(serial_passthrough_enabled[1]);
|
|
||||||
ui->pushButtonSerialPassThru3->setEnabled(serial_passthrough_enabled[2]);
|
|
||||||
ui->pushButtonSerialPassThru4->setEnabled(serial_passthrough_enabled[3]);
|
|
||||||
#if 0
|
|
||||||
ui->pushButtonSerialPassThru5->setEnabled(serial_passthrough_enabled[4]);
|
|
||||||
ui->pushButtonSerialPassThru6->setEnabled(serial_passthrough_enabled[5]);
|
|
||||||
ui->pushButtonSerialPassThru7->setEnabled(serial_passthrough_enabled[6]);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPorts::~SettingsPorts()
|
SettingsPorts::~SettingsPorts()
|
||||||
@@ -112,6 +68,51 @@ SettingsPorts::save()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SettingsPorts::onCurrentMachineChanged(int machineId)
|
||||||
|
{
|
||||||
|
this->machineId = machineId;
|
||||||
|
|
||||||
|
for (int i = 0; i < PARALLEL_MAX; i++) {
|
||||||
|
auto *cbox = findChild<QComboBox *>(QString("comboBoxLpt%1").arg(i + 1));
|
||||||
|
auto *model = cbox->model();
|
||||||
|
int c = 0;
|
||||||
|
int selectedRow = 0;
|
||||||
|
while (true) {
|
||||||
|
const char *lptName = lpt_device_get_name(c);
|
||||||
|
if (lptName == nullptr) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Models::AddEntry(model, tr(lptName), c);
|
||||||
|
if (c == lpt_ports[i].device) {
|
||||||
|
selectedRow = c;
|
||||||
|
}
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
cbox->setCurrentIndex(selectedRow);
|
||||||
|
|
||||||
|
auto *checkBox = findChild<QCheckBox *>(QString("checkBoxParallel%1").arg(i + 1));
|
||||||
|
if (checkBox != NULL)
|
||||||
|
checkBox->setChecked(lpt_ports[i].enabled > 0);
|
||||||
|
if (cbox != NULL)
|
||||||
|
cbox->setEnabled(lpt_ports[i].enabled > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < SERIAL_MAX; i++) {
|
||||||
|
auto *checkBox = findChild<QCheckBox *>(QString("checkBoxSerial%1").arg(i + 1));
|
||||||
|
auto *checkBoxPass = findChild<QCheckBox *>(QString("checkBoxSerialPassThru%1").arg(i + 1));
|
||||||
|
auto *buttonPass = findChild<QPushButton *>(QString("pushButtonSerialPassThru%1").arg(i + 1));
|
||||||
|
if (checkBox != NULL)
|
||||||
|
checkBox->setChecked(com_ports[i].enabled > 0);
|
||||||
|
if (checkBoxPass != NULL) {
|
||||||
|
checkBoxPass->setEnabled(com_ports[i].enabled > 0);
|
||||||
|
checkBoxPass->setChecked(serial_passthrough_enabled[i]);
|
||||||
|
buttonPass->setEnabled((com_ports[i].enabled > 0) && serial_passthrough_enabled[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SettingsPorts::on_checkBoxParallel1_stateChanged(int state)
|
SettingsPorts::on_checkBoxParallel1_stateChanged(int state)
|
||||||
{
|
{
|
||||||
@@ -136,6 +137,101 @@ SettingsPorts::on_checkBoxParallel4_stateChanged(int state)
|
|||||||
ui->comboBoxLpt4->setEnabled(state == Qt::Checked);
|
ui->comboBoxLpt4->setEnabled(state == Qt::Checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SettingsPorts::on_checkBoxSerial1_stateChanged(int state)
|
||||||
|
{
|
||||||
|
ui->checkBoxSerialPassThru1->setEnabled(state == Qt::Checked);
|
||||||
|
ui->pushButtonSerialPassThru1->setEnabled((state == Qt::Checked) && ui->checkBoxSerialPassThru1->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SettingsPorts::on_checkBoxSerial2_stateChanged(int state)
|
||||||
|
{
|
||||||
|
ui->checkBoxSerialPassThru2->setEnabled(state == Qt::Checked);
|
||||||
|
ui->pushButtonSerialPassThru2->setEnabled((state == Qt::Checked) && ui->checkBoxSerialPassThru2->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SettingsPorts::on_checkBoxSerial3_stateChanged(int state)
|
||||||
|
{
|
||||||
|
ui->checkBoxSerialPassThru3->setEnabled(state == Qt::Checked);
|
||||||
|
ui->pushButtonSerialPassThru3->setEnabled((state == Qt::Checked) && ui->checkBoxSerialPassThru3->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SettingsPorts::on_checkBoxSerial4_stateChanged(int state)
|
||||||
|
{
|
||||||
|
ui->checkBoxSerialPassThru4->setEnabled(state == Qt::Checked);
|
||||||
|
ui->pushButtonSerialPassThru4->setEnabled((state == Qt::Checked) && ui->checkBoxSerialPassThru4->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void
|
||||||
|
SettingsPorts::on_checkBoxSerial5_stateChanged(int state)
|
||||||
|
{
|
||||||
|
ui->checkBoxSerialPassThru5->setEnabled(state == Qt::Checked);
|
||||||
|
ui->pushButtonSerialPassThru5->setEnabled((state == Qt::Checked) && ui->checkBoxSerialPassThru5->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SettingsPorts::on_checkBoxSerial6_stateChanged(int state)
|
||||||
|
{
|
||||||
|
ui->checkBoxSerialPassThru6->setEnabled(state == Qt::Checked);
|
||||||
|
ui->pushButtonSerialPassThru6->setEnabled((state == Qt::Checked) && ui->checkBoxSerialPassThru6->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SettingsPorts::on_checkBoxSerial7_stateChanged(int state)
|
||||||
|
{
|
||||||
|
ui->checkBoxSerialPassThru7->setEnabled(state == Qt::Checked);
|
||||||
|
ui->pushButtonSerialPassThru7->setEnabled((state == Qt::Checked) && ui->checkBoxSerialPassThru7->isChecked());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void
|
||||||
|
SettingsPorts::on_checkBoxSerialPassThru1_stateChanged(int state)
|
||||||
|
{
|
||||||
|
ui->pushButtonSerialPassThru1->setEnabled(state == Qt::Checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SettingsPorts::on_checkBoxSerialPassThru2_stateChanged(int state)
|
||||||
|
{
|
||||||
|
ui->pushButtonSerialPassThru2->setEnabled(state == Qt::Checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SettingsPorts::on_checkBoxSerialPassThru3_stateChanged(int state)
|
||||||
|
{
|
||||||
|
ui->pushButtonSerialPassThru3->setEnabled(state == Qt::Checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SettingsPorts::on_checkBoxSerialPassThru4_stateChanged(int state)
|
||||||
|
{
|
||||||
|
ui->pushButtonSerialPassThru4->setEnabled(state == Qt::Checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void
|
||||||
|
SettingsPorts::on_checkBoxSerialPassThru5_stateChanged(int state)
|
||||||
|
{
|
||||||
|
ui->pushButtonSerialPassThru5->setEnabled(state == Qt::Checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SettingsPorts::on_checkBoxSerialPassThru6_stateChanged(int state)
|
||||||
|
{
|
||||||
|
ui->pushButtonSerialPassThru6->setEnabled(state == Qt::Checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SettingsPorts::on_checkBoxSerialPassThru7_stateChanged(int state)
|
||||||
|
{
|
||||||
|
ui->pushButtonSerialPassThru7->setEnabled(state == Qt::Checked);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
SettingsPorts::on_pushButtonSerialPassThru1_clicked()
|
SettingsPorts::on_pushButtonSerialPassThru1_clicked()
|
||||||
{
|
{
|
||||||
@@ -179,47 +275,3 @@ SettingsPorts::on_pushButtonSerialPassThru7_clicked()
|
|||||||
DeviceConfig::ConfigureDevice(&serial_passthrough_device, 7, qobject_cast<Settings *>(Settings::settings));
|
DeviceConfig::ConfigureDevice(&serial_passthrough_device, 7, qobject_cast<Settings *>(Settings::settings));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
|
||||||
SettingsPorts::on_checkBoxSerialPassThru1_clicked(bool checked)
|
|
||||||
{
|
|
||||||
ui->pushButtonSerialPassThru1->setEnabled(checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
SettingsPorts::on_checkBoxSerialPassThru2_clicked(bool checked)
|
|
||||||
{
|
|
||||||
ui->pushButtonSerialPassThru2->setEnabled(checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
SettingsPorts::on_checkBoxSerialPassThru3_clicked(bool checked)
|
|
||||||
{
|
|
||||||
ui->pushButtonSerialPassThru3->setEnabled(checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
SettingsPorts::on_checkBoxSerialPassThru4_clicked(bool checked)
|
|
||||||
{
|
|
||||||
ui->pushButtonSerialPassThru4->setEnabled(checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
void
|
|
||||||
SettingsPorts::on_checkBoxSerialPassThru5_clicked(bool checked)
|
|
||||||
{
|
|
||||||
ui->pushButtonSerialPassThru5->setEnabled(checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
SettingsPorts::on_checkBoxSerialPassThru6_clicked(bool checked)
|
|
||||||
{
|
|
||||||
ui->pushButtonSerialPassThru6->setEnabled(checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
SettingsPorts::on_checkBoxSerialPassThru7_clicked(bool checked)
|
|
||||||
{
|
|
||||||
ui->pushButtonSerialPassThru7->setEnabled(checked);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -16,36 +16,47 @@ public:
|
|||||||
|
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
#if 0
|
public slots:
|
||||||
private slots:
|
void onCurrentMachineChanged(int machineId);
|
||||||
void on_checkBoxSerialPassThru7_clicked(bool checked);
|
|
||||||
void on_checkBoxSerialPassThru6_clicked(bool checked);
|
|
||||||
void on_checkBoxSerialPassThru5_clicked(bool checked);
|
|
||||||
#endif
|
|
||||||
void on_checkBoxSerialPassThru4_clicked(bool checked);
|
|
||||||
void on_checkBoxSerialPassThru3_clicked(bool checked);
|
|
||||||
void on_checkBoxSerialPassThru2_clicked(bool checked);
|
|
||||||
void on_checkBoxSerialPassThru1_clicked(bool checked);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void on_checkBoxParallel1_stateChanged(int state);
|
||||||
|
void on_checkBoxParallel2_stateChanged(int state);
|
||||||
|
void on_checkBoxParallel3_stateChanged(int state);
|
||||||
|
void on_checkBoxParallel4_stateChanged(int state);
|
||||||
|
|
||||||
|
void on_checkBoxSerial1_stateChanged(int state);
|
||||||
|
void on_checkBoxSerial2_stateChanged(int state);
|
||||||
|
void on_checkBoxSerial3_stateChanged(int state);
|
||||||
|
void on_checkBoxSerial4_stateChanged(int state);
|
||||||
#if 0
|
#if 0
|
||||||
void on_pushButtonSerialPassThru7_clicked();
|
void on_checkBoxSerial5_stateChanged(int state);
|
||||||
void on_pushButtonSerialPassThru6_clicked();
|
void on_checkBoxSerial6_stateChanged(int state);
|
||||||
void on_pushButtonSerialPassThru5_clicked();
|
void on_checkBoxSerial7_stateChanged(int state);
|
||||||
#endif
|
#endif
|
||||||
void on_pushButtonSerialPassThru4_clicked();
|
void on_checkBoxSerialPassThru1_stateChanged(int state);
|
||||||
void on_pushButtonSerialPassThru3_clicked();
|
void on_checkBoxSerialPassThru2_stateChanged(int state);
|
||||||
void on_pushButtonSerialPassThru2_clicked();
|
void on_checkBoxSerialPassThru3_stateChanged(int state);
|
||||||
|
void on_checkBoxSerialPassThru4_stateChanged(int state);
|
||||||
|
#if 0
|
||||||
|
void on_checkBoxSerialPassThru5_stateChanged(int state);
|
||||||
|
void on_checkBoxSerialPassThru6_stateChanged(int state);
|
||||||
|
void on_checkBoxSerialPassThru7_stateChanged(int state);
|
||||||
|
#endif
|
||||||
|
|
||||||
void on_pushButtonSerialPassThru1_clicked();
|
void on_pushButtonSerialPassThru1_clicked();
|
||||||
|
void on_pushButtonSerialPassThru2_clicked();
|
||||||
private slots:
|
void on_pushButtonSerialPassThru3_clicked();
|
||||||
void on_checkBoxParallel4_stateChanged(int arg1);
|
void on_pushButtonSerialPassThru4_clicked();
|
||||||
void on_checkBoxParallel3_stateChanged(int arg1);
|
#if 0
|
||||||
void on_checkBoxParallel2_stateChanged(int arg1);
|
void on_pushButtonSerialPassThru5_clicked();
|
||||||
void on_checkBoxParallel1_stateChanged(int arg1);
|
void on_pushButtonSerialPassThru6_clicked();
|
||||||
|
void on_pushButtonSerialPassThru7_clicked();
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::SettingsPorts *ui;
|
Ui::SettingsPorts *ui;
|
||||||
|
int machineId = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QT_SETTINGSPORTS_HPP
|
#endif // QT_SETTINGSPORTS_HPP
|
||||||
|
|||||||
Reference in New Issue
Block a user