Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PwNode.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 <PhosphorServicePipeWire/phosphorservicepipewire_export.h>
7
8#include <QHash>
9#include <QList>
10#include <QObject>
11#include <QString>
12
13#include <memory>
14
16
18
48class PHOSPHORSERVICEPIPEWIRE_EXPORT PwNode : public QObject
49{
50 Q_OBJECT
51 Q_DISABLE_COPY_MOVE(PwNode)
52 Q_PROPERTY(quint32 id READ id CONSTANT)
53 Q_PROPERTY(QString name READ name NOTIFY infoChanged)
54 Q_PROPERTY(QString nick READ nick NOTIFY infoChanged)
55 Q_PROPERTY(QString description READ description NOTIFY infoChanged)
56 Q_PROPERTY(bool running READ running NOTIFY infoChanged)
57 Q_PROPERTY(QString mediaName READ mediaName NOTIFY infoChanged)
58 Q_PROPERTY(QString applicationName READ applicationName NOTIFY infoChanged)
59 Q_PROPERTY(QString iconName READ iconName NOTIFY infoChanged)
60 Q_PROPERTY(QString serial READ serial NOTIFY infoChanged)
61 Q_PROPERTY(QString targetName READ targetName NOTIFY infoChanged)
62 Q_PROPERTY(bool canMove READ canMove NOTIFY infoChanged)
63 Q_PROPERTY(QString mediaClass READ mediaClass CONSTANT)
64 Q_PROPERTY(quint32 channelCount READ channelCount NOTIFY propsChanged)
65 Q_PROPERTY(QList<qreal> volumes READ volumes NOTIFY propsChanged)
66 Q_PROPERTY(bool muted READ muted NOTIFY propsChanged)
67
68public:
69 ~PwNode() override;
70
71 [[nodiscard]] quint32 id() const;
72 [[nodiscard]] QString name() const;
73 [[nodiscard]] QString nick() const;
74 [[nodiscard]] QString description() const;
75 [[nodiscard]] QString mediaClass() const;
76 [[nodiscard]] bool running() const;
77 [[nodiscard]] QString mediaName() const;
79 [[nodiscard]] QString applicationName() const;
80 [[nodiscard]] QString iconName() const;
81 [[nodiscard]] QString serial() const;
82 [[nodiscard]] QString targetName() const;
83 [[nodiscard]] bool canMove() const;
85 void applyTarget(const QString& target, bool present);
86 [[nodiscard]] quint32 channelCount() const;
87 [[nodiscard]] QList<qreal> volumes() const;
88 [[nodiscard]] bool muted() const;
100 [[nodiscard]] QHash<QString, QString> properties() const;
101
105 [[nodiscard]] PipeWireConnection* connection() const;
106
117 void applyInfo(QHash<QString, QString> props);
123 void applyProps(int channelCount, QList<qreal> volumes, bool muted);
124
125public Q_SLOTS:
140 void setVolume(qreal value);
149 void setVolumes(const QList<qreal>& values);
152 void setMuted(bool muted);
153
154Q_SIGNALS:
157
158private:
159 friend class PipeWireConnection;
160
173 PwNode(quint32 id, QString mediaClass, PipeWireConnection* parent);
174
175 class Private;
176 std::unique_ptr<Private> d;
177};
178
179} // namespace PhosphorServicePipeWire
Owns the PipeWire main loop on a dedicated QThread and exposes connection state to the GUI thread via...
Definition PipeWireConnection.h:59
friend class PipeWireConnection
Definition PwNode.h:159
void applyProps(int channelCount, QList< qreal > volumes, bool muted)
QList< qreal > volumes() const
void setVolumes(const QList< qreal > &values)
Per-channel write.
void applyTarget(const QString &target, bool present)
Internal metadata echo, on the GUI thread.
void applyInfo(QHash< QString, QString > props)
void applyRunning(bool running)
void setMuted(bool muted)
Asynchronous mute write.
void setVolume(qreal value)
Set every channel's linear amplitude to value.
PipeWireConnection * connection() const
Typed accessor for the owning connection.
QHash< QString, QString > properties() const
Definition PipeWireConnection.h:20