diff options
author | MrMelon <github@onpointcoding.net> | 2022-06-06 22:18:19 +0100 |
---|---|---|
committer | MrMelon <github@onpointcoding.net> | 2022-06-06 22:18:19 +0100 |
commit | 89d4405563fdffc36aea222983904ca1f7b91720 (patch) | |
tree | e431fc2380b304e38f0715242624964401ff95c3 | |
parent | 1c60e9b4fcaeae505232aa6287d76a2567d6ea1d (diff) | |
download | PrismLauncher-89d4405563fdffc36aea222983904ca1f7b91720.tar.gz PrismLauncher-89d4405563fdffc36aea222983904ca1f7b91720.tar.bz2 PrismLauncher-89d4405563fdffc36aea222983904ca1f7b91720.zip |
Simplify sorting logic to a single std::sort call
-rw-r--r-- | launcher/icons/IconList.cpp | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/launcher/icons/IconList.cpp b/launcher/icons/IconList.cpp index e0debcb0..522b39a7 100644 --- a/launcher/icons/IconList.cpp +++ b/launcher/icons/IconList.cpp @@ -59,26 +59,9 @@ IconList::IconList(const QStringList &builtinPaths, QString path, QObject *paren 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; + std::sort(icons.begin(), icons.end(), [](const MMCIcon& a, const MMCIcon& b) { + return a.m_key.compare(b.m_key) < 0; + }); reindex(); } |