2 * Copyright (C) 2016,2017 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>
19 #include <QtCore/QAbstractListModel>
20 #include <QtCore/QList>
27 PaControl(const quint32 &index, const QString &desc, const quint32 &type, const quint32 &channel, const QString &cdesc, const quint32 &volume);
29 quint32 cindex() const;
32 quint32 channel() const;
33 QString cdesc() const;
34 quint32 volume() const;
35 void setCIndex(const QVariant&);
36 void setDesc(const QVariant&);
37 void setType(const QVariant&);
38 void setChannel(const QVariant&);
39 void setCDesc(const QVariant&);
40 void setVolume(PaControlModel *, const QVariant&);
51 class PaControlModel : public QAbstractListModel
56 CIndexRole = Qt::UserRole + 1,
64 PaControlModel(QObject *parent = 0);
66 void addControl(const PaControl &control);
68 int rowCount(const QModelIndex &parent = QModelIndex()) const;
70 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
72 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
74 Qt::ItemFlags flags(const QModelIndex &index) const;
77 void addOneControl(int cindex, QString desc, int type, int channel, const char *cdesc, int volume);
78 void changeExternalVolume(uint32_t type, uint32_t cindex, uint32_t chan, uint32_t volume);
81 void volumeChanged(uint32_t type, uint32_t index, uint32_t channel, uint32_t volume);
84 QHash<int, QByteArray> roleNames() const;
86 QList<PaControl> m_controls;