Settings mode behaviour now identical to Win32

This commit is contained in:
Cacodemon345
2022-02-06 12:45:55 +06:00
parent c311658330
commit 34b9c824e0
3 changed files with 16 additions and 8 deletions

View File

@@ -24,11 +24,15 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin)
#include <86box/win.h> #include <86box/win.h>
#endif #endif
extern "C"
{
#include <86box/86box.h> #include <86box/86box.h>
#include <86box/config.h>
#include <86box/plat.h> #include <86box/plat.h>
#include <86box/ui.h> #include <86box/ui.h>
#include <86box/video.h> #include <86box/video.h>
#include <86box/discord.h> #include <86box/discord.h>
}
#include <thread> #include <thread>
#include <iostream> #include <iostream>
@@ -36,6 +40,7 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin)
#include "qt_mainwindow.hpp" #include "qt_mainwindow.hpp"
#include "qt_progsettings.hpp" #include "qt_progsettings.hpp"
#include "qt_settings.hpp"
#include "cocoa_mouse.hpp" #include "cocoa_mouse.hpp"
#include "qt_styleoverride.hpp" #include "qt_styleoverride.hpp"
@@ -131,6 +136,16 @@ int main(int argc, char* argv[]) {
} }
discord_load(); discord_load();
if (settings_only)
{
Settings settings;
if (settings.exec() == QDialog::Accepted)
{
settings.save();
config_save();
}
return 0;
}
main_window = new MainWindow(); main_window = new MainWindow();
main_window->show(); main_window->show();
app.installEventFilter(main_window); app.installEventFilter(main_window);
@@ -182,7 +197,6 @@ int main(int argc, char* argv[]) {
/* Set the PAUSE mode depending on the renderer. */ /* Set the PAUSE mode depending on the renderer. */
// plat_pause(0); // plat_pause(0);
if (settings_only) dopause = 1;
QTimer onesec; QTimer onesec;
QTimer discordupdate; QTimer discordupdate;
QObject::connect(&onesec, &QTimer::timeout, &app, [] { QObject::connect(&onesec, &QTimer::timeout, &app, [] {

View File

@@ -442,7 +442,6 @@ void MainWindow::showEvent(QShowEvent *event) {
scrnsz_x = window_w; scrnsz_x = window_w;
scrnsz_y = window_h; scrnsz_y = window_h;
} }
if (settings_only) QTimer::singleShot(0, this, [this] () { ui->actionSettings->trigger(); });
} }
void MainWindow::on_actionKeyboard_requires_capture_triggered() { void MainWindow::on_actionKeyboard_requires_capture_triggered() {
@@ -518,11 +517,6 @@ void MainWindow::on_actionSettings_triggered() {
break; break;
} }
plat_pause(currentPause); plat_pause(currentPause);
if (settings_only) {
cpu_thread_run = 0;
config_save();
QApplication::quit();
}
} }
std::array<uint32_t, 256> x11_to_xt_base std::array<uint32_t, 256> x11_to_xt_base

View File

@@ -149,7 +149,7 @@ void Settings::save() {
void Settings::accept() 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); 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")); QCheckBox *chkbox = new QCheckBox(tr("Don't show this message again"));