mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 00:54:53 -07:00
* Have CardDatabase::getPreferredPrintingInfo respect card provider ID overrides (pinned printings)
Took 13 minutes
Took 37 seconds
Took 10 seconds
Took 10 seconds
# Commit time for manual adjustment:
# Took 30 seconds
Took 15 seconds
Took 8 minutes
Took 21 seconds
* Move settings cache and settings card preference provider out of libcockatrice_settings and into cockatrice
Took 52 minutes
Took 9 minutes
Took 1 minute
* Temp cache.
Took 16 minutes
* Dependency Injection for SettingsCache
* Turn SettingsCache into a QSharedPointer.
* Implement interfaces for settings that need it
Took 2 hours 38 minutes
* Adjust oracle.
Took 5 minutes
* Move abstract/noop interfaces to libcockatrice_interfaces so they can be linked against independently.
Took 52 minutes
* Clean up some links.
Took 3 minutes
* Cleanup two includes.
Took 3 minutes
* More fixes.
Took 7 minutes
* More includes that slipped past.
Took 3 minutes
* Stop mocking and start injecting for tests.
Took 15 minutes
* I don't know why remote_client was including main.
Took 4 minutes
* Include.
Took 3 minutes
* Lint.
Took 2 minutes
* Don't use Qt pointers.
Took 1 hour 7 minutes
* Make parser use CardSettingsInterface
Took 13 minutes
* Also adjust constructor lol.
Took 8 minutes
* Lint.
Took 32 minutes
* Revert "Lint."
This reverts commit ecb596c39e.
Took 3 minutes
* Test.
Took 3 minutes
---------
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
70 lines
2.1 KiB
C++
70 lines
2.1 KiB
C++
/**
|
|
* @file card_database_loader.h
|
|
* @ingroup CardDatabase
|
|
* @brief The CardDatabaseLoader is responsible for populating the card database from files on disk.
|
|
*/
|
|
|
|
#ifndef COCKATRICE_CARD_DATABASE_LOADER_H
|
|
#define COCKATRICE_CARD_DATABASE_LOADER_H
|
|
|
|
#include <QBasicMutex>
|
|
#include <QList>
|
|
#include <QLoggingCategory>
|
|
#include <QObject>
|
|
#include <libcockatrice/interfaces/interface_card_database_path_provider.h>
|
|
#include <libcockatrice/interfaces/interface_card_preference_provider.h>
|
|
|
|
inline Q_LOGGING_CATEGORY(CardDatabaseLoadingLog, "card_database.loading");
|
|
inline Q_LOGGING_CATEGORY(CardDatabaseLoadingSuccessOrFailureLog, "card_database.loading.success_or_failure");
|
|
|
|
class CardDatabase;
|
|
class ICardDatabaseParser;
|
|
|
|
enum LoadStatus
|
|
{
|
|
Ok,
|
|
VersionTooOld,
|
|
Invalid,
|
|
NotLoaded,
|
|
FileError,
|
|
NoCards
|
|
};
|
|
|
|
class CardDatabaseLoader : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit CardDatabaseLoader(QObject *parent,
|
|
CardDatabase *db,
|
|
ICardDatabasePathProvider *pathProvider,
|
|
ICardPreferenceProvider *preferenceProvider);
|
|
~CardDatabaseLoader() override;
|
|
|
|
public slots:
|
|
LoadStatus loadCardDatabases(); // discover & load the configured databases
|
|
LoadStatus loadCardDatabase(const QString &path); // load a single file
|
|
bool saveCustomTokensToFile(); // write tokens to custom DB path
|
|
|
|
signals:
|
|
void loadingStarted();
|
|
void loadingFinished();
|
|
void loadingFailed();
|
|
void newSetsFound(int numSets, const QStringList &setNames);
|
|
void allNewSetsEnabled();
|
|
|
|
private:
|
|
LoadStatus loadFromFile(const QString &fileName); // internal helper
|
|
QStringList collectCustomDatabasePaths() const;
|
|
|
|
CardDatabase *database; // non-owning pointer to the container
|
|
|
|
ICardDatabasePathProvider *pathProvider; // pointer to the implementation providing the paths
|
|
|
|
// parsers
|
|
QList<ICardDatabaseParser *> availableParsers;
|
|
|
|
QBasicMutex *loadFromFileMutex = new QBasicMutex();
|
|
QBasicMutex *reloadDatabaseMutex = new QBasicMutex();
|
|
};
|
|
|
|
#endif // COCKATRICE_CARD_DATABASE_LOADER_H
|