Loader {
property int modelType: type
property int modelCIndex: cindex
- property string modelDesc: desc
+ property string modelDesc: name
sourceComponent: (channel == 0) ? ctldesc : empty
}
RowLayout {
QObject::connect(window, SIGNAL(frameSwapped()), qwm, SLOT(slotActivateSurface()));
PaControlModel *pacm = mobjs.first()->findChild<PaControlModel *>("pacm");
- QObject::connect(client, SIGNAL(controlAdded(int, QString, int, int, const char *, int)),
- pacm, SLOT(addOneControl(int, QString, int, int, const char *, int)));
+ QObject::connect(client, SIGNAL(controlAdded(int, QString, QString, int, int, const char *, int)),
+ pacm, SLOT(addOneControl(int, QString, QString, int, int, const char *, int)));
QObject::connect(client, SIGNAL(volumeExternallyChanged(uint32_t, uint32_t, uint32_t, uint32_t)),
pacm, SLOT(changeExternalVolume(uint32_t, uint32_t, uint32_t, uint32_t)));
QObject::connect(pacm, SIGNAL(volumeChanged(uint32_t, uint32_t, uint32_t, uint32_t)),
if (!eol) {
self->addOneControlState(C_SOURCE, i->index, &i->volume);
for (chan = 0; chan < i->channel_map.channels; chan++) {
- emit self->controlAdded(i->index, QString(i->description), C_SOURCE, chan,
- channel_position_string[i->channel_map.map[chan]],
+ // NOTE: hide input control
+ if (QString(i->name).endsWith("monitor"))
+ continue;
+
+ emit self->controlAdded(i->index, QString(i->name), QString(i->description),
+ C_SOURCE, chan, channel_position_string[i->channel_map.map[chan]],
i->volume.values[chan]);
}
}
if(!eol) {
self->addOneControlState(C_SINK, i->index, &i->volume);
for (chan = 0; chan < i->channel_map.channels; chan++) {
- emit self->controlAdded(i->index, QString(i->description), C_SINK, chan,
- channel_position_string[i->channel_map.map[chan]],
- i->volume.values[chan]);
+ emit self->controlAdded(i->index, QString(i->name), QString(i->description),
+ C_SINK, chan, channel_position_string[i->channel_map.map[chan]],
+ i->volume.values[chan]);
}
}
}
void setVolume(uint32_t type, uint32_t index, uint32_t channel, uint32_t volume);
signals:
- void controlAdded(int cindex, QString desc, int type, int channel, const char *cdesc, int volume);
+ void controlAdded(int cindex, QString name, QString desc, int type, int channel, const char *cdesc, int volume);
void volumeExternallyChanged(uint32_t type, uint32_t cindex, uint32_t channel, uint32_t volume);
private:
#include "pacontrolmodel.h"
-PaControl::PaControl(const quint32 &cindex, const QString &desc, const quint32 &type, const quint32 &channel, const QString &cdesc, const quint32 &volume)
- : m_cindex(cindex), m_desc(desc), m_type(type), m_channel(channel), m_cdesc(cdesc), m_volume(volume)
+PaControl::PaControl(const quint32 &cindex, const QString &name, const QString &desc, const quint32 &type, const quint32 &channel, const QString &cdesc, const quint32 &volume)
+ : m_cindex(cindex), m_name(name), m_desc(desc), m_type(type), m_channel(channel), m_cdesc(cdesc), m_volume(volume)
{
}
return m_cindex;
}
+QString PaControl::name() const
+{
+ QStringList list = m_name.split(".");
+
+ return list.at(1);
+}
+
QString PaControl::desc() const
{
return m_desc;
m_cindex = cindex.toUInt();
}
+void PaControl::setName(const QVariant &name)
+{
+ m_name = name.toString();
+}
+
void PaControl::setDesc(const QVariant &desc)
{
m_desc = desc.toString();
endInsertRows();
}
-void PaControlModel::addOneControl(int cindex, QString desc, int type, int channel, const char *cdesc, int volume)
+void PaControlModel::addOneControl(int cindex, QString name, QString desc, int type, int channel, const char *cdesc, int volume)
{
- addControl(PaControl(cindex, desc, type, channel, cdesc, volume));
+ addControl(PaControl(cindex, name, desc, type, channel, cdesc, volume));
}
void PaControlModel::changeExternalVolume(uint32_t type, uint32_t cindex, uint32_t channel, uint32_t volume)
PaControl &control = m_controls[index.row()];
if (role == CIndexRole)
control.setCIndex(value);
+ else if (role == NameRole)
+ control.setName(value);
else if (role == DescRole)
control.setDesc(value);
else if (role == TypeRole)
const PaControl &control = m_controls[index.row()];
if (role == CIndexRole)
return control.cindex();
+ else if (role == NameRole)
+ return control.name();
else if (role == DescRole)
return control.desc();
else if (role == TypeRole)
QHash<int, QByteArray> PaControlModel::roleNames() const {
QHash<int, QByteArray> roles;
roles[CIndexRole] = "cindex";
+ roles[NameRole] = "name";
roles[DescRole] = "desc";
roles[TypeRole] = "type";
roles[ChannelRole] = "channel";
class PaControl
{
public:
- PaControl(const quint32 &index, const QString &desc, const quint32 &type, const quint32 &channel, const QString &cdesc, const quint32 &volume);
+ PaControl(const quint32 &index, const QString &name, const QString &desc, const quint32 &type, const quint32 &channel, const QString &cdesc, const quint32 &volume);
quint32 cindex() const;
+ QString name() const;
QString desc() const;
quint32 type() const;
quint32 channel() const;
QString cdesc() const;
quint32 volume() const;
void setCIndex(const QVariant&);
+ void setName(const QVariant&);
void setDesc(const QVariant&);
void setType(const QVariant&);
void setChannel(const QVariant&);
private:
quint32 m_cindex;
+ QString m_name;
QString m_desc;
quint32 m_type;
quint32 m_channel;
public:
enum PaControlRoles {
CIndexRole = Qt::UserRole + 1,
+ NameRole,
DescRole,
TypeRole,
ChannelRole,
Qt::ItemFlags flags(const QModelIndex &index) const;
public slots:
- void addOneControl(int cindex, QString desc, int type, int channel, const char *cdesc, int volume);
+ void addOneControl(int cindex, QString name, QString desc, int type, int channel, const char *cdesc, int volume);
void changeExternalVolume(uint32_t type, uint32_t cindex, uint32_t chan, uint32_t volume);
signals: