Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
ObjectManager.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <PhosphorDBus/phosphordbus_export.h>
7
8#include <QMap>
9#include <QObject>
10#include <QString>
11#include <QStringList>
12#include <QVariantMap>
13
14#include <memory>
15
16class QDBusConnection;
17class QDBusMessage;
18class QLoggingCategory;
19
20namespace PhosphorDBus {
21
25using InterfaceMap = QMap<QString, QVariantMap>;
26
47class PHOSPHORDBUS_EXPORT ObjectManager : public QObject
48{
49 Q_OBJECT
50
51public:
62 explicit ObjectManager(QDBusConnection connection, QString service, QString rootPath = QStringLiteral("/"),
63 QObject* parent = nullptr, const QLoggingCategory* log = nullptr);
64 ~ObjectManager() override;
65
66 [[nodiscard]] QString service() const;
67 [[nodiscard]] QString rootPath() const;
68
71 [[nodiscard]] bool isReady() const;
72
73Q_SIGNALS:
76 void interfacesAdded(const QString& path, const PhosphorDBus::InterfaceMap& interfaces);
77
81 void interfacesRemoved(const QString& path, const QStringList& interfaces);
82
84 void ready();
85
86private Q_SLOTS:
87 void _q_onInterfacesAdded(const QDBusMessage& message);
88 void _q_onInterfacesRemoved(const QDBusMessage& message);
89
90private:
91 class Private;
92 std::unique_ptr<Private> d;
93};
94
95} // namespace PhosphorDBus
Service-agnostic observer for org.freedesktop.DBus.ObjectManager.
Definition ObjectManager.h:48
bool isReady() const
True once the initial GetManagedObjects round-trip has completed (success or error).
void interfacesRemoved(const QString &path, const QStringList &interfaces)
Some of an object's interfaces went away.
void interfacesAdded(const QString &path, const PhosphorDBus::InterfaceMap &interfaces)
A managed object appeared, or the initial walk surfaced it.
ObjectManager(QDBusConnection connection, QString service, QString rootPath=QStringLiteral("/"), QObject *parent=nullptr, const QLoggingCategory *log=nullptr)
void ready()
Emitted once after the initial GetManagedObjects round-trip completes.
Definition Client.h:17
QMap< QString, QVariantMap > InterfaceMap
One D-Bus object's interfaces as reported by ObjectManager: a map of interface name → that interface'...
Definition ObjectManager.h:25