Skip to content

Commit fbaec14

Browse files
committed
service/pipewire: improve documentation
1 parent fdc78ae commit fbaec14

File tree

1 file changed

+40
-8
lines changed

1 file changed

+40
-8
lines changed

src/services/pipewire/qml.hpp

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,31 @@ class PwObjectIface
5252
class Pipewire: public QObject {
5353
Q_OBJECT;
5454
// clang-format off
55-
/// All pipewire nodes.
55+
/// All nodes present in pipewire.
56+
///
57+
/// This list contains every node on the system.
58+
/// To find a useful subset, filtering with the following properties may be helpful:
59+
/// - @@PwNode.isStream - if the node is an application or hardware device.
60+
/// - @@PwNode.isSink - if the node is a sink or source.
61+
/// - @@PwNode.audio - if non null the node is an audio node.
5662
Q_PROPERTY(ObjectModel<PwNodeIface>* nodes READ nodes CONSTANT);
57-
/// All pipewire links.
63+
/// All links present in pipewire.
64+
///
65+
/// Links connect pipewire nodes to each other, and can be used to determine
66+
/// their relationship.
67+
///
68+
/// If you already have a node you want to check for connections to,
69+
/// use @@PwNodeLinkTracker instead of filtering this list.
70+
///
71+
/// > [!INFO] Multiple links may exist between the same nodes. See @@linkGroups
72+
/// > for a deduplicated list containing only one entry per link between nodes.
5873
Q_PROPERTY(ObjectModel<PwLinkIface>* links READ links CONSTANT);
59-
/// All pipewire link groups.
74+
/// All link groups present in pipewire.
75+
///
76+
/// The same as @@links but deduplicated.
77+
///
78+
/// If you already have a node you want to check for connections to,
79+
/// use @@PwNodeLinkTracker instead of filtering this list.
6080
Q_PROPERTY(ObjectModel<PwLinkGroupIface>* linkGroups READ linkGroups CONSTANT);
6181
/// The default audio sink (output) or `null`.
6282
///
@@ -231,7 +251,7 @@ class PwNodeIface: public PwObjectIface {
231251
Q_OBJECT;
232252
/// The pipewire object id of the node.
233253
///
234-
/// Mainly useful for debugging. you can inspect the node directly
254+
/// Mainly useful for debugging. You can inspect the node directly
235255
/// with `pw-cli i <id>`.
236256
Q_PROPERTY(quint32 id READ id CONSTANT);
237257
/// The node's name, corrosponding to the object's `node.name` property.
@@ -247,7 +267,8 @@ class PwNodeIface: public PwObjectIface {
247267
/// If `true`, then the node accepts audio input from other nodes,
248268
/// if `false` the node outputs audio to other nodes.
249269
Q_PROPERTY(bool isSink READ isSink CONSTANT);
250-
/// If `true` then the node is likely to be a program, if false it is liekly to be hardware.
270+
/// If `true` then the node is likely to be a program, if `false` it is likely to be
271+
/// a hardware device.
251272
Q_PROPERTY(bool isStream READ isStream CONSTANT);
252273
/// The property set present on the node, as an object containing key-value pairs.
253274
/// You can inspect this directly with `pw-cli i <id>`.
@@ -263,6 +284,9 @@ class PwNodeIface: public PwObjectIface {
263284
/// > [!WARNING] This property is invalid unless the node is [bound](../pwobjecttracker).
264285
Q_PROPERTY(QVariantMap properties READ properties NOTIFY propertiesChanged);
265286
/// Extra information present only if the node sends or receives audio.
287+
///
288+
/// The presence or absence of this property can be used to determine if a node
289+
/// manages audio, regardless of if it is bound. If non null, the node is an audio node.
266290
Q_PROPERTY(PwNodeAudioIface* audio READ audio CONSTANT);
267291
QML_NAMED_ELEMENT(PwNode);
268292
QML_UNCREATABLE("PwNodes cannot be created directly");
@@ -370,11 +394,19 @@ class PwLinkGroupIface
370394
};
371395

372396
///! Binds pipewire objects.
373-
/// If the object list of at least one PwObjectTracker contains a given pipewire object,
374-
/// it will become *bound* and you will be able to interact with bound-only properties.
397+
/// PwObjectTracker binds every node given in its @@objects list.
398+
///
399+
/// #### Object Binding
400+
/// By default, pipewire objects are unbound. Unbound objects only have a subset of
401+
/// information available for use or modification. **Binding an object makes all of its
402+
/// properties available for use or modification if applicable.**
403+
///
404+
/// Properties that require their object be bound to use are clearly marked. You do not
405+
/// need to bind the object unless mentioned in the description of the property you
406+
/// want to use.
375407
class PwObjectTracker: public QObject {
376408
Q_OBJECT;
377-
/// The list of objects to bind.
409+
/// The list of objects to bind. May contain nulls.
378410
Q_PROPERTY(QList<QObject*> objects READ objects WRITE setObjects NOTIFY objectsChanged);
379411
QML_ELEMENT;
380412

0 commit comments

Comments
 (0)