Add Deck Loader logging category.

This commit is contained in:
Lukas Brübach 2025-01-12 18:21:07 +01:00
parent 8b5ba5a3ca
commit 7d76221e39
2 changed files with 8 additions and 4 deletions

View file

@ -1,2 +1,3 @@
[Rules] [Rules]
picture_loader.debug = true picture_loader.debug = true
deck_loader.debug = true

View file

@ -10,6 +10,9 @@
#include <QFileInfo> #include <QFileInfo>
#include <QRegularExpression> #include <QRegularExpression>
#include <QStringList> #include <QStringList>
#include <qloggingcategory.h>
Q_LOGGING_CATEGORY(DeckLoaderLog, "deck_loader")
const QStringList DeckLoader::fileNameFilters = QStringList() const QStringList DeckLoader::fileNameFilters = QStringList()
<< QObject::tr("Common deck formats (*.cod *.dec *.dek *.txt *.mwDeck)") << QObject::tr("Common deck formats (*.cod *.dec *.dek *.txt *.mwDeck)")
@ -49,9 +52,9 @@ bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool user
break; break;
case CockatriceFormat: { case CockatriceFormat: {
result = loadFromFile_Native(&file); result = loadFromFile_Native(&file);
qDebug() << "Loaded from" << fileName << "-" << result; qCDebug(DeckLoaderLog) << "Loaded from" << fileName << "-" << result;
if (!result) { if (!result) {
qDebug() << "Retrying as plain format"; qCDebug(DeckLoaderLog) << "Retrying as plain format";
file.seek(0); file.seek(0);
result = loadFromFile_Plain(&file); result = loadFromFile_Plain(&file);
fmt = PlainTextFormat; fmt = PlainTextFormat;
@ -73,7 +76,7 @@ bool DeckLoader::loadFromFile(const QString &fileName, FileFormat fmt, bool user
emit deckLoaded(); emit deckLoaded();
} }
qDebug() << "Deck was loaded -" << result; qCDebug(DeckLoaderLog) << "Deck was loaded -" << result;
return result; return result;
} }