mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-11 04:23:29 -08:00
[Card] Add Scryfall Tagger tag search and filtering (#7337)
* [Card] Import Scryfall Tagger tags from MTGJson * [Card] Search cards by Scryfall Tagger tag * [Card] Add a Tag attribute to the card filter tree * [Card] Add a Tags filter to the visual card database * [Oracle] Add a script to inject Scryfall tags into AllPrintings * [Card] Elide long tag lists in the card info and drop the Scryfall label from the tag filter tooltip * [Oracle] Load card tags from a tag database during import Add a TagDatabase loader that understands Scryfall's Oracle Tags bulk data and user-supplied tag files (tag objects, flat oracle-id or name maps, optional manifest, JSON or JSONL, gzip/xz/zip). The importer joins the slugs on identifiers.scryfallOracleId while the identifiers are still available, falls back to the card name, and unions them with any tags the source already provides. Split-card faces merge through the existing tag union path. This replaces oracle/scripts/inject_scryfall_tags.py, which patched AllPrintings.json before import. Loading during import keeps tags on by default for every source and lets users pair Oracle with any tag database. * [Oracle] Add a tag data step to the import wizard Insert a Tags page between set selection and the import. It downloads Scryfall's Oracle Tags by default (or a user-supplied file/URL), can include parent tags, and persists tagsenabled, tagssource and tagsparents in oracle.ini. The page loads asynchronously and soft-fails in background mode, so a tag download or parse error never aborts the card database import. * [Help] Describe tag search without naming Scryfall Tags can come from Scryfall's Oracle Tags or any user-supplied tag database, so the search help should not claim a single source. * [Oracle] Fix Scryfall tag requests and the retry loop api.scryfall.com rejects requests that lack an Accept header with HTTP 400, and QNetworkAccessManager does not add one. Send application/json for the bulk metadata request and */* for the tag file, and surface the URL plus Scryfall's JSON error body when a request fails. A failed tag load used to call next(), which re-ran validatePage() and started the same failing download again, trapping the user in an error loop. Stay on the page instead, drop the unusable database, and tell the user they can retry, change the source, or untick the option to import without tags. Also explain parent tags inline with a real Scryfall hierarchy example. * [Oracle] Give the parent-tag explainer room to breathe The wrapped explainer sat flush under the checkbox with no separation from the status label, which made the paragraph look cramped. Indent it under the checkbox and add a little vertical margin. * [Oracle] Stop the parent-tag explainer from being clipped A word-wrapped QLabel reports a one-line sizeHint, so the wizard page reserved too little height and the explanation lost its top and bottom lines. Pin the vertical size policy to Minimum on the explainer and on the status label, so the wrapped height becomes part of the page minimum. Verified with a layout probe: the label went from 28 px tall (needed 56) to its full height. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
c7e8422808
commit
6138fbd0a0
31 changed files with 2242 additions and 37 deletions
|
|
@ -17,12 +17,14 @@
|
|||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <libcockatrice/card/card_info.h>
|
||||
#include <memory>
|
||||
#include <qnamespace.h>
|
||||
#include <qtmetamacros.h>
|
||||
#include <utility>
|
||||
|
||||
class CardRelation;
|
||||
class QRegularExpression;
|
||||
class TagDatabase;
|
||||
|
||||
// many users prefer not to see these sets with non english arts
|
||||
// they will given priority PriorityLowest
|
||||
|
|
@ -215,6 +217,12 @@ private:
|
|||
*/
|
||||
bool localizationEnabled = false;
|
||||
|
||||
/**
|
||||
* Optional tag lookup applied to every imported card. Owned by the wizard
|
||||
* so it outlives the import worker; null when tags are disabled.
|
||||
*/
|
||||
std::shared_ptr<const TagDatabase> tagDatabase;
|
||||
|
||||
/**
|
||||
* Localized name/text collected per imported card key while parsing sets,
|
||||
* applied to the CardInfo objects by applyLocalizedData() once all
|
||||
|
|
@ -269,6 +277,16 @@ public:
|
|||
{
|
||||
progressReporting = enabled;
|
||||
}
|
||||
/**
|
||||
* @brief Supplies the tag database applied to every imported card.
|
||||
*
|
||||
* Pass nullptr to import without tags. The wizard keeps the database alive
|
||||
* for the whole import, so the worker sees a stable pointer.
|
||||
*/
|
||||
void setTagDatabase(std::shared_ptr<const TagDatabase> database)
|
||||
{
|
||||
tagDatabase = std::move(database);
|
||||
}
|
||||
/**
|
||||
* Selects the ISO-639 language code whose foreignData is imported.
|
||||
* English (the default) and unsupported codes disable localization.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue