summaryrefslogtreecommitdiffstats
path: root/app/pacontrolmodel.cpp
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2017-12-19 22:39:05 -0800
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2017-12-21 19:58:33 +0000
commit47695d79a938eb52c116062c218147049b994246 (patch)
tree382ee4e545cb114360f2add30ba15087422e66f5 /app/pacontrolmodel.cpp
parentbd9276be767d5ee09f46b71c90c92b9e12f63dfe (diff)
Use the role name for the control name in the Mixer UI instead of overall vague control description Bug-AGL: SPEC-1196 Change-Id: I34b5c3378fa3bca7464067490907f9ae0adb6364 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'app/pacontrolmodel.cpp')
-rw-r--r--app/pacontrolmodel.cpp25
1 files changed, 21 insertions, 4 deletions
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";