mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-03-21 09:45:37 -05:00
[Card DB] Properly pass along set priority controller to parsers (#6430)
Some checks failed
Build Desktop / Configure (push) Has been cancelled
Build Docker Image / amd64 & arm64 (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, 11) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, 13) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, skip, 12) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Fedora, RPM, 43) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Fedora, RPM, skip, 42) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Servatrice_Debian, DEB, yes, skip, 11) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Ubuntu, DEB, 24.04) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Ubuntu, DEB, skip, 22.04) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (yes, Arch, skip) (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Windows10-installer, true, Visual Studio 17 2022, x64, 1, Windows, -Win10, win64_msvc2019_64, qtimageformats qtmultimedia qt… (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Windows7-installer, true, Visual Studio 17 2022, x64, 1, Windows, -Win7, win64_msvc2019_64, 5.15.*, windows-2022, 7, Release) (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (false, Ninja, macOS, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.6.*, macos-15, Apple, 15, Debug, 1, 16.4) (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (macOS13_Intel-package, false, Ninja, 1, macOS, 13, -macOS13_Intel, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.6.*… (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (macOS14-package, false, Ninja, 1, macOS, -macOS14, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.6.*, macos-14, Appl… (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (macOS15-package, false, Ninja, 1, macOS, -macOS15, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.6.*, macos-15, Appl… (push) Has been cancelled
Some checks failed
Build Desktop / Configure (push) Has been cancelled
Build Docker Image / amd64 & arm64 (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, 11) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, 13) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, skip, 12) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Fedora, RPM, 43) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Fedora, RPM, skip, 42) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Servatrice_Debian, DEB, yes, skip, 11) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Ubuntu, DEB, 24.04) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Ubuntu, DEB, skip, 22.04) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (yes, Arch, skip) (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Windows10-installer, true, Visual Studio 17 2022, x64, 1, Windows, -Win10, win64_msvc2019_64, qtimageformats qtmultimedia qt… (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Windows7-installer, true, Visual Studio 17 2022, x64, 1, Windows, -Win7, win64_msvc2019_64, 5.15.*, windows-2022, 7, Release) (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (false, Ninja, macOS, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.6.*, macos-15, Apple, 15, Debug, 1, 16.4) (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (macOS13_Intel-package, false, Ninja, 1, macOS, 13, -macOS13_Intel, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.6.*… (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (macOS14-package, false, Ninja, 1, macOS, -macOS14, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.6.*, macos-14, Appl… (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (macOS15-package, false, Ninja, 1, macOS, -macOS15, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.6.*, macos-15, Appl… (push) Has been cancelled
* [Card DB] Properly pass along set priority controller to parsers Took 16 minutes Took 35 seconds * More adjustments. Took 13 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
d47dc35885
commit
ebb02b27b2
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
|
||||
#include "libcockatrice/interfaces/noop_card_set_priority_controller.h"
|
||||
|
||||
#include <libcockatrice/card/database/card_database.h>
|
||||
#include <libcockatrice/card/database/parser/cockatrice_xml_4.h>
|
||||
#include <libcockatrice/interfaces/noop_card_preference_provider.h>
|
||||
|
|
@ -26,7 +28,7 @@ public:
|
|||
|
||||
bool saveCardDatabase(const QString &fileName)
|
||||
{
|
||||
CockatriceXml4Parser parser(new NoopCardPreferenceProvider());
|
||||
CockatriceXml4Parser parser(new NoopCardPreferenceProvider(), new NoopCardSetPriorityController());
|
||||
|
||||
return parser.saveToFile(createDefaultMagicFormats(), sets, cards, fileName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ CardDatabase::CardDatabase(QObject *parent,
|
|||
qRegisterMetaType<CardInfoPtr>("CardSetPtr");
|
||||
|
||||
// create loader and wire it up
|
||||
loader = new CardDatabaseLoader(this, this, pathProvider, prefs);
|
||||
loader = new CardDatabaseLoader(this, this, pathProvider, prefs, setPriorityController);
|
||||
// re-emit loader signals (so other code doesn't need to know about internals)
|
||||
connect(loader, &CardDatabaseLoader::loadingFinished, this, &CardDatabase::cardDatabaseLoadingFinished);
|
||||
connect(loader, &CardDatabaseLoader::loadingFailed, this, &CardDatabase::cardDatabaseLoadingFailed);
|
||||
|
|
|
|||
|
|
@ -12,12 +12,13 @@
|
|||
CardDatabaseLoader::CardDatabaseLoader(QObject *parent,
|
||||
CardDatabase *db,
|
||||
ICardDatabasePathProvider *_pathProvider,
|
||||
ICardPreferenceProvider *_preferenceProvider)
|
||||
ICardPreferenceProvider *_preferenceProvider,
|
||||
ICardSetPriorityController *_priorityController)
|
||||
: QObject(parent), database(db), pathProvider(_pathProvider)
|
||||
{
|
||||
// instantiate available parsers here and connect them to the database
|
||||
availableParsers << new CockatriceXml4Parser(_preferenceProvider);
|
||||
availableParsers << new CockatriceXml3Parser;
|
||||
availableParsers << new CockatriceXml4Parser(_preferenceProvider, _priorityController);
|
||||
availableParsers << new CockatriceXml3Parser(_priorityController);
|
||||
|
||||
for (auto *p : availableParsers) {
|
||||
// connect parser outputs to the database adders
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include <QLoggingCategory>
|
||||
#include <libcockatrice/interfaces/interface_card_database_path_provider.h>
|
||||
#include <libcockatrice/interfaces/interface_card_preference_provider.h>
|
||||
#include <libcockatrice/interfaces/interface_card_set_priority_controller.h>
|
||||
|
||||
inline Q_LOGGING_CATEGORY(CardDatabaseLoadingLog, "card_database.loading");
|
||||
inline Q_LOGGING_CATEGORY(CardDatabaseLoadingSuccessOrFailureLog, "card_database.loading.success_or_failure");
|
||||
|
|
@ -52,7 +53,8 @@ public:
|
|||
explicit CardDatabaseLoader(QObject *parent,
|
||||
CardDatabase *db,
|
||||
ICardDatabasePathProvider *pathProvider,
|
||||
ICardPreferenceProvider *preferenceProvider);
|
||||
ICardPreferenceProvider *preferenceProvider,
|
||||
ICardSetPriorityController *_priorityController);
|
||||
|
||||
/** @brief Destructor cleans up allocated parsers. */
|
||||
~CardDatabaseLoader() override;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
SetNameMap ICardDatabaseParser::sets;
|
||||
|
||||
ICardDatabaseParser::ICardDatabaseParser(ICardSetPriorityController *_cardSetPriorityController)
|
||||
: cardSetPriorityController(_cardSetPriorityController)
|
||||
{
|
||||
}
|
||||
void ICardDatabaseParser::clearSetlist()
|
||||
{
|
||||
sets.clear();
|
||||
|
|
@ -19,7 +23,7 @@ CardSetPtr ICardDatabaseParser::internalAddSet(const QString &setName,
|
|||
return sets.value(setName);
|
||||
}
|
||||
|
||||
CardSetPtr newSet = CardSet::newInstance(new NoopCardSetPriorityController(), setName);
|
||||
CardSetPtr newSet = CardSet::newInstance(cardSetPriorityController, setName);
|
||||
newSet->setLongName(longName);
|
||||
newSet->setSetType(setType);
|
||||
newSet->setReleaseDate(releaseDate);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ class ICardDatabaseParser : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ICardDatabaseParser(ICardSetPriorityController *cardSetPriorityController);
|
||||
~ICardDatabaseParser() override = default;
|
||||
|
||||
/**
|
||||
|
|
@ -59,6 +60,7 @@ public:
|
|||
protected:
|
||||
/** @brief Cached global list of sets shared between all parsers. */
|
||||
static SetNameMap sets;
|
||||
ICardSetPriorityController *cardSetPriorityController;
|
||||
|
||||
/**
|
||||
* @brief Internal helper to add a set to the global set cache.
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@
|
|||
#define COCKATRICE_XML3_SCHEMALOCATION \
|
||||
"https://raw.githubusercontent.com/Cockatrice/Cockatrice/master/doc/carddatabase_v3/cards.xsd"
|
||||
|
||||
CockatriceXml3Parser::CockatriceXml3Parser(ICardSetPriorityController *_cardSetPriorityController)
|
||||
: ICardDatabaseParser(_cardSetPriorityController)
|
||||
{
|
||||
}
|
||||
|
||||
bool CockatriceXml3Parser::getCanParseFile(const QString &fileName, QIODevice &device)
|
||||
{
|
||||
qCInfo(CockatriceXml3Log) << "Trying to parse: " << fileName;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class CockatriceXml3Parser : public ICardDatabaseParser
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CockatriceXml3Parser() = default;
|
||||
CockatriceXml3Parser(ICardSetPriorityController *cardSetPriorityController);
|
||||
~CockatriceXml3Parser() override = default;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,8 +14,9 @@
|
|||
#define COCKATRICE_XML4_SCHEMALOCATION \
|
||||
"https://raw.githubusercontent.com/Cockatrice/Cockatrice/master/doc/carddatabase_v4/cards.xsd"
|
||||
|
||||
CockatriceXml4Parser::CockatriceXml4Parser(ICardPreferenceProvider *_cardPreferenceProvider)
|
||||
: cardPreferenceProvider(_cardPreferenceProvider)
|
||||
CockatriceXml4Parser::CockatriceXml4Parser(ICardPreferenceProvider *_cardPreferenceProvider,
|
||||
ICardSetPriorityController *_cardSetPriorityController)
|
||||
: ICardDatabaseParser(_cardSetPriorityController), cardPreferenceProvider(_cardPreferenceProvider)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@ class CockatriceXml4Parser : public ICardDatabaseParser
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CockatriceXml4Parser(ICardPreferenceProvider *cardPreferenceProvider);
|
||||
explicit CockatriceXml4Parser(ICardPreferenceProvider *cardPreferenceProvider,
|
||||
ICardSetPriorityController *cardSetPriorityController);
|
||||
~CockatriceXml4Parser() override = default;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef COCKATRICE_INTERFACE_CARD_SET_PRIORITY_CONTROLLER_H
|
||||
#define COCKATRICE_INTERFACE_CARD_SET_PRIORITY_CONTROLLER_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
class ICardSetPriorityController
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -6,25 +6,25 @@
|
|||
class NoopCardSetPriorityController : public ICardSetPriorityController
|
||||
{
|
||||
public:
|
||||
void setSortKey(QString /* shortName */, unsigned int /* sortKey */)
|
||||
void setSortKey(QString /* shortName */, unsigned int /* sortKey */) override
|
||||
{
|
||||
}
|
||||
void setEnabled(QString /* shortName */, bool /* enabled */)
|
||||
void setEnabled(QString /* shortName */, bool /* enabled */) override
|
||||
{
|
||||
}
|
||||
void setIsKnown(QString /* shortName */, bool /* isknown */)
|
||||
void setIsKnown(QString /* shortName */, bool /* isknown */) override
|
||||
{
|
||||
}
|
||||
|
||||
unsigned int getSortKey(QString /* shortName */)
|
||||
unsigned int getSortKey(QString /* shortName */) override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
bool isEnabled(QString /* shortName */)
|
||||
bool isEnabled(QString /* shortName */) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool isKnown(QString /* shortName */)
|
||||
bool isKnown(QString /* shortName */) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -565,7 +565,7 @@ int OracleImporter::startImport()
|
|||
|
||||
bool OracleImporter::saveToFile(const QString &fileName, const QString &sourceUrl, const QString &sourceVersion)
|
||||
{
|
||||
CockatriceXml4Parser parser(new NoopCardPreferenceProvider());
|
||||
CockatriceXml4Parser parser(new NoopCardPreferenceProvider(), new NoopCardSetPriorityController());
|
||||
|
||||
return parser.saveToFile(createDefaultMagicFormats(), sets, cards, fileName, sourceUrl, sourceVersion);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user