diff options
Diffstat (limited to 'application')
-rw-r--r-- | application/MultiMC.cpp | 1 | ||||
-rw-r--r-- | application/themes/CustomTheme.cpp | 9 | ||||
-rw-r--r-- | application/themes/CustomTheme.h | 1 | ||||
-rw-r--r-- | application/themes/ITheme.h | 4 |
4 files changed, 14 insertions, 1 deletions
diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp index 9ccd0895..40a11a26 100644 --- a/application/MultiMC.cpp +++ b/application/MultiMC.cpp @@ -1027,6 +1027,7 @@ void MultiMC::setApplicationTheme(const QString& name) auto & theme = (*themeIter).second; setStyle(QStyleFactory::create(theme->qtTheme())); setPalette(theme->colorScheme()); + QDir::setSearchPaths("theme", theme->searchPaths()); setStyleSheet(theme->appStyleSheet()); } else diff --git a/application/themes/CustomTheme.cpp b/application/themes/CustomTheme.cpp index a3141573..70d55211 100644 --- a/application/themes/CustomTheme.cpp +++ b/application/themes/CustomTheme.cpp @@ -128,10 +128,11 @@ CustomTheme::CustomTheme(ITheme* baseTheme, QString folder) { m_id = folder; QString path = FS::PathCombine("themes", m_id); + QString pathResources = FS::PathCombine("themes", m_id, "resources"); qDebug() << "Loading theme" << m_id; - if(!FS::ensureFolderPathExists(path)) + if(!FS::ensureFolderPathExists(path) || !FS::ensureFolderPathExists(pathResources)) { qWarning() << "couldn't create folder for theme!"; m_palette = baseTheme->colorScheme(); @@ -191,6 +192,12 @@ CustomTheme::CustomTheme(ITheme* baseTheme, QString folder) } } +QStringList CustomTheme::searchPaths() +{ + return { FS::PathCombine("themes", m_id, "resources") }; +} + + QString CustomTheme::id() { return m_id; diff --git a/application/themes/CustomTheme.h b/application/themes/CustomTheme.h index 94cd10a5..e5d3625c 100644 --- a/application/themes/CustomTheme.h +++ b/application/themes/CustomTheme.h @@ -15,6 +15,7 @@ public: double fadeAmount() override; QColor fadeColor() override; QString qtTheme() override; + QStringList searchPaths() override; private: /* data */ QPalette m_palette; diff --git a/application/themes/ITheme.h b/application/themes/ITheme.h index 9c071e0a..8070efb1 100644 --- a/application/themes/ITheme.h +++ b/application/themes/ITheme.h @@ -13,6 +13,10 @@ public: virtual QPalette colorScheme() = 0; virtual QColor fadeColor() = 0; virtual double fadeAmount() = 0; + virtual QStringList searchPaths() + { + return {}; + } static QPalette fadeInactive(QPalette in, qreal bias, QColor color); }; |