Mercurial > hg > svgui
comparison 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 |
comparison
equal
deleted
inserted
replaced
176:ad7df5989d08 | 177:dbd34ff746c7 |
---|---|
330 { | 330 { |
331 m_defaultValue = defaultValue; | 331 m_defaultValue = defaultValue; |
332 } | 332 } |
333 | 333 |
334 | 334 |
335 void AudioDial::setMappedValue(float mappedValue) | |
336 { | |
337 if (m_rangeMapper) { | |
338 int newPosition = m_rangeMapper->getPositionForValue(mappedValue); | |
339 m_mappedValue = mappedValue; | |
340 m_noMappedUpdate = true; | |
341 std::cerr << "AudioDial::setMappedValue(" << mappedValue << "): new position is " << newPosition << std::endl; | |
342 if (newPosition != value()) { | |
343 setValue(newPosition); | |
344 } else { | |
345 emit valueChanged(newPosition); | |
346 } | |
347 m_noMappedUpdate = false; | |
348 } else { | |
349 setValue(mappedValue); | |
350 } | |
351 } | |
352 | |
353 | |
335 void AudioDial::setShowToolTip(bool show) | 354 void AudioDial::setShowToolTip(bool show) |
336 { | 355 { |
337 m_showTooltip = show; | 356 m_showTooltip = show; |
338 m_noMappedUpdate = true; | 357 m_noMappedUpdate = true; |
339 updateMappedValue(value()); | 358 updateMappedValue(value()); |
398 if (m_mouseDial) { | 417 if (m_mouseDial) { |
399 QDial::mouseDoubleClickEvent(mouseEvent); | 418 QDial::mouseDoubleClickEvent(mouseEvent); |
400 } else if (mouseEvent->button() == Qt::LeftButton) { | 419 } else if (mouseEvent->button() == Qt::LeftButton) { |
401 | 420 |
402 bool ok = false; | 421 bool ok = false; |
403 | |
404 int newPosition = value(); | |
405 | 422 |
406 if (m_rangeMapper) { | 423 if (m_rangeMapper) { |
407 | 424 |
408 float min = m_rangeMapper->getValueForPosition(minimum()); | 425 float min = m_rangeMapper->getValueForPosition(minimum()); |
409 float max = m_rangeMapper->getValueForPosition(maximum()); | 426 float max = m_rangeMapper->getValueForPosition(maximum()); |
437 min, | 454 min, |
438 max, | 455 max, |
439 4, | 456 4, |
440 &ok); | 457 &ok); |
441 | 458 |
442 newPosition = m_rangeMapper->getPositionForValue(newValue); | |
443 | |
444 if (ok) { | 459 if (ok) { |
445 m_mappedValue = newValue; | 460 setMappedValue(newValue); |
446 m_noMappedUpdate = true; | |
447 if (newPosition != value()) { | |
448 setValue(newPosition); | |
449 } else { | |
450 emit valueChanged(newPosition); | |
451 } | |
452 m_noMappedUpdate = false; | |
453 } | 461 } |
454 | 462 |
455 } else { | 463 } else { |
456 | 464 |
457 newPosition = QInputDialog::getInteger | 465 int newPosition = QInputDialog::getInteger |
458 (this, | 466 (this, |
459 tr("Enter new value"), | 467 tr("Enter new value"), |
460 tr("Enter a new value from %1 to %2:") | 468 tr("Enter a new value from %1 to %2:") |
461 .arg(minimum()).arg(maximum()), | 469 .arg(minimum()).arg(maximum()), |
462 value(), minimum(), maximum(), pageStep(), &ok); | 470 value(), minimum(), maximum(), pageStep(), &ok); |