aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/Mixer.qml2
-rw-r--r--app/main.cpp4
-rw-r--r--app/paclient.cpp14
-rw-r--r--app/paclient.h2
-rw-r--r--app/pacontrolmodel.cpp25
-rw-r--r--app/pacontrolmodel.h8
6 files changed, 40 insertions, 15 deletions
diff --git a/app/Mixer.qml b/app/Mixer.qml
index 58124c7..96875e0 100644
--- a/app/Mixer.qml
+++ b/app/Mixer.qml
@@ -64,7 +64,7 @@ ApplicationWindow {
Loader {
property int modelType: type
property int modelCIndex: cindex
- property string modelDesc: desc
+ property string modelDesc: name
sourceComponent: (channel == 0) ? ctldesc : empty
}
RowLayout {
diff --git a/app/main.cpp b/app/main.cpp
index e93cf0c..bfce498 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -118,8 +118,8 @@ int main(int argc, char *argv[])
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)),
diff --git a/app/paclient.cpp b/app/paclient.cpp
index afe0fad..bd53cde 100644
--- a/app/paclient.cpp
+++ b/app/paclient.cpp
@@ -104,8 +104,12 @@ void get_source_list_cb(pa_context *c,
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]);
}
}
@@ -129,9 +133,9 @@ void get_sink_list_cb(pa_context *c,
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]);
}
}
}
diff --git a/app/paclient.h b/app/paclient.h
index b8a7961..73137f2 100644
--- a/app/paclient.h
+++ b/app/paclient.h
@@ -82,7 +82,7 @@ class PaClient : public QObject
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:
diff --git a/app/pacontrolmodel.cpp b/app/pacontrolmodel.cpp
index fe5de53..9489052 100644
--- a/app/pacontrolmodel.cpp
+++ b/app/pacontrolmodel.cpp
@@ -16,8 +16,8 @@
#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)
{
}
@@ -26,6 +26,13 @@ quint32 PaControl::cindex() const
return m_cindex;
}
+QString PaControl::name() const
+{
+ QStringList list = m_name.split(".");
+
+ return list.at(1);
+}
+
QString PaControl::desc() const
{
return m_desc;
@@ -58,6 +65,11 @@ void PaControl::setCIndex(const QVariant &cindex)
m_cindex = cindex.toUInt();
}
+void PaControl::setName(const QVariant &name)
+{
+ m_name = name.toString();
+}
+
void PaControl::setDesc(const QVariant &desc)
{
m_desc = desc.toString();
@@ -99,9 +111,9 @@ void PaControlModel::addControl(const PaControl &control)
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)
@@ -135,6 +147,8 @@ bool PaControlModel::setData(const QModelIndex &index, const QVariant &value, in
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)
@@ -158,6 +172,8 @@ QVariant PaControlModel::data(const QModelIndex & index, int role) const {
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)
@@ -182,6 +198,7 @@ Qt::ItemFlags PaControlModel::flags(const QModelIndex &index) const
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";
diff --git a/app/pacontrolmodel.h b/app/pacontrolmodel.h
index a3cd5ae..81eb70b 100644
--- a/app/pacontrolmodel.h
+++ b/app/pacontrolmodel.h
@@ -24,15 +24,17 @@ class PaControlModel;
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&);
@@ -41,6 +43,7 @@ class PaControl
private:
quint32 m_cindex;
+ QString m_name;
QString m_desc;
quint32 m_type;
quint32 m_channel;
@@ -54,6 +57,7 @@ class PaControlModel : public QAbstractListModel
public:
enum PaControlRoles {
CIndexRole = Qt::UserRole + 1,
+ NameRole,
DescRole,
TypeRole,
ChannelRole,
@@ -74,7 +78,7 @@ class PaControlModel : public QAbstractListModel
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: