From 663dd8d88768583cb943e32774254d09567a50e0 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Thu, 7 Apr 2022 15:55:22 +0200 Subject: [PATCH] added autostart feature --- core/src/command_args.cpp | 1 + core/src/gui/main_window.cpp | 7 +++++++ core/src/gui/main_window.h | 1 + 3 files changed, 9 insertions(+) diff --git a/core/src/command_args.cpp b/core/src/command_args.cpp index 75418fa..33ef374 100644 --- a/core/src/command_args.cpp +++ b/core/src/command_args.cpp @@ -18,6 +18,7 @@ void CommandArgsParser::defineAll() { define('p', "port", "Server mode port", 5259); define('r', "root", "Root directory, where all config files are stored", std::filesystem::absolute(root).string()); define('s', "server", "Run in server mode"); + define('\0', "autostart", "Automatically start the SDR after loading"); } int CommandArgsParser::parse(int argc, char* argv[]) { diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp index 0c377fd..a684c41 100644 --- a/core/src/gui/main_window.cpp +++ b/core/src/gui/main_window.cpp @@ -221,6 +221,7 @@ void MainWindow::init() { } } + autostart = core::args["autostart"].b(); initComplete = true; core::moduleManager.doPostInitAll(); @@ -385,6 +386,12 @@ void MainWindow::draw() { } if (playButtonLocked && !tmpPlaySate) { style::endDisabled(); } + // Handle auto-start + if (autostart) { + autostart = false; + setPlayState(true); + } + ImGui::SameLine(); float origY = ImGui::GetCursorPosY(); diff --git a/core/src/gui/main_window.h b/core/src/gui/main_window.h index b46cff1..e7aaee8 100644 --- a/core/src/gui/main_window.h +++ b/core/src/gui/main_window.h @@ -63,6 +63,7 @@ private: int selectedWindow = 0; bool initComplete = false; + bool autostart = false; EventHandler vfoCreatedHandler; }; \ No newline at end of file