summaryrefslogtreecommitdiffstats
path: root/src/PulseAudioQt/pulseobject.h
blob: 4d5b4946358b0ccfb3b7f27efb7a6afd43b3b39a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
    SPDX-FileCopyrightText: 2014-2015 Harald Sitter <sitter@kde.org>

    SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/

#ifndef PULSEOBJECT_H
#define PULSEOBJECT_H

#include <QObject>

#include "pulseaudioqt_export.h"

namespace PulseAudioQt
{
class Context;

template<typename Type, typename PAInfo>
class MapBase;

/**
 * Base class for most PulseAudio objects.
 */
class PULSEAUDIOQT_EXPORT PulseObject : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString name READ name NOTIFY nameChanged)
    Q_PROPERTY(QString iconName READ iconName CONSTANT)
    Q_PROPERTY(QVariantMap properties READ properties NOTIFY propertiesChanged)

public:
    ~PulseObject();

    QString name() const;

    /**
     * A freedesktop.org icon name that fits this object.
     */
    QString iconName() const;

    /**
     * A map of properties associated with this object.
     * The set of available properties depends on the type of object.
     */
    QVariantMap properties() const;

Q_SIGNALS:
    /**
     * Emitted when any of the \ref properties changed.
     */
    void propertiesChanged();

    void nameChanged();

protected:
    /** @private */
    explicit PulseObject(QObject *parent);

    /** @private */
    class PulseObjectPrivate *const d;

private:
    // Ensure that we get properly parented.
    PulseObject();
    friend class IndexedPulseObjectPrivate;
    friend class ClientPrivate;
    friend class CardPrivate;
    friend class ModulePrivate;
    friend class VolumeObjectPrivate;
    friend class ProfilePrivate;
    friend class StreamRestorePrivate;
};

} // PulseAudioQt

#endif // PULSEOBJECT_H