aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/themes
diff options
context:
space:
mode:
authorTheKodeToad <TheKodeToad@proton.me>2023-07-26 17:17:02 +0100
committerTheKodeToad <TheKodeToad@proton.me>2023-07-26 17:19:39 +0100
commit816acc9c769eee50a4b738761d0b07995dc1eef6 (patch)
treef5fd05740392e10cb9987938f5e620f598fe8adc /launcher/ui/themes
parent516ddb22ae2c05e35401b0a5a6d81d93fc3d5ea1 (diff)
downloadPrismLauncher-816acc9c769eee50a4b738761d0b07995dc1eef6.tar.gz
PrismLauncher-816acc9c769eee50a4b738761d0b07995dc1eef6.tar.bz2
PrismLauncher-816acc9c769eee50a4b738761d0b07995dc1eef6.zip
Open catpak folder action
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Diffstat (limited to 'launcher/ui/themes')
-rw-r--r--launcher/ui/themes/ThemeManager.cpp15
-rw-r--r--launcher/ui/themes/ThemeManager.h2
2 files changed, 12 insertions, 5 deletions
diff --git a/launcher/ui/themes/ThemeManager.cpp b/launcher/ui/themes/ThemeManager.cpp
index 46fe0b25..bce13b45 100644
--- a/launcher/ui/themes/ThemeManager.cpp
+++ b/launcher/ui/themes/ThemeManager.cpp
@@ -205,6 +205,11 @@ QDir ThemeManager::getApplicationThemesFolder()
return m_applicationThemeFolder;
}
+QDir ThemeManager::getCatPacksFolder()
+{
+ return m_catPacksFolder;
+}
+
void ThemeManager::setIconTheme(const QString& name)
{
if (m_icons.find(name) == m_icons.end()) {
@@ -270,9 +275,9 @@ void ThemeManager::initializeCatPacks()
for (auto [id, name] : defaultCats) {
addCatPack(std::unique_ptr<CatPack>(new BasicCatPack(id, name)));
}
- QDir catpacksDir("catpacks");
- QString catpacksFolder = catpacksDir.absoluteFilePath("");
- themeDebugLog() << "CatPacks Folder Path:" << catpacksFolder;
+ if (!m_catPacksFolder.mkpath("."))
+ themeWarningLog() << "Couldn't create theme folder";
+ themeDebugLog() << "CatPacks Folder Path:" << m_catPacksFolder.absolutePath();
QStringList supportedImageFormats;
for (auto format : QImageReader::supportedImageFormats()) {
@@ -289,9 +294,9 @@ void ThemeManager::initializeCatPacks()
}
};
- loadFiles(catpacksDir);
+ loadFiles(m_catPacksFolder);
- QDirIterator directoryIterator(catpacksFolder, QDir::Dirs | QDir::NoDotAndDotDot);
+ QDirIterator directoryIterator(m_catPacksFolder.path(), QDir::Dirs | QDir::NoDotAndDotDot);
while (directoryIterator.hasNext()) {
QDir dir(directoryIterator.next());
QFileInfo manifest(dir.absoluteFilePath("catpack.json"));
diff --git a/launcher/ui/themes/ThemeManager.h b/launcher/ui/themes/ThemeManager.h
index 1eb83ce1..b5c66677 100644
--- a/launcher/ui/themes/ThemeManager.h
+++ b/launcher/ui/themes/ThemeManager.h
@@ -44,6 +44,7 @@ class ThemeManager {
bool isValidApplicationTheme(const QString& id);
QDir getIconThemesFolder();
QDir getApplicationThemesFolder();
+ QDir getCatPacksFolder();
void applyCurrentlySelectedTheme(bool initial = false);
void setIconTheme(const QString& name);
void setApplicationTheme(const QString& name, bool initial = false);
@@ -59,6 +60,7 @@ class ThemeManager {
std::map<QString, IconTheme> m_icons;
QDir m_iconThemeFolder{ "iconthemes" };
QDir m_applicationThemeFolder{ "themes" };
+ QDir m_catPacksFolder{ "catpacks" };
std::map<QString, std::unique_ptr<CatPack>> m_catPacks;
void initializeThemes();