PulseAudio Qt Bindings
15#include <pulse/ext-stream-restore.h>
16#include <pulse/pulseaudio.h>
22#include "sinkinput_p.h"
24#include "sourceoutput_p.h"
25#include "streamrestore_p.h"
49 virtual int count()
const = 0;
50 virtual QObject *objectAt(
int index)
const = 0;
51 virtual int indexOfObject(
QObject *
object)
const = 0;
54 void aboutToBeAdded(
int index);
55 void added(
int index,
QObject *
object);
56 void aboutToBeRemoved(
int index);
57 void removed(
int index,
QObject *
object);
66template<
typename Type,
typename PAInfo>
79 int count()
const override
81 return m_data.count();
84 int indexOfObject(
QObject *
object)
const override
86 return m_data.indexOf(
static_cast<Type *
>(
object));
89 QObject *objectAt(
int index)
const override
91 return m_data.at(index);
97 removeEntry(m_data.at(m_data.count() - 1)->index());
99 m_pendingRemovals.
clear();
102 void insert(Type *
object)
106 const int modelIndex = m_data.count();
108 Q_EMIT aboutToBeAdded(modelIndex);
109 m_data.append(
object);
110 m_hash[
object->index()] = object;
111 Q_EMIT added(modelIndex,
object);
121 if (m_pendingRemovals.
remove(info->index)) {
126 auto *
obj = m_hash.
value(info->index);
129 obj->d->update(info);
132 obj->d->update(info);
136 void removeEntry(
quint32 index)
139 m_pendingRemovals.
insert(index);
141 const int modelIndex = m_data.indexOf(m_hash.
value(index));
142 Q_EMIT aboutToBeRemoved(modelIndex);
143 m_data.removeAt(modelIndex);
144 auto object = m_hash.
take(index);
145 Q_EMIT removed(modelIndex,
object);
Maps a specific index to a specific object pointer.
The primary namespace of PulseAudioQt.
bool contains(const Key &key) const const
bool isEmpty() const const
T value(const Key &key) const const
QObject * parent() const const
T qobject_cast(QObject *object)
iterator insert(const T &value)
bool remove(const T &value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:07 by
doxygen 1.10.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.