Qt UI improvements

* Port 209b5d9cd1 to Qt UI
* Remove dividers from status bar
* Make OpenGL ES available as an option only if ANGLE is used
This commit is contained in:
Cacodemon345
2021-12-23 17:05:11 +06:00
parent f481574a0f
commit 17c3e803a4
4 changed files with 36 additions and 8 deletions

View File

@@ -57,6 +57,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui->setupUi(this); ui->setupUi(this);
ui->stackedWidget->setMouseTracking(true); ui->stackedWidget->setMouseTracking(true);
statusBar()->setVisible(!hide_status_bar); statusBar()->setVisible(!hide_status_bar);
statusBar()->setStyleSheet("QStatusBar::item {border: None;}");
this->setWindowIcon(QIcon(":/settings/win/icons/86Box-yellow.ico")); this->setWindowIcon(QIcon(":/settings/win/icons/86Box-yellow.ico"));
@@ -252,8 +253,8 @@ MainWindow::MainWindow(QWidget *parent) :
} }
#ifdef Q_OS_WINDOWS #ifdef Q_OS_WINDOWS
/* qt opengles doesn't work (yet?) so hide the menu option */ /* Make the option visible only if ANGLE is loaded. */
ui->actionHardware_Renderer_OpenGL_ES->setVisible(false); ui->actionHardware_Renderer_OpenGL_ES->setVisible(QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES);
#endif #endif
setFocusPolicy(Qt::StrongFocus); setFocusPolicy(Qt::StrongFocus);
@@ -890,10 +891,11 @@ uint16_t x11_keycode_to_keysym(uint32_t keycode)
void MainWindow::on_actionFullscreen_triggered() { void MainWindow::on_actionFullscreen_triggered() {
if (video_fullscreen > 0) { if (video_fullscreen > 0) {
showNormal();
ui->menubar->show(); ui->menubar->show();
ui->statusbar->show(); ui->statusbar->show();
showNormal();
video_fullscreen = 0; video_fullscreen = 0;
setGeometry(geometry());
} else { } else {
ui->menubar->hide(); ui->menubar->hide();
ui->statusbar->hide(); ui->statusbar->hide();

View File

@@ -112,6 +112,7 @@ Settings::Settings(QWidget *parent) :
connect(machine, &SettingsMachine::currentMachineChanged, sound, &SettingsSound::onCurrentMachineChanged); connect(machine, &SettingsMachine::currentMachineChanged, sound, &SettingsSound::onCurrentMachineChanged);
connect(machine, &SettingsMachine::currentMachineChanged, network, &SettingsNetwork::onCurrentMachineChanged); connect(machine, &SettingsMachine::currentMachineChanged, network, &SettingsNetwork::onCurrentMachineChanged);
connect(machine, &SettingsMachine::currentMachineChanged, storageControllers, &SettingsStorageControllers::onCurrentMachineChanged); connect(machine, &SettingsMachine::currentMachineChanged, storageControllers, &SettingsStorageControllers::onCurrentMachineChanged);
connect(machine, &SettingsMachine::currentMachineChanged, otherPeripherals, &SettingsOtherPeripherals::onCurrentMachineChanged);
connect(ui->listView->selectionModel(), &QItemSelectionModel::currentChanged, this, [this](const QModelIndex &current, const QModelIndex &previous) { connect(ui->listView->selectionModel(), &QItemSelectionModel::currentChanged, this, [this](const QModelIndex &current, const QModelIndex &previous) {
ui->stackedWidget->setCurrentIndex(current.row()); ui->stackedWidget->setCurrentIndex(current.row());

View File

@@ -4,6 +4,7 @@
extern "C" { extern "C" {
#include <86box/86box.h> #include <86box/86box.h>
#include <86box/device.h> #include <86box/device.h>
#include <86box/machine.h>
#include <86box/isamem.h> #include <86box/isamem.h>
#include <86box/isartc.h> #include <86box/isartc.h>
} }
@@ -16,9 +17,18 @@ SettingsOtherPeripherals::SettingsOtherPeripherals(QWidget *parent) :
ui(new Ui::SettingsOtherPeripherals) ui(new Ui::SettingsOtherPeripherals)
{ {
ui->setupUi(this); ui->setupUi(this);
onCurrentMachineChanged(machine);
}
void SettingsOtherPeripherals::onCurrentMachineChanged(int machineId)
{
this->machineId = machineId;
ui->checkBoxISABugger->setChecked(bugger_enabled > 0 ? true : false); ui->checkBoxISABugger->setChecked(bugger_enabled > 0 ? true : false);
ui->checkBoxPOSTCard->setChecked(postcard_enabled > 0 ? true : false); ui->checkBoxPOSTCard->setChecked(postcard_enabled > 0 ? true : false);
ui->checkBoxISABugger->setEnabled(machine_has_bus(machineId, MACHINE_BUS_ISA));
ui->comboBoxRTC->setEnabled(machine_has_bus(machineId, MACHINE_BUS_ISA));
ui->pushButtonConfigureRTC->setEnabled(machine_has_bus(machineId, MACHINE_BUS_ISA));
auto* model = ui->comboBoxRTC->model(); auto* model = ui->comboBoxRTC->model();
int d = 0; int d = 0;
@@ -29,6 +39,10 @@ SettingsOtherPeripherals::SettingsOtherPeripherals(QWidget *parent) :
break; break;
} }
if (!device_is_valid(isartc_get_device(d), machineId)) {
break;
}
int row = Models::AddEntry(model, name, d); int row = Models::AddEntry(model, name, d);
if (d == isartc_type) { if (d == isartc_type) {
selectedRow = row; selectedRow = row;
@@ -48,6 +62,10 @@ SettingsOtherPeripherals::SettingsOtherPeripherals(QWidget *parent) :
break; break;
} }
if (!device_is_valid(isamem_get_device(d), machineId)) {
break;
}
int row = Models::AddEntry(model, name, d); int row = Models::AddEntry(model, name, d);
if (d == isamem_type[c]) { if (d == isamem_type[c]) {
selectedRow = row; selectedRow = row;
@@ -56,6 +74,8 @@ SettingsOtherPeripherals::SettingsOtherPeripherals(QWidget *parent) :
} }
cbox->setCurrentIndex(-1); cbox->setCurrentIndex(-1);
cbox->setCurrentIndex(selectedRow); cbox->setCurrentIndex(selectedRow);
cbox->setEnabled(machine_has_bus(machineId, MACHINE_BUS_ISA));
findChild<QPushButton*>(QString("pushButtonConfigureCard%1").arg(c + 1))->setEnabled(isamem_type[c] != 0 && machine_has_bus(machineId, MACHINE_BUS_ISA));
} }
} }
@@ -81,7 +101,7 @@ void SettingsOtherPeripherals::on_comboBoxRTC_currentIndexChanged(int index) {
if (index < 0) { if (index < 0) {
return; return;
} }
ui->pushButtonConfigureRTC->setEnabled(index != 0); ui->pushButtonConfigureRTC->setEnabled(index != 0 && machine_has_bus(machineId, MACHINE_BUS_ISA));
} }
void SettingsOtherPeripherals::on_pushButtonConfigureRTC_clicked() { void SettingsOtherPeripherals::on_pushButtonConfigureRTC_clicked() {
@@ -92,7 +112,7 @@ void SettingsOtherPeripherals::on_comboBoxCard1_currentIndexChanged(int index) {
if (index < 0) { if (index < 0) {
return; return;
} }
ui->pushButtonConfigureCard1->setEnabled(index != 0); ui->pushButtonConfigureCard1->setEnabled(index != 0 && machine_has_bus(machineId, MACHINE_BUS_ISA));
} }
void SettingsOtherPeripherals::on_pushButtonConfigureCard1_clicked() { void SettingsOtherPeripherals::on_pushButtonConfigureCard1_clicked() {
@@ -103,7 +123,7 @@ void SettingsOtherPeripherals::on_comboBoxCard2_currentIndexChanged(int index) {
if (index < 0) { if (index < 0) {
return; return;
} }
ui->pushButtonConfigureCard2->setEnabled(index != 0); ui->pushButtonConfigureCard2->setEnabled(index != 0 && machine_has_bus(machineId, MACHINE_BUS_ISA));
} }
void SettingsOtherPeripherals::on_pushButtonConfigureCard2_clicked() { void SettingsOtherPeripherals::on_pushButtonConfigureCard2_clicked() {
@@ -114,7 +134,7 @@ void SettingsOtherPeripherals::on_comboBoxCard3_currentIndexChanged(int index) {
if (index < 0) { if (index < 0) {
return; return;
} }
ui->pushButtonConfigureCard3->setEnabled(index != 0); ui->pushButtonConfigureCard3->setEnabled(index != 0 && machine_has_bus(machineId, MACHINE_BUS_ISA));
} }
void SettingsOtherPeripherals::on_pushButtonConfigureCard3_clicked() { void SettingsOtherPeripherals::on_pushButtonConfigureCard3_clicked() {
@@ -125,7 +145,7 @@ void SettingsOtherPeripherals::on_comboBoxCard4_currentIndexChanged(int index) {
if (index < 0) { if (index < 0) {
return; return;
} }
ui->pushButtonConfigureCard4->setEnabled(index != 0); ui->pushButtonConfigureCard4->setEnabled(index != 0 && machine_has_bus(machineId, MACHINE_BUS_ISA));
} }
void SettingsOtherPeripherals::on_pushButtonConfigureCard4_clicked() { void SettingsOtherPeripherals::on_pushButtonConfigureCard4_clicked() {

View File

@@ -16,6 +16,10 @@ public:
~SettingsOtherPeripherals(); ~SettingsOtherPeripherals();
void save(); void save();
public slots:
void onCurrentMachineChanged(int machineId);
private slots: private slots:
void on_pushButtonConfigureCard4_clicked(); void on_pushButtonConfigureCard4_clicked();
void on_comboBoxCard4_currentIndexChanged(int index); void on_comboBoxCard4_currentIndexChanged(int index);
@@ -30,6 +34,7 @@ private slots:
private: private:
Ui::SettingsOtherPeripherals *ui; Ui::SettingsOtherPeripherals *ui;
int machineId{0};
}; };
#endif // QT_SETTINGSOTHERPERIPHERALS_HPP #endif // QT_SETTINGSOTHERPERIPHERALS_HPP