mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-26 08:33:54 -07:00
[VDS] Use display name for generic search expression (#5976)
This commit is contained in:
parent
456da93465
commit
7495d2dc65
4 changed files with 16 additions and 7 deletions
|
|
@ -4,9 +4,9 @@ The search bar recognizes a set of special commands.<br>
|
||||||
In this list of examples below, each entry has an explanation and can be clicked to test the query. Note that all
|
In this list of examples below, each entry has an explanation and can be clicked to test the query. Note that all
|
||||||
searches are case insensitive.
|
searches are case insensitive.
|
||||||
<dl>
|
<dl>
|
||||||
<dt>Filename:</dt>
|
<dt>Display Name (The deck name, or the filename if the deck name isn't set):</dt>
|
||||||
<dd>[red deck wins](#red deck wins) <small>(Any deck filename containing the words red, deck, and wins)</small></dd>
|
<dd>[red deck wins](#red deck wins) <small>(Any deck with a display name containing the words red, deck, and wins)</small></dd>
|
||||||
<dd>["red deck wins"](#%22red deck wins%22) <small>(Any deck filename containing the exact phrase "red deck wins")</small></dd>
|
<dd>["red deck wins"](#%22red deck wins%22) <small>(Any deck with a display name containing the exact phrase "red deck wins")</small></dd>
|
||||||
|
|
||||||
<dt>Deck Contents (Uses [card search expressions](#cardSearchSyntaxHelp)):</dt>
|
<dt>Deck Contents (Uses [card search expressions](#cardSearchSyntaxHelp)):</dt>
|
||||||
<dd><a href="#[[plains]]">[[plains]]</a> <small>(Any deck that contains at least one card with "plains" in its name)</small></dd>
|
<dd><a href="#[[plains]]">[[plains]]</a> <small>(Any deck that contains at least one card with "plains" in its name)</small></dd>
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,15 @@ QString DeckPreviewWidget::getColorIdentity()
|
||||||
return colorIdentity;
|
return colorIdentity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The display name is given by the deck name, or the filename if the deck name is not set.
|
||||||
|
*/
|
||||||
|
QString DeckPreviewWidget::getDisplayName() const
|
||||||
|
{
|
||||||
|
return deckLoader->getName().isEmpty() ? QFileInfo(deckLoader->getLastFileName()).fileName()
|
||||||
|
: deckLoader->getName();
|
||||||
|
}
|
||||||
|
|
||||||
void DeckPreviewWidget::setFilePath(const QString &_filePath)
|
void DeckPreviewWidget::setFilePath(const QString &_filePath)
|
||||||
{
|
{
|
||||||
filePath = _filePath;
|
filePath = _filePath;
|
||||||
|
|
@ -193,8 +202,7 @@ void DeckPreviewWidget::setFilePath(const QString &_filePath)
|
||||||
*/
|
*/
|
||||||
void DeckPreviewWidget::refreshBannerCardText()
|
void DeckPreviewWidget::refreshBannerCardText()
|
||||||
{
|
{
|
||||||
bannerCardDisplayWidget->setOverlayText(
|
bannerCardDisplayWidget->setOverlayText(getDisplayName());
|
||||||
deckLoader->getName().isEmpty() ? QFileInfo(deckLoader->getLastFileName()).fileName() : deckLoader->getName());
|
|
||||||
|
|
||||||
refreshBannerCardToolTip();
|
refreshBannerCardToolTip();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ public:
|
||||||
const QString &_filePath);
|
const QString &_filePath);
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
QString getColorIdentity();
|
QString getColorIdentity();
|
||||||
|
QString getDisplayName() const;
|
||||||
|
|
||||||
VisualDeckStorageWidget *visualDeckStorageWidget;
|
VisualDeckStorageWidget *visualDeckStorageWidget;
|
||||||
QVBoxLayout *layout;
|
QVBoxLayout *layout;
|
||||||
|
|
|
||||||
|
|
@ -131,8 +131,8 @@ static void setupParserRules()
|
||||||
|
|
||||||
search["GenericQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
search["GenericQuery"] = [](const peg::SemanticValues &sv) -> DeckFilter {
|
||||||
auto name = std::any_cast<QString>(sv[0]);
|
auto name = std::any_cast<QString>(sv[0]);
|
||||||
return [=](const DeckPreviewWidget *, const ExtraDeckSearchInfo &info) {
|
return [=](const DeckPreviewWidget *deck, const ExtraDeckSearchInfo &) {
|
||||||
return info.fileSearchName.contains(name, Qt::CaseInsensitive);
|
return deck->getDisplayName().contains(name, Qt::CaseInsensitive);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue