From b91bab835699d69244c70c8c45924c32feb02d06 Mon Sep 17 00:00:00 2001 From: Matt Lowe Date: Mon, 9 Mar 2015 13:56:40 +0100 Subject: [PATCH] Re-added some search and filter code I had previously removed some filtering code that would allow users to filter cards using our filtering tools. This functionality has now been re-added. --- cockatrice/src/carddatabasemodel.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/cockatrice/src/carddatabasemodel.cpp b/cockatrice/src/carddatabasemodel.cpp index 0eea4cb4..6a8d3fe7 100644 --- a/cockatrice/src/carddatabasemodel.cpp +++ b/cockatrice/src/carddatabasemodel.cpp @@ -146,14 +146,17 @@ bool CardDatabaseDisplayModel::filterAcceptsRow(int sourceRow, const QModelIndex { CardInfo const *info = static_cast(sourceModel())->getCard(sourceRow); - bool show = false; - if (!cardName.isEmpty()) { - if (info->getName().contains(cardName, Qt::CaseInsensitive)) - show = true; - } else - return true;// search is empty, show all + if (((isToken == ShowTrue) && !info->getIsToken()) || ((isToken == ShowFalse) && info->getIsToken())) + return false; - return show; + if (!cardName.isEmpty()) + if (!info->getName().contains(cardName, Qt::CaseInsensitive)) + return false; + + if (filterTree != NULL) + return filterTree->acceptsCard(info); + + return true; } void CardDatabaseDisplayModel::clearSearch()