comparison widgets/PropertyBox.cpp @ 221:a89ab7dfbf4c

add a equalizer to the TimeStretchFilter and a PropertyType in PropertyContainer to include Plotter
author lbajardsilogic
date Fri, 08 Feb 2008 16:36:03 +0000
parents 95d9c6de5a4f
children 7d5d51145b81
comparison
equal deleted inserted replaced
220:7b2a7880a501 221:a89ab7dfbf4c
33 #include "Slider.h" 33 #include "Slider.h"
34 #include "LEDButton.h" 34 #include "LEDButton.h"
35 35
36 #include "NotifyingCheckBox.h" 36 #include "NotifyingCheckBox.h"
37 #include "NotifyingComboBox.h" 37 #include "NotifyingComboBox.h"
38 #include "Plotter.h"
38 39
39 #include <QGridLayout> 40 #include <QGridLayout>
40 #include <QHBoxLayout> 41 #include <QHBoxLayout>
41 #include <QVBoxLayout> 42 #include <QVBoxLayout>
42 #include <QPushButton> 43 #include <QPushButton>
327 connect(cb, SIGNAL(mouseEntered()), 328 connect(cb, SIGNAL(mouseEntered()),
328 this, SLOT(mouseEnteredWidget())); 329 this, SLOT(mouseEnteredWidget()));
329 connect(cb, SIGNAL(mouseLeft()), 330 connect(cb, SIGNAL(mouseLeft()),
330 this, SLOT(mouseLeftWidget())); 331 this, SLOT(mouseLeftWidget()));
331 if (inGroup) { 332 if (inGroup) {
332 cb->setToolTip(propertyLabel); 333 cb->setToolTip(propertyLabel);
333 m_groupLayouts[groupName]->addWidget(cb); 334 m_groupLayouts[groupName]->addWidget(cb);
334 } else { 335 } else {
335 m_layout->addWidget(cb, row, 1, 1, 2); 336 m_layout->addWidget(cb, row, 1, 1, 2);
336 } 337 }
337 m_propertyControllers[name] = cb; 338 m_propertyControllers[name] = cb;
338 } 339 }
339 340
340 if (cb->isChecked() != (value > 0)) { 341 if (cb->isChecked() != (value > 0)) {
534 #endif 535 #endif
535 536
536 break; 537 break;
537 } 538 }
538 539
540 case PropertyContainer::PlotProperty:
541 {
542 Plotter* cb;
543
544 if (have) {
545 cb = dynamic_cast<Plotter *>(m_propertyControllers[name]);
546 assert(cb);
547 } else {
548 #ifdef DEBUG_PROPERTY_BOX
549 std::cerr << "PropertyBox: creating new Plotter" << std::endl;
550 #endif
551
552 cb = new Plotter();
553 cb->setObjectName(name);
554 //cb->setDuplicatesEnabled(false);
555 }
556
557 /*if (!have || rangeChanged) {
558 cb->blockSignals(true);
559 cb->clear();
560 if (type == PropertyContainer::ValueProperty) {
561 for (int i = min; i <= max; ++i) {
562 cb->addItem(m_container->getPropertyValueLabel(name, i));
563 }
564 cb->setEditable(false);
565 } else {
566 QStringList units = UnitDatabase::getInstance()->getKnownUnits();
567 for (int i = 0; i < units.size(); ++i) {
568 cb->addItem(units[i]);
569 }
570 cb->setEditable(true);
571 }
572 cb->blockSignals(false);
573 }*/
574
575 if (!have) {
576 connect(cb, SIGNAL(activated(int)), this, SLOT(propertyControllerChanged(int)));
577 connect(cb, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
578 connect(cb, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
579
580 if (inGroup) {
581 cb->setToolTip(propertyLabel);
582 m_groupLayouts[groupName]->addWidget(cb);
583 } else {
584 m_layout->addWidget(cb, row, 0, 1, 2);
585 }
586 m_propertyControllers[name] = cb;
587 }
588
589 /*cb->blockSignals(true);
590 if (type == PropertyContainer::ValueProperty) {
591 if (cb->currentIndex() != value) {
592 cb->setCurrentIndex(value);
593 }
594 } else {
595 QString unit = UnitDatabase::getInstance()->getUnitById(value);
596 if (cb->currentText() != unit) {
597 for (int i = 0; i < cb->count(); ++i) {
598 if (cb->itemText(i) == unit) {
599 cb->setCurrentIndex(i);
600 break;
601 }
602 }
603 }
604 }
605 cb->blockSignals(false);
606
607 #ifdef Q_WS_MAC
608 // Crashes on startup without this, for some reason
609 cb->setMinimumSize(QSize(10, 10));
610 #endif
611 */
612 break;
613 }
539 default: 614 default:
540 break; 615 break;
541 } 616 }
542 } 617 }
543 618