Changeset View
Changeset View
Standalone View
Standalone View
src/device_p.h
Show All 21 Lines | |||||
22 | 22 | | |||
23 | #include <pulse/proplist.h> | 23 | #include <pulse/proplist.h> | ||
24 | 24 | | |||
25 | #include <QVector> | 25 | #include <QVector> | ||
26 | 26 | | |||
27 | #include "device.h" | 27 | #include "device.h" | ||
28 | #include "port.h" | 28 | #include "port.h" | ||
29 | #include "port_p.h" | 29 | #include "port_p.h" | ||
30 | #include "volumeobject_p.h" | ||||
30 | 31 | | |||
31 | namespace PulseAudioQt | 32 | namespace PulseAudioQt | ||
32 | { | 33 | { | ||
33 | 34 | | |||
34 | class DevicePrivate | 35 | class DevicePrivate | ||
35 | { | 36 | { | ||
36 | 37 | | |||
37 | public: | 38 | public: | ||
Show All 9 Lines | |||||
47 | quint32 m_activePortIndex = -1; | 48 | quint32 m_activePortIndex = -1; | ||
48 | Device::State m_state = Device::UnknownState; | 49 | Device::State m_state = Device::UnknownState; | ||
49 | 50 | | |||
50 | Device::State stateFromPaState(int value) const; | 51 | Device::State stateFromPaState(int value) const; | ||
51 | 52 | | |||
52 | template <typename PAInfo> | 53 | template <typename PAInfo> | ||
53 | void updateDevice(const PAInfo *info) | 54 | void updateDevice(const PAInfo *info) | ||
54 | { | 55 | { | ||
55 | q->updateVolumeObject(info); | 56 | q->VolumeObject::d->updateVolumeObject(info); | ||
56 | 57 | | |||
57 | if (m_name != info->name) { | 58 | if (m_name != info->name) { | ||
58 | m_name = info->name; | 59 | m_name = info->name; | ||
59 | Q_EMIT q->nameChanged(); | 60 | Q_EMIT q->nameChanged(); | ||
60 | } | 61 | } | ||
61 | if (m_description != info->description) { | 62 | if (m_description != info->description) { | ||
62 | m_description = info->description; | 63 | m_description = info->description; | ||
63 | Q_EMIT q->descriptionChanged(); | 64 | Q_EMIT q->descriptionChanged(); | ||
Show All 13 Lines | |||||
77 | // TODO: this rebuilds the entire port list on every update. would be | 78 | // TODO: this rebuilds the entire port list on every update. would be | ||
78 | // nicer if it actually removed what needs removing updates what needs | 79 | // nicer if it actually removed what needs removing updates what needs | ||
79 | // updating and adds what needs adding. Alas, this is a tad more | 80 | // updating and adds what needs adding. Alas, this is a tad more | ||
80 | // involved. | 81 | // involved. | ||
81 | qDeleteAll(m_ports); | 82 | qDeleteAll(m_ports); | ||
82 | m_ports.clear(); | 83 | m_ports.clear(); | ||
83 | for (auto **ports = info->ports; ports && *ports != nullptr; ++ports) { | 84 | for (auto **ports = info->ports; ports && *ports != nullptr; ++ports) { | ||
84 | Port *port = new Port(q); | 85 | Port *port = new Port(q); | ||
85 | port->setInfo(*ports); | 86 | port->d->setInfo(*ports); | ||
86 | m_ports.append(port); | 87 | m_ports.append(port); | ||
87 | if (info->active_port == *ports) { | 88 | if (info->active_port == *ports) { | ||
88 | m_activePortIndex = m_ports.length() - 1; | 89 | m_activePortIndex = m_ports.length() - 1; | ||
89 | } | 90 | } | ||
90 | } | 91 | } | ||
91 | Q_EMIT q->portsChanged(); | 92 | Q_EMIT q->portsChanged(); | ||
92 | Q_EMIT q->activePortIndexChanged(); | 93 | Q_EMIT q->activePortIndexChanged(); | ||
93 | 94 | | |||
Show All 12 Lines |