UI: Add 'theme:' prefix to Qt search paths

This commit is contained in:
derrod 2023-09-22 12:47:12 +02:00 committed by Georges Basile Stavracas Neto
parent 0d450a34a0
commit ae148b60a8

View File

@ -31,6 +31,7 @@
#include <obs-config.h>
#include <obs.hpp>
#include <QDir>
#include <QFile>
#include <QGuiApplication>
#include <QScreen>
@ -1272,6 +1273,19 @@ bool OBSApp::InitTheme()
defaultPalette = palette();
setStyle(new OBSProxyStyle());
/* Set search paths for custom 'theme:' URI prefix */
string searchDir;
if (GetDataFilePath("themes", searchDir)) {
auto installSearchDir = filesystem::u8path(searchDir);
QDir::addSearchPath("theme", absolute(installSearchDir));
}
char userDir[512];
if (GetConfigPath(userDir, sizeof(userDir), "obs-studio/themes")) {
auto configSearchDir = filesystem::u8path(userDir);
QDir::addSearchPath("theme", absolute(configSearchDir));
}
const char *themeName =
config_get_string(globalConfig, "General", "CurrentTheme3");
if (!themeName)