From b27854e440344dd167dbf7c56d38b2bf08609801 Mon Sep 17 00:00:00 2001 From: Matt Lowe Date: Tue, 7 Apr 2015 21:23:21 +0200 Subject: [PATCH] Ignore punctuation in card search It is awkward to have to use precise punctuation when searching for cards. Planeswalkers and legendary creatures often have "," in the name and you have to enter it. This commit means you no longer need to do that. + Can use " " in place of "-" (example: Wilt-Leaf Liege) + Can use "" in place of non word chars (Example: Hero's Downfall and Ajani, Caller of the Pride) --- cockatrice/src/carddatabasemodel.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cockatrice/src/carddatabasemodel.cpp b/cockatrice/src/carddatabasemodel.cpp index b84abdd0..fca39c79 100644 --- a/cockatrice/src/carddatabasemodel.cpp +++ b/cockatrice/src/carddatabasemodel.cpp @@ -152,8 +152,9 @@ bool CardDatabaseDisplayModel::filterAcceptsRow(int sourceRow, const QModelIndex return false; if (!cardName.isEmpty()) - if (!info->getName().contains(cardName, Qt::CaseInsensitive)) - return false; + if (!info->getName().contains(cardName, Qt::CaseInsensitive)) + if (!CardInfo::simplifyName(info->getName()).contains(cardName, Qt::CaseInsensitive)) + return false; if (filterTree != NULL) return filterTree->acceptsCard(info);