Skip to content

Commit

Permalink
Qt: Implement Batch flag (-b)
Browse files Browse the repository at this point in the history
  • Loading branch information
spycrab committed Apr 29, 2018
1 parent 1c9b64f commit 2a837a8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions Source/Core/DolphinQt2/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DolphinQt2/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions Source/Core/DolphinQt2/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
3 changes: 3 additions & 0 deletions Source/Core/DolphinQt2/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class Settings final : public QObject
// Emulation
int GetStateSlot() const;
void SetStateSlot(int);
bool IsBatchModeEnabled() const;
void SetBatchModeEnabled(bool batch);

// Graphics
void SetHideCursor(bool hide_cursor);
Expand Down Expand Up @@ -147,6 +149,7 @@ class Settings final : public QObject
void AnalyticsToggled(bool enabled);

private:
bool m_batch = false;
bool m_controller_state_needed = false;
std::unique_ptr<NetPlayClient> m_client;
std::unique_ptr<NetPlayServer> m_server;
Expand Down

0 comments on commit 2a837a8

Please sign in to comment.