diff options
author | Simon Rettberg | 2022-08-18 20:27:25 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-08-18 20:27:25 +0200 |
commit | c48cebd620d3f5330c104d85ac32f0aaffadaa14 (patch) | |
tree | 8fc74d8aa05fcdc75bfcdf93fdc89c0f071692eb /src/PulseAudioQt/profile_p.h | |
parent | When changing default output of card, also set default sink (diff) | |
download | pavucontrol-slx-c48cebd620d3f5330c104d85ac32f0aaffadaa14.tar.gz pavucontrol-slx-c48cebd620d3f5330c104d85ac32f0aaffadaa14.tar.xz pavucontrol-slx-c48cebd620d3f5330c104d85ac32f0aaffadaa14.zip |
Replace everything with new "slxmix" (work in progress)
Diffstat (limited to 'src/PulseAudioQt/profile_p.h')
-rw-r--r-- | src/PulseAudioQt/profile_p.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/PulseAudioQt/profile_p.h b/src/PulseAudioQt/profile_p.h new file mode 100644 index 0000000..7fa1f9d --- /dev/null +++ b/src/PulseAudioQt/profile_p.h @@ -0,0 +1,59 @@ +/* + SPDX-FileCopyrightText: 2018 Nicolas Fella <nicolas.fella@gmx.de> + + SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL +*/ + +#pragma once + +#include "profile.h" +#include "pulseobject_p.h" + +namespace PulseAudioQt +{ +class ProfilePrivate +{ +public: + explicit ProfilePrivate(Profile *q); + virtual ~ProfilePrivate(); + + Profile *q; + + QString m_description; + quint32 m_priority = 0; + quint32 m_sources = 0; + quint32 m_sinks = 0; + Profile::Availability m_availability = Profile::Unknown; + + template<typename PAInfo> + void setInfo(const PAInfo *info) + { + setCommonInfo(info, info->available ? Profile::Available : Profile::Unavailable); + m_sources = info->n_sources; + m_sinks = info->n_sinks; + } + + template<typename PAInfo> + void setCommonInfo(const PAInfo *info, Profile::Availability newAvailability) + { + if (info->description) { + QString infoDescription = QString::fromUtf8(info->description); + if (m_description != infoDescription) { + m_description = infoDescription; + Q_EMIT q->descriptionChanged(); + } + } + if (m_priority != info->priority) { + m_priority = info->priority; + Q_EMIT q->priorityChanged(); + } + + if (m_availability != newAvailability) { + m_availability = newAvailability; + Q_EMIT q->availabilityChanged(); + } + + q->PulseObject::d->updatePulseObject(info); + } +}; +} |