mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 19:33:01 +02:00
Use logging categories
This commit is contained in:
parent
72bcd6a008
commit
b540c426c1
7 changed files with 21 additions and 8 deletions
|
@ -481,7 +481,7 @@ public slots:
|
||||||
void setIsInterstitialMode(bool interstitialMode);
|
void setIsInterstitialMode(bool interstitialMode);
|
||||||
|
|
||||||
void updateVerboseLogging();
|
void updateVerboseLogging();
|
||||||
|
|
||||||
void setCachebustRequire();
|
void setCachebustRequire();
|
||||||
|
|
||||||
void changeViewAsNeeded(float boomLength);
|
void changeViewAsNeeded(float boomLength);
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(settings_handle, "settings.handle")
|
||||||
|
|
||||||
const QString Settings::firstRun { "firstRun" };
|
const QString Settings::firstRun { "firstRun" };
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <QtCore/QReadWriteLock>
|
#include <QtCore/QReadWriteLock>
|
||||||
#include <QtCore/QSharedPointer>
|
#include <QtCore/QSharedPointer>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/quaternion.hpp>
|
||||||
|
@ -27,6 +28,8 @@
|
||||||
#include "SettingInterface.h"
|
#include "SettingInterface.h"
|
||||||
|
|
||||||
|
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(settings_handle)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QSettings analog
|
* @brief QSettings analog
|
||||||
*
|
*
|
||||||
|
@ -309,7 +312,7 @@ namespace Setting {
|
||||||
void deprecate() {
|
void deprecate() {
|
||||||
if (_isSet) {
|
if (_isSet) {
|
||||||
if (get() != getDefault()) {
|
if (get() != getDefault()) {
|
||||||
qInfo().nospace() << "[DEPRECATION NOTICE] " << _key << "(" << get() << ") has been deprecated, and has no effect";
|
qCInfo(settings_handle).nospace() << "[DEPRECATION NOTICE] " << _key << "(" << get() << ") has been deprecated, and has no effect";
|
||||||
} else {
|
} else {
|
||||||
remove();
|
remove();
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace Setting {
|
||||||
// in an assignment-client - the QSettings backing we use for this means persistence of these
|
// in an assignment-client - the QSettings backing we use for this means persistence of these
|
||||||
// settings from an AC (when there can be multiple terminating at same time on one machine)
|
// settings from an AC (when there can be multiple terminating at same time on one machine)
|
||||||
// is currently not supported
|
// is currently not supported
|
||||||
qWarning() << "Setting::Interface::init() for key" << _key << "- Manager not yet created." <<
|
qCWarning(settings_interface) << "Setting::Interface::init() for key" << _key << "- Manager not yet created." <<
|
||||||
"Settings persistence disabled.";
|
"Settings persistence disabled.";
|
||||||
} else {
|
} else {
|
||||||
_manager = DependencyManager::get<Manager>();
|
_manager = DependencyManager::get<Manager>();
|
||||||
|
@ -84,11 +84,12 @@ namespace Setting {
|
||||||
manager->registerHandle(this);
|
manager->registerHandle(this);
|
||||||
_isInitialized = true;
|
_isInitialized = true;
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Settings interface used after manager destroyed";
|
qCWarning(settings_interface) << "Settings interface used after manager destroyed";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load value from disk
|
// Load value from disk
|
||||||
load();
|
load();
|
||||||
|
//qCDebug(settings_interface) << "Setting" << this->getKey() << "initialized to" << getVariant();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,6 +107,7 @@ namespace Setting {
|
||||||
|
|
||||||
void Interface::maybeInit() const {
|
void Interface::maybeInit() const {
|
||||||
if (!_isInitialized) {
|
if (!_isInitialized) {
|
||||||
|
//qCDebug(settings_interface) << "Initializing setting" << this->getKey();
|
||||||
const_cast<Interface*>(this)->init();
|
const_cast<Interface*>(this)->init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
#include <QtCore/QWeakPointer>
|
#include <QtCore/QWeakPointer>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(settings_interface)
|
||||||
|
|
||||||
namespace Setting {
|
namespace Setting {
|
||||||
class Manager;
|
class Manager;
|
||||||
|
@ -37,7 +40,7 @@ namespace Setting {
|
||||||
void init();
|
void init();
|
||||||
void maybeInit() const;
|
void maybeInit() const;
|
||||||
void deinit();
|
void deinit();
|
||||||
|
|
||||||
void save();
|
void save();
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
|
@ -46,7 +49,7 @@ namespace Setting {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable bool _isInitialized = false;
|
mutable bool _isInitialized = false;
|
||||||
|
|
||||||
friend class Manager;
|
friend class Manager;
|
||||||
mutable QWeakPointer<Manager> _manager;
|
mutable QWeakPointer<Manager> _manager;
|
||||||
};
|
};
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace Setting {
|
||||||
_fileName = settings.fileName();
|
_fileName = settings.fileName();
|
||||||
|
|
||||||
for(QString key : settings.allKeys()) {
|
for(QString key : settings.allKeys()) {
|
||||||
qDebug() << "Loaded key" << key << "with value" << settings.value(key);
|
//qCDebug(settings_manager) << "Loaded key" << key << "with value" << settings.value(key);
|
||||||
_settings[key] = settings.value(key);
|
_settings[key] = settings.value(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ namespace Setting {
|
||||||
const QString& key = handle->getKey();
|
const QString& key = handle->getKey();
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
if (_handles.contains(key)) {
|
if (_handles.contains(key)) {
|
||||||
qWarning() << "Setting::Manager::registerHandle(): Key registered more than once, overriding: " << key;
|
qCWarning(settings_manager) << "Setting::Manager::registerHandle(): Key registered more than once, overriding: " << key;
|
||||||
}
|
}
|
||||||
_handles.insert(key, handle);
|
_handles.insert(key, handle);
|
||||||
});
|
});
|
||||||
|
@ -96,6 +96,7 @@ namespace Setting {
|
||||||
|
|
||||||
void Manager::loadSetting(Interface* handle) {
|
void Manager::loadSetting(Interface* handle) {
|
||||||
const auto& key = handle->getKey();
|
const auto& key = handle->getKey();
|
||||||
|
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
QVariant loadedValue = _settings[key];
|
QVariant loadedValue = _settings[key];
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,13 @@
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
#include "DependencyManager.h"
|
#include "DependencyManager.h"
|
||||||
#include "shared/ReadWriteLockable.h"
|
#include "shared/ReadWriteLockable.h"
|
||||||
|
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(settings_manager)
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(settings_writer)
|
||||||
|
|
||||||
// This is for the testing system.
|
// This is for the testing system.
|
||||||
class SettingsTests;
|
class SettingsTests;
|
||||||
|
|
Loading…
Reference in a new issue