summaryrefslogtreecommitdiffstats
path: root/src/PulseAudioQt/profile_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/PulseAudioQt/profile_p.h')
-rw-r--r--src/PulseAudioQt/profile_p.h59
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);
+ }
+};
+}