From 629875abd995f46f99b3cba3387faa7367a6f823 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 6 Oct 2015 07:06:29 +0200 Subject: 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 --- opentrack/plugin-support.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'opentrack') 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 #include #include +#include #include #include @@ -245,6 +246,12 @@ private: QList> filter_modules; QList> tracker_modules; QList> protocol_modules; + + template + static void sort(QList& xs) + { + std::sort(xs.begin(), xs.end(), [&](const t& a, const t& b) { return a->name.toLower() < b->name.toLower(); }); + } QList> 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; } }; -- cgit v1.2.3