mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
2827da5ecf
commit
03c22c3b18
2 changed files with 12 additions and 6 deletions
|
@ -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;
|
||||
|
|
|
@ -484,7 +484,8 @@ void TagFilter::hideEvent(QHideEvent *event)
|
|||
BuddyFilter::BuddyFilter(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
ui.label->setText(tr("Buddies: "));
|
||||
ui.label->setText(tr("Person: "));
|
||||
ui.label->setToolTip(tr("Searches for Buddies and Divemasters"));
|
||||
#if QT_VERSION >= 0x050000
|
||||
ui.filterInternalList->setClearButtonEnabled(true);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue