summaryrefslogtreecommitdiffstats
path: root/qt-ui/models.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-10-31 17:13:09 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-31 14:58:56 -0700
commit03c22c3b18133ae4e71d69d1c20246bc7fbb83ec (patch)
tree71dfc7174c87770eb9962398c812a11ffc011ce9 /qt-ui/models.cpp
parent2827da5ecfaa77c41b391c2b0fc85c0605ea1568 (diff)
downloadsubsurface-03c22c3b18133ae4e71d69d1c20246bc7fbb83ec.tar.gz
Treat buddy as Buddy and Divemaster, sort the filter lists.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/models.cpp')
-rw-r--r--qt-ui/models.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 74d5ec6a4..42a696834 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -2282,6 +2282,7 @@ void TagFilterModel::repopulate()
list.append(QString(current_tag_entry->tag->name));
current_tag_entry = current_tag_entry->next;
}
+ qSort(list);
list << tr("Empty Tags");
setStringList(list);
delete[] checkState;
@@ -2383,9 +2384,9 @@ bool BuddyFilterModel::filterRow(int source_row, const QModelIndex &source_paren
// Checked means 'Show', Unchecked means 'Hide'.
QString diveBuddy(d->buddy);
-
+ QString divemaster(d->divemaster);
// only show empty buddie dives if the user checked that.
- if (diveBuddy.isEmpty()) {
+ if (diveBuddy.isEmpty() && divemaster.isEmpty()) {
if (rowCount() > 0)
return checkState[rowCount() - 1];
else
@@ -2397,7 +2398,7 @@ bool BuddyFilterModel::filterRow(int source_row, const QModelIndex &source_paren
if (!buddyList.isEmpty()) {
buddyList.removeLast(); // remove the "Show Empty Tags";
for(int i = 0; i < rowCount(); i++){
- if(checkState[i] && diveBuddy.indexOf(stringList()[i]) != -1){
+ if(checkState[i] && (diveBuddy.indexOf(stringList()[i]) != -1 || divemaster.indexOf(stringList()[i]) != -1 )){
return true;
}
}
@@ -2418,11 +2419,15 @@ void BuddyFilterModel::repopulate()
for_each_dive (i, dive)
{
QString buddy(dive->buddy);
- if (!list.contains(buddy)) {
+ QString divemaster(dive->divemaster);
+ if (!buddy.isEmpty() && !list.contains(buddy)) {
list.append(buddy);
}
+ if(!divemaster.isEmpty() && !list.contains(divemaster)){
+ list.append(divemaster);
+ }
}
- setStringList(list);
+ qSort(list);
list << tr("No Buddies");
setStringList(list);
delete[] checkState;