PulseAudio Qt Bindings

pulseobject.cpp
1 /*
2  SPDX-FileCopyrightText: 2014-2015 Harald Sitter <[email protected]>
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 
14 namespace PulseAudioQt
15 {
16 PulseObject::PulseObject(QObject *parent)
17  : QObject(parent)
18  , d(new PulseObjectPrivate(this))
19 {
20 }
21 
22 PulseObject::~PulseObject()
23 {
24  delete d;
25 }
26 
27 PulseObjectPrivate::PulseObjectPrivate(PulseObject *q)
28  : q(q)
29 {
30 }
31 
32 PulseObjectPrivate::~PulseObjectPrivate()
33 {
34 }
35 
36 QString PulseObject::name() const
37 {
38  return d->m_name;
39 }
40 
41 QString 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 = property("name").toString();
74  if (!name.isEmpty() && QIcon::hasThemeIcon(name)) {
75  return name;
76  }
77 
78  return QString();
79 }
80 
81 QVariantMap PulseObject::properties() const
82 {
83  return d->m_properties;
84 }
85 
86 } // PulseAudioQt
The primary namespace of PulseAudioQt.
Definition: card.cpp:16
bool hasThemeIcon(const QString &name)
const char * name(StandardAction id)
QString toString() const const
QVariant property(const char *name) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Jun 26 2022 04:11:24 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.