mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-12 13:00:01 -08:00
Fix signatures
This commit is contained in:
parent
598da954fc
commit
d8213088e4
66 changed files with 143 additions and 132 deletions
|
|
@ -27,8 +27,7 @@ CardDatabase::CardDatabase(QObject *parent,
|
|||
ICardPreferenceProvider *prefs,
|
||||
ICardDatabasePathProvider *pathProvider,
|
||||
ICardSetPriorityController *_setPriorityController)
|
||||
: QObject(parent), setPriorityController(_setPriorityController), loadStatus(NotLoaded),
|
||||
querier(this, prefs)
|
||||
: QObject(parent), setPriorityController(_setPriorityController), loadStatus(NotLoaded), querier(this, prefs)
|
||||
{
|
||||
qRegisterMetaType<CardInfoPtr>("CardInfoPtr");
|
||||
qRegisterMetaType<CardInfoPtr>("CardSetPtr");
|
||||
|
|
@ -45,6 +44,17 @@ CardDatabase::CardDatabase(QObject *parent,
|
|||
// that cross-thread loads are delivered via the event loop while same-thread/
|
||||
// synchronous callers get the swap immediately.
|
||||
connect(loader, &CardDatabaseLoader::databaseDataReady, this, &CardDatabase::swapInDatabaseData);
|
||||
|
||||
// The querier is a plain (non-QObject) member, so its cache invalidation is
|
||||
// driven from here instead of by connecting its own slots.
|
||||
connect(this, &CardDatabase::cardAdded, this, &CardDatabase::invalidateQuerierCaches);
|
||||
connect(this, &CardDatabase::cardRemoved, this, &CardDatabase::invalidateQuerierCaches);
|
||||
connect(this, &CardDatabase::cardDatabaseReset, this, &CardDatabase::invalidateQuerierCaches);
|
||||
}
|
||||
|
||||
void CardDatabase::invalidateQuerierCaches()
|
||||
{
|
||||
querier.invalidateCaches();
|
||||
}
|
||||
|
||||
CardDatabase::~CardDatabase()
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "../set/card_set_list.h"
|
||||
#include "card_database_loader.h"
|
||||
#include "card_database_querier.h"
|
||||
|
||||
// IWYU pragma: keep
|
||||
// CardDatabaseData is passed by value to the swapInDatabaseData() slot, and
|
||||
|
|
@ -18,7 +19,6 @@
|
|||
#include <QStringList>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class CardDatabaseQuerier;
|
||||
class ICardDatabasePathProvider;
|
||||
class ICardPreferenceProvider;
|
||||
class ICardSetPriorityController;
|
||||
|
|
@ -62,6 +62,7 @@ protected:
|
|||
/** @brief Querier for higher-level card lookups. */
|
||||
CardDatabaseQuerier querier;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Refreshes the cached reverse-related cards for all cards.
|
||||
*/
|
||||
|
|
@ -94,6 +95,11 @@ protected:
|
|||
QBasicMutex *clearDatabaseMutex = new QBasicMutex(), *addCardMutex = new QBasicMutex(),
|
||||
*removeCardMutex = new QBasicMutex();
|
||||
|
||||
/**
|
||||
* @brief Invalidates the querier's cached count maps after the database contents change.
|
||||
*/
|
||||
void invalidateQuerierCaches();
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Constructs a new CardDatabase instance.
|
||||
|
|
@ -142,7 +148,7 @@ public:
|
|||
}
|
||||
|
||||
/** @brief Returns the querier for performing card lookups. */
|
||||
[[nodiscard]] CardDatabaseQuerier const &query() const
|
||||
[[nodiscard]] const CardDatabaseQuerier &query() const
|
||||
{
|
||||
return querier;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ CardDatabase *CardDatabaseManager::getInstance()
|
|||
return &instance;
|
||||
}
|
||||
|
||||
CardDatabaseQuerier const &CardDatabaseManager::query()
|
||||
const CardDatabaseQuerier &CardDatabaseManager::query()
|
||||
{
|
||||
return getInstance()->query();
|
||||
}
|
||||
|
|
@ -61,9 +61,9 @@ public:
|
|||
|
||||
/**
|
||||
* @brief Returns the CardDatabaseQuerier of the singleton database.
|
||||
* @return Pointer to CardDatabaseQuerier.
|
||||
* @return Reference to the singleton database querier.
|
||||
*/
|
||||
static CardDatabaseQuerier const &query();
|
||||
static const CardDatabaseQuerier &query();
|
||||
|
||||
private:
|
||||
/** @brief Private default constructor to enforce singleton. */
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@
|
|||
CardDatabaseQuerier::CardDatabaseQuerier(const CardDatabase *_db, const ICardPreferenceProvider *prefs)
|
||||
: db(_db), prefs(prefs)
|
||||
{
|
||||
// Invalidate the cached count maps whenever the database contents change.
|
||||
connect(db, &CardDatabase::cardAdded, this, &CardDatabaseQuerier::invalidateCaches);
|
||||
connect(db, &CardDatabase::cardRemoved, this, &CardDatabaseQuerier::invalidateCaches);
|
||||
connect(db, &CardDatabase::cardDatabaseReset, this, &CardDatabaseQuerier::invalidateCaches);
|
||||
}
|
||||
|
||||
void CardDatabaseQuerier::invalidateCaches()
|
||||
|
|
|
|||
|
|
@ -7,10 +7,8 @@
|
|||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
class CardDatabase;
|
||||
class ICardPreferenceProvider;
|
||||
|
|
@ -232,8 +230,9 @@ private:
|
|||
mutable QMap<QString, int> subCardTypeCountsCache;
|
||||
mutable QMap<QString, int> formatsCountCache;
|
||||
|
||||
private slots:
|
||||
void invalidateCaches();
|
||||
|
||||
friend class CardDatabase;
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_CARD_DATABASE_QUERIER_H
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
static QString getCompleteCardName(const QString &cardName)
|
||||
{
|
||||
ExactCard temp = CardDatabaseManager::query()->guessCard({cardName});
|
||||
ExactCard temp = CardDatabaseManager::query().guessCard({cardName});
|
||||
if (temp) {
|
||||
return temp.getName();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue