Cockatrice/cockatrice/src/client/network/spoiler_background_updater.h
BruebachL aa24502129
Move logging from QDebug to QCDebug and introduce LoggingCategories. (#5491)
* Move logging from QDebug to QCDebug and introduce LoggingCategories.

* Lint.

* Unlint like one change.

* Remove .debug category since this is autofilled by Qt and used to differentiate between QCDebug and QCWarning and QCError.

* Uncomment defaults, include main category.

* Make PictureLoader logging a bit more useful.

* Lint...?

* Address comments.

* Clean up some unnecessary classes in logging statements.

* Add a new message format to the logging handler.

* Lint.

* Lint.

* Support Windows in Regex

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
Co-authored-by: ZeldaZach <zahalpern+github@gmail.com>
2025-01-19 13:14:23 +00:00

41 lines
No EOL
1.1 KiB
C++

#ifndef COCKATRICE_SPOILER_DOWNLOADER_H
#define COCKATRICE_SPOILER_DOWNLOADER_H
#include <QByteArray>
#include <QLoggingCategory>
#include <QObject>
#include <QProcess>
inline Q_LOGGING_CATEGORY(SpoilerBackgroundUpdaterLog, "spoiler_background_updater");
class SpoilerBackgroundUpdater : public QObject
{
Q_OBJECT
public:
explicit SpoilerBackgroundUpdater(QObject *apParent = nullptr);
inline QString getCardUpdaterBinaryName()
{
return "oracle";
};
QByteArray getHash(const QString fileName);
QByteArray getHash(QByteArray data);
static bool deleteSpoilerFile();
private slots:
void actDownloadFinishedSpoilersFile();
void actCheckIfSpoilerSeasonEnabled();
private:
bool isSpoilerDownloadEnabled;
QProcess *cardUpdateProcess;
QByteArray spoilerData;
void startSpoilerDownloadProcess(QString url, bool saveResults);
void downloadFromURL(QUrl url, bool saveResults);
bool saveDownloadedFile(QByteArray data);
signals:
void spoilersUpdatedSuccessfully();
void spoilerCheckerDone();
};
#endif // COCKATRICE_SPOILER_DOWNLOADER_H