瀏覽代碼

UI: Ensure theme backward compat. with older OBS vers.

Deprecates "Theme" global config value and uses "CurrentTheme" instead
to ensure backward compatibility with older versions of OBS, which will
fail to load if you have a theme that isn't available.

(Jim Edit: Putting this back because I misunderstood the purpose of
jp9000/obs-studio#936)
VodBox 8 年之前
父節點
當前提交
f1588daca0
共有 2 個文件被更改,包括 10 次插入4 次删除
  1. 8 3
      UI/obs-app.cpp
  2. 2 1
      UI/window-basic-settings.cpp

+ 8 - 3
UI/obs-app.cpp

@@ -737,9 +737,14 @@ bool OBSApp::SetTheme(std::string name, std::string path)
 bool OBSApp::InitTheme()
 {
 	const char *themeName = config_get_string(globalConfig, "General",
-			"Theme");
-	if (!themeName)
-		themeName = "Default";
+			"CurrentTheme");
+	if (!themeName) {
+		/* Use deprecated "Theme" value if available */
+		themeName = config_get_string(globalConfig,
+				"General", "Theme");
+		if (!themeName)
+			themeName = "Default";
+	}
 
 	if (strcmp(themeName, "Default") != 0 && SetTheme(themeName))
 		return true;

+ 2 - 1
UI/window-basic-settings.cpp

@@ -2436,8 +2436,9 @@ void OBSBasicSettings::SaveGeneralSettings()
 	string theme = themeData.toStdString();
 
 	if (WidgetChanged(ui->theme)) {
-		config_set_string(GetGlobalConfig(), "General", "Theme",
+		config_set_string(GetGlobalConfig(), "General", "CurrentTheme",
 				  theme.c_str());
+
 		App()->SetTheme(theme);
 	}