Changeset View
Changeset View
Standalone View
Standalone View
src/card.h
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 56 | while (const char *key = pa_proplist_iterate(info->proplist, &it)) { | |||
---|---|---|---|---|---|
58 | const char *value = pa_proplist_gets(info->proplist, key); | 58 | const char *value = pa_proplist_gets(info->proplist, key); | ||
59 | if (!value) { | 59 | if (!value) { | ||
60 | qCDebug(PLASMAPA) << "property" << key << "not a string"; | 60 | qCDebug(PLASMAPA) << "property" << key << "not a string"; | ||
61 | continue; | 61 | continue; | ||
62 | } | 62 | } | ||
63 | Q_ASSERT(value); | 63 | Q_ASSERT(value); | ||
64 | m_properties.insert(QString::fromUtf8(key), QString::fromUtf8(value)); | 64 | m_properties.insert(QString::fromUtf8(key), QString::fromUtf8(value)); | ||
65 | } | 65 | } | ||
66 | emit propertiesChanged(); | 66 | Q_EMIT propertiesChanged(); | ||
67 | } | 67 | } | ||
68 | 68 | | |||
69 | QVariantMap properties() const { return m_properties; } | 69 | QVariantMap properties() const { return m_properties; } | ||
70 | 70 | | |||
71 | signals: | 71 | Q_SIGNALS: | ||
72 | void propertiesChanged(); | 72 | void propertiesChanged(); | ||
73 | 73 | | |||
74 | private: | 74 | private: | ||
75 | QVariantMap m_properties; | 75 | QVariantMap m_properties; | ||
76 | }; | 76 | }; | ||
77 | 77 | | |||
78 | class Card : public PulseObject | 78 | class Card : public PulseObject | ||
79 | { | 79 | { | ||
80 | Q_OBJECT | 80 | Q_OBJECT | ||
81 | Q_PROPERTY(QString name READ name NOTIFY nameChanged) | 81 | Q_PROPERTY(QString name READ name NOTIFY nameChanged) | ||
82 | Q_PROPERTY(QList<QObject *> profiles READ profiles NOTIFY profilesChanged) | 82 | Q_PROPERTY(QList<QObject *> profiles READ profiles NOTIFY profilesChanged) | ||
83 | Q_PROPERTY(quint32 activeProfileIndex READ activeProfileIndex WRITE setActiveProfileIndex NOTIFY activeProfileIndexChanged) | 83 | Q_PROPERTY(quint32 activeProfileIndex READ activeProfileIndex WRITE setActiveProfileIndex NOTIFY activeProfileIndexChanged) | ||
84 | Q_PROPERTY(QList<QObject *> ports READ ports NOTIFY portsChanged) | 84 | Q_PROPERTY(QList<QObject *> ports READ ports NOTIFY portsChanged) | ||
85 | public: | 85 | public: | ||
86 | explicit Card(QObject *parent); | 86 | explicit Card(QObject *parent); | ||
87 | 87 | | |||
88 | void update(const pa_card_info *info); | 88 | void update(const pa_card_info *info); | ||
89 | 89 | | |||
90 | QString name() const; | 90 | QString name() const; | ||
91 | QList<QObject *> profiles() const; | 91 | QList<QObject *> profiles() const; | ||
92 | quint32 activeProfileIndex() const; | 92 | quint32 activeProfileIndex() const; | ||
93 | void setActiveProfileIndex(quint32 profileIndex); | 93 | void setActiveProfileIndex(quint32 profileIndex); | ||
94 | QList<QObject *> ports() const; | 94 | QList<QObject *> ports() const; | ||
95 | 95 | | |||
96 | signals: | 96 | Q_SIGNALS: | ||
97 | void nameChanged(); | 97 | void nameChanged(); | ||
98 | void profilesChanged(); | 98 | void profilesChanged(); | ||
99 | void activeProfileIndexChanged(); | 99 | void activeProfileIndexChanged(); | ||
100 | void portsChanged(); | 100 | void portsChanged(); | ||
101 | 101 | | |||
102 | private: | 102 | private: | ||
103 | QString m_name; | 103 | QString m_name; | ||
104 | QList<QObject *> m_profiles; | 104 | QList<QObject *> m_profiles; | ||
105 | quint32 m_activeProfileIndex; | 105 | quint32 m_activeProfileIndex; | ||
106 | QList<QObject *> m_ports; | 106 | QList<QObject *> m_ports; | ||
107 | }; | 107 | }; | ||
108 | 108 | | |||
109 | } // QPulseAudio | 109 | } // QPulseAudio | ||
110 | 110 | | |||
111 | #endif // CARD_H | 111 | #endif // CARD_H |