diff options
author | Sefa Eyeoglu <contact@scrumplex.net> | 2022-06-11 19:14:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-11 19:14:26 +0200 |
commit | 2d261607dfbf11d7253682f58ea169a54e0368c8 (patch) | |
tree | ba6931ad9655ba04689382053852db004a3c089e | |
parent | 2257c875f5447b85ac885fbf2684608af0262c25 (diff) | |
parent | 1d9797660b70f6bd4026403a738c1d08fd3bba5d (diff) | |
download | PrismLauncher-2d261607dfbf11d7253682f58ea169a54e0368c8.tar.gz PrismLauncher-2d261607dfbf11d7253682f58ea169a54e0368c8.tar.bz2 PrismLauncher-2d261607dfbf11d7253682f58ea169a54e0368c8.zip |
Merge pull request #732 from MrMelon54/develop
-rw-r--r-- | launcher/icons/IconList.cpp | 11 | ||||
-rw-r--r-- | launcher/icons/IconList.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/launcher/icons/IconList.cpp b/launcher/icons/IconList.cpp index 0ddfae55..d426aa80 100644 --- a/launcher/icons/IconList.cpp +++ b/launcher/icons/IconList.cpp @@ -56,6 +56,15 @@ IconList::IconList(const QStringList &builtinPaths, QString path, QObject *paren emit iconUpdated({}); } +void IconList::sortIconList() +{ + qDebug() << "Sorting icon list..."; + std::sort(icons.begin(), icons.end(), [](const MMCIcon& a, const MMCIcon& b) { + return a.m_key.localeAwareCompare(b.m_key) < 0; + }); + reindex(); +} + void IconList::directoryChanged(const QString &path) { QDir new_dir (path); @@ -141,6 +150,8 @@ void IconList::directoryChanged(const QString &path) emit iconUpdated(key); } } + + sortIconList(); } void IconList::fileChanged(const QString &path) diff --git a/launcher/icons/IconList.h b/launcher/icons/IconList.h index ebbb52e2..f9f49e7f 100644 --- a/launcher/icons/IconList.h +++ b/launcher/icons/IconList.h @@ -71,6 +71,7 @@ private: // hide assign op IconList &operator=(const IconList &) = delete; void reindex(); + void sortIconList(); public slots: void directoryChanged(const QString &path); |