aboutsummaryrefslogtreecommitdiff
path: root/launcher/icons
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/icons')
-rw-r--r--launcher/icons/IconList.cpp11
-rw-r--r--launcher/icons/IconList.h1
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);