PulseAudio Qt Bindings

pulseobject.cpp
1/*
2 SPDX-FileCopyrightText: 2014-2015 Harald Sitter <sitter@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#include "pulseobject.h"
8#include "pulseobject_p.h"
9
10#include "context.h"
11
12#include <QIcon>
13
14namespace PulseAudioQt
15{
16PulseObject::PulseObject(QObject *parent)
17 : QObject(parent)
18 , d(new PulseObjectPrivate(this))
19{
20}
21
22PulseObject::~PulseObject()
23{
24 delete d;
25}
26
27PulseObjectPrivate::PulseObjectPrivate(PulseObject *q)
28 : q(q)
29{
30}
31
32PulseObjectPrivate::~PulseObjectPrivate()
33{
34}
35
36QString PulseObject::name() const
37{
38 return d->m_name;
39}
40
41QString PulseObject::iconName() const
42{
43 QString name = d->m_properties.value(QStringLiteral("device.icon_name")).toString();
44 if (!name.isEmpty() && QIcon::hasThemeIcon(name)) {
45 return name;
46 }
47
48 name = d->m_properties.value(QStringLiteral("media.icon_name")).toString();
49 if (!name.isEmpty() && QIcon::hasThemeIcon(name)) {
50 return name;
51 }
52
53 name = d->m_properties.value(QStringLiteral("window.icon_name")).toString();
54 if (!name.isEmpty() && QIcon::hasThemeIcon(name)) {
55 return name;
56 }
57
58 name = d->m_properties.value(QStringLiteral("application.icon_name")).toString();
59 if (!name.isEmpty() && QIcon::hasThemeIcon(name)) {
60 return name;
61 }
62
63 name = d->m_properties.value(QStringLiteral("application.process.binary")).toString();
64 if (!name.isEmpty() && QIcon::hasThemeIcon(name)) {
65 return name;
66 }
67
68 name = d->m_properties.value(QStringLiteral("application.name")).toString();
69 if (!name.isEmpty() && QIcon::hasThemeIcon(name)) {
70 return name;
71 }
72
73 name = d->m_properties.value(QStringLiteral("pipewire.access.portal.app_id")).toString();
74 if (!name.isEmpty() && QIcon::hasThemeIcon(name)) {
75 return name;
76 }
77
78 name = property("name").toString();
79 if (!name.isEmpty() && QIcon::hasThemeIcon(name)) {
80 return name;
81 }
82
83 return QString();
84}
85
86QVariantMap PulseObject::properties() const
87{
88 return d->m_properties;
89}
90
91} // PulseAudioQt
The primary namespace of PulseAudioQt.
Definition card.cpp:17
bool hasThemeIcon(const QString &name)
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:52:10 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.