Mercurial > hg > easaier-soundaccess
comparison widgets/PropertyBox.cpp @ 83:76d4fbab5f20
replace the QDial by sliders
author | lbajardsilogic |
---|---|
date | Fri, 22 Jun 2007 12:49:50 +0000 |
parents | b3c3a5fa185f |
children | 7386cd014f52 |
comparison
equal
deleted
inserted
replaced
82:8ebc85f6ce4e | 83:76d4fbab5f20 |
---|---|
26 #include "plugin/RealTimePluginFactory.h" | 26 #include "plugin/RealTimePluginFactory.h" |
27 #include "plugin/RealTimePluginInstance.h" | 27 #include "plugin/RealTimePluginInstance.h" |
28 #include "plugin/PluginXml.h" | 28 #include "plugin/PluginXml.h" |
29 | 29 |
30 #include "AudioDial.h" | 30 #include "AudioDial.h" |
31 #include "Slider.h" | |
31 #include "LEDButton.h" | 32 #include "LEDButton.h" |
32 | 33 |
33 #include "NotifyingCheckBox.h" | 34 #include "NotifyingCheckBox.h" |
34 #include "NotifyingComboBox.h" | 35 #include "NotifyingComboBox.h" |
35 | 36 |
334 cb->blockSignals(false); | 335 cb->blockSignals(false); |
335 } | 336 } |
336 break; | 337 break; |
337 } | 338 } |
338 | 339 |
339 case PropertyContainer::RangeProperty: | 340 /* case PropertyContainer::RangeProperty: |
340 { | 341 { |
341 AudioDial *dial; | 342 AudioDial *dial; |
342 | 343 |
343 if (have) { | 344 if (have) { |
344 dial = dynamic_cast<AudioDial *>(m_propertyControllers[name]); | 345 dial = dynamic_cast<AudioDial *>(m_propertyControllers[name]); |
345 assert(dial); | 346 assert(dial); |
346 if (rangeChanged) { | 347 if (rangeChanged) { |
347 dial->blockSignals(true); | 348 dial->blockSignals(true); |
348 dial->setMinimum(min); | 349 dial->setMinimum(min); |
349 dial->setMaximum(max); | 350 dial->setMaximum(max); |
350 dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name)); | 351 dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name)); |
351 dial->blockSignals(false); | 352 dial->blockSignals(false); |
352 } | 353 } |
353 | 354 |
354 } else { | 355 } else { |
355 #ifdef DEBUG_PROPERTY_BOX | 356 #ifdef DEBUG_PROPERTY_BOX |
356 std::cerr << "PropertyBox: creating new dial" << std::endl; | 357 std::cerr << "PropertyBox: creating new dial" << std::endl; |
357 #endif | 358 #endif |
358 dial = new AudioDial(); | 359 dial = new AudioDial(); |
359 dial->setObjectName(name); | 360 dial->setObjectName(name); |
360 dial->setMinimum(min); | 361 dial->setMinimum(min); |
361 dial->setMaximum(max); | 362 dial->setMaximum(max); |
362 dial->setPageStep(1); | 363 dial->setPageStep(1); |
363 dial->setNotchesVisible((max - min) <= 12); | 364 dial->setNotchesVisible((max - min) <= 12); |
364 dial->setDefaultValue(deflt); | 365 dial->setDefaultValue(deflt); |
365 dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name)); | 366 dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name)); |
366 dial->setShowToolTip(true); | 367 dial->setShowToolTip(true); |
367 connect(dial, SIGNAL(valueChanged(int)), | 368 connect(dial, SIGNAL(valueChanged(int)), |
368 this, SLOT(propertyControllerChanged(int))); | 369 this, SLOT(propertyControllerChanged(int))); |
369 connect(dial, SIGNAL(mouseEntered()), | 370 connect(dial, SIGNAL(mouseEntered()), |
370 this, SLOT(mouseEnteredWidget())); | 371 this, SLOT(mouseEnteredWidget())); |
371 connect(dial, SIGNAL(mouseLeft()), | 372 connect(dial, SIGNAL(mouseLeft()), |
372 this, SLOT(mouseLeftWidget())); | 373 this, SLOT(mouseLeftWidget())); |
373 | 374 |
374 if (inGroup) { | 375 if (inGroup) { |
375 dial->setFixedWidth(24); | 376 dial->setFixedWidth(24); |
376 dial->setFixedHeight(24); | 377 dial->setFixedHeight(24); |
377 m_groupLayouts[groupName]->addWidget(dial); | 378 m_groupLayouts[groupName]->addWidget(dial); |
378 } else { | 379 } else { |
379 dial->setFixedWidth(32); | 380 dial->setFixedWidth(32); |
380 dial->setFixedHeight(32); | 381 dial->setFixedHeight(32); |
381 m_layout->addWidget(dial, row, 1); | 382 m_layout->addWidget(dial, row, 1); |
382 QLabel *label = new QLabel(m_mainWidget); | 383 QLabel *label = new QLabel(m_mainWidget); |
383 connect(dial, SIGNAL(valueChanged(int)), | 384 connect(dial, SIGNAL(valueChanged(int)), |
384 label, SLOT(setNum(int))); | 385 label, SLOT(setNum(int))); |
385 label->setNum(value); | 386 label->setNum(value); |
386 m_layout->addWidget(label, row, 2); | 387 m_layout->addWidget(label, row, 2); |
387 } | 388 } |
388 | 389 |
389 m_propertyControllers[name] = dial; | 390 m_propertyControllers[name] = dial; |
391 } | |
392 | |
393 if (dial->value() != value) { | |
394 dial->blockSignals(true); | |
395 dial->setValue(value); | |
396 dial->blockSignals(false); | |
397 } | |
398 break; | |
399 }*/ | |
400 case PropertyContainer::RangeProperty: | |
401 { | |
402 Slider *slider; | |
403 | |
404 if (have) { | |
405 slider = dynamic_cast<Slider *>(m_propertyControllers[name]); | |
406 assert(slider); | |
407 if (rangeChanged) { | |
408 slider->blockSignals(true); | |
409 slider->setMinimum(min); | |
410 slider->setMaximum(max); | |
411 slider->blockSignals(false); | |
412 } | |
413 | |
414 } else { | |
415 slider = new Slider(Qt::Horizontal); | |
416 slider->setObjectName(name); | |
417 slider->setMinimum(min); | |
418 slider->setMaximum(max); | |
419 slider->setPageStep(1); | |
420 connect(slider, SIGNAL(valueChanged(int)), | |
421 this, SLOT(propertyControllerChanged(int))); | |
422 connect(slider, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); | |
423 connect(slider, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); | |
424 | |
425 if (inGroup) { | |
426 slider->setFixedWidth(48); | |
427 slider->setFixedHeight(24); | |
428 m_groupLayouts[groupName]->addWidget(slider); | |
429 } else { | |
430 slider->setFixedWidth(100); | |
431 slider->setFixedHeight(32); | |
432 m_layout->addWidget(slider, row, 1); | |
433 QLabel *label = new QLabel(m_mainWidget); | |
434 connect(slider, SIGNAL(valueChanged(int)), | |
435 label, SLOT(setNum(int))); | |
436 label->setNum(value); | |
437 m_layout->addWidget(label, row, 2); | |
438 } | |
439 | |
440 m_propertyControllers[name] = slider; | |
441 } | |
442 | |
443 if (slider->value() != value) { | |
444 slider->blockSignals(true); | |
445 slider->setValue(value); | |
446 slider->blockSignals(false); | |
447 } | |
448 break; | |
390 } | 449 } |
391 | |
392 if (dial->value() != value) { | |
393 dial->blockSignals(true); | |
394 dial->setValue(value); | |
395 dial->blockSignals(false); | |
396 } | |
397 break; | |
398 } | |
399 | 450 |
400 case PropertyContainer::ValueProperty: | 451 case PropertyContainer::ValueProperty: |
401 case PropertyContainer::UnitsProperty: | 452 case PropertyContainer::UnitsProperty: |
402 { | 453 { |
403 NotifyingComboBox *cb; | 454 NotifyingComboBox *cb; |