mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-30 18:43:55 -07:00
* big move * also move game_specific_terms * fix imports * alphabetize cmake * fix build failure * create database folder and move files into it * fix includes * run formatter
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
#ifndef PICTURE_LOADER_LOCAL_H
|
|
#define PICTURE_LOADER_LOCAL_H
|
|
|
|
#include "../../../card/exact_card.h"
|
|
|
|
#include <QLoggingCategory>
|
|
#include <QObject>
|
|
#include <QTimer>
|
|
|
|
inline Q_LOGGING_CATEGORY(PictureLoaderLocalLog, "picture_loader.local");
|
|
|
|
/**
|
|
* Handles searching for and loading card images from the local pics and custom image folders.
|
|
* This class maintains an index of the CUSTOM folder, to avoid repeatedly searching the entire directory.
|
|
*/
|
|
class PictureLoaderLocal : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit PictureLoaderLocal(QObject *parent);
|
|
|
|
QImage tryLoad(const ExactCard &toLoad) const;
|
|
|
|
private:
|
|
QString picsPath, customPicsPath;
|
|
|
|
QMultiHash<QString, QString> customFolderIndex; // multimap of cardName to picPaths
|
|
QTimer *refreshTimer;
|
|
|
|
void refreshIndex();
|
|
|
|
QImage tryLoadCardImageFromDisk(const QString &setName,
|
|
const QString &correctedCardName,
|
|
const QString &collectorNumber,
|
|
const QString &providerId) const;
|
|
|
|
private slots:
|
|
void picsPathChanged();
|
|
};
|
|
|
|
#endif // PICTURE_LOADER_LOCAL_H
|