diff options
author | Trial97 <alexandru.tripon97@gmail.com> | 2023-07-28 01:09:21 +0300 |
---|---|---|
committer | Trial97 <alexandru.tripon97@gmail.com> | 2023-07-28 01:20:05 +0300 |
commit | d460986de0c84627d1725eada908e52911a97c5f (patch) | |
tree | c2b2b64ebb37d2018fdc5f5ef98872d9dd0a63fc /launcher/icons/IconUtils.cpp | |
parent | d960effb994ba421c502d8d5e0a1bb4d46efd9a3 (diff) | |
download | PrismLauncher-d460986de0c84627d1725eada908e52911a97c5f.tar.gz PrismLauncher-d460986de0c84627d1725eada908e52911a97c5f.tar.bz2 PrismLauncher-d460986de0c84627d1725eada908e52911a97c5f.zip |
format
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/icons/IconUtils.cpp')
-rw-r--r-- | launcher/icons/IconUtils.cpp | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/launcher/icons/IconUtils.cpp b/launcher/icons/IconUtils.cpp index bf530c16..0b06639e 100644 --- a/launcher/icons/IconUtils.cpp +++ b/launcher/icons/IconUtils.cpp @@ -1,24 +1,18 @@ #include "IconUtils.h" -#include "FileSystem.h" #include <QDirIterator> +#include "FileSystem.h" #include <array> namespace { -std::array<const char *, 6> validIconExtensions = {{ - "svg", - "png", - "ico", - "gif", - "jpg", - "jpeg" -}}; +std::array<const char*, 6> validIconExtensions = { { "svg", "png", "ico", "gif", "jpg", "jpeg" } }; } -namespace IconUtils{ +namespace IconUtils { -QString findBestIconIn(const QString &folder, const QString & iconKey) { +QString findBestIconIn(const QString& folder, const QString& iconKey) +{ int best_found = validIconExtensions.size(); QString best_filename; @@ -27,13 +21,13 @@ QString findBestIconIn(const QString &folder, const QString & iconKey) { it.next(); auto fileInfo = it.fileInfo(); - if(fileInfo.completeBaseName() != iconKey) + if (fileInfo.completeBaseName() != iconKey) continue; auto extension = fileInfo.suffix(); - for(int i = 0; i < best_found; i++) { - if(extension == validIconExtensions[i]) { + for (int i = 0; i < best_found; i++) { + if (extension == validIconExtensions[i]) { best_found = i; qDebug() << i << " : " << fileInfo.fileName(); best_filename = fileInfo.fileName(); @@ -43,12 +37,13 @@ QString findBestIconIn(const QString &folder, const QString & iconKey) { return FS::PathCombine(folder, best_filename); } -QString getIconFilter() { +QString getIconFilter() +{ QString out; QTextStream stream(&out); stream << '('; - for(size_t i = 0; i < validIconExtensions.size() - 1; i++) { - if(i > 0) { + for (size_t i = 0; i < validIconExtensions.size() - 1; i++) { + if (i > 0) { stream << " "; } stream << "*." << validIconExtensions[i]; @@ -58,5 +53,4 @@ QString getIconFilter() { return out; } -} - +} // namespace IconUtils |