From aa9f8cd00166800f900b4372b3ae058646f36c62 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Mon, 29 Apr 2024 18:37:57 -0700 Subject: [PATCH] dbus/properties: dbus/dbusutil -> dbus/properties --- src/dbus/CMakeLists.txt | 2 +- src/dbus/{dbusutil.cpp => properties.cpp} | 50 ++++++++++++----------- src/dbus/{dbusutil.hpp => properties.hpp} | 2 +- src/services/status_notifier/host.cpp | 2 +- src/services/status_notifier/item.cpp | 2 +- src/services/status_notifier/item.hpp | 2 +- src/services/status_notifier/qml.cpp | 2 +- 7 files changed, 33 insertions(+), 29 deletions(-) rename src/dbus/{dbusutil.cpp => properties.cpp} (81%) rename src/dbus/{dbusutil.hpp => properties.hpp} (98%) diff --git a/src/dbus/CMakeLists.txt b/src/dbus/CMakeLists.txt index 7ec99159..a468c6b2 100644 --- a/src/dbus/CMakeLists.txt +++ b/src/dbus/CMakeLists.txt @@ -8,7 +8,7 @@ qt_add_dbus_interface(DBUS_INTERFACES ) qt_add_library(quickshell-dbus STATIC - dbusutil.cpp + properties.cpp ${DBUS_INTERFACES} ) diff --git a/src/dbus/dbusutil.cpp b/src/dbus/properties.cpp similarity index 81% rename from src/dbus/dbusutil.cpp rename to src/dbus/properties.cpp index f0b25f45..1e5e0bd1 100644 --- a/src/dbus/dbusutil.cpp +++ b/src/dbus/properties.cpp @@ -1,4 +1,4 @@ -#include "dbusutil.hpp" +#include "properties.hpp" #include #include @@ -22,7 +22,7 @@ #include "dbus_properties.h" -Q_LOGGING_CATEGORY(logDbus, "quickshell.dbus", QtWarningMsg); +Q_LOGGING_CATEGORY(logDbusProperties, "quickshell.dbus.properties", QtWarningMsg); namespace qs::dbus { @@ -114,27 +114,28 @@ void asyncReadPropertyInternal( void AbstractDBusProperty::tryUpdate(const QVariant& variant) { auto error = this->read(variant); if (error.isValid()) { - qCWarning(logDbus).noquote() << "Error demarshalling property update for" << this->toString(); - qCWarning(logDbus) << error; + qCWarning(logDbusProperties).noquote() + << "Error demarshalling property update for" << this->toString(); + qCWarning(logDbusProperties) << error; } else { - qCDebug(logDbus).noquote() << "Updated property" << this->toString() << "to" - << this->valueString(); + qCDebug(logDbusProperties).noquote() + << "Updated property" << this->toString() << "to" << this->valueString(); } } void AbstractDBusProperty::update() { if (this->group == nullptr) { - qFatal(logDbus) << "Tried to update dbus property" << this->name - << "which is not attached to a group"; + qFatal(logDbusProperties) << "Tried to update dbus property" << this->name + << "which is not attached to a group"; } else { const QString propStr = this->toString(); if (this->group->interface == nullptr) { - qFatal(logDbus).noquote() << "Tried to update property" << propStr - << "of a disconnected interface"; + qFatal(logDbusProperties).noquote() + << "Tried to update property" << propStr << "of a disconnected interface"; } - qCDebug(logDbus).noquote() << "Updating property" << propStr; + qCDebug(logDbusProperties).noquote() << "Updating property" << propStr; auto pendingCall = this->group->propertyInterface->Get(this->group->interface->interface(), this->name); @@ -145,8 +146,8 @@ void AbstractDBusProperty::update() { const QDBusPendingReply reply = *call; if (reply.isError()) { - qCWarning(logDbus).noquote() << "Error updating property" << propStr; - qCWarning(logDbus) << reply.error(); + qCWarning(logDbusProperties).noquote() << "Error updating property" << propStr; + qCWarning(logDbusProperties) << reply.error(); } else { this->tryUpdate(reply.value().variant()); } @@ -198,8 +199,8 @@ void DBusPropertyGroup::attachProperty(AbstractDBusProperty* property) { } void DBusPropertyGroup::updateAllDirect() { - qCDebug(logDbus).noquote() << "Updating all properties of" << this->toString() - << "via individual queries"; + qCDebug(logDbusProperties).noquote() + << "Updating all properties of" << this->toString() << "via individual queries"; if (this->interface == nullptr) { qFatal() << "Attempted to update properties of disconnected property group"; @@ -211,7 +212,8 @@ void DBusPropertyGroup::updateAllDirect() { } void DBusPropertyGroup::updateAllViaGetAll() { - qCDebug(logDbus).noquote() << "Updating all properties of" << this->toString() << "via GetAll"; + qCDebug(logDbusProperties).noquote() + << "Updating all properties of" << this->toString() << "via GetAll"; if (this->interface == nullptr) { qFatal() << "Attempted to update properties of disconnected property group"; @@ -224,11 +226,12 @@ void DBusPropertyGroup::updateAllViaGetAll() { const QDBusPendingReply reply = *call; if (reply.isError()) { - qCWarning(logDbus).noquote() + qCWarning(logDbusProperties).noquote() << "Error updating properties of" << this->toString() << "via GetAll"; - qCWarning(logDbus) << reply.error(); + qCWarning(logDbusProperties) << reply.error(); } else { - qCDebug(logDbus).noquote() << "Received GetAll property set for" << this->toString(); + qCDebug(logDbusProperties).noquote() + << "Received GetAll property set for" << this->toString(); this->updatePropertySet(reply.value()); } @@ -248,7 +251,7 @@ void DBusPropertyGroup::updatePropertySet(const QVariantMap& properties) { ); if (prop == this->properties.end()) { - qCDebug(logDbus) << "Ignoring untracked property update" << name << "for" << this; + qCDebug(logDbusProperties) << "Ignoring untracked property update" << name << "for" << this; } else { (*prop)->tryUpdate(value); } @@ -270,8 +273,8 @@ void DBusPropertyGroup::onPropertiesChanged( const QStringList& invalidatedProperties ) { if (interfaceName != this->interface->interface()) return; - qCDebug(logDbus).noquote() << "Received property change set and invalidations for" - << this->toString(); + qCDebug(logDbusProperties).noquote() + << "Received property change set and invalidations for" << this->toString(); for (const auto& name: invalidatedProperties) { auto prop = std::find_if( @@ -281,7 +284,8 @@ void DBusPropertyGroup::onPropertiesChanged( ); if (prop == this->properties.end()) { - qCDebug(logDbus) << "Ignoring untracked property invalidation" << name << "for" << this; + qCDebug(logDbusProperties) << "Ignoring untracked property invalidation" << name << "for" + << this; } else { (*prop)->update(); } diff --git a/src/dbus/dbusutil.hpp b/src/dbus/properties.hpp similarity index 98% rename from src/dbus/dbusutil.hpp rename to src/dbus/properties.hpp index 480a6c22..3aac07f6 100644 --- a/src/dbus/dbusutil.hpp +++ b/src/dbus/properties.hpp @@ -19,7 +19,7 @@ class DBusPropertiesInterface; -Q_DECLARE_LOGGING_CATEGORY(logDbus); +Q_DECLARE_LOGGING_CATEGORY(logDbusProperties); namespace qs::dbus { diff --git a/src/services/status_notifier/host.cpp b/src/services/status_notifier/host.cpp index 84ef3106..470b86a7 100644 --- a/src/services/status_notifier/host.cpp +++ b/src/services/status_notifier/host.cpp @@ -11,7 +11,7 @@ #include #include -#include "../../dbus/dbusutil.hpp" +#include "../../dbus/properties.hpp" #include "dbus_watcher_interface.h" #include "item.hpp" #include "watcher.hpp" diff --git a/src/services/status_notifier/item.cpp b/src/services/status_notifier/item.cpp index 8d55ba2a..a9e0bee9 100644 --- a/src/services/status_notifier/item.cpp +++ b/src/services/status_notifier/item.cpp @@ -17,7 +17,7 @@ #include #include "../../core/iconimageprovider.hpp" -#include "../../dbus/dbusutil.hpp" +#include "../../dbus/properties.hpp" #include "dbus_item.h" #include "dbus_item_types.hpp" #include "host.hpp" diff --git a/src/services/status_notifier/item.hpp b/src/services/status_notifier/item.hpp index cbe21ff2..24978a08 100644 --- a/src/services/status_notifier/item.hpp +++ b/src/services/status_notifier/item.hpp @@ -9,7 +9,7 @@ #include #include -#include "../../dbus/dbusutil.hpp" +#include "../../dbus/properties.hpp" #include "dbus_item.h" #include "dbus_item_types.hpp" diff --git a/src/services/status_notifier/qml.cpp b/src/services/status_notifier/qml.cpp index 8185ac57..f661c04e 100644 --- a/src/services/status_notifier/qml.cpp +++ b/src/services/status_notifier/qml.cpp @@ -9,7 +9,7 @@ #include #include -#include "../../dbus/dbusutil.hpp" +#include "../../dbus/properties.hpp" #include "host.hpp" #include "item.hpp"