mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Filter panel: add suit and notes search fields
All the field in the Notes Panel of the main window are now supported. This needs some testing especially for the Notes field that may contain markup. It appears ok to me for single term searches. One would like to think about the default search option for the Notes. There is a vertical spacer in the Filter panel that I moved downwards and whose function I am not quite sure of. [Dirk Hohndel: small adjustments] Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
01e8a54f58
commit
10e7835290
4 changed files with 113 additions and 2 deletions
|
@ -74,6 +74,27 @@ namespace {
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool hasSuits(const QStringList &suits, const struct dive *d, FilterData::Mode mode)
|
||||
{
|
||||
if (suits.isEmpty())
|
||||
return true;
|
||||
QStringList diveSuits;
|
||||
if (d->suit)
|
||||
diveSuits.push_back(QString(d->suit));
|
||||
return check(suits, diveSuits, mode);
|
||||
}
|
||||
|
||||
bool hasNotes(const QStringList &dnotes, const struct dive *d, FilterData::Mode mode)
|
||||
{
|
||||
if (dnotes.isEmpty())
|
||||
return true;
|
||||
QStringList diveNotes;
|
||||
if (d->notes)
|
||||
diveNotes.push_back(QString(d->notes));
|
||||
return check(dnotes, diveNotes, mode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MultiFilterSortModel *MultiFilterSortModel::instance()
|
||||
|
@ -149,6 +170,14 @@ bool MultiFilterSortModel::showDive(const struct dive *d) const
|
|||
if (!hasLocations(filterData.location, d, filterData.locationMode))
|
||||
return false;
|
||||
|
||||
// Suit
|
||||
if (!hasSuits(filterData.suit, d, filterData.suitMode))
|
||||
return false;
|
||||
|
||||
// Notes
|
||||
if (!hasNotes(filterData.dnotes, d, filterData.dnotesMode))
|
||||
return false;
|
||||
|
||||
if (!hasEquipment(filterData.equipment, d, filterData.equipmentMode))
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue