Changeset View
Changeset View
Standalone View
Standalone View
src/pulseobject_p.h
Show All 35 Lines | |||||
36 | public: | 36 | public: | ||
37 | explicit PulseObjectPrivate(PulseObject *q); | 37 | explicit PulseObjectPrivate(PulseObject *q); | ||
38 | virtual ~PulseObjectPrivate(); | 38 | virtual ~PulseObjectPrivate(); | ||
39 | 39 | | |||
40 | PulseObject *q; | 40 | PulseObject *q; | ||
41 | quint32 m_index; | 41 | quint32 m_index; | ||
42 | QVariantMap m_properties; | 42 | QVariantMap m_properties; | ||
43 | 43 | | |||
44 | }; | | |||
45 | | ||||
46 | template <typename PAInfo> | 44 | template <typename PAInfo> | ||
47 | void PulseObject::updatePulseObject(PAInfo *info) | 45 | void updatePulseObject(PAInfo *info) | ||
48 | { | 46 | { | ||
49 | d->m_index = info->index; | 47 | m_index = info->index; | ||
50 | 48 | | |||
51 | d->m_properties.clear(); | 49 | m_properties.clear(); | ||
52 | void *it = nullptr; | 50 | void *it = nullptr; | ||
53 | while (const char *key = pa_proplist_iterate(info->proplist, &it)) { | 51 | while (const char *key = pa_proplist_iterate(info->proplist, &it)) { | ||
54 | Q_ASSERT(key); | 52 | Q_ASSERT(key); | ||
55 | const char *value = pa_proplist_gets(info->proplist, key); | 53 | const char *value = pa_proplist_gets(info->proplist, key); | ||
56 | if (!value) { | 54 | if (!value) { | ||
57 | qCDebug(PULSEAUDIOQT) << "property" << key << "not a string"; | 55 | qCDebug(PULSEAUDIOQT) << "property" << key << "not a string"; | ||
58 | continue; | 56 | continue; | ||
59 | } | 57 | } | ||
60 | Q_ASSERT(value); | 58 | Q_ASSERT(value); | ||
61 | d->m_properties.insert(QString::fromUtf8(key), QString::fromUtf8(value)); | 59 | m_properties.insert(QString::fromUtf8(key), QString::fromUtf8(value)); | ||
62 | } | 60 | } | ||
63 | Q_EMIT propertiesChanged(); | 61 | Q_EMIT q->propertiesChanged(); | ||
64 | } | 62 | } | ||
63 | }; | ||||
65 | } | 64 | } | ||
66 | #endif | 65 | #endif |