2 * Copyright (C) 2016 Konsulko Group
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <pulse/pulseaudio.h>
20 extern void add_one_control(void *ctx, int, const char *, int, int, const char *, int);
22 extern "C" void add_one_control(void *ctx, int, const char *, int, int, const char *, int);
24 #include <QAbstractListModel>
25 #include <QStringList>
32 PaControl(const quint32 &index, const QString &desc, const quint32 &type, const quint32 &channel, const QString &cdesc, const quint32 &volume);
34 quint32 cindex() const;
37 quint32 channel() const;
38 QString cdesc() const;
39 quint32 volume() const;
40 void setCIndex(const QVariant&);
41 void setDesc(const QVariant&);
42 void setType(const QVariant&);
43 void setChannel(const QVariant&);
44 void setCDesc(const QVariant&);
45 void setVolume(pa_context *, const QVariant&);
56 class PaControlModel : public QAbstractListModel
61 CIndexRole = Qt::UserRole + 1,
69 PaControlModel(QObject *parent = 0);
71 void addControl(const PaControl &control);
73 int rowCount(const QModelIndex &parent = QModelIndex()) const;
75 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
77 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
79 Qt::ItemFlags flags(const QModelIndex &index) const;
82 QHash<int, QByteArray> roleNames() const;
84 QList<PaControl> m_controls;