mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-25 16:13:54 -07:00
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>
This commit is contained in:
parent
e752578d15
commit
aa24502129
63 changed files with 316 additions and 162 deletions
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
||||
class ReleaseChannel;
|
||||
|
||||
// In MB (Increments of 64)
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
||||
class ServersSettings : public SettingsManager
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -3,8 +3,11 @@
|
|||
|
||||
#include <QApplication>
|
||||
#include <QKeySequence>
|
||||
#include <QLoggingCategory>
|
||||
#include <QSettings>
|
||||
|
||||
inline Q_LOGGING_CATEGORY(ShortcutsSettingsLog, "shortcuts_settings");
|
||||
|
||||
class ShortcutGroup
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue