Mercurial > hg > svgui
diff widgets/PluginParameterBox.cpp @ 167:53b9c7656798
* Use RangeMappers in various places in plugin parameters, layer properties,
playback parameters &c
author | Chris Cannam |
---|---|
date | Mon, 16 Oct 2006 20:42:23 +0000 |
parents | 5064eeb1c76f |
children | d4be66d61c04 |
line wrap: on
line diff
--- a/widgets/PluginParameterBox.cpp Mon Oct 16 13:13:57 2006 +0000 +++ b/widgets/PluginParameterBox.cpp Mon Oct 16 20:42:23 2006 +0000 @@ -19,6 +19,8 @@ #include "plugin/PluginXml.h" +#include "base/RangeMapper.h" + #include <QDoubleSpinBox> #include <QGridLayout> #include <QComboBox> @@ -150,7 +152,7 @@ } else { AudioDial *dial = new AudioDial; - dial->setObjectName(name); + dial->setObjectName(description); dial->setMinimum(imin); dial->setMaximum(imax); dial->setPageStep(1); @@ -159,6 +161,8 @@ dial->setValue(lrintf((value - min) / qtz)); dial->setFixedWidth(32); dial->setFixedHeight(32); + dial->setRangeMapper(new LinearRangeMapper + (imin, imax, min, max, unit)); connect(dial, SIGNAL(valueChanged(int)), this, SLOT(dialChanged(int))); m_layout->addWidget(dial, i + offset, 1); @@ -179,6 +183,7 @@ } m_params[name] = rec; + m_descriptionMap[description] = name; } } @@ -188,6 +193,11 @@ QObject *obj = sender(); QString name = obj->objectName(); + if (m_params.find(name) == m_params.end() && + m_descriptionMap.find(name) != m_descriptionMap.end()) { + name = m_descriptionMap[name]; + } + if (m_params.find(name) == m_params.end()) { std::cerr << "WARNING: PluginParameterBox::dialChanged: Unknown parameter \"" << name.toStdString() << "\"" << std::endl; return; @@ -225,6 +235,11 @@ QObject *obj = sender(); QString name = obj->objectName(); + if (m_params.find(name) == m_params.end() && + m_descriptionMap.find(name) != m_descriptionMap.end()) { + name = m_descriptionMap[name]; + } + if (m_params.find(name) == m_params.end()) { std::cerr << "WARNING: PluginParameterBox::checkBoxChanged: Unknown parameter \"" << name.toStdString() << "\"" << std::endl; return; @@ -244,6 +259,11 @@ QObject *obj = sender(); QString name = obj->objectName(); + if (m_params.find(name) == m_params.end() && + m_descriptionMap.find(name) != m_descriptionMap.end()) { + name = m_descriptionMap[name]; + } + if (m_params.find(name) == m_params.end()) { std::cerr << "WARNING: PluginParameterBox::spinBoxChanged: Unknown parameter \"" << name.toStdString() << "\"" << std::endl; return;