Open catpak folder action

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad
2023-07-26 17:17:02 +01:00
parent 516ddb22ae
commit 816acc9c76
7 changed files with 40 additions and 13 deletions

View File

@ -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"));