aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--launcher/icons/IconList.cpp28
-rw-r--r--launcher/icons/IconList.h1
2 files changed, 29 insertions, 0 deletions
diff --git a/launcher/icons/IconList.cpp b/launcher/icons/IconList.cpp
index 0ddfae55..e0debcb0 100644
--- a/launcher/icons/IconList.cpp
+++ b/launcher/icons/IconList.cpp
@@ -56,6 +56,32 @@ IconList::IconList(const QStringList &builtinPaths, QString path, QObject *paren
emit iconUpdated({});
}
+void IconList::sortIconList()
+{
+ qDebug() << "Sorting icon list...";
+
+ QVector<MMCIcon> newIcons = QVector<MMCIcon>();
+ QVectorIterator<MMCIcon> iconIter(icons);
+
+iconLoop:
+ while(iconIter.hasNext())
+ {
+ MMCIcon a = iconIter.next();
+ for(int i=0;i<newIcons.size();i++)
+ {
+ if(a.m_key.compare(newIcons[i].m_key) < 0)
+ {
+ newIcons.insert(i,a);
+ goto iconLoop;
+ }
+ }
+ newIcons.append(a);
+ }
+
+ icons = newIcons;
+ reindex();
+}
+
void IconList::directoryChanged(const QString &path)
{
QDir new_dir (path);
@@ -141,6 +167,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);