diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-02-19 21:39:23 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-03-01 10:21:44 -0800 |
commit | e0766aa4bdd19dbcf538534abc8369aff6a6fa7a (patch) | |
tree | b9fe1a781b66cb4128144a429943fd80564de6cc /mobile-widgets/qmlmanager.cpp | |
parent | c1e33aac214c331f293e6257c9be509421f77c96 (diff) | |
download | subsurface-e0766aa4bdd19dbcf538534abc8369aff6a6fa7a.tar.gz |
filter: introduce people- and tags-filtering in the mobile UI
Add a combo-box where the user can switch between "fulltext",
"people" and "tags" filtering. Connect the combobox to the
already existing filter-code.
Dirk: make combo-box smaller by using a smaller font and restricting
the width. Setting both maximum and preferred widths gives more
consistent results.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index a877818cb..5896428b8 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -2094,13 +2094,20 @@ void QMLManager::showDownloadPage(QString deviceString) emit pluggedInDeviceNameChanged(); } -void QMLManager::setFilter(const QString filterText) +void QMLManager::setFilter(const QString filterText, int index) { + FilterData::Mode mode; + switch(index) { + default: + case 0: mode = FilterData::Mode::FULLTEXT; break; + case 1: mode = FilterData::Mode::PEOPLE; break; + case 2: mode = FilterData::Mode::TAGS; break; + } // show that we are doing something, then do something in another thread in order not to block the UI QMetaObject::invokeMethod(qmlWindow, "showBusyAndDisconnectModel"); QtConcurrent::run(QThreadPool::globalInstance(), - [this,filterText]{ - DiveListSortModel::instance()->setFilter(filterText); + [this,filterText,mode]{ + DiveListSortModel::instance()->setFilter(filterText, mode); CollapsedDiveListSortModel::instance()->updateFilterState(); QMetaObject::invokeMethod(qmlWindow, "hideBusyAndConnectModel"); }); |