Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
card_picture_loader_local.h
Go to the documentation of this file.
1#ifndef PICTURE_LOADER_LOCAL_H
2#define PICTURE_LOADER_LOCAL_H
3
4#include <QTimer>
6
7inline Q_LOGGING_CATEGORY(CardPictureLoaderLocalLog, "card_picture_loader.local");
8
22class CardPictureLoaderLocal : public QObject
23{
24 Q_OBJECT
25
26public:
34 explicit CardPictureLoaderLocal(QObject *parent);
35
43 [[nodiscard]] QImage tryLoad(const ExactCard &toLoad) const;
44
45private:
46 QString picsPath;
48
49 QMultiHash<QString, QString> customFolderIndex;
50 QTimer *refreshTimer;
51
59 void refreshIndex();
60
73 [[nodiscard]] QImage tryLoadCardImageFromDisk(const QString &setName,
74 const QString &correctedCardName,
75 const QString &collectorNumber,
76 const QString &providerId) const;
77
78private slots:
84 void picsPathChanged();
85};
86
87#endif // PICTURE_LOADER_LOCAL_H
Q_LOGGING_CATEGORY(CardPictureLoaderLocalLog, "card_picture_loader.local")
QMultiHash< QString, QString > customFolderIndex
Multimap from cardName to file paths in CUSTOM folder.
Definition card_picture_loader_local.h:49
QString picsPath
Path to standard card image folder.
Definition card_picture_loader_local.h:46
QImage tryLoadCardImageFromDisk(const QString &setName, const QString &correctedCardName, const QString &collectorNumber, const QString &providerId) const
Attempts to load a card image from disk given its set and name info.
Definition card_picture_loader_local.cpp:70
QTimer * refreshTimer
Timer for periodic folder index refresh.
Definition card_picture_loader_local.h:50
QImage tryLoad(const ExactCard &toLoad) const
Attempts to load a card image from local disk or custom folders.
Definition card_picture_loader_local.cpp:50
void refreshIndex()
Rebuilds the index of the custom image folder.
Definition card_picture_loader_local.cpp:27
QString customPicsPath
Path to custom card image folder.
Definition card_picture_loader_local.h:47
CardPictureLoaderLocal(QObject *parent)
Constructs a CardPictureLoaderLocal object.
Definition card_picture_loader_local.cpp:12
void picsPathChanged()
Updates internal paths when the user changes picture settings.
Definition card_picture_loader_local.cpp:145
Represents a specific card instance, defined by its CardInfo and a particular printing.
Definition exact_card.h:19