From c48cebd620d3f5330c104d85ac32f0aaffadaa14 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 18 Aug 2022 20:27:25 +0200 Subject: Replace everything with new "slxmix" (work in progress) --- src/PulseAudioQt/pulseobject.cpp | 86 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 src/PulseAudioQt/pulseobject.cpp (limited to 'src/PulseAudioQt/pulseobject.cpp') diff --git a/src/PulseAudioQt/pulseobject.cpp b/src/PulseAudioQt/pulseobject.cpp new file mode 100644 index 0000000..ac9b975 --- /dev/null +++ b/src/PulseAudioQt/pulseobject.cpp @@ -0,0 +1,86 @@ +/* + SPDX-FileCopyrightText: 2014-2015 Harald Sitter + + SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL +*/ + +#include "pulseobject.h" +#include "pulseobject_p.h" + +#include "context.h" + +#include + +namespace PulseAudioQt +{ +PulseObject::PulseObject(QObject *parent) + : QObject(parent) + , d(new PulseObjectPrivate(this)) +{ +} + +PulseObject::~PulseObject() +{ + delete d; +} + +PulseObjectPrivate::PulseObjectPrivate(PulseObject *q) + : q(q) +{ +} + +PulseObjectPrivate::~PulseObjectPrivate() +{ +} + +QString PulseObject::name() const +{ + return d->m_name; +} + +QString PulseObject::iconName() const +{ + QString name = d->m_properties.value(QStringLiteral("device.icon_name")).toString(); + if (!name.isEmpty() && QIcon::hasThemeIcon(name)) { + return name; + } + + name = d->m_properties.value(QStringLiteral("media.icon_name")).toString(); + if (!name.isEmpty() && QIcon::hasThemeIcon(name)) { + return name; + } + + name = d->m_properties.value(QStringLiteral("window.icon_name")).toString(); + if (!name.isEmpty() && QIcon::hasThemeIcon(name)) { + return name; + } + + name = d->m_properties.value(QStringLiteral("application.icon_name")).toString(); + if (!name.isEmpty() && QIcon::hasThemeIcon(name)) { + return name; + } + + name = d->m_properties.value(QStringLiteral("application.process.binary")).toString(); + if (!name.isEmpty() && QIcon::hasThemeIcon(name)) { + return name; + } + + name = d->m_properties.value(QStringLiteral("application.name")).toString(); + if (!name.isEmpty() && QIcon::hasThemeIcon(name)) { + return name; + } + + name = property("name").toString(); + if (!name.isEmpty() && QIcon::hasThemeIcon(name)) { + return name; + } + + return QString(); +} + +QVariantMap PulseObject::properties() const +{ + return d->m_properties; +} + +} // PulseAudioQt -- cgit v1.2.3-55-g7522