Move logging from QDebug to QCDebug and introduce LoggingCategories.

This commit is contained in:
Lukas Brübach 2025-01-17 11:37:30 +01:00
parent 92a903b035
commit 710f7b0f07
63 changed files with 262 additions and 123 deletions

View file

@ -1,3 +1,47 @@
[Rules]
picture_loader.debug = true
deck_loader.debug = true
# Uncomment a rule to disable logging for that category
# qt_translator.debug = false // Doesn't work because logging isn't initialized yet in main.cpp
# window_main.debug = false
# release_channel.debug = false
# spoiler_background_updater.debug = false
# theme_manager.debug = false
# sound_engine.debug = false
# tapped_out_interface.debug = false
# tab_game.debug = false
# tab_message.debug = false
# tab_supervisor.debug = false
# dlg_edit_avatar.debug = false
# dlg_settings.debug = false
# dlg_tip_of_the_day.debug = false
# dlg_update.debug = false
# settings_cache.debug = false
# servers_settings.debug = false
# shortcuts_settings.debug = false
# player.debug = false
# game_scene.debug = false
# game_scene.debug.player_addition_removal = false
# card_zone.debug = false
# view_zone.debug = false
# user_info_connection.debug = false
# picture_loader.* = false
# picture_loader.debug = false
# picture_loader.worker.debug = false
# deck_loader.debug = false
# card_database.debug = false
# card_database.debug.loading = false
# card_database.debug.loading.success_or_failure = false
# cockatrice_xml.debug.* = false
# cockatrice_xml.debug.xml_3_parser = false
# cockatrice_xml.debug.xml_4_parser = false
# set_list.debug = false
# card_list.debug = false
# filter_string.debug = false

View file

@ -33,7 +33,7 @@ ReleaseChannel::~ReleaseChannel()
void ReleaseChannel::checkForUpdates()
{
QString releaseChannelUrl = getReleaseChannelUrl();
qDebug() << "Searching for updates on the channel: " << releaseChannelUrl;
qCDebug(ReleaseChannelLog) << "Searching for updates on the channel: " << releaseChannelUrl;
response = netMan->get(QNetworkRequest(releaseChannelUrl));
connect(response, &QNetworkReply::finished, this, &ReleaseChannel::releaseListFinished);
}
@ -145,15 +145,15 @@ void StableReleaseChannel::releaseListFinished()
QString shortHash = lastRelease->getCommitHash().left(GIT_SHORT_HASH_LEN);
QString myHash = QString(VERSION_COMMIT);
qDebug() << "Current hash=" << myHash << "update hash=" << shortHash;
qCDebug(ReleaseChannelLog) << "Current hash=" << myHash << "update hash=" << shortHash;
qDebug() << "Got reply from release server, name=" << lastRelease->getName()
qCDebug(ReleaseChannelLog) << "Got reply from release server, name=" << lastRelease->getName()
<< "desc=" << lastRelease->getDescriptionUrl() << "date=" << lastRelease->getPublishDate()
<< "url=" << lastRelease->getDownloadUrl();
const QString &tagName = resultMap["tag_name"].toString();
QString url = QString(STABLETAG_URL) + tagName;
qDebug() << "Searching for commit hash corresponding to stable channel tag: " << tagName;
qCDebug(ReleaseChannelLog) << "Searching for commit hash corresponding to stable channel tag: " << tagName;
response = netMan->get(QNetworkRequest(url));
connect(response, &QNetworkReply::finished, this, &StableReleaseChannel::tagListFinished);
}
@ -178,11 +178,11 @@ void StableReleaseChannel::tagListFinished()
}
lastRelease->setCommitHash(resultMap["object"].toMap()["sha"].toString());
qDebug() << "Got reply from tag server, commit=" << lastRelease->getCommitHash();
qCDebug(ReleaseChannelLog) << "Got reply from tag server, commit=" << lastRelease->getCommitHash();
QString shortHash = lastRelease->getCommitHash().left(GIT_SHORT_HASH_LEN);
QString myHash = QString(VERSION_COMMIT);
qDebug() << "Current hash=" << myHash << "update hash=" << shortHash;
qCDebug(ReleaseChannelLog) << "Current hash=" << myHash << "update hash=" << shortHash;
const bool needToUpdate = (QString::compare(shortHash, myHash, Qt::CaseInsensitive) != 0);
emit finishedCheck(needToUpdate, lastRelease->isCompatibleVersionFound(), lastRelease);
@ -249,13 +249,13 @@ void BetaReleaseChannel::releaseListFinished()
lastRelease->setName(QString("%1 (%2)").arg(resultMap["tag_name"].toString()).arg(shortHash));
lastRelease->setDescriptionUrl(QString(BETARELEASE_CHANGESURL).arg(VERSION_COMMIT, shortHash));
qDebug() << "Got reply from release server, size=" << resultMap.size() << "name=" << lastRelease->getName()
qCDebug(ReleaseChannelLog) << "Got reply from release server, size=" << resultMap.size() << "name=" << lastRelease->getName()
<< "desc=" << lastRelease->getDescriptionUrl() << "commit=" << lastRelease->getCommitHash()
<< "date=" << lastRelease->getPublishDate();
QString betaBuildDownloadUrl = resultMap["assets_url"].toString();
qDebug() << "Searching for a corresponding file on the beta channel: " << betaBuildDownloadUrl;
qCDebug(ReleaseChannelLog) << "Searching for a corresponding file on the beta channel: " << betaBuildDownloadUrl;
response = netMan->get(QNetworkRequest(betaBuildDownloadUrl));
connect(response, &QNetworkReply::finished, this, &BetaReleaseChannel::fileListFinished);
}
@ -275,7 +275,7 @@ void BetaReleaseChannel::fileListFinished()
QVariantList resultList = jsonResponse.toVariant().toList();
QString shortHash = lastRelease->getCommitHash().left(GIT_SHORT_HASH_LEN);
QString myHash = QString(VERSION_COMMIT);
qDebug() << "Current hash=" << myHash << "update hash=" << shortHash;
qCDebug(ReleaseChannelLog) << "Current hash=" << myHash << "update hash=" << shortHash;
bool needToUpdate = (QString::compare(shortHash, myHash, Qt::CaseInsensitive) != 0);
bool compatibleVersion = false;
@ -292,7 +292,7 @@ void BetaReleaseChannel::fileListFinished()
if (downloadMatchesCurrentOS(*url)) {
compatibleVersion = true;
lastRelease->setDownloadUrl(*url);
qDebug() << "Found compatible version url=" << *url;
qCDebug(ReleaseChannelLog) << "Found compatible version url=" << *url;
break;
}
}

View file

@ -2,12 +2,15 @@
#define RELEASECHANNEL_H
#include <QDate>
#include <QLoggingCategory>
#include <QObject>
#include <QString>
#include <QVariantMap>
#include <utility>
class QNetworkReply;
inline Q_LOGGING_CATEGORY(ReleaseChannelLog, "release_channel.debug")
class QNetworkReply;
class QNetworkAccessManager;
class Release

View file

@ -28,7 +28,7 @@ SpoilerBackgroundUpdater::SpoilerBackgroundUpdater(QObject *apParent) : QObject(
// File exists means we're in spoiler season
startSpoilerDownloadProcess(SPOILERS_STATUS_URL, false);
} else {
qDebug() << "Spoilers Disabled";
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoilers Disabled";
}
}
@ -67,7 +67,7 @@ void SpoilerBackgroundUpdater::actDownloadFinishedSpoilersFile()
reply->deleteLater();
emit spoilerCheckerDone();
} else {
qDebug() << "Error downloading spoilers file" << errorCode;
qCDebug(SpoilerBackgroundUpdaterLog) << "Error downloading spoilers file" << errorCode;
emit spoilerCheckerDone();
}
}
@ -81,11 +81,11 @@ bool SpoilerBackgroundUpdater::deleteSpoilerFile()
// Delete the spoiler.xml file
if (file.exists() && file.remove()) {
qDebug() << "Deleting spoiler.xml";
qCDebug(SpoilerBackgroundUpdaterLog) << "Deleting spoiler.xml";
return true;
}
qDebug() << "Error: Spoiler.xml not found or not deleted";
qCDebug(SpoilerBackgroundUpdaterLog) << "Error: Spoiler.xml not found or not deleted";
return false;
}
@ -101,24 +101,24 @@ void SpoilerBackgroundUpdater::actCheckIfSpoilerSeasonEnabled()
trayIcon->showMessage(tr("Spoilers season has ended"), tr("Deleting spoiler.xml. Please run Oracle"));
}
qDebug() << "Spoiler Season Offline";
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoiler Season Offline";
emit spoilerCheckerDone();
} else if (errorCode == QNetworkReply::NoError) {
qDebug() << "Spoiler Service Online";
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoiler Service Online";
startSpoilerDownloadProcess(SPOILERS_URL, true);
} else if (errorCode == QNetworkReply::HostNotFoundError) {
if (trayIcon) {
trayIcon->showMessage(tr("Spoilers download failed"), tr("No internet connection"));
}
qDebug() << "Spoiler download failed due to no internet connection";
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoiler download failed due to no internet connection";
emit spoilerCheckerDone();
} else {
if (trayIcon) {
trayIcon->showMessage(tr("Spoilers download failed"), tr("Error") + " " + (short)errorCode);
}
qDebug() << "Spoiler download failed with reason" << errorCode;
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoiler download failed with reason" << errorCode;
emit spoilerCheckerDone();
}
}
@ -139,19 +139,19 @@ bool SpoilerBackgroundUpdater::saveDownloadedFile(QByteArray data)
trayIcon->showMessage(tr("Spoilers already up to date"), tr("No new spoilers added"));
}
qDebug() << "Spoilers Up to Date";
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoilers Up to Date";
return false;
}
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly)) {
qDebug() << "Spoiler Service Error: File open (w) failed for" << fileName;
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoiler Service Error: File open (w) failed for" << fileName;
file.close();
return false;
}
if (file.write(data) == -1) {
qDebug() << "Spoiler Service Error: File write (w) failed for" << fileName;
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoiler Service Error: File write (w) failed for" << fileName;
file.close();
return false;
}
@ -159,7 +159,7 @@ bool SpoilerBackgroundUpdater::saveDownloadedFile(QByteArray data)
file.close();
// Data written, so reload the card database
qDebug() << "Spoiler Service Data Written";
qCDebug(SpoilerBackgroundUpdaterLog) << "Spoiler Service Data Written";
const auto reloadOk = QtConcurrent::run([] { CardDatabaseManager::getInstance()->loadCardDatabases(); });
// If the user has notifications enabled, let them know
@ -202,12 +202,12 @@ QByteArray SpoilerBackgroundUpdater::getHash(const QString fileName)
QCryptographicHash hash(QCryptographicHash::Algorithm::Md5);
hash.addData(bytes);
qDebug() << "File Hash =" << hash.result();
qCDebug(SpoilerBackgroundUpdaterLog) << "File Hash =" << hash.result();
file.close();
return hash.result();
} else {
qDebug() << "getHash ReadOnly failed!";
qCDebug(SpoilerBackgroundUpdaterLog) << "getHash ReadOnly failed!";
file.close();
return QByteArray();
}
@ -221,7 +221,7 @@ QByteArray SpoilerBackgroundUpdater::getHash(QByteArray data)
QCryptographicHash hash(QCryptographicHash::Algorithm::Md5);
hash.addData(bytes);
qDebug() << "Data Hash =" << hash.result();
qCDebug(SpoilerBackgroundUpdaterLog) << "Data Hash =" << hash.result();
return hash.result();
}

View file

@ -4,6 +4,9 @@
#include <QByteArray>
#include <QObject>
#include <QProcess>
#include <QLoggingCategory>
inline Q_LOGGING_CATEGORY(SpoilerBackgroundUpdaterLog, "spoiler_background_updater.debug");
class SpoilerBackgroundUpdater : public QObject
{

View file

@ -37,7 +37,7 @@ SoundEngine::~SoundEngine()
void SoundEngine::soundEnabledChanged()
{
if (SettingsCache::instance().getSoundEnabled()) {
qDebug() << "SoundEngine: enabling sound with" << audioData.size() << "sounds";
qCDebug(SoundEngineLog) << "SoundEngine: enabling sound with" << audioData.size() << "sounds";
if (!player) {
player = new QMediaPlayer;
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
@ -46,7 +46,7 @@ void SoundEngine::soundEnabledChanged()
#endif
}
} else {
qDebug() << "SoundEngine: disabling sound";
qCDebug(SoundEngineLog) << "SoundEngine: disabling sound";
if (player) {
player->stop();
player->deleteLater();
@ -90,7 +90,7 @@ void SoundEngine::ensureThemeDirectoryExists()
{
if (SettingsCache::instance().getSoundThemeName().isEmpty() ||
!getAvailableThemes().contains(SettingsCache::instance().getSoundThemeName())) {
qDebug() << "Sounds theme name not set, setting default value";
qCDebug(SoundEngineLog) << "Sounds theme name not set, setting default value";
SettingsCache::instance().setSoundThemeName(DEFAULT_THEME_NAME);
}
}
@ -131,7 +131,7 @@ QStringMap &SoundEngine::getAvailableThemes()
void SoundEngine::themeChangedSlot()
{
QString themeName = SettingsCache::instance().getSoundThemeName();
qDebug() << "Sound theme changed:" << themeName;
qCDebug(SoundEngineLog) << "Sound theme changed:" << themeName;
QDir dir = getAvailableThemes().value(themeName);

View file

@ -6,6 +6,9 @@
#include <QMediaPlayer>
#include <QObject>
#include <QString>
#include <QLoggingCategory>
inline Q_LOGGING_CATEGORY(SoundEngineLog, "sound_engine.debug");
class QBuffer;

View file

@ -1578,12 +1578,10 @@ void TabDeckEditor::actDecrement()
void TabDeckEditor::setDeck(DeckLoader *_deck)
{
qDebug() << " ORIGINAL BANNER CARD " << _deck->getBannerCard().first;
deckModel->setDeckList(_deck);
nameEdit->setText(deckModel->getDeckList()->getName());
commentsEdit->setText(deckModel->getDeckList()->getComments());
qDebug() << deckModel->getDeckList()->getBannerCard() << " was the banner card";
bannerCardComboBox->setCurrentText(deckModel->getDeckList()->getBannerCard().first);
updateBannerCardComboBox();
updateHash();

View file

@ -759,7 +759,7 @@ void TabGame::processGameEventContainer(const GameEventContainer &cont,
default: {
Player *player = players.value(playerId, 0);
if (!player) {
qDebug() << "unhandled game event: invalid player id";
qCDebug(TabGameLog) << "unhandled game event: invalid player id";
break;
}
player->processGameEvent(eventType, event, context, options);

View file

@ -10,6 +10,9 @@
#include <QCompleter>
#include <QMap>
#include <QLoggingCategory>
inline Q_LOGGING_CATEGORY(TabGameLog, "tab_game.debug");
class UserListProxy;
class DeckViewContainer;

View file

@ -148,7 +148,7 @@ void TabMessage::showSystemPopup(const Event_UserMessage &event)
event.message().c_str());
connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
} else {
qDebug() << "Error: trayIcon is NULL. TabMessage::showSystemPopup failed";
qCDebug(TabMessageLog) << "Error: trayIcon is NULL. TabMessage::showSystemPopup failed";
}
}

View file

@ -3,6 +3,10 @@
#include "tab.h"
#include <QLoggingCategory>
inline Q_LOGGING_CATEGORY(TabMessageLog, "tab_message.debug");
class AbstractClient;
class ChatView;
class LineEditUnfocusable;

View file

@ -760,7 +760,7 @@ void TabSupervisor::processGameEventContainer(const GameEventContainer &cont)
if (tab)
tab->processGameEventContainer(cont, qobject_cast<AbstractClient *>(sender()), {});
else
qDebug() << "gameEvent: invalid gameId";
qCDebug(TabSupervisorLog) << "gameEvent: invalid gameId";
}
void TabSupervisor::processUserMessageEvent(const Event_UserMessage &event)
@ -787,9 +787,9 @@ void TabSupervisor::processUserMessageEvent(const Event_UserMessage &event)
void TabSupervisor::actShowPopup(const QString &message)
{
qDebug() << "ACT SHOW POPUP";
qCDebug(TabSupervisorLog) << "ACT SHOW POPUP";
if (trayIcon && (QApplication::activeWindow() == nullptr || QApplication::focusWidget() == nullptr)) {
qDebug() << "LAUNCHING POPUP";
qCDebug(TabSupervisorLog) << "LAUNCHING POPUP";
// disconnect(trayIcon, SIGNAL(messageClicked()), nullptr, nullptr);
trayIcon->showMessage(message, tr("Click to view"));
// connect(trayIcon, SIGNAL(messageClicked()), chatView, SLOT(actMessageClicked()));

View file

@ -7,10 +7,13 @@
#include <QAbstractButton>
#include <QCommonStyle>
#include <QLoggingCategory>
#include <QMap>
#include <QProxyStyle>
#include <QTabWidget>
inline Q_LOGGING_CATEGORY(TabSupervisorLog, "tab_supervisor.debug");
class UserListManager;
class QMenu;
class AbstractClient;

View file

@ -33,7 +33,7 @@ void TappedOutInterface::queryFinished(QNetworkReply *reply)
* can be extracted from the header. The http status is a 302 "redirect".
*/
QString deckUrl = reply->rawHeader("Location");
qDebug() << "Tappedout: good reply, http status" << httpStatus << "location" << deckUrl;
qCDebug(TappedOutInterfaceLog) << "Tappedout: good reply, http status" << httpStatus << "location" << deckUrl;
QDesktopServices::openUrl("https://tappedout.net" + deckUrl);
} else {
/*
@ -57,7 +57,7 @@ void TappedOutInterface::queryFinished(QNetworkReply *reply)
}
QString errorMessage = errorMessageList.join("\n");
qDebug() << "Tappedout: bad reply, http status" << httpStatus << "size" << data.size() << "message"
qCDebug(TappedOutInterfaceLog) << "Tappedout: bad reply, http status" << httpStatus << "size" << data.size() << "message"
<< errorMessage;
QMessageBox::critical(nullptr, tr("Error"), errorMessage);

View file

@ -5,6 +5,9 @@
#include "decklist.h"
#include <QObject>
#include <QLoggingCategory>
inline Q_LOGGING_CATEGORY(TappedOutInterfaceLog, "tapped_out_interface.debug")
class QByteArray;
class QNetworkAccessManager;

View file

@ -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

View file

@ -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:

View file

@ -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";

View file

@ -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

View file

@ -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())

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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());

View file

@ -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;

View file

@ -61,7 +61,7 @@ void DlgEditAvatar::actBrowse()
imgReader.setDecideFormatFromContent(true);
imgReader.setFileName(fileName);
if (!imgReader.read(&image)) {
qDebug() << "Avatar image loading failed for file:" << fileName;
qCDebug(DlgEditAvatarLog) << "Avatar image loading failed for file:" << fileName;
imageLabel->setText(tr("Invalid image chosen."));
return;
}

View file

@ -4,6 +4,9 @@
#include <QComboBox>
#include <QDialog>
#include <QLineEdit>
#include <QLoggingCategory>
inline Q_LOGGING_CATEGORY(DlgEditAvatarLog, "dlg_edit_avatar.debug")
class QLabel;
class QPushButton;

View file

@ -198,7 +198,7 @@ QString GeneralSettingsPage::languageName(const QString &lang)
QString appNameHint = translationPrefix + "_" + lang;
bool appTranslationLoaded = qTranslator.load(appNameHint, translationPath);
if (!appTranslationLoaded) {
qDebug() << "Unable to load" << translationPrefix << "translation" << appNameHint << "at" << translationPath;
qCDebug(DlgSettingsLog) << "Unable to load" << translationPrefix << "translation" << appNameHint << "at" << translationPath;
}
return qTranslator.translate("i18n", DEFAULT_LANG_NAME);
@ -1535,7 +1535,7 @@ void DlgSettings::closeEvent(QCloseEvent *event)
bool showLoadError = true;
QString loadErrorMessage = tr("Unknown Error loading card database");
LoadStatus loadStatus = CardDatabaseManager::getInstance()->getLoadStatus();
qDebug() << "Card Database load status: " << loadStatus;
qCDebug(DlgSettingsLog) << "Card Database load status: " << loadStatus;
switch (loadStatus) {
case Ok:
showLoadError = false;

View file

@ -8,9 +8,12 @@
#include <QDialog>
#include <QGroupBox>
#include <QLabel>
#include <QLoggingCategory>
#include <QPushButton>
#include <QSpinBox>
inline Q_LOGGING_CATEGORY(DlgSettingsLog, "dlg_settings.debug");
class ShortcutTreeView;
class SearchLineEdit;
class QTreeView;

View file

@ -146,7 +146,7 @@ void DlgTipOfTheDay::updateTip(int tipId)
tipTextContent->setText(contentText);
if (!image->load(imagePath)) {
qDebug() << "Image failed to load from" << imagePath;
qCDebug(DlgTipOfTheDayLog) << "Image failed to load from" << imagePath;
imageLabel->clear();
} else {
int h = std::min(std::max(imageLabel->height(), MIN_TIP_IMAGE_HEIGHT), MAX_TIP_IMAGE_HEIGHT);

View file

@ -5,10 +5,13 @@
#include <QDialog>
#include <QDialogButtonBox>
#include <QHBoxLayout>
#include <QLoggingCategory>
#include <QLineEdit>
#include <QPushButton>
#include <QVBoxLayout>
inline Q_LOGGING_CATEGORY(DlgTipOfTheDayLog, "dlg_tip_of_the_day.debug");
class QLabel;
class QPushButton;
class QCheckBox;

View file

@ -221,7 +221,7 @@ void DlgUpdate::downloadSuccessful(const QUrl &filepath)
// Try to open the installer. If it opens, quit Cockatrice
if (QDesktopServices::openUrl(filepath)) {
QMetaObject::invokeMethod(static_cast<MainWindow *>(parent()), "close", Qt::QueuedConnection);
qDebug() << "Opened downloaded update file successfully - closing Cockatrice";
qCDebug(DlgUpdateLog) << "Opened downloaded update file successfully - closing Cockatrice";
close();
} else {
setLabel(tr("Error"));

View file

@ -4,8 +4,12 @@
#include "../client/update_downloader.h"
#include <QDialogButtonBox>
#include <QLoggingCategory>
#include <QProgressDialog>
#include <QtNetwork>
inline Q_LOGGING_CATEGORY(DlgUpdateLog, "dlg_update.debug");
class Release;
class DlgUpdate : public QDialog

View file

@ -22,7 +22,6 @@ ArrowItem::ArrowItem(Player *_player, int _id, ArrowTarget *_startItem, ArrowTar
: QGraphicsItem(), player(_player), id(_id), startItem(_startItem), targetItem(_targetItem), targetLocked(false),
color(_color), fullColor(true)
{
qDebug() << "ArrowItem constructor: startItem=" << static_cast<QGraphicsItem *>(startItem);
setZValue(2000000005);
if (startItem)
@ -36,7 +35,6 @@ ArrowItem::ArrowItem(Player *_player, int _id, ArrowTarget *_startItem, ArrowTar
ArrowItem::~ArrowItem()
{
qDebug() << "ArrowItem destructor";
}
void ArrowItem::delArrow()

View file

@ -102,7 +102,7 @@ public:
inline bool operator()(const CardSetPtr &a, const CardSetPtr &b) const
{
if (a.isNull() || b.isNull()) {
qDebug() << "SetList::KeyCompareFunctor a or b is null";
qCDebug(SetListLog) << "SetList::KeyCompareFunctor a or b is null";
return false;
}
@ -170,7 +170,7 @@ void SetList::enableAll()
CardSetPtr set = at(i);
if (set == nullptr) {
qDebug() << "enabledAll has null";
qCDebug(SetListLog) << "enabledAll has null";
continue;
}
@ -201,7 +201,7 @@ void SetList::guessSortKeys()
for (int i = 0; i < size(); ++i) {
CardSetPtr set = at(i);
if (set.isNull()) {
qDebug() << "guessSortKeys set is null";
qCDebug(SetListLog) << "guessSortKeys set is null";
continue;
}
set->setSortKey(i);
@ -415,7 +415,7 @@ void CardDatabase::clear()
void CardDatabase::addCard(CardInfoPtr card)
{
if (card == nullptr) {
qDebug() << "addCard(nullptr)";
qCDebug(CardDatabaseLog) << "CardDatabase::addCard(nullptr)";
return;
}
@ -440,7 +440,7 @@ void CardDatabase::addCard(CardInfoPtr card)
void CardDatabase::removeCard(CardInfoPtr card)
{
if (card.isNull()) {
qDebug() << "removeCard(nullptr)";
qCDebug(CardDatabaseLog) << "CardDatabase::removeCard(nullptr)";
return;
}
@ -582,8 +582,8 @@ LoadStatus CardDatabase::loadCardDatabase(const QString &path)
}
int msecs = startTime.msecsTo(QTime::currentTime());
qDebug() << "[CardDatabase] loadCardDatabase(): Path =" << path << "Status =" << tempLoadStatus
<< "Cards =" << cards.size() << "Sets =" << sets.size() << QString("%1ms").arg(msecs);
qCDebug(CardDatabaseLoadingLog) << "[CardDatabase] loadCardDatabase(): Path =" << path
<< "Status =" << tempLoadStatus << "Cards =" << cards.size() << "Sets =" << sets.size() << QString("%1ms").arg(msecs);
return tempLoadStatus;
}
@ -592,7 +592,7 @@ LoadStatus CardDatabase::loadCardDatabases()
{
reloadDatabaseMutex->lock();
qDebug() << "CardDatabase::loadCardDatabases start";
qCDebug(CardDatabaseLoadingLog) << "CardDatabase::loadCardDatabases start";
clear(); // remove old db
@ -613,7 +613,7 @@ LoadStatus CardDatabase::loadCardDatabases()
for (auto i = 0; i < databasePaths.size(); ++i) {
const auto &databasePath = databasePaths.at(i);
qDebug() << "Loading Custom Set" << i << "(" << databasePath << ")";
qCDebug(CardDatabaseLoadingLog) << "Loading Custom Set" << i << "(" << databasePath << ")";
loadCardDatabase(databasePath);
}
@ -626,10 +626,10 @@ LoadStatus CardDatabase::loadCardDatabases()
if (loadStatus == Ok) {
checkUnknownSets(); // update deck editors, etc
qDebug() << "CardDatabase::loadCardDatabases success";
qCDebug(CardDatabaseLoadingSuccessOrFailureLog) << "CardDatabase::loadCardDatabases success";
emit cardDatabaseLoadingFinished();
} else {
qDebug() << "CardDatabase::loadCardDatabases failed";
qCDebug(CardDatabaseLoadingSuccessOrFailureLog) << "CardDatabase::loadCardDatabases failed";
emit cardDatabaseLoadingFailed(); // bring up the settings dialog
}

View file

@ -5,6 +5,7 @@
#include <QDate>
#include <QHash>
#include <QList>
#include <QLoggingCategory>
#include <QMap>
#include <QMetaType>
#include <QSharedPointer>
@ -13,6 +14,11 @@
#include <QVector>
#include <utility>
inline Q_LOGGING_CATEGORY(SetListLog, "set_list.debug");
inline Q_LOGGING_CATEGORY(CardDatabaseLog, "card_database.debug");
inline Q_LOGGING_CATEGORY(CardDatabaseLoadingLog, "card_database.debug.loading");
inline Q_LOGGING_CATEGORY(CardDatabaseLoadingSuccessOrFailureLog, "card_database.debug.loading.success_or_failure");
class CardDatabase;
class CardInfo;
class CardInfoPerSet;

View file

@ -13,10 +13,10 @@
bool CockatriceXml3Parser::getCanParseFile(const QString &fileName, QIODevice &device)
{
qDebug() << "[CockatriceXml3Parser] Trying to parse: " << fileName;
qCDebug(CockatriceXml3Log) << "[CockatriceXml3Parser] Trying to parse: " << fileName;
if (!fileName.endsWith(".xml", Qt::CaseInsensitive)) {
qDebug() << "[CockatriceXml3Parser] Parsing failed: wrong extension";
qCDebug(CockatriceXml3Log) << "[CockatriceXml3Parser] Parsing failed: wrong extension";
return false;
}
@ -28,12 +28,12 @@ bool CockatriceXml3Parser::getCanParseFile(const QString &fileName, QIODevice &d
if (version == COCKATRICE_XML3_TAGVER) {
return true;
} else {
qDebug() << "[CockatriceXml3Parser] Parsing failed: wrong version" << version;
qCDebug(CockatriceXml3Log) << "[CockatriceXml3Parser] Parsing failed: wrong version" << version;
return false;
}
} else {
qDebug() << "[CockatriceXml3Parser] Parsing failed: wrong element tag" << xml.name();
qCDebug(CockatriceXml3Log) << "[CockatriceXml3Parser] Parsing failed: wrong element tag" << xml.name();
return false;
}
}
@ -58,7 +58,8 @@ void CockatriceXml3Parser::parseFile(QIODevice &device)
} else if (name == "cards") {
loadCardsFromXml(xml);
} else if (!name.isEmpty()) {
qDebug() << "[CockatriceXml3Parser] Unknown item" << name << ", trying to continue anyway";
qCDebug(CockatriceXml3Log)
<< "[CockatriceXml3Parser] Unknown item" << name << ", trying to continue anyway";
xml.skipCurrentElement();
}
}
@ -93,7 +94,8 @@ void CockatriceXml3Parser::loadSetsFromXml(QXmlStreamReader &xml)
releaseDate =
QDate::fromString(xml.readElementText(QXmlStreamReader::IncludeChildElements), Qt::ISODate);
} else if (!name.isEmpty()) {
qDebug() << "[CockatriceXml3Parser] Unknown set property" << name << ", trying to continue anyway";
qCDebug(CockatriceXml3Log)
<< "[CockatriceXml3Parser] Unknown set property" << name << ", trying to continue anyway";
xml.skipCurrentElement();
}
}
@ -263,8 +265,8 @@ void CockatriceXml3Parser::loadCardsFromXml(QXmlStreamReader &xml)
relatedCards << relation;
}
} else if (!xmlName.isEmpty()) {
qDebug() << "[CockatriceXml3Parser] Unknown card property" << xmlName
<< ", trying to continue anyway";
qCDebug(CockatriceXml3Log)
<< "[CockatriceXml3Parser] Unknown card property" << xmlName << ", trying to continue anyway";
xml.skipCurrentElement();
}
}
@ -281,7 +283,7 @@ void CockatriceXml3Parser::loadCardsFromXml(QXmlStreamReader &xml)
static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardSetPtr &set)
{
if (set.isNull()) {
qDebug() << "&operator<< set is nullptr";
qCDebug(CockatriceXml3Log) << "&operator<< set is nullptr";
return xml;
}
@ -298,7 +300,7 @@ static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardSetPtr &set
static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfoPtr &info)
{
if (info.isNull()) {
qDebug() << "operator<< info is nullptr";
qCDebug(CockatriceXml3Log) << "operator<< info is nullptr";
return xml;
}

View file

@ -3,9 +3,12 @@
#include "card_database_parser.h"
#include <QLoggingCategory>
#include <QXmlStreamReader>
class CockatriceXml3Parser : public ICardDatabaseParser
inline Q_LOGGING_CATEGORY(CockatriceXml3Log, "cockatrice_xml.debug.xml_3_parser")
class CockatriceXml3Parser : public ICardDatabaseParser
{
Q_OBJECT
Q_INTERFACES(ICardDatabaseParser)

View file

@ -13,10 +13,10 @@
bool CockatriceXml4Parser::getCanParseFile(const QString &fileName, QIODevice &device)
{
qDebug() << "[CockatriceXml4Parser] Trying to parse: " << fileName;
qCDebug(CockatriceXml4Log) << "[CockatriceXml4Parser] Trying to parse: " << fileName;
if (!fileName.endsWith(".xml", Qt::CaseInsensitive)) {
qDebug() << "[CockatriceXml4Parser] Parsing failed: wrong extension";
qCDebug(CockatriceXml4Log) << "[CockatriceXml4Parser] Parsing failed: wrong extension";
return false;
}
@ -28,12 +28,12 @@ bool CockatriceXml4Parser::getCanParseFile(const QString &fileName, QIODevice &d
if (version == COCKATRICE_XML4_TAGVER) {
return true;
} else {
qDebug() << "[CockatriceXml4Parser] Parsing failed: wrong version" << version;
qCDebug(CockatriceXml4Log) << "[CockatriceXml4Parser] Parsing failed: wrong version" << version;
return false;
}
} else {
qDebug() << "[CockatriceXml4Parser] Parsing failed: wrong element tag" << xml.name();
qCDebug(CockatriceXml4Log) << "[CockatriceXml4Parser] Parsing failed: wrong element tag" << xml.name();
return false;
}
}
@ -58,7 +58,8 @@ void CockatriceXml4Parser::parseFile(QIODevice &device)
} else if (xmlName == "cards") {
loadCardsFromXml(xml);
} else if (!xmlName.isEmpty()) {
qDebug() << "[CockatriceXml4Parser] Unknown item" << xmlName << ", trying to continue anyway";
qCDebug(CockatriceXml4Log)
<< "[CockatriceXml4Parser] Unknown item" << xmlName << ", trying to continue anyway";
xml.skipCurrentElement();
}
}
@ -96,8 +97,8 @@ void CockatriceXml4Parser::loadSetsFromXml(QXmlStreamReader &xml)
} else if (xmlName == "priority") {
priority = xml.readElementText(QXmlStreamReader::IncludeChildElements).toShort();
} else if (!xmlName.isEmpty()) {
qDebug() << "[CockatriceXml4Parser] Unknown set property" << xmlName
<< ", trying to continue anyway";
qCDebug(CockatriceXml4Log)
<< "[CockatriceXml4Parser] Unknown set property" << xmlName << ", trying to continue anyway";
xml.skipCurrentElement();
}
}
@ -230,8 +231,8 @@ void CockatriceXml4Parser::loadCardsFromXml(QXmlStreamReader &xml)
relatedCards << relation;
}
} else if (!xmlName.isEmpty()) {
qDebug() << "[CockatriceXml4Parser] Unknown card property" << xmlName
<< ", trying to continue anyway";
qCDebug(CockatriceXml4Log)
<< "[CockatriceXml4Parser] Unknown card property" << xmlName << ", trying to continue anyway";
xml.skipCurrentElement();
}
}
@ -247,7 +248,7 @@ void CockatriceXml4Parser::loadCardsFromXml(QXmlStreamReader &xml)
static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardSetPtr &set)
{
if (set.isNull()) {
qDebug() << "&operator<< set is nullptr";
qCDebug(CockatriceXml4Log) << "&operator<< set is nullptr";
return xml;
}
@ -265,7 +266,7 @@ static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardSetPtr &set
static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfoPtr &info)
{
if (info.isNull()) {
qDebug() << "operator<< info is nullptr";
qCDebug(CockatriceXml4Log) << "operator<< info is nullptr";
return xml;
}

View file

@ -3,9 +3,12 @@
#include "card_database_parser.h"
#include <QLoggingCategory>
#include <QXmlStreamReader>
class CockatriceXml4Parser : public ICardDatabaseParser
inline Q_LOGGING_CATEGORY(CockatriceXml4Log, "cockatrice_xml.debug.xml_4_parser")
class CockatriceXml4Parser : public ICardDatabaseParser
{
Q_OBJECT
Q_INTERFACES(ICardDatabaseParser)

View file

@ -151,6 +151,6 @@ std::function<QString(CardItem *)> CardList::getExtractorFor(SortOption option)
}
// this line should never be reached
qDebug() << "cardlist.cpp: Could not find extractor for SortOption" << option;
qCDebug(CardListLog) << "cardlist.cpp: Could not find extractor for SortOption" << option;
return [](CardItem *) { return ""; };
}

View file

@ -2,6 +2,9 @@
#define CARDLIST_H
#include <QList>
#include <QLoggingCategory>
inline Q_LOGGING_CATEGORY(CardListLog, "card_list.debug");
class CardItem;

View file

@ -382,7 +382,7 @@ FilterString::FilterString(const QString &expr)
});
if (!search.parse(ba.data(), result)) {
qDebug().nospace() << "FilterString error for " << expr << "; " << qPrintable(_error);
qCDebug(FilterStringLog).nospace() << "FilterString error for " << expr << "; " << qPrintable(_error);
result = [](const CardData &) -> bool { return false; };
}
}

View file

@ -4,11 +4,14 @@
#include "../cards/card_database.h"
#include "filter_tree.h"
#include <QLoggingCategory>
#include <QMap>
#include <QString>
#include <functional>
#include <utility>
inline Q_LOGGING_CATEGORY(FilterStringLog, "filter_string.debug");
typedef CardInfoPtr CardData;
typedef std::function<bool(const CardData &)> Filter;
typedef std::function<bool(const QString &)> StringMatcher;

View file

@ -39,7 +39,7 @@ void GameScene::retranslateUi()
void GameScene::addPlayer(Player *player)
{
qDebug() << "GameScene::addPlayer name=" << player->getName();
qCDebug(GameScenePlayerAdditionRemovalLog) << "GameScene::addPlayer name=" << player->getName();
players << player;
addItem(player);
connect(player, &Player::sizeChanged, this, &GameScene::rearrange);
@ -48,7 +48,7 @@ void GameScene::addPlayer(Player *player)
void GameScene::removePlayer(Player *player)
{
qDebug() << "GameScene::removePlayer name=" << player->getName();
qCDebug(GameScenePlayerAdditionRemovalLog) << "GameScene::removePlayer name=" << player->getName();
for (ZoneViewWidget *zone : zoneViews) {
if (zone->getPlayer() == player) {
zone->close();

View file

@ -3,9 +3,13 @@
#include <QGraphicsScene>
#include <QList>
#include <QLoggingCategory>
#include <QPointer>
#include <QSet>
inline Q_LOGGING_CATEGORY(GameSceneLog, "game_scene.debug");
inline Q_LOGGING_CATEGORY(GameScenePlayerAdditionRemovalLog, "game_scene.debug.player_addition_removal");
class Player;
class ZoneViewWidget;
class CardZone;

View file

@ -562,7 +562,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
Player::~Player()
{
qDebug() << "Player destructor:" << getName();
qCDebug(PlayerLog) << "Player destructor:" << getName();
static_cast<GameScene *>(scene())->removePlayer(this);

View file

@ -9,10 +9,13 @@
#include "pb/game_event.pb.h"
#include <QInputDialog>
#include <QLoggingCategory>
#include <QMap>
#include <QPoint>
#include <QTimer>
inline Q_LOGGING_CATEGORY(PlayerLog, "player.debug");
namespace google
{
namespace protobuf

View file

@ -42,7 +42,7 @@ CardZone::CardZone(Player *_p,
CardZone::~CardZone()
{
qDebug() << "CardZone destructor: " << name;
qCDebug(CardZoneLog) << "CardZone destructor: " << name;
for (auto *view : views) {
if (view != nullptr) {
view->deleteLater();
@ -147,7 +147,7 @@ void CardZone::mousePressEvent(QGraphicsSceneMouseEvent *event)
void CardZone::addCard(CardItem *card, const bool reorganize, const int x, const int y)
{
if (!card) {
qDebug() << "CardZone::addCard() card is null, this shouldn't normally happen";
qCDebug(CardZoneLog) << "CardZone::addCard() card is null, this shouldn't normally happen";
return;
}
@ -171,7 +171,7 @@ CardItem *CardZone::getCard(int cardId, const QString &cardName)
{
CardItem *c = cards.findCard(cardId);
if (!c) {
qDebug() << "CardZone::getCard: card id=" << cardId << "not found";
qCDebug(CardZoneLog) << "CardZone::getCard: card id=" << cardId << "not found";
return nullptr;
}
// If the card's id is -1, this zone is invisible,
@ -216,7 +216,7 @@ CardItem *CardZone::takeCard(int position, int cardId, bool /*canResize*/)
void CardZone::removeCard(CardItem *card)
{
if (!card) {
qDebug() << "CardZone::removeCard: card is null, this shouldn't normally happen";
qCDebug(CardZoneLog) << "CardZone::removeCard: card is null, this shouldn't normally happen";
return;
}

View file

@ -5,8 +5,11 @@
#include "../board/abstract_graphics_item.h"
#include "../cards/card_list.h"
#include <QLoggingCategory>
#include <QString>
inline Q_LOGGING_CATEGORY(CardZoneLog, "card_zone.debug");
class Player;
class ZoneViewZone;
class QMenu;

View file

@ -246,7 +246,7 @@ ZoneViewZone::GridSize ZoneViewZone::positionCardsForDisplay(CardList &cards, Ca
if (cols < 2)
cols = 2;
qDebug() << "reorganizeCards: rows=" << rows << "cols=" << cols;
qCDebug(ViewZoneLog) << "reorganizeCards: rows=" << rows << "cols=" << cols;
for (int i = 0; i < cardCount; i++) {
CardItem *c = cards.at(i);

View file

@ -4,9 +4,12 @@
#include "select_zone.h"
#include <QGraphicsLayoutItem>
#include <QLoggingCategory>
#include <pb/commands.pb.h>
class ZoneViewWidget;
inline Q_LOGGING_CATEGORY(ViewZoneLog, "view_zone.debug")
class ZoneViewWidget;
class Response;
class ServerInfo_Card;
class QGraphicsSceneWheelEvent;

View file

@ -102,18 +102,19 @@ void installNewTranslator()
bool qtTranslationLoaded = qtTranslator->load(qtNameHint, qtTranslationPath);
if (!qtTranslationLoaded) {
qDebug() << "Unable to load qt translation" << qtNameHint << "at" << qtTranslationPath;
qCDebug(QtTranslatorDebug) << "aaUnable to load qt translation" << qtNameHint << "at" << qtTranslationPath;
} else {
qDebug() << "Loaded qt translation" << qtNameHint << "at" << qtTranslationPath;
qCDebug(QtTranslatorDebug) << "Loaded qt translation" << qtNameHint << "at" << qtTranslationPath;
}
qApp->installTranslator(qtTranslator);
QString appNameHint = translationPrefix + "_" + lang;
bool appTranslationLoaded = qtTranslator->load(appNameHint, translationPath);
if (!appTranslationLoaded) {
qDebug() << "Unable to load" << translationPrefix << "translation" << appNameHint << "at" << translationPath;
qCDebug(QtTranslatorDebug) << "aaUnable to load" << translationPrefix << "translation" << appNameHint << "at"
<< translationPath;
} else {
qDebug() << "Loaded" << translationPrefix << "translation" << appNameHint << "at" << translationPath;
qCDebug(QtTranslatorDebug) << "Loaded" << translationPrefix << "translation" << appNameHint << "at" << translationPath;
}
qApp->installTranslator(translator);
}

View file

@ -3,6 +3,10 @@
#include "utility/macros.h"
#include <QLoggingCategory>
inline Q_LOGGING_CATEGORY(QtTranslatorDebug, "qt_translator.debug");
class CardDatabase;
class QString;
class QSystemTrayIcon;

View file

@ -74,7 +74,7 @@ QStringList UserConnection_Information::getServerInfo(const QString &find)
}
if (_server.empty())
qDebug() << "There was a problem!";
qCDebug(UserInfoConnectionLog) << "There was a problem!";
return _server;
}

View file

@ -4,9 +4,12 @@
#include <QApplication>
#include <QDir>
#include <QFile>
#include <QLoggingCategory>
#include <QSettings>
#include <QStandardPaths>
inline Q_LOGGING_CATEGORY(UserInfoConnectionLog, "user_info_connection.debug");
class UserConnection_Information
{
private:

View file

@ -144,7 +144,7 @@ QString SettingsCache::getSafeConfigPath(QString configEntry, QString defaultPat
// ensure that the defaut path exists and return it
if (tmp.isEmpty() || !QDir(tmp).exists()) {
if (!QDir().mkpath(defaultPath))
qDebug() << "[SettingsCache] Could not create folder:" << defaultPath;
qCDebug(SettingsCacheLog) << "[SettingsCache] Could not create folder:" << defaultPath;
tmp = defaultPath;
}
return tmp;
@ -165,7 +165,7 @@ SettingsCache::SettingsCache()
// first, figure out if we are running in portable mode
isPortableBuild = QFile::exists(qApp->applicationDirPath() + "/portable.dat");
if (isPortableBuild)
qDebug() << "Portable mode enabled";
qCDebug(SettingsCacheLog) << "Portable mode enabled";
// define a dummy context that will be used where needed
QString dummy = QT_TRANSLATE_NOOP("i18n", "English");

View file

@ -13,10 +13,13 @@
#include "servers_settings.h"
#include "shortcuts_settings.h"
#include <QLoggingCategory>
#include <QObject>
#include <QSize>
#include <QStringList>
inline Q_LOGGING_CATEGORY(SettingsCacheLog, "settings_cache.debug");
class ReleaseChannel;
// In MB (Increments of 64)

View file

@ -76,7 +76,7 @@ QString ServersSettings::getPort(QString defaultPort)
{
int index = getPrevioushostindex(getPrevioushostName());
QVariant port = getValue(QString("port%1").arg(index), "server", "server_details");
qDebug() << "getPort() index = " << index << " port.val = " << port.toString();
qCDebug(ServersSettingsLog) << "getPort() index = " << index << " port.val = " << port.toString();
return port == QVariant() ? std::move(defaultPort) : port.toString();
}
@ -84,7 +84,7 @@ QString ServersSettings::getPlayerName(QString defaultName)
{
int index = getPrevioushostindex(getPrevioushostName());
QVariant name = getValue(QString("username%1").arg(index), "server", "server_details");
qDebug() << "getPlayerName() index = " << index << " name.val = " << name.toString();
qCDebug(ServersSettingsLog) << "getPlayerName() index = " << index << " name.val = " << name.toString();
return name == QVariant() ? std::move(defaultName) : name.toString();
}

View file

@ -3,10 +3,13 @@
#include "settings_manager.h"
#include <QLoggingCategory>
#include <QObject>
#define SERVERSETTINGS_DEFAULT_HOST "server.cockatrice.us"
#define SERVERSETTINGS_DEFAULT_PORT "4748"
inline Q_LOGGING_CATEGORY(ServersSettingsLog, "servers_settings.debug");
class ServersSettings : public SettingsManager
{
Q_OBJECT

View file

@ -67,7 +67,7 @@ void ShortcutsSettings::migrateShortcuts()
shortCutsFile.beginGroup(custom);
if (shortCutsFile.contains("Textbox/unfocusTextBox")) {
qDebug()
qCDebug(ShortcutsSettingsLog)
<< "[ShortcutsSettings] Textbox/unfocusTextBox shortcut found. Migrating to Player/unfocusTextBox.";
QString unfocusTextBox = shortCutsFile.value("Textbox/unfocusTextBox", "").toString();
this->setShortcuts("Player/unfocusTextBox", unfocusTextBox);
@ -75,7 +75,8 @@ void ShortcutsSettings::migrateShortcuts()
}
if (shortCutsFile.contains("tab_game/aFocusChat")) {
qDebug() << "[ShortcutsSettings] tab_game/aFocusChat shortcut found. Migrating to Player/aFocusChat.";
qCDebug(ShortcutsSettingsLog)
<< "[ShortcutsSettings] tab_game/aFocusChat shortcut found. Migrating to Player/aFocusChat.";
QString aFocusChat = shortCutsFile.value("tab_game/aFocusChat", "").toString();
this->setShortcuts("Player/aFocusChat", aFocusChat);
shortCutsFile.remove("tab_game/aFocusChat");

View file

@ -3,8 +3,11 @@
#include <QApplication>
#include <QKeySequence>
#include <QLoggingCategory>
#include <QSettings>
inline Q_LOGGING_CATEGORY(ShortcutsSettingsLog, "shortcuts_settings.debug");
class ShortcutGroup
{
public: