From 2d61189655fb868280f5e115208f3364218b00f0 Mon Sep 17 00:00:00 2001
From: WarmUpTill
Date: Wed, 5 Jan 2022 01:24:40 +0100
Subject: [PATCH] Display message on first boot
---
data/locale/en-US.ini | 2 ++
src/advanced-scene-switcher.cpp | 1 +
src/general.cpp | 8 ++++++++
src/headers/advanced-scene-switcher.hpp | 1 +
src/headers/switcher-data-structs.hpp | 1 +
src/switcher-data-structs.cpp | 1 +
6 files changed, 14 insertions(+)
diff --git a/data/locale/en-US.ini b/data/locale/en-US.ini
index d7d4b7aa..7c07f9a9 100644
--- a/data/locale/en-US.ini
+++ b/data/locale/en-US.ini
@@ -677,6 +677,8 @@ AdvSceneSwitcher.status.inactive="Inactive"
AdvSceneSwitcher.running="Plugin running"
AdvSceneSwitcher.stopped="Plugin stopped"
+AdvSceneSwitcher.firstBootMessage="
This seems to be the first time the Advanced Scene Switcher was installed.
Please have a look at the Wiki for a list of guides and examples.
Do not hesitate to ask questions in the plugin's thread on the OBS forums!
"
+
AdvSceneSwitcher.unit.milliseconds="milliseconds"
AdvSceneSwitcher.unit.secends="seconds"
AdvSceneSwitcher.unit.minutes="minutes"
diff --git a/src/advanced-scene-switcher.cpp b/src/advanced-scene-switcher.cpp
index 098a3eb0..104e0d25 100644
--- a/src/advanced-scene-switcher.cpp
+++ b/src/advanced-scene-switcher.cpp
@@ -87,6 +87,7 @@ void AdvSceneSwitcher::loadUI()
setTabOrder();
restoreWindowGeo();
+ checkFirstTimeSetup();
loading = false;
}
diff --git a/src/general.cpp b/src/general.cpp
index ba535e27..5203cf5b 100644
--- a/src/general.cpp
+++ b/src/general.cpp
@@ -444,6 +444,14 @@ void AdvSceneSwitcher::restoreWindowGeo()
}
}
+void AdvSceneSwitcher::checkFirstTimeSetup()
+{
+ if (switcher->firstBoot && !switcher->disableHints) {
+ DisplayMessage(
+ obs_module_text("AdvSceneSwitcher.firstBootMessage"));
+ }
+}
+
void AdvSceneSwitcher::on_tabMoved(int from, int to)
{
if (loading) {
diff --git a/src/headers/advanced-scene-switcher.hpp b/src/headers/advanced-scene-switcher.hpp
index 828f52d2..28e5c44a 100644
--- a/src/headers/advanced-scene-switcher.hpp
+++ b/src/headers/advanced-scene-switcher.hpp
@@ -83,6 +83,7 @@ public:
void setupMacroTab();
void setTabOrder();
void restoreWindowGeo();
+ void checkFirstTimeSetup();
signals:
void MacroAdded(const QString &name);
diff --git a/src/headers/switcher-data-structs.hpp b/src/headers/switcher-data-structs.hpp
index 1bc56f43..5fc62141 100644
--- a/src/headers/switcher-data-structs.hpp
+++ b/src/headers/switcher-data-structs.hpp
@@ -77,6 +77,7 @@ struct SwitcherData {
SwitcherThread *th = nullptr;
bool settingsWindowOpened = false;
+ bool firstBoot = true;
std::condition_variable cv;
std::mutex m;
diff --git a/src/switcher-data-structs.cpp b/src/switcher-data-structs.cpp
index 890cbc21..bf86fefa 100644
--- a/src/switcher-data-structs.cpp
+++ b/src/switcher-data-structs.cpp
@@ -123,6 +123,7 @@ bool SwitcherData::versionChanged(obs_data_t *obj, std::string currentVersion)
if (!obs_data_has_user_value(obj, "version")) {
return false;
}
+ switcher->firstBoot = false;
std::string previousVersion = obs_data_get_string(obj, "version");
return previousVersion != currentVersion;
}