core/log: track default logging categories

Fixes a bug in fb37be7 which ignored default logging categories due to
skipping QLoggingRegistry's filter.
This commit is contained in:
outfoxxed 2025-07-08 13:39:34 -07:00
parent 5d7e07508a
commit 3d594e16dd
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
68 changed files with 212 additions and 79 deletions

View file

@ -12,13 +12,14 @@
#include <qstringliteral.h>
#include <qtypes.h>
#include "../core/logcat.hpp"
#include "../dbus/properties.hpp"
#include "dbus_adapter.h"
namespace qs::bluetooth {
namespace {
Q_LOGGING_CATEGORY(logAdapter, "quickshell.bluetooth.adapter", QtWarningMsg);
QS_LOGGING_CATEGORY(logAdapter, "quickshell.bluetooth.adapter", QtWarningMsg);
}
QString BluetoothAdapterState::toString(BluetoothAdapterState::Enum state) {

View file

@ -8,6 +8,7 @@
#include <qobject.h>
#include <qtmetamacros.h>
#include "../core/logcat.hpp"
#include "../dbus/dbus_objectmanager_types.hpp"
#include "../dbus/objectmanager.hpp"
#include "adapter.hpp"
@ -16,7 +17,7 @@
namespace qs::bluetooth {
namespace {
Q_LOGGING_CATEGORY(logBluetooth, "quickshell.bluetooth", QtWarningMsg);
QS_LOGGING_CATEGORY(logBluetooth, "quickshell.bluetooth", QtWarningMsg);
}
Bluez* Bluez::instance() {
@ -156,7 +157,12 @@ void Bluez::onInterfacesRemoved(const QDBusObjectPath& path, const QStringList&
}
BluezQml::BluezQml() {
QObject::connect(Bluez::instance(), &Bluez::defaultAdapterChanged, this, &BluezQml::defaultAdapterChanged);
QObject::connect(
Bluez::instance(),
&Bluez::defaultAdapterChanged,
this,
&BluezQml::defaultAdapterChanged
);
}
} // namespace qs::bluetooth

View file

@ -50,13 +50,21 @@ private:
ObjectModel<BluetoothDevice> mDevices {this};
public:
Q_OBJECT_BINDABLE_PROPERTY(Bluez, BluetoothAdapter*, bDefaultAdapter, &Bluez::defaultAdapterChanged);
Q_OBJECT_BINDABLE_PROPERTY(
Bluez,
BluetoothAdapter*,
bDefaultAdapter,
&Bluez::defaultAdapterChanged
);
};
///! Bluetooth manager
/// Provides access to bluetooth devices and adapters.
class BluezQml: public QObject {
Q_OBJECT;
QML_NAMED_ELEMENT(Bluetooth);
QML_SINGLETON;
// clang-format off
/// The default bluetooth adapter. Usually there is only one.
Q_PROPERTY(BluetoothAdapter* defaultAdapter READ default NOTIFY defaultAdapterChanged BINDABLE bindableDefaultAdapter);
QSDOC_TYPE_OVERRIDE(ObjectModel<qs::bluetooth::BluetoothAdapter>*);
@ -66,8 +74,7 @@ class BluezQml: public QObject {
/// A list of all connected bluetooth devices across all adapters.
/// See @@BluetoothAdapter.devices for the devices connected to a single adapter.
Q_PROPERTY(UntypedObjectModel* devices READ devices CONSTANT);
QML_NAMED_ELEMENT(Bluetooth);
QML_SINGLETON;
// clang-format on
signals:
void defaultAdapterChanged();

View file

@ -12,6 +12,7 @@
#include <qtmetamacros.h>
#include <qtypes.h>
#include "../core/logcat.hpp"
#include "../dbus/properties.hpp"
#include "adapter.hpp"
#include "bluez.hpp"
@ -20,7 +21,7 @@
namespace qs::bluetooth {
namespace {
Q_LOGGING_CATEGORY(logDevice, "quickshell.bluetooth.device", QtWarningMsg);
QS_LOGGING_CATEGORY(logDevice, "quickshell.bluetooth.device", QtWarningMsg);
}
QString BluetoothDeviceState::toString(BluetoothDeviceState::Enum state) {