diff options
author | TheKodeToad <TheKodeToad@proton.me> | 2023-07-19 16:29:52 +0100 |
---|---|---|
committer | TheKodeToad <TheKodeToad@proton.me> | 2023-07-19 16:29:52 +0100 |
commit | 54d393632d5c964f0c30ca9bc816853b92552c9c (patch) | |
tree | ecfd42a55efa0f1cb67d700ba1a3ec3ff4df3a0d /launcher/ui/themes | |
parent | c633c6d083f7b2395cd98da2d26df361392cfa61 (diff) | |
download | PrismLauncher-54d393632d5c964f0c30ca9bc816853b92552c9c.tar.gz PrismLauncher-54d393632d5c964f0c30ca9bc816853b92552c9c.tar.bz2 PrismLauncher-54d393632d5c964f0c30ca9bc816853b92552c9c.zip |
Automatically create theme folders, and add an action to open them
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Diffstat (limited to 'launcher/ui/themes')
-rw-r--r-- | launcher/ui/themes/ThemeManager.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/launcher/ui/themes/ThemeManager.cpp b/launcher/ui/themes/ThemeManager.cpp index 8c9a6a58..525201be 100644 --- a/launcher/ui/themes/ThemeManager.cpp +++ b/launcher/ui/themes/ThemeManager.cpp @@ -74,10 +74,13 @@ void ThemeManager::initializeIcons() // TODO: icon themes and instance icons do not mesh well together. Rearrange and fix discrepancies! // set icon theme search path! - QString themeFolder = "iconthemes"; + QDir themeFolder("iconthemes"); + if (!themeFolder.mkpath(".")) + themeWarningLog() << "Couldn't create icon theme folder"; + themeDebugLog() << "Icon Theme Folder Path: " << themeFolder.absolutePath(); auto searchPaths = QIcon::themeSearchPaths(); - searchPaths.append(themeFolder); + searchPaths.append(themeFolder.path()); QIcon::setThemeSearchPaths(searchPaths); themeDebugLog() << "<> Initializing Icon Themes"; @@ -93,7 +96,7 @@ void ThemeManager::initializeIcons() themeDebugLog() << "Loaded Built-In Icon Theme" << id; } - QDirIterator directoryIterator(themeFolder, QDir::Dirs | QDir::NoDotAndDotDot); + QDirIterator directoryIterator(themeFolder.path(), QDir::Dirs | QDir::NoDotAndDotDot); while (directoryIterator.hasNext()) { QDir dir(directoryIterator.next()); IconTheme theme(dir.dirName(), dir.path()); @@ -117,10 +120,13 @@ void ThemeManager::initializeWidgets() // TODO: need some way to differentiate same name themes in different subdirectories (maybe smaller grey text next to theme name in // dropdown?) - QString themeFolder = QDir("./themes/").absoluteFilePath(""); - themeDebugLog() << "Theme Folder Path: " << themeFolder; - QDirIterator directoryIterator(themeFolder, QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); + QDir themeFolder("themes"); + if (!themeFolder.mkpath(".")) + themeWarningLog() << "Couldn't create theme folder"; + themeDebugLog() << "Theme Folder Path: " << themeFolder.absolutePath(); + + QDirIterator directoryIterator(themeFolder.path(), QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); while (directoryIterator.hasNext()) { QDir dir(directoryIterator.next()); QFileInfo themeJson(dir.absoluteFilePath("theme.json")); |