mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-22 10:22:15 -07:00
Move logging from QDebug to QCDebug and introduce LoggingCategories.
This commit is contained in:
parent
92a903b035
commit
710f7b0f07
63 changed files with 262 additions and 123 deletions
|
|
@ -15,11 +15,8 @@
|
|||
#include <QScreen>
|
||||
#include <QThread>
|
||||
#include <algorithm>
|
||||
#include <qloggingcategory.h>
|
||||
#include <utility>
|
||||
|
||||
Q_LOGGING_CATEGORY(PictureLoaderLog, "picture_loader")
|
||||
|
||||
// never cache more than 300 cards at once for a single deck
|
||||
#define CACHED_CARD_PER_DECK_MAX 300
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,11 @@
|
|||
#include "../../../game/cards/card_database.h"
|
||||
#include "picture_loader_worker.h"
|
||||
|
||||
class PictureLoader : public QObject
|
||||
#include <QLoggingCategory>
|
||||
|
||||
inline Q_LOGGING_CATEGORY(PictureLoaderLog, "picture_loader")
|
||||
|
||||
class PictureLoader : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -5,14 +5,11 @@
|
|||
|
||||
#include <QBuffer>
|
||||
#include <QDirIterator>
|
||||
#include <QLoggingCategory>
|
||||
#include <QMovie>
|
||||
#include <QNetworkDiskCache>
|
||||
#include <QNetworkReply>
|
||||
#include <QThread>
|
||||
|
||||
Q_LOGGING_CATEGORY(PictureLoaderWorkerLog, "picture_loader.worker");
|
||||
|
||||
// Card back returned by gatherer when card is not found
|
||||
QStringList PictureLoaderWorker::md5Blacklist = QStringList() << "db0c48db407a907c16ade38de048a441";
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "../../../game/cards/card_database.h"
|
||||
#include "picture_to_load.h"
|
||||
|
||||
#include <QLoggingCategory>
|
||||
#include <QMutex>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QObject>
|
||||
|
|
@ -14,6 +15,8 @@
|
|||
#define REDIRECT_TIMESTAMP "timestamp"
|
||||
#define REDIRECT_CACHE_FILENAME "cache.ini"
|
||||
|
||||
inline Q_LOGGING_CATEGORY(PictureLoaderWorkerLog, "picture_loader.worker");
|
||||
|
||||
class PictureLoaderWorker : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
|||
|
|
@ -7,9 +7,6 @@
|
|||
#include <QRegularExpression>
|
||||
#include <QUrl>
|
||||
#include <algorithm>
|
||||
#include <qloggingcategory.h>
|
||||
|
||||
Q_LOGGING_CATEGORY(PictureToLoadLog, "picture_loader.picture_to_load")
|
||||
|
||||
PictureToLoad::PictureToLoad(CardInfoPtr _card)
|
||||
: card(std::move(_card)), urlTemplates(SettingsCache::instance().downloads().getAllURLs())
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@
|
|||
|
||||
#include "../../../game/cards/card_database.h"
|
||||
|
||||
class PictureToLoad
|
||||
#include <QLoggingCategory>
|
||||
|
||||
inline Q_LOGGING_CATEGORY(PictureToLoadLog, "picture_loader.picture_to_load")
|
||||
|
||||
class PictureToLoad
|
||||
{
|
||||
private:
|
||||
class SetDownloadPriorityComparator
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ void ThemeManager::ensureThemeDirectoryExists()
|
|||
{
|
||||
if (SettingsCache::instance().getThemeName().isEmpty() ||
|
||||
!getAvailableThemes().contains(SettingsCache::instance().getThemeName())) {
|
||||
qDebug() << "Theme name not set, setting default value";
|
||||
qCDebug(ThemeManagerLog) << "Theme name not set, setting default value";
|
||||
SettingsCache::instance().setThemeName(NONE_THEME_NAME);
|
||||
}
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@ QBrush ThemeManager::loadExtraBrush(QString fileName, QBrush &fallbackBrush)
|
|||
void ThemeManager::themeChangedSlot()
|
||||
{
|
||||
QString themeName = SettingsCache::instance().getThemeName();
|
||||
qDebug() << "Theme changed:" << themeName;
|
||||
qCDebug(ThemeManagerLog) << "Theme changed:" << themeName;
|
||||
|
||||
QString dirPath = getAvailableThemes().value(themeName);
|
||||
QDir dir = dirPath;
|
||||
|
|
|
|||
|
|
@ -3,11 +3,14 @@
|
|||
|
||||
#include <QBrush>
|
||||
#include <QDir>
|
||||
#include <QLoggingCategory>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QPixmap>
|
||||
#include <QString>
|
||||
|
||||
inline Q_LOGGING_CATEGORY(ThemeManagerLog, "theme_manager.debug");
|
||||
|
||||
typedef QMap<QString, QString> QStringMap;
|
||||
typedef QMap<int, QBrush> QBrushMap;
|
||||
|
||||
|
|
|
|||
|
|
@ -904,13 +904,13 @@ void MainWindow::startupConfigCheck()
|
|||
|
||||
if (SettingsCache::instance().getClientVersion() == CLIENT_INFO_NOT_SET) {
|
||||
// no config found, 99% new clean install
|
||||
qDebug() << "Startup: old client version empty, assuming first start after clean install";
|
||||
qCDebug(WindowMainStartupVersionLog) << "Startup: old client version empty, assuming first start after clean install";
|
||||
alertForcedOracleRun(VERSION_STRING, false);
|
||||
SettingsCache::instance().downloads().resetToDefaultURLs(); // populate the download urls
|
||||
SettingsCache::instance().setClientVersion(VERSION_STRING);
|
||||
} else if (SettingsCache::instance().getClientVersion() != VERSION_STRING) {
|
||||
// config found, from another (presumably older) version
|
||||
qDebug() << "Startup: old client version" << SettingsCache::instance().getClientVersion()
|
||||
qCDebug(WindowMainStartupVersionLog) << "Startup: old client version" << SettingsCache::instance().getClientVersion()
|
||||
<< "differs, assuming first start after update";
|
||||
if (SettingsCache::instance().getNotifyAboutNewVersion()) {
|
||||
alertForcedOracleRun(VERSION_STRING, true);
|
||||
|
|
@ -918,13 +918,13 @@ void MainWindow::startupConfigCheck()
|
|||
const auto reloadOk0 = QtConcurrent::run([] { CardDatabaseManager::getInstance()->loadCardDatabases(); });
|
||||
}
|
||||
|
||||
qDebug() << "[MainWindow] Migrating shortcuts after update detected.";
|
||||
qCDebug(WindowMainStartupShortcutsLog) << "[MainWindow] Migrating shortcuts after update detected.";
|
||||
SettingsCache::instance().shortcuts().migrateShortcuts();
|
||||
|
||||
SettingsCache::instance().setClientVersion(VERSION_STRING);
|
||||
} else {
|
||||
// previous config from this version found
|
||||
qDebug() << "Startup: found config with current version";
|
||||
qCDebug(WindowMainStartupVersionLog) << "Startup: found config with current version";
|
||||
const auto reloadOk1 = QtConcurrent::run([] { CardDatabaseManager::getInstance()->loadCardDatabases(); });
|
||||
|
||||
// Run the tips dialog only on subsequent startups.
|
||||
|
|
@ -1036,11 +1036,11 @@ void MainWindow::changeEvent(QEvent *event)
|
|||
if (isActiveWindow() && !bHasActivated) {
|
||||
bHasActivated = true;
|
||||
if (!connectTo.isEmpty()) {
|
||||
qDebug() << "Command line connect to " << connectTo;
|
||||
qCDebug(WindowMainStartupAutoconnectLog) << "Command line connect to " << connectTo;
|
||||
client->connectToServer(connectTo.host(), connectTo.port(), connectTo.userName(), connectTo.password());
|
||||
} else if (SettingsCache::instance().servers().getAutoConnect() &&
|
||||
!SettingsCache::instance().debug().getLocalGameOnStartup()) {
|
||||
qDebug() << "Attempting auto-connect...";
|
||||
qCDebug(WindowMainStartupAutoconnectLog) << "Attempting auto-connect...";
|
||||
DlgConnect dlg(this);
|
||||
client->connectToServer(dlg.getHost(), static_cast<unsigned int>(dlg.getPort()), dlg.getPlayerName(),
|
||||
dlg.getPassword());
|
||||
|
|
|
|||
|
|
@ -24,12 +24,19 @@
|
|||
#include "pb/response.pb.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QLoggingCategory>
|
||||
#include <QMainWindow>
|
||||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QtNetwork>
|
||||
|
||||
inline Q_LOGGING_CATEGORY(WindowMainLog, "window_main.debug");
|
||||
inline Q_LOGGING_CATEGORY(WindowMainStartupLog, "window_main.debug.startup");
|
||||
inline Q_LOGGING_CATEGORY(WindowMainStartupVersionLog, "window_main.debug.startup.version");
|
||||
inline Q_LOGGING_CATEGORY(WindowMainStartupShortcutsLog, "window_main.debug.startup.shortcuts");
|
||||
inline Q_LOGGING_CATEGORY(WindowMainStartupAutoconnectLog, "window_main.debug.startup.autoconnect");
|
||||
|
||||
class Release;
|
||||
class DlgConnect;
|
||||
class DlgViewLog;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue