diff --git a/forms/advanced-scene-switcher.ui b/forms/advanced-scene-switcher.ui
index 8a5f9ef9..55f7f7f5 100644
--- a/forms/advanced-scene-switcher.ui
+++ b/forms/advanced-scene-switcher.ui
@@ -65,6 +65,42 @@
-
+
-
+
+
+ Qt::Vertical
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 10
+ 0
+
+
+
+
-
-
@@ -119,22 +155,6 @@
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 10
- 0
-
-
-
-
-
-
@@ -220,13 +240,6 @@
- -
-
-
- Qt::Vertical
-
-
-
-
@@ -243,19 +256,55 @@
- -
-
+
-
+
+
+ -
+
Qt::Horizontal
+
+ QSizePolicy::Fixed
+
- 40
- 20
+ 10
+ 0
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 10
+ 0
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ -
+
+
+ On startup:
+
+
+
-
diff --git a/src/general.cpp b/src/general.cpp
index 725cae46..179209ef 100644
--- a/src/general.cpp
+++ b/src/general.cpp
@@ -10,15 +10,6 @@ void SceneSwitcher::on_close_clicked()
done(0);
}
-void SceneSwitcher::on_startAtLaunch_toggled(bool value)
-{
- if (loading)
- return;
-
- std::lock_guard lock(switcher->m);
- switcher->startAtLaunch = value;
-}
-
void SceneSwitcher::UpdateNonMatchingScene(const QString &name)
{
obs_source_t *scene = obs_get_source_by_name(name.toUtf8().constData());
@@ -61,6 +52,15 @@ void SceneSwitcher::on_noMatchRandomSwitch_clicked()
ui->noMatchSwitchScene->setEnabled(false);
}
+void SceneSwitcher::on_startupBehavior_currentIndexChanged(int index)
+{
+ if (loading)
+ return;
+
+ std::lock_guard lock(switcher->m);
+ switcher->startupBehavior = (StartupBehavior)index;
+}
+
void SceneSwitcher::on_noMatchSwitchScene_currentTextChanged(const QString &text)
{
if (loading)
@@ -337,6 +337,7 @@ void SwitcherData::saveGeneralSettings(obs_data_t *obj)
switcher->switchIfNotMatching);
obs_data_set_bool(obj, "active", !switcher->stop);
+ obs_data_set_int(obj, "startup_behavior", switcher->startupBehavior);
std::string autoStopSceneName =
GetWeakSourceName(switcher->autoStopScene);
@@ -393,6 +394,12 @@ void SwitcherData::loadGeneralSettings(obs_data_t *obj)
GetWeakSourceByName(nonMatchingScene.c_str());
switcher->stop = !obs_data_get_bool(obj, "active");
+ switcher->startupBehavior =
+ (StartupBehavior)obs_data_get_int(obj, "startup_behavior");
+ if (switcher->startupBehavior == START)
+ switcher->stop = false;
+ if (switcher->startupBehavior == STOP)
+ switcher->stop = true;
std::string autoStopScene =
obs_data_get_string(obj, "autoStopSceneName");
@@ -558,6 +565,13 @@ void SceneSwitcher::setupGeneralTab()
}
}
+ ui->startupBehavior->addItem(
+ "Start the scene switcher if it was running");
+ ui->startupBehavior->addItem("Always start the scene switcher");
+ ui->startupBehavior->addItem("Do not start the scene switcher");
+
+ ui->startupBehavior->setCurrentIndex(switcher->startupBehavior);
+
if (switcher->th && switcher->th->isRunning())
SetStarted();
else
diff --git a/src/headers/advanced-scene-switcher.hpp b/src/headers/advanced-scene-switcher.hpp
index fe805474..b9910d61 100644
--- a/src/headers/advanced-scene-switcher.hpp
+++ b/src/headers/advanced-scene-switcher.hpp
@@ -76,7 +76,7 @@ public slots:
void on_noMatchDontSwitch_clicked();
void on_noMatchSwitch_clicked();
void on_noMatchRandomSwitch_clicked();
- void on_startAtLaunch_toggled(bool value);
+ void on_startupBehavior_currentIndexChanged(int index);
void on_noMatchSwitchScene_currentTextChanged(const QString &text);
void on_checkInterval_valueChanged(int value);
void on_toggleStartButton_clicked();
diff --git a/src/headers/switcher-data-structs.hpp b/src/headers/switcher-data-structs.hpp
index 61e6c996..8dae27d3 100644
--- a/src/headers/switcher-data-structs.hpp
+++ b/src/headers/switcher-data-structs.hpp
@@ -253,6 +253,7 @@ struct TimeSwitch {
};
typedef enum { NO_SWITCH = 0, SWITCH = 1, RANDOM_SWITCH = 2 } NoMatch;
+typedef enum { PERSIST = 0, START = 1, STOP = 2 } StartupBehavior;
class SwitcherThread;
@@ -267,7 +268,6 @@ struct SwitcherData {
bool transitionActive = false;
bool waitForTransition = false;
std::condition_variable transitionCv;
- bool startAtLaunch = false;
bool stop = false;
bool verbose = false;
bool tansitionOverrideOverride = false;
@@ -280,6 +280,7 @@ struct SwitcherData {
OBSWeakSource lastRandomScene;
OBSWeakSource nonMatchingScene;
NoMatch switchIfNotMatching = NO_SWITCH;
+ StartupBehavior startupBehavior = PERSIST;
std::vector windowSwitches;
std::vector ignoreIdleWindows;