summaryrefslogtreecommitdiffhomepage
path: root/opentrack/plugin-support.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-10-06 07:06:29 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-10-06 07:09:31 +0200
commit629875abd995f46f99b3cba3387faa7367a6f823 (patch)
tree766679032a56f6e3d8d8b957bd7542b1d0745476 /opentrack/plugin-support.hpp
parent18001ba72d8472697fafdcbd7fa8873e792d5f64 (diff)
main, ui: fix sort order
Sort order was applied only to combobox but not to tracker list. Reported-by: @nanospork cf. https://github.com/opentrack/opentrack/issues/231#issuecomment-145741998
Diffstat (limited to 'opentrack/plugin-support.hpp')
-rw-r--r--opentrack/plugin-support.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/opentrack/plugin-support.hpp b/opentrack/plugin-support.hpp
index 8efda800..102d11c4 100644
--- a/opentrack/plugin-support.hpp
+++ b/opentrack/plugin-support.hpp
@@ -20,6 +20,7 @@
#include <cstdio>
#include <cinttypes>
#include <iostream>
+#include <algorithm>
#include <QCoreApplication>
#include <QFile>
@@ -245,6 +246,12 @@ private:
QList<mem<dylib>> filter_modules;
QList<mem<dylib>> tracker_modules;
QList<mem<dylib>> protocol_modules;
+
+ template<typename t>
+ static void sort(QList<t>& xs)
+ {
+ std::sort(xs.begin(), xs.end(), [&](const t& a, const t& b) { return a->name.toLower() < b->name.toLower(); });
+ }
QList<mem<dylib>> filter(dylib::Type t)
{
@@ -252,6 +259,9 @@ private:
for (auto x : module_list)
if (x->type == t)
ret.push_back(x);
+
+ sort(ret);
+
return ret;
}
};