feat: use logging categories
This commit is contained in:
parent
a2a63977c1
commit
4714fe8795
16 changed files with 106 additions and 52 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import Caelestia
|
import Caelestia
|
||||||
|
|
@ -115,7 +116,7 @@ Scope {
|
||||||
const visibilities = Visibilities.getForActive();
|
const visibilities = Visibilities.getForActive();
|
||||||
visibilities[drawer] = !visibilities[drawer];
|
visibilities[drawer] = !visibilities[drawer];
|
||||||
} else {
|
} else {
|
||||||
console.warn(`[IPC] Drawer "${drawer}" does not exist`);
|
console.warn(lc, `Drawer "${drawer}" does not exist`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -154,4 +155,11 @@ Scope {
|
||||||
|
|
||||||
target: "toaster"
|
target: "toaster"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoggingCategory {
|
||||||
|
id: lc
|
||||||
|
|
||||||
|
name: "caelestia.qml.shortcuts"
|
||||||
|
defaultLogLevel: LoggingCategory.Info
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ Item {
|
||||||
|
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (status === Loader.Error) {
|
if (status === Loader.Error) {
|
||||||
console.error("[AppearancePane] Wallpaper loader error!");
|
console.error(lc, "Wallpaper loader error!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -259,4 +259,11 @@ Item {
|
||||||
|
|
||||||
rightContent: appearanceRightContentComponent
|
rightContent: appearanceRightContentComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoggingCategory {
|
||||||
|
id: lc
|
||||||
|
|
||||||
|
name: "caelestia.qml.controlcenter.appearance"
|
||||||
|
defaultLogLevel: LoggingCategory.Info
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,12 @@
|
||||||
#include <qfileinfo.h>
|
#include <qfileinfo.h>
|
||||||
#include <qfuturewatcher.h>
|
#include <qfuturewatcher.h>
|
||||||
#include <qimagereader.h>
|
#include <qimagereader.h>
|
||||||
|
#include <qloggingcategory.h>
|
||||||
#include <qpainter.h>
|
#include <qpainter.h>
|
||||||
#include <qtconcurrentrun.h>
|
#include <qtconcurrentrun.h>
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(lcCim, "caelestia.internal.cim", QtInfoMsg)
|
||||||
|
|
||||||
namespace caelestia::internal {
|
namespace caelestia::internal {
|
||||||
|
|
||||||
qreal CachingImageManager::effectiveScale() const {
|
qreal CachingImageManager::effectiveScale() const {
|
||||||
|
|
@ -132,7 +135,7 @@ void CachingImageManager::updateSource(const QString& path) {
|
||||||
emit cachePathChanged();
|
emit cachePathChanged();
|
||||||
|
|
||||||
if (!cache.isLocalFile()) {
|
if (!cache.isLocalFile()) {
|
||||||
qWarning() << "CachingImageManager::updateSource: cachePath" << cache << "is not a local file";
|
qCWarning(lcCim) << "updateSource: cachePath" << cache << "is not a local file";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,7 +164,7 @@ void CachingImageManager::createCache(
|
||||||
QImage image(path);
|
QImage image(path);
|
||||||
|
|
||||||
if (image.isNull()) {
|
if (image.isNull()) {
|
||||||
qWarning() << "CachingImageManager::createCache: failed to read" << path;
|
qCWarning(lcCim) << "createCache: failed to read" << path;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -188,7 +191,7 @@ void CachingImageManager::createCache(
|
||||||
|
|
||||||
const QString parent = QFileInfo(cache).absolutePath();
|
const QString parent = QFileInfo(cache).absolutePath();
|
||||||
if (!QDir().mkpath(parent) || !image.save(cache)) {
|
if (!QDir().mkpath(parent) || !image.save(cache)) {
|
||||||
qWarning() << "CachingImageManager::createCache: failed to save to" << cache;
|
qCWarning(lcCim) << "createCache: failed to save to" << cache;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -196,7 +199,7 @@ void CachingImageManager::createCache(
|
||||||
QString CachingImageManager::sha256sum(const QString& path) {
|
QString CachingImageManager::sha256sum(const QString& path) {
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
qWarning() << "CachingImageManager::sha256sum: failed to open" << path;
|
qCWarning(lcCim) << "sha256sum: failed to open" << path;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,11 @@
|
||||||
#include <qdir.h>
|
#include <qdir.h>
|
||||||
#include <qjsonarray.h>
|
#include <qjsonarray.h>
|
||||||
#include <qlocalsocket.h>
|
#include <qlocalsocket.h>
|
||||||
|
#include <qloggingcategory.h>
|
||||||
#include <qvariant.h>
|
#include <qvariant.h>
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(lcHypr, "caelestia.internal.hypr", QtInfoMsg)
|
||||||
|
|
||||||
namespace caelestia::internal::hypr {
|
namespace caelestia::internal::hypr {
|
||||||
|
|
||||||
HyprExtras::HyprExtras(QObject* parent)
|
HyprExtras::HyprExtras(QObject* parent)
|
||||||
|
|
@ -16,8 +19,7 @@ HyprExtras::HyprExtras(QObject* parent)
|
||||||
, m_devices(new HyprDevices(this)) {
|
, m_devices(new HyprDevices(this)) {
|
||||||
const auto his = qEnvironmentVariable("HYPRLAND_INSTANCE_SIGNATURE");
|
const auto his = qEnvironmentVariable("HYPRLAND_INSTANCE_SIGNATURE");
|
||||||
if (his.isEmpty()) {
|
if (his.isEmpty()) {
|
||||||
qWarning()
|
qCWarning(lcHypr) << "$HYPRLAND_INSTANCE_SIGNATURE is unset. Unable to connect to Hyprland socket.";
|
||||||
<< "HyprExtras::HyprExtras: $HYPRLAND_INSTANCE_SIGNATURE is unset. Unable to connect to Hyprland socket.";
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -26,8 +28,7 @@ HyprExtras::HyprExtras(QObject* parent)
|
||||||
hyprDir = "/tmp/hypr/" + his;
|
hyprDir = "/tmp/hypr/" + his;
|
||||||
|
|
||||||
if (!QDir(hyprDir).exists()) {
|
if (!QDir(hyprDir).exists()) {
|
||||||
qWarning() << "HyprExtras::HyprExtras: Hyprland socket directory does not exist. Unable to connect to "
|
qCWarning(lcHypr) << "Hyprland socket directory does not exist. Unable to connect to Hyprland socket.";
|
||||||
"Hyprland socket.";
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +63,7 @@ void HyprExtras::message(const QString& message) {
|
||||||
|
|
||||||
makeRequest(message, [](bool success, const QByteArray& res) {
|
makeRequest(message, [](bool success, const QByteArray& res) {
|
||||||
if (!success) {
|
if (!success) {
|
||||||
qWarning() << "HyprExtras::message: request error:" << QString::fromUtf8(res);
|
qCWarning(lcHypr) << "message: request error:" << QString::fromUtf8(res);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -74,7 +75,7 @@ void HyprExtras::batchMessage(const QStringList& messages) {
|
||||||
|
|
||||||
makeRequest("[[BATCH]]" + messages.join(";"), [](bool success, const QByteArray& res) {
|
makeRequest("[[BATCH]]" + messages.join(";"), [](bool success, const QByteArray& res) {
|
||||||
if (!success) {
|
if (!success) {
|
||||||
qWarning() << "HyprExtras::batchMessage: request error:" << QString::fromUtf8(res);
|
qCWarning(lcHypr) << "batchMessage: request error:" << QString::fromUtf8(res);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -95,7 +96,7 @@ void HyprExtras::applyOptions(const QVariantHash& options) {
|
||||||
if (success) {
|
if (success) {
|
||||||
refreshOptions();
|
refreshOptions();
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "HyprExtras::applyOptions: request error" << QString::fromUtf8(res);
|
qCWarning(lcHypr) << "applyOptions: request error" << QString::fromUtf8(res);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -145,15 +146,15 @@ void HyprExtras::refreshDevices() {
|
||||||
|
|
||||||
void HyprExtras::socketError(QLocalSocket::LocalSocketError error) const {
|
void HyprExtras::socketError(QLocalSocket::LocalSocketError error) const {
|
||||||
if (!m_socketValid) {
|
if (!m_socketValid) {
|
||||||
qWarning() << "HyprExtras::socketError: unable to connect to Hyprland event socket:" << error;
|
qCWarning(lcHypr) << "socketError: unable to connect to Hyprland event socket:" << error;
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "HyprExtras::socketError: Hyprland event socket error:" << error;
|
qCWarning(lcHypr) << "socketError: Hyprland event socket error:" << error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HyprExtras::socketStateChanged(QLocalSocket::LocalSocketState state) {
|
void HyprExtras::socketStateChanged(QLocalSocket::LocalSocketState state) {
|
||||||
if (state == QLocalSocket::UnconnectedState && m_socketValid) {
|
if (state == QLocalSocket::UnconnectedState && m_socketValid) {
|
||||||
qWarning() << "HyprExtras::socketStateChanged: Hyprland event socket disconnected.";
|
qCWarning(lcHypr) << "socketStateChanged: Hyprland event socket disconnected.";
|
||||||
}
|
}
|
||||||
|
|
||||||
m_socketValid = state == QLocalSocket::ConnectedState;
|
m_socketValid = state == QLocalSocket::ConnectedState;
|
||||||
|
|
@ -206,7 +207,7 @@ HyprExtras::SocketPtr HyprExtras::makeRequest(
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(socket.data(), &QLocalSocket::errorOccurred, this, [=](QLocalSocket::LocalSocketError err) {
|
QObject::connect(socket.data(), &QLocalSocket::errorOccurred, this, [=](QLocalSocket::LocalSocketError err) {
|
||||||
qWarning() << "HyprExtras::makeRequest: error making request:" << err << "| request:" << request;
|
qCWarning(lcHypr) << "makeRequest: error making request:" << err << "| request:" << request;
|
||||||
callback(false, {});
|
callback(false, {});
|
||||||
socket->close();
|
socket->close();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@
|
||||||
#include <QtDBus/qdbuserror.h>
|
#include <QtDBus/qdbuserror.h>
|
||||||
#include <QtDBus/qdbusinterface.h>
|
#include <QtDBus/qdbusinterface.h>
|
||||||
#include <QtDBus/qdbusreply.h>
|
#include <QtDBus/qdbusreply.h>
|
||||||
|
#include <qloggingcategory.h>
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(lcLogindManager, "caelestia.internal.logindmanager", QtInfoMsg)
|
||||||
|
|
||||||
namespace caelestia::internal {
|
namespace caelestia::internal {
|
||||||
|
|
||||||
|
|
@ -11,7 +14,7 @@ LogindManager::LogindManager(QObject* parent)
|
||||||
: QObject(parent) {
|
: QObject(parent) {
|
||||||
auto bus = QDBusConnection::systemBus();
|
auto bus = QDBusConnection::systemBus();
|
||||||
if (!bus.isConnected()) {
|
if (!bus.isConnected()) {
|
||||||
qWarning() << "LogindManager::LogindManager: failed to connect to system bus:" << bus.lastError().message();
|
qCWarning(lcLogindManager) << "Failed to connect to system bus:" << bus.lastError().message();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -19,14 +22,13 @@ LogindManager::LogindManager(QObject* parent)
|
||||||
"PrepareForSleep", this, SLOT(handlePrepareForSleep(bool)));
|
"PrepareForSleep", this, SLOT(handlePrepareForSleep(bool)));
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
qWarning() << "LogindManager::LogindManager: failed to connect to PrepareForSleep signal:"
|
qCWarning(lcLogindManager) << "Failed to connect to PrepareForSleep signal:" << bus.lastError().message();
|
||||||
<< bus.lastError().message();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QDBusInterface login1("org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", bus);
|
QDBusInterface login1("org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", bus);
|
||||||
const QDBusReply<QDBusObjectPath> reply = login1.call("GetSession", "auto");
|
const QDBusReply<QDBusObjectPath> reply = login1.call("GetSession", "auto");
|
||||||
if (!reply.isValid()) {
|
if (!reply.isValid()) {
|
||||||
qWarning() << "LogindManager::LogindManager: failed to get session path";
|
qCWarning(lcLogindManager) << "Failed to get session path";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto sessionPath = reply.value().path();
|
const auto sessionPath = reply.value().path();
|
||||||
|
|
@ -35,14 +37,14 @@ LogindManager::LogindManager(QObject* parent)
|
||||||
SLOT(handleLockRequested()));
|
SLOT(handleLockRequested()));
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
qWarning() << "LogindManager::LogindManager: failed to connect to Lock signal:" << bus.lastError().message();
|
qCWarning(lcLogindManager) << "Failed to connect to Lock signal:" << bus.lastError().message();
|
||||||
}
|
}
|
||||||
|
|
||||||
ok = bus.connect("org.freedesktop.login1", sessionPath, "org.freedesktop.login1.Session", "Unlock", this,
|
ok = bus.connect("org.freedesktop.login1", sessionPath, "org.freedesktop.login1.Session", "Unlock", this,
|
||||||
SLOT(handleUnlockRequested()));
|
SLOT(handleUnlockRequested()));
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
qWarning() << "LogindManager::LogindManager: failed to connect to Unlock signal:" << bus.lastError().message();
|
qCWarning(lcLogindManager) << "Failed to connect to Unlock signal:" << bus.lastError().message();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,16 @@
|
||||||
#include "service.hpp"
|
#include "service.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <pipewire/pipewire.h>
|
#include <pipewire/pipewire.h>
|
||||||
#include <qdebug.h>
|
#include <qloggingcategory.h>
|
||||||
#include <qmutex.h>
|
#include <qmutex.h>
|
||||||
#include <spa/param/audio/format-utils.h>
|
#include <spa/param/audio/format-utils.h>
|
||||||
#include <spa/param/latency-utils.h>
|
#include <spa/param/latency-utils.h>
|
||||||
#include <stop_token>
|
#include <stop_token>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(lcAc, "caelestia.services.ac", QtInfoMsg)
|
||||||
|
Q_LOGGING_CATEGORY(lcAcWorker, "caelestia.services.ac.worker", QtInfoMsg)
|
||||||
|
|
||||||
namespace caelestia::services {
|
namespace caelestia::services {
|
||||||
|
|
||||||
PipeWireWorker::PipeWireWorker(std::stop_token token, AudioCollector* collector)
|
PipeWireWorker::PipeWireWorker(std::stop_token token, AudioCollector* collector)
|
||||||
|
|
@ -23,7 +26,7 @@ PipeWireWorker::PipeWireWorker(std::stop_token token, AudioCollector* collector)
|
||||||
|
|
||||||
m_loop = pw_main_loop_new(nullptr);
|
m_loop = pw_main_loop_new(nullptr);
|
||||||
if (!m_loop) {
|
if (!m_loop) {
|
||||||
qWarning() << "PipeWireWorker::init: failed to create PipeWire main loop";
|
qCWarning(lcAcWorker) << "init: failed to create PipeWire main loop";
|
||||||
pw_deinit();
|
pw_deinit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -31,7 +34,7 @@ PipeWireWorker::PipeWireWorker(std::stop_token token, AudioCollector* collector)
|
||||||
timespec timeout = { 0, 10 * SPA_NSEC_PER_MSEC };
|
timespec timeout = { 0, 10 * SPA_NSEC_PER_MSEC };
|
||||||
m_timer = pw_loop_add_timer(pw_main_loop_get_loop(m_loop), handleTimeout, this);
|
m_timer = pw_loop_add_timer(pw_main_loop_get_loop(m_loop), handleTimeout, this);
|
||||||
if (!m_timer) {
|
if (!m_timer) {
|
||||||
qWarning() << "PipeWireWorker::init: failed to create timer";
|
qCWarning(lcAcWorker) << "init: failed to create timer";
|
||||||
pw_main_loop_destroy(m_loop);
|
pw_main_loop_destroy(m_loop);
|
||||||
pw_deinit();
|
pw_deinit();
|
||||||
return;
|
return;
|
||||||
|
|
@ -73,7 +76,7 @@ PipeWireWorker::PipeWireWorker(std::stop_token token, AudioCollector* collector)
|
||||||
|
|
||||||
m_stream = pw_stream_new_simple(pw_main_loop_get_loop(m_loop), "caelestia-shell", props, &events, this);
|
m_stream = pw_stream_new_simple(pw_main_loop_get_loop(m_loop), "caelestia-shell", props, &events, this);
|
||||||
if (!m_stream) {
|
if (!m_stream) {
|
||||||
qWarning() << "PipeWireWorker::init: failed to create stream";
|
qCWarning(lcAcWorker) << "init: failed to create stream";
|
||||||
pw_main_loop_destroy(m_loop);
|
pw_main_loop_destroy(m_loop);
|
||||||
pw_deinit();
|
pw_deinit();
|
||||||
return;
|
return;
|
||||||
|
|
@ -84,7 +87,7 @@ PipeWireWorker::PipeWireWorker(std::stop_token token, AudioCollector* collector)
|
||||||
PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS | PW_STREAM_FLAG_RT_PROCESS),
|
PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS | PW_STREAM_FLAG_RT_PROCESS),
|
||||||
params, 1);
|
params, 1);
|
||||||
if (success < 0) {
|
if (success < 0) {
|
||||||
qWarning() << "PipeWireWorker::init: failed to connect stream";
|
qCWarning(lcAcWorker) << "init: failed to connect stream";
|
||||||
pw_stream_destroy(m_stream);
|
pw_stream_destroy(m_stream);
|
||||||
pw_main_loop_destroy(m_loop);
|
pw_main_loop_destroy(m_loop);
|
||||||
pw_deinit();
|
pw_deinit();
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,12 @@
|
||||||
|
|
||||||
#include "audiocollector.hpp"
|
#include "audiocollector.hpp"
|
||||||
#include "service.hpp"
|
#include "service.hpp"
|
||||||
#include <qdebug.h>
|
#include <qloggingcategory.h>
|
||||||
#include <qthread.h>
|
#include <qthread.h>
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(lcAp, "caelestia.services.ap", QtInfoMsg)
|
||||||
|
Q_LOGGING_CATEGORY(lcApProcessor, "caelestia.services.ap.processor", QtInfoMsg)
|
||||||
|
|
||||||
namespace caelestia::services {
|
namespace caelestia::services {
|
||||||
|
|
||||||
AudioProcessor::AudioProcessor(QObject* parent)
|
AudioProcessor::AudioProcessor(QObject* parent)
|
||||||
|
|
@ -48,7 +51,7 @@ AudioProvider::~AudioProvider() {
|
||||||
|
|
||||||
void AudioProvider::init() {
|
void AudioProvider::init() {
|
||||||
if (!m_processor) {
|
if (!m_processor) {
|
||||||
qWarning() << "AudioProvider::init: attempted to init with no processor set";
|
qCWarning(lcAp) << "init: attempted to init with no processor set";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,10 @@
|
||||||
#include "audioprovider.hpp"
|
#include "audioprovider.hpp"
|
||||||
#include <cava/cavacore.h>
|
#include <cava/cavacore.h>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <qdebug.h>
|
#include <qloggingcategory.h>
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(lcCava, "caelestia.services.cava", QtInfoMsg)
|
||||||
|
Q_LOGGING_CATEGORY(lcCavaProcessor, "caelestia.services.cava.processor", QtInfoMsg)
|
||||||
|
|
||||||
namespace caelestia::services {
|
namespace caelestia::services {
|
||||||
|
|
||||||
|
|
@ -57,7 +60,7 @@ void CavaProcessor::process() {
|
||||||
|
|
||||||
void CavaProcessor::setBars(int bars) {
|
void CavaProcessor::setBars(int bars) {
|
||||||
if (bars < 0) {
|
if (bars < 0) {
|
||||||
qWarning() << "CavaProcessor::setBars: bars must be greater than 0. Setting to 0.";
|
qCWarning(lcCavaProcessor) << "setBars: bars must be greater than 0. Setting to 0.";
|
||||||
bars = 0;
|
bars = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,7 +112,7 @@ int CavaProvider::bars() const {
|
||||||
|
|
||||||
void CavaProvider::setBars(int bars) {
|
void CavaProvider::setBars(int bars) {
|
||||||
if (bars < 0) {
|
if (bars < 0) {
|
||||||
qWarning() << "CavaProvider::setBars: bars must be greater than 0. Setting to 0.";
|
qCWarning(lcCava) << "setBars: bars must be greater than 0. Setting to 0.";
|
||||||
bars = 0;
|
bars = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#include "service.hpp"
|
#include "service.hpp"
|
||||||
|
|
||||||
#include <qdebug.h>
|
|
||||||
#include <qpointer.h>
|
#include <qpointer.h>
|
||||||
|
|
||||||
namespace caelestia::services {
|
namespace caelestia::services {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
#include "appdb.hpp"
|
#include "appdb.hpp"
|
||||||
|
|
||||||
|
#include <qloggingcategory.h>
|
||||||
#include <qsqldatabase.h>
|
#include <qsqldatabase.h>
|
||||||
#include <qsqlquery.h>
|
#include <qsqlquery.h>
|
||||||
#include <quuid.h>
|
#include <quuid.h>
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(lcAppDb, "caelestia.appdb", QtInfoMsg)
|
||||||
|
|
||||||
namespace caelestia {
|
namespace caelestia {
|
||||||
|
|
||||||
AppEntry::AppEntry(QObject* entry, unsigned int frequency, QObject* parent)
|
AppEntry::AppEntry(QObject* entry, unsigned int frequency, QObject* parent)
|
||||||
|
|
@ -180,7 +183,7 @@ void AppDb::setFavouriteApps(const QStringList& favApps) {
|
||||||
if (re.isValid()) {
|
if (re.isValid()) {
|
||||||
m_favouriteAppsRegex << re;
|
m_favouriteAppsRegex << re;
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "AppDb::setFavouriteApps: Regular expression is not valid: " << re.pattern();
|
qCWarning(lcAppDb) << "setFavouriteApps: regular expression is not valid:" << re.pattern();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -218,7 +221,7 @@ void AppDb::incrementFrequency(const QString& id) {
|
||||||
emit appsChanged();
|
emit appsChanged();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "AppDb::incrementFrequency: could not find app with id" << id;
|
qCWarning(lcAppDb) << "incrementFrequency: could not find app with id" << id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,11 @@
|
||||||
#include <qdir.h>
|
#include <qdir.h>
|
||||||
#include <qfileinfo.h>
|
#include <qfileinfo.h>
|
||||||
#include <qfuturewatcher.h>
|
#include <qfuturewatcher.h>
|
||||||
|
#include <qloggingcategory.h>
|
||||||
#include <qqmlengine.h>
|
#include <qqmlengine.h>
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(lcCUtils, "caelestia.cutils", QtInfoMsg)
|
||||||
|
|
||||||
namespace caelestia {
|
namespace caelestia {
|
||||||
|
|
||||||
void CUtils::saveItem(QQuickItem* target, const QUrl& path) {
|
void CUtils::saveItem(QQuickItem* target, const QUrl& path) {
|
||||||
|
|
@ -32,17 +35,17 @@ void CUtils::saveItem(QQuickItem* target, const QUrl& path, const QRect& rect, Q
|
||||||
|
|
||||||
void CUtils::saveItem(QQuickItem* target, const QUrl& path, const QRect& rect, QJSValue onSaved, QJSValue onFailed) {
|
void CUtils::saveItem(QQuickItem* target, const QUrl& path, const QRect& rect, QJSValue onSaved, QJSValue onFailed) {
|
||||||
if (!target) {
|
if (!target) {
|
||||||
qWarning() << "CUtils::saveItem: a target is required";
|
qCWarning(lcCUtils) << "saveItem: a target is required";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!path.isLocalFile()) {
|
if (!path.isLocalFile()) {
|
||||||
qWarning() << "CUtils::saveItem:" << path << "is not a local file";
|
qCWarning(lcCUtils) << "saveItem:" << path << "is not a local file";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!target->window()) {
|
if (!target->window()) {
|
||||||
qWarning() << "CUtils::saveItem: unable to save target" << target << "without a window";
|
qCWarning(lcCUtils) << "saveItem: unable to save target" << target << "without a window";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,7 +85,7 @@ void CUtils::saveItem(QQuickItem* target, const QUrl& path, const QRect& rect, Q
|
||||||
onSaved.call(args);
|
onSaved.call(args);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "CUtils::saveItem: failed to save" << path;
|
qCWarning(lcCUtils) << "saveItem: failed to save" << path;
|
||||||
if (onFailed.isCallable()) {
|
if (onFailed.isCallable()) {
|
||||||
if (engine) {
|
if (engine) {
|
||||||
onFailed.call({ engine->toScriptValue(QVariant::fromValue(path)) });
|
onFailed.call({ engine->toScriptValue(QVariant::fromValue(path)) });
|
||||||
|
|
@ -99,17 +102,17 @@ void CUtils::saveItem(QQuickItem* target, const QUrl& path, const QRect& rect, Q
|
||||||
|
|
||||||
bool CUtils::copyFile(const QUrl& source, const QUrl& target, bool overwrite) const {
|
bool CUtils::copyFile(const QUrl& source, const QUrl& target, bool overwrite) const {
|
||||||
if (!source.isLocalFile()) {
|
if (!source.isLocalFile()) {
|
||||||
qWarning() << "CUtils::copyFile: source" << source << "is not a local file";
|
qCWarning(lcCUtils) << "copyFile: source" << source << "is not a local file";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!target.isLocalFile()) {
|
if (!target.isLocalFile()) {
|
||||||
qWarning() << "CUtils::copyFile: target" << target << "is not a local file";
|
qCWarning(lcCUtils) << "copyFile: target" << target << "is not a local file";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overwrite && QFile::exists(target.toLocalFile())) {
|
if (overwrite && QFile::exists(target.toLocalFile())) {
|
||||||
if (!QFile::remove(target.toLocalFile())) {
|
if (!QFile::remove(target.toLocalFile())) {
|
||||||
qWarning() << "CUtils::copyFile: overwrite was specified but failed to remove" << target.toLocalFile();
|
qCWarning(lcCUtils) << "copyFile: overwrite was specified but failed to remove" << target.toLocalFile();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -119,7 +122,7 @@ bool CUtils::copyFile(const QUrl& source, const QUrl& target, bool overwrite) co
|
||||||
|
|
||||||
bool CUtils::deleteFile(const QUrl& path) const {
|
bool CUtils::deleteFile(const QUrl& path) const {
|
||||||
if (!path.isLocalFile()) {
|
if (!path.isLocalFile()) {
|
||||||
qWarning() << "CUtils::deleteFile: path" << path << "is not a local file";
|
qCWarning(lcCUtils) << "deleteFile: path" << path << "is not a local file";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,7 +131,7 @@ bool CUtils::deleteFile(const QUrl& path) const {
|
||||||
|
|
||||||
QString CUtils::toLocalFile(const QUrl& url) const {
|
QString CUtils::toLocalFile(const QUrl& url) const {
|
||||||
if (!url.isLocalFile()) {
|
if (!url.isLocalFile()) {
|
||||||
qWarning() << "CUtils::toLocalFile: given url is not a local file" << url;
|
qCWarning(lcCUtils) << "toLocalFile: given url is not a local file" << url;
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,11 @@
|
||||||
#include <QtQuick/qquickitemgrabresult.h>
|
#include <QtQuick/qquickitemgrabresult.h>
|
||||||
#include <qfuturewatcher.h>
|
#include <qfuturewatcher.h>
|
||||||
#include <qimage.h>
|
#include <qimage.h>
|
||||||
|
#include <qloggingcategory.h>
|
||||||
#include <qquickwindow.h>
|
#include <qquickwindow.h>
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(lcImageAnalyser, "caelestia.imageanalyser", QtInfoMsg)
|
||||||
|
|
||||||
namespace caelestia {
|
namespace caelestia {
|
||||||
|
|
||||||
ImageAnalyser::ImageAnalyser(QObject* parent)
|
ImageAnalyser::ImageAnalyser(QObject* parent)
|
||||||
|
|
@ -152,7 +155,7 @@ void ImageAnalyser::update() {
|
||||||
|
|
||||||
void ImageAnalyser::analyse(QPromise<AnalyseResult>& promise, const QImage& image, int rescaleSize) {
|
void ImageAnalyser::analyse(QPromise<AnalyseResult>& promise, const QImage& image, int rescaleSize) {
|
||||||
if (image.isNull()) {
|
if (image.isNull()) {
|
||||||
qWarning() << "ImageAnalyser::analyse: image is null";
|
qCWarning(lcImageAnalyser) << "analyse: image is null";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
#include "requests.hpp"
|
#include "requests.hpp"
|
||||||
|
|
||||||
#include <qjsvalueiterator.h>
|
#include <qjsvalueiterator.h>
|
||||||
|
#include <qloggingcategory.h>
|
||||||
#include <qnetworkaccessmanager.h>
|
#include <qnetworkaccessmanager.h>
|
||||||
#include <qnetworkcookiejar.h>
|
#include <qnetworkcookiejar.h>
|
||||||
#include <qnetworkreply.h>
|
#include <qnetworkreply.h>
|
||||||
#include <qnetworkrequest.h>
|
#include <qnetworkrequest.h>
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(lcRequests, "caelestia.requests", QtInfoMsg)
|
||||||
|
|
||||||
namespace caelestia {
|
namespace caelestia {
|
||||||
|
|
||||||
Requests::Requests(QObject* parent)
|
Requests::Requests(QObject* parent)
|
||||||
|
|
@ -14,7 +17,7 @@ Requests::Requests(QObject* parent)
|
||||||
|
|
||||||
void Requests::get(const QUrl& url, QJSValue onSuccess, QJSValue onError, QJSValue headers) const {
|
void Requests::get(const QUrl& url, QJSValue onSuccess, QJSValue onError, QJSValue headers) const {
|
||||||
if (!onSuccess.isCallable()) {
|
if (!onSuccess.isCallable()) {
|
||||||
qWarning() << "Requests::get: onSuccess is not callable";
|
qCWarning(lcRequests) << "get: onSuccess is not callable";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -41,7 +44,7 @@ void Requests::get(const QUrl& url, QJSValue onSuccess, QJSValue onError, QJSVal
|
||||||
} else if (onError.isCallable()) {
|
} else if (onError.isCallable()) {
|
||||||
onError.call({ reply->errorString() });
|
onError.call({ reply->errorString() });
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Requests::get: request failed with error" << reply->errorString();
|
qCWarning(lcRequests) << "get: request failed with error" << reply->errorString();
|
||||||
}
|
}
|
||||||
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#include "toaster.hpp"
|
#include "toaster.hpp"
|
||||||
|
|
||||||
#include <qdebug.h>
|
|
||||||
#include <qlogging.h>
|
#include <qlogging.h>
|
||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -391,7 +391,7 @@ Singleton {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result.success && root.pendingConnection && retries < maxRetries) {
|
if (!result.success && root.pendingConnection && retries < maxRetries) {
|
||||||
console.warn("[NMCLI] Connection failed, retrying... (attempt " + (retries + 1) + "/" + maxRetries + ")");
|
console.warn(lc, "Connection failed, retrying... (attempt " + (retries + 1) + "/" + maxRetries + ")");
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
connectWireless(ssid, password, bssid, callback, retries + 1);
|
connectWireless(ssid, password, bssid, callback, retries + 1);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
@ -417,7 +417,7 @@ Singleton {
|
||||||
loadSavedConnections(() => {});
|
loadSavedConnections(() => {});
|
||||||
activateConnection(ssid, callback);
|
activateConnection(ssid, callback);
|
||||||
} else {
|
} else {
|
||||||
console.warn("[NMCLI] Connection profile creation failed, trying fallback...");
|
console.warn(lc, "Connection profile creation failed, trying fallback...");
|
||||||
let fallbackCmd = [root.nmcliCommandDevice, root.nmcliCommandWifi, "connect", ssid, root.connectionParamPassword, password];
|
let fallbackCmd = [root.nmcliCommandDevice, root.nmcliCommandWifi, "connect", ssid, root.connectionParamPassword, password];
|
||||||
executeCommand(fallbackCmd, fallbackResult => {
|
executeCommand(fallbackCmd, fallbackResult => {
|
||||||
if (callback)
|
if (callback)
|
||||||
|
|
@ -1277,6 +1277,13 @@ Singleton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoggingCategory {
|
||||||
|
id: lc
|
||||||
|
|
||||||
|
name: "caelestia.qml.services.nmcli"
|
||||||
|
defaultLogLevel: LoggingCategory.Info
|
||||||
|
}
|
||||||
|
|
||||||
component CommandProcess: Process {
|
component CommandProcess: Process {
|
||||||
id: proc
|
id: proc
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -454,7 +454,7 @@ Singleton {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
const error = text.trim();
|
const error = text.trim();
|
||||||
if (error && !error.includes("[#]")) {
|
if (error && !error.includes("[#]")) {
|
||||||
console.warn("VPN disconnection error:", error);
|
console.warn(lc, "Disconnection error:", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -476,4 +476,11 @@ Singleton {
|
||||||
interval: 500
|
interval: 500
|
||||||
onTriggered: root.checkStatus()
|
onTriggered: root.checkStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoggingCategory {
|
||||||
|
id: lc
|
||||||
|
|
||||||
|
name: "caelestia.qml.services.vpn"
|
||||||
|
defaultLogLevel: LoggingCategory.Info
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue