From 7c98edccc52b91c0de475a1d0beaf60d7b4625a9 Mon Sep 17 00:00:00 2001 From: cg2121 Date: Wed, 11 Jan 2017 13:19:17 -0600 Subject: [PATCH] UI: Add more command line options --- UI/obs-app.cpp | 44 ++++++++++++++++++++++++++++++++++++++++ UI/obs-app.hpp | 3 +++ UI/window-basic-main.cpp | 20 +++++++++++++++--- 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp index 8fd6f0bbc..c98432ba1 100644 --- a/UI/obs-app.cpp +++ b/UI/obs-app.cpp @@ -51,6 +51,8 @@ #include #endif +#include + using namespace std; static log_handler_t def_log_handler; @@ -63,6 +65,9 @@ static bool log_verbose = false; static bool unfiltered_log = false; bool opt_start_streaming = false; bool opt_start_recording = false; +bool opt_studio_mode = false; +bool opt_start_replaybuffer = false; +bool opt_minimize_tray = false; string opt_starting_collection; string opt_starting_profile; string opt_starting_scene; @@ -1749,6 +1754,9 @@ int main(int argc, char *argv[]) } else if (arg_is(argv[i], "--startrecording", nullptr)) { opt_start_recording = true; + } else if (arg_is(argv[i], "--startreplaybuffer", nullptr)) { + opt_start_replaybuffer = true; + } else if (arg_is(argv[i], "--collection", nullptr)) { if (++i < argc) opt_starting_collection = argv[i]; @@ -1757,6 +1765,42 @@ int main(int argc, char *argv[]) } else if (arg_is(argv[i], "--scene", nullptr)) { if (++i < argc) opt_starting_scene = argv[i]; + + } else if (arg_is(argv[i], "--minimize-to-tray", nullptr)) { + opt_minimize_tray = true; + + } else if (arg_is(argv[i], "--studio-mode", nullptr)) { + opt_studio_mode = true; + + } else if (arg_is(argv[i], "--help", "-h")) { + std::cout << + "--help, -h: Get list of available commands.\n\n" << + "--startstreaming: Automatically start streaming.\n" << + "--startrecording: Automatically start recording.\n" << + "--startreplaybuffer: Start replay buffer.\n\n" << + "--collection : Use specific scene collection." + << "\n" << + "--profile : Use specific profile.\n" << + "--scene : Start with specific scene.\n\n" << + "--studio-mode: Enable studio mode.\n" << + "--minimize-to-tray: Minimize to system tray.\n" << + "--portable, -p: Use portable mode.\n\n" << + "--verbose: Make log more verbose.\n" << + "--unfiltered_log: Make log unfiltered.\n\n" << + "--version, -V: Get current version.\n"; + + exit(0); + + } else if (arg_is(argv[i], "--version", "-V")) { + std::cout << "OBS Studio - " << + App()->GetVersionString() << "\n"; + exit(0); + + } else { + std::cout << + "Invalid arguments. Use --help or -h to get " << + "a list of available command line arguments.\n"; + exit(0); } } diff --git a/UI/obs-app.hpp b/UI/obs-app.hpp index 3990e04af..381f9d6b2 100644 --- a/UI/obs-app.hpp +++ b/UI/obs-app.hpp @@ -178,4 +178,7 @@ static inline int GetProfilePath(char *path, size_t size, const char *file) extern bool opt_start_streaming; extern bool opt_start_recording; +extern bool opt_start_replaybuffer; +extern bool opt_minimize_tray; +extern bool opt_studio_mode; extern std::string opt_starting_scene; diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index fcb18835f..0fa9f58ef 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -703,6 +703,12 @@ retryScene: opt_start_recording = false; } + if (opt_start_replaybuffer) { + QMetaObject::invokeMethod(this, "StartReplayBuffer", + Qt::QueuedConnection); + opt_start_replaybuffer = false; + } + LogScenes(); disableSaving--; @@ -1162,8 +1168,14 @@ void OBSBasic::OBSInit() "BasicWindow", "SwapScenesMode"); editPropertiesMode = config_get_bool(App()->GlobalConfig(), "BasicWindow", "EditPropertiesMode"); - SetPreviewProgramMode(config_get_bool(App()->GlobalConfig(), - "BasicWindow", "PreviewProgramMode")); + + if (!opt_studio_mode) { + SetPreviewProgramMode(config_get_bool(App()->GlobalConfig(), + "BasicWindow", "PreviewProgramMode")); + } else { + SetPreviewProgramMode(true); + opt_studio_mode = false; + } #define SET_VISIBILITY(name, control) \ do { \ @@ -4983,12 +4995,14 @@ void OBSBasic::SystemTray(bool firstStarted) if (!sysTrayWhenStarted && !sysTrayEnabled) { trayIcon->hide(); - } else if (sysTrayWhenStarted && sysTrayEnabled) { + } else if ((sysTrayWhenStarted && sysTrayEnabled) + || opt_minimize_tray) { trayIcon->show(); if (firstStarted) { QTimer::singleShot(50, this, SLOT(hide())); EnablePreviewDisplay(false); setVisible(false); + opt_minimize_tray = false; } } else if (sysTrayEnabled) { trayIcon->show();