Cockatrice 2026-10-19-Development-3.1.2-beta.2
A 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 <QImage>
5#include <QLoggingCategory>
6#include <QMultiHash>
7#include <QObject>
8#include <QString>
9#include <qtmetamacros.h>
10
11class ExactCard;
12class QTimer;
13
14inline Q_LOGGING_CATEGORY(CardPictureLoaderLocalLog, "card_picture_loader.local");
15
29class CardPictureLoaderLocal : public QObject
30{
31 Q_OBJECT
32
33public:
41 explicit CardPictureLoaderLocal(QObject *parent);
42
50 [[nodiscard]] QImage tryLoad(const ExactCard &toLoad) const;
51
52private:
53 QString picsPath;
55
56 QMultiHash<QString, QString> customFolderIndex;
57 QTimer *refreshTimer;
58
66 void refreshIndex();
67
80 [[nodiscard]] QImage tryLoadCardImageFromDisk(const QString &setName,
81 const QString &correctedCardName,
82 const QString &collectorNumber,
83 const QString &providerId) const;
84
85private slots:
91 void picsPathChanged();
92};
93
94#endif // PICTURE_LOADER_LOCAL_H
QMultiHash< QString, QString > customFolderIndex
Multimap from cardName to file paths in CUSTOM folder.
Definition card_picture_loader_local.h:56
QString picsPath
Path to standard card image folder.
Definition card_picture_loader_local.h:53
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:82
QTimer * refreshTimer
Timer for periodic folder index refresh.
Definition card_picture_loader_local.h:57
QImage tryLoad(const ExactCard &toLoad) const
Attempts to load a card image from local disk or custom folders.
Definition card_picture_loader_local.cpp:62
void refreshIndex()
Rebuilds the index of the custom image folder.
Definition card_picture_loader_local.cpp:39
QString customPicsPath
Path to custom card image folder.
Definition card_picture_loader_local.h:54
CardPictureLoaderLocal(QObject *parent)
Constructs a CardPictureLoaderLocal object.
Definition card_picture_loader_local.cpp:24
void picsPathChanged()
Updates internal paths when the user changes picture settings.
Definition card_picture_loader_local.cpp:144
Represents a specific card instance, defined by its CardInfo and a particular printing.
Definition exact_card.h:24
Q_LOGGING_CATEGORY(CrashReportLog, "crash_report")