From 2a837a82d45b68e07a97f782b546f1ca4e052ced Mon Sep 17 00:00:00 2001 From: spycrab Date: Sun, 29 Apr 2018 19:13:40 +0200 Subject: [PATCH] Qt: Implement Batch flag (-b) --- Source/Core/DolphinQt2/Main.cpp | 1 + Source/Core/DolphinQt2/MainWindow.cpp | 2 +- Source/Core/DolphinQt2/Settings.cpp | 9 +++++++++ Source/Core/DolphinQt2/Settings.h | 3 +++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/Core/DolphinQt2/Main.cpp b/Source/Core/DolphinQt2/Main.cpp index 4c615676b2..878efef2f8 100644 --- a/Source/Core/DolphinQt2/Main.cpp +++ b/Source/Core/DolphinQt2/Main.cpp @@ -87,6 +87,7 @@ int main(int argc, char* argv[]) UICommon::Init(); Resources::Init(); Settings::Instance().SetDebugModeEnabled(options.is_set("debugger")); + Settings::Instance().SetBatchModeEnabled(options.is_set("batch")); // Hook up alerts from core RegisterMsgAlertHandler(QtMsgAlertHandler); diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp index 78f76bedd7..de05df1602 100644 --- a/Source/Core/DolphinQt2/MainWindow.cpp +++ b/Source/Core/DolphinQt2/MainWindow.cpp @@ -526,7 +526,7 @@ void MainWindow::OnStopComplete() m_stop_requested = false; HideRenderWidget(); - if (m_exit_requested) + if (m_exit_requested || Settings::Instance().IsBatchModeEnabled()) QGuiApplication::instance()->quit(); // If the current emulation prevented the booting of another, do that now diff --git a/Source/Core/DolphinQt2/Settings.cpp b/Source/Core/DolphinQt2/Settings.cpp index d289eef494..70e321e91b 100644 --- a/Source/Core/DolphinQt2/Settings.cpp +++ b/Source/Core/DolphinQt2/Settings.cpp @@ -416,3 +416,12 @@ bool Settings::AreWidgetsLocked() const { return GetQSettings().value(QStringLiteral("widgets/locked"), true).toBool(); } + +bool Settings::IsBatchModeEnabled() const +{ + return m_batch; +} +void Settings::SetBatchModeEnabled(bool batch) +{ + m_batch = batch; +} diff --git a/Source/Core/DolphinQt2/Settings.h b/Source/Core/DolphinQt2/Settings.h index eea558546c..5ea267afb8 100644 --- a/Source/Core/DolphinQt2/Settings.h +++ b/Source/Core/DolphinQt2/Settings.h @@ -70,6 +70,8 @@ public: // Emulation int GetStateSlot() const; void SetStateSlot(int); + bool IsBatchModeEnabled() const; + void SetBatchModeEnabled(bool batch); // Graphics void SetHideCursor(bool hide_cursor); @@ -147,6 +149,7 @@ signals: void AnalyticsToggled(bool enabled); private: + bool m_batch = false; bool m_controller_state_needed = false; std::unique_ptr m_client; std::unique_ptr m_server;