diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | core/divefilter.cpp | 24 |
2 files changed, 16 insertions, 9 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 482e55a60..a5ff63f60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +Filter: fix searching for tags [#2842] Desktop: fix plotting of thumbnails on profile [#2833] Core: always include BT/BLE name, even for devices no recognized as dive computer Core: fix failure to recognize several Aqualung BLE dive computers diff --git a/core/divefilter.cpp b/core/divefilter.cpp index 89fbd731d..fae6c1760 100644 --- a/core/divefilter.cpp +++ b/core/divefilter.cpp @@ -2,7 +2,8 @@ #include "divefilter.h" #include "divelist.h" -#include "qthelper.h" +#include "gettextfromc.h" +#include "tag.h" #include "subsurface-qt/divelistnotifier.h" static void updateDiveStatus(dive *d, bool newStatus, ShownChange &change) @@ -15,6 +16,15 @@ static void updateDiveStatus(dive *d, bool newStatus, ShownChange &change) } } +static QStringList getTagList(const dive *d) +{ + QStringList res; + for (const tag_entry *tag = d->tag_list; tag; tag = tag->next) + res.push_back(QString(tag->tag->name).trimmed()); + res.append(gettextFromC::tr(divemode_text_ui[d->dc.divemode])); + return res; +} + #ifdef SUBSURFACE_MOBILE // Check if a string-list contains at least one string that starts with the second argument. @@ -31,16 +41,14 @@ static bool check(const QStringList &items, const QStringList &list) { return listContainsSuperstring(list, item); }); } -bool hasTags(const QStringList &tags, const struct dive *d) +static bool hasTags(const QStringList &tags, const struct dive *d) { if (tags.isEmpty()) return true; - QStringList dive_tags = get_taglist_string(d->tag_list).split(","); - dive_tags.append(gettextFromC::tr(divemode_text_ui[d->dc.divemode])); - return check(tags, dive_tags); + return check(tags, getTagList(d)); } -bool hasPersons(const QStringList &people, const struct dive *d) +static bool hasPersons(const QStringList &people, const struct dive *d) { if (people.isEmpty()) return true; @@ -220,9 +228,7 @@ namespace { { if (tags.isEmpty()) return true; - QStringList dive_tags = get_taglist_string(d->tag_list).split(","); - dive_tags.append(gettextFromC::tr(divemode_text_ui[d->dc.divemode])); - return check(tags, dive_tags, mode, stringMode); + return check(tags, getTagList(d), mode, stringMode); } bool hasPersons(const QStringList &people, const struct dive *d, FilterData::Mode mode, StringFilterMode stringMode) |