Mercurial > hg > svgui
diff widgets/AudioDial.cpp @ 177:dbd34ff746c7
* Update the main sv.prf for compatibility with Qt 4.2 qmake instead of
that from 4.1. Add a README.Qt41 describing how to build with 4.1 if
preferred.
* Add OSC support for control from external scripts etc (work in progress).
author | Chris Cannam |
---|---|
date | Fri, 10 Nov 2006 13:27:57 +0000 |
parents | bdba24db0446 |
children | 42118892f428 |
line wrap: on
line diff
--- a/widgets/AudioDial.cpp Mon Oct 30 12:44:45 2006 +0000 +++ b/widgets/AudioDial.cpp Fri Nov 10 13:27:57 2006 +0000 @@ -332,6 +332,25 @@ } +void AudioDial::setMappedValue(float mappedValue) +{ + if (m_rangeMapper) { + int newPosition = m_rangeMapper->getPositionForValue(mappedValue); + m_mappedValue = mappedValue; + m_noMappedUpdate = true; + std::cerr << "AudioDial::setMappedValue(" << mappedValue << "): new position is " << newPosition << std::endl; + if (newPosition != value()) { + setValue(newPosition); + } else { + emit valueChanged(newPosition); + } + m_noMappedUpdate = false; + } else { + setValue(mappedValue); + } +} + + void AudioDial::setShowToolTip(bool show) { m_showTooltip = show; @@ -401,8 +420,6 @@ bool ok = false; - int newPosition = value(); - if (m_rangeMapper) { float min = m_rangeMapper->getValueForPosition(minimum()); @@ -439,22 +456,13 @@ 4, &ok); - newPosition = m_rangeMapper->getPositionForValue(newValue); - if (ok) { - m_mappedValue = newValue; - m_noMappedUpdate = true; - if (newPosition != value()) { - setValue(newPosition); - } else { - emit valueChanged(newPosition); - } - m_noMappedUpdate = false; + setMappedValue(newValue); } } else { - newPosition = QInputDialog::getInteger + int newPosition = QInputDialog::getInteger (this, tr("Enter new value"), tr("Enter a new value from %1 to %2:")