Changeset View
Changeset View
Standalone View
Standalone View
src/volumeobject.h
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | 40 | public: | |||
---|---|---|---|---|---|
42 | ~VolumeObject() override; | 42 | ~VolumeObject() override; | ||
43 | 43 | | |||
44 | template <typename PAInfo> | 44 | template <typename PAInfo> | ||
45 | void updateVolumeObject(PAInfo *info) | 45 | void updateVolumeObject(PAInfo *info) | ||
46 | { | 46 | { | ||
47 | updatePulseObject(info); | 47 | updatePulseObject(info); | ||
48 | if (m_muted != info->mute) { | 48 | if (m_muted != info->mute) { | ||
49 | m_muted = info->mute; | 49 | m_muted = info->mute; | ||
50 | emit mutedChanged(); | 50 | Q_EMIT mutedChanged(); | ||
51 | } | 51 | } | ||
52 | if (!pa_cvolume_equal(&m_volume, &info->volume)) { | 52 | if (!pa_cvolume_equal(&m_volume, &info->volume)) { | ||
53 | m_volume = info->volume; | 53 | m_volume = info->volume; | ||
54 | emit volumeChanged(); | 54 | Q_EMIT volumeChanged(); | ||
55 | emit channelVolumesChanged(); | 55 | Q_EMIT channelVolumesChanged(); | ||
56 | } | 56 | } | ||
57 | QStringList infoChannels; | 57 | QStringList infoChannels; | ||
58 | infoChannels.reserve(info->channel_map.channels); | 58 | infoChannels.reserve(info->channel_map.channels); | ||
59 | for (int i = 0; i < info->channel_map.channels; ++i) { | 59 | for (int i = 0; i < info->channel_map.channels; ++i) { | ||
60 | infoChannels << QString::fromUtf8(pa_channel_position_to_pretty_string(info->channel_map.map[i])); | 60 | infoChannels << QString::fromUtf8(pa_channel_position_to_pretty_string(info->channel_map.map[i])); | ||
61 | } | 61 | } | ||
62 | if (m_channels != infoChannels) { | 62 | if (m_channels != infoChannels) { | ||
63 | m_channels = infoChannels; | 63 | m_channels = infoChannels; | ||
64 | emit channelsChanged(); | 64 | Q_EMIT channelsChanged(); | ||
65 | } | 65 | } | ||
66 | } | 66 | } | ||
67 | 67 | | |||
68 | qint64 volume() const; | 68 | qint64 volume() const; | ||
69 | virtual void setVolume(qint64 volume) = 0; | 69 | virtual void setVolume(qint64 volume) = 0; | ||
70 | 70 | | |||
71 | bool isMuted() const; | 71 | bool isMuted() const; | ||
72 | virtual void setMuted(bool muted) = 0; | 72 | virtual void setMuted(bool muted) = 0; | ||
73 | 73 | | |||
74 | bool hasVolume() const; | 74 | bool hasVolume() const; | ||
75 | bool isVolumeWritable() const; | 75 | bool isVolumeWritable() const; | ||
76 | 76 | | |||
77 | QStringList channels() const; | 77 | QStringList channels() const; | ||
78 | QList<qreal> channelVolumes() const; | 78 | QList<qreal> channelVolumes() const; | ||
79 | Q_INVOKABLE virtual void setChannelVolume(int channel, qint64 volume) = 0; | 79 | Q_INVOKABLE virtual void setChannelVolume(int channel, qint64 volume) = 0; | ||
80 | 80 | | |||
81 | signals: | 81 | Q_SIGNALS: | ||
82 | void volumeChanged(); | 82 | void volumeChanged(); | ||
83 | void mutedChanged(); | 83 | void mutedChanged(); | ||
84 | void hasVolumeChanged(); | 84 | void hasVolumeChanged(); | ||
85 | void isVolumeWritableChanged(); | 85 | void isVolumeWritableChanged(); | ||
86 | void channelsChanged(); | 86 | void channelsChanged(); | ||
87 | void channelVolumesChanged(); | 87 | void channelVolumesChanged(); | ||
88 | 88 | | |||
89 | protected: | 89 | protected: | ||
Show All 12 Lines |