From 34b9c824e07da562b82a9a333b23ee4f2c224cd2 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sun, 6 Feb 2022 12:45:55 +0600 Subject: [PATCH] Settings mode behaviour now identical to Win32 --- src/qt/qt_main.cpp | 16 +++++++++++++++- src/qt/qt_mainwindow.cpp | 6 ------ src/qt/qt_settings.cpp | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/qt/qt_main.cpp b/src/qt/qt_main.cpp index 6df56c6e6..f9200f08b 100644 --- a/src/qt/qt_main.cpp +++ b/src/qt/qt_main.cpp @@ -24,11 +24,15 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin) #include <86box/win.h> #endif +extern "C" +{ #include <86box/86box.h> +#include <86box/config.h> #include <86box/plat.h> #include <86box/ui.h> #include <86box/video.h> #include <86box/discord.h> +} #include #include @@ -36,6 +40,7 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin) #include "qt_mainwindow.hpp" #include "qt_progsettings.hpp" +#include "qt_settings.hpp" #include "cocoa_mouse.hpp" #include "qt_styleoverride.hpp" @@ -131,6 +136,16 @@ int main(int argc, char* argv[]) { } discord_load(); + if (settings_only) + { + Settings settings; + if (settings.exec() == QDialog::Accepted) + { + settings.save(); + config_save(); + } + return 0; + } main_window = new MainWindow(); main_window->show(); app.installEventFilter(main_window); @@ -182,7 +197,6 @@ int main(int argc, char* argv[]) { /* Set the PAUSE mode depending on the renderer. */ // plat_pause(0); - if (settings_only) dopause = 1; QTimer onesec; QTimer discordupdate; QObject::connect(&onesec, &QTimer::timeout, &app, [] { diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index f7afab6e7..881053cdc 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -442,7 +442,6 @@ void MainWindow::showEvent(QShowEvent *event) { scrnsz_x = window_w; scrnsz_y = window_h; } - if (settings_only) QTimer::singleShot(0, this, [this] () { ui->actionSettings->trigger(); }); } void MainWindow::on_actionKeyboard_requires_capture_triggered() { @@ -518,11 +517,6 @@ void MainWindow::on_actionSettings_triggered() { break; } plat_pause(currentPause); - if (settings_only) { - cpu_thread_run = 0; - config_save(); - QApplication::quit(); - } } std::array x11_to_xt_base diff --git a/src/qt/qt_settings.cpp b/src/qt/qt_settings.cpp index fbd16254e..b7678bb8e 100644 --- a/src/qt/qt_settings.cpp +++ b/src/qt/qt_settings.cpp @@ -149,7 +149,7 @@ void Settings::save() { void Settings::accept() { - if (confirm_save) + if (confirm_save && !settings_only) { QMessageBox questionbox(QMessageBox::Icon::Question, "86Box", QStringLiteral("%1\n\n%2").arg(tr("Do you want to save the settings?"), tr("This will hard reset the emulated machine.")), QMessageBox::Save | QMessageBox::Cancel, this); QCheckBox *chkbox = new QCheckBox(tr("Don't show this message again"));