mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01: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 updateVerboseLogging();
|
||||
|
||||
|
||||
void setCachebustRequire();
|
||||
|
||||
void changeViewAsNeeded(float boomLength);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <math.h>
|
||||
|
||||
|
||||
Q_LOGGING_CATEGORY(settings_handle, "settings.handle")
|
||||
|
||||
const QString Settings::firstRun { "firstRun" };
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <QtCore/QReadWriteLock>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QLoggingCategory>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
|
@ -27,6 +28,8 @@
|
|||
#include "SettingInterface.h"
|
||||
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(settings_handle)
|
||||
|
||||
/**
|
||||
* @brief QSettings analog
|
||||
*
|
||||
|
@ -309,7 +312,7 @@ namespace Setting {
|
|||
void deprecate() {
|
||||
if (_isSet) {
|
||||
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 {
|
||||
remove();
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace Setting {
|
|||
// 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)
|
||||
// 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.";
|
||||
} else {
|
||||
_manager = DependencyManager::get<Manager>();
|
||||
|
@ -84,11 +84,12 @@ namespace Setting {
|
|||
manager->registerHandle(this);
|
||||
_isInitialized = true;
|
||||
} else {
|
||||
qWarning() << "Settings interface used after manager destroyed";
|
||||
qCWarning(settings_interface) << "Settings interface used after manager destroyed";
|
||||
}
|
||||
|
||||
// Load value from disk
|
||||
load();
|
||||
//qCDebug(settings_interface) << "Setting" << this->getKey() << "initialized to" << getVariant();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,6 +107,7 @@ namespace Setting {
|
|||
|
||||
void Interface::maybeInit() const {
|
||||
if (!_isInitialized) {
|
||||
//qCDebug(settings_interface) << "Initializing setting" << this->getKey();
|
||||
const_cast<Interface*>(this)->init();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
#include <QtCore/QWeakPointer>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QLoggingCategory>
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(settings_interface)
|
||||
|
||||
namespace Setting {
|
||||
class Manager;
|
||||
|
@ -37,7 +40,7 @@ namespace Setting {
|
|||
void init();
|
||||
void maybeInit() const;
|
||||
void deinit();
|
||||
|
||||
|
||||
void save();
|
||||
void load();
|
||||
|
||||
|
@ -46,7 +49,7 @@ namespace Setting {
|
|||
|
||||
private:
|
||||
mutable bool _isInitialized = false;
|
||||
|
||||
|
||||
friend class Manager;
|
||||
mutable QWeakPointer<Manager> _manager;
|
||||
};
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace Setting {
|
|||
_fileName = settings.fileName();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ namespace Setting {
|
|||
const QString& key = handle->getKey();
|
||||
withWriteLock([&] {
|
||||
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);
|
||||
});
|
||||
|
@ -96,6 +96,7 @@ namespace Setting {
|
|||
|
||||
void Manager::loadSetting(Interface* handle) {
|
||||
const auto& key = handle->getKey();
|
||||
|
||||
withWriteLock([&] {
|
||||
QVariant loadedValue = _settings[key];
|
||||
|
||||
|
|
|
@ -19,10 +19,13 @@
|
|||
|
||||
#include <QSettings>
|
||||
#include <QThread>
|
||||
#include <QLoggingCategory>
|
||||
|
||||
#include "DependencyManager.h"
|
||||
#include "shared/ReadWriteLockable.h"
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(settings_manager)
|
||||
Q_DECLARE_LOGGING_CATEGORY(settings_writer)
|
||||
|
||||
// This is for the testing system.
|
||||
class SettingsTests;
|
||||
|
|
Loading…
Reference in a new issue