changeset 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 7b2a7880a501
children c9042816f12d
files base/PropertyContainer.h sv/filter/TimeStretchFilter.cpp widgets/Plotter.cpp widgets/PropertyBox.cpp
diffstat 4 files changed, 83 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/base/PropertyContainer.h	Thu Feb 07 15:53:32 2008 +0000
+++ b/base/PropertyContainer.h	Fri Feb 08 16:36:03 2008 +0000
@@ -43,6 +43,7 @@
         UnitsProperty, // unit from UnitDatabase, get/set unit id
 		InvalidProperty, // property not found!
 		StringProperty,	//string value that can be set to any value
+		PlotProperty,	//string value that can be set to any value
     };
 
     /**
--- a/sv/filter/TimeStretchFilter.cpp	Thu Feb 07 15:53:32 2008 +0000
+++ b/sv/filter/TimeStretchFilter.cpp	Fri Feb 08 16:36:03 2008 +0000
@@ -148,6 +148,7 @@
 	list.push_back("Bypass");
 	list.push_back("Transdetect");
 	list.push_back("Peaklock");
+	list.push_back("Equalizer");
     return list;
 }
 
@@ -158,6 +159,7 @@
 	if (name == "Bypass") return tr("Bypass Processing");
 	if (name == "Transdetect") return tr("Transient Detection");
 	if (name == "Peaklock") return tr("Peak Locking");
+    if (name == "Equalizer") return tr("Equalizer");
     return "";
 }
 
@@ -168,6 +170,7 @@
 	if (name == "Bypass") return ToggleProperty;
 	if (name == "Transdetect") return ToggleProperty;
 	if (name == "Peaklock") return ToggleProperty;
+    if (name == "Equalizer") return PlotProperty;
     return InvalidProperty;
 }
 
--- a/widgets/Plotter.cpp	Thu Feb 07 15:53:32 2008 +0000
+++ b/widgets/Plotter.cpp	Fri Feb 08 16:36:03 2008 +0000
@@ -32,6 +32,7 @@
 	m_curve.push_back(QPoint(10,30));
 	m_curve.push_back(QPoint(0,0));
 
+	setMinimumSize(QSize(410, 190));
 
 	refreshPixmap();
 
--- a/widgets/PropertyBox.cpp	Thu Feb 07 15:53:32 2008 +0000
+++ b/widgets/PropertyBox.cpp	Fri Feb 08 16:36:03 2008 +0000
@@ -35,6 +35,7 @@
 
 #include "NotifyingCheckBox.h"
 #include "NotifyingComboBox.h"
+#include "Plotter.h"
 
 #include <QGridLayout>
 #include <QHBoxLayout>
@@ -329,10 +330,10 @@
             connect(cb, SIGNAL(mouseLeft()),
                     this, SLOT(mouseLeftWidget()));
 	    if (inGroup) {
-		cb->setToolTip(propertyLabel);
-		m_groupLayouts[groupName]->addWidget(cb);
+			cb->setToolTip(propertyLabel);
+			m_groupLayouts[groupName]->addWidget(cb);
 	    } else {
-		m_layout->addWidget(cb, row, 1, 1, 2);
+			m_layout->addWidget(cb, row, 1, 1, 2);
 	    }
 	    m_propertyControllers[name] = cb;
 	}
@@ -536,6 +537,80 @@
 	break;
     }
 
+	case PropertyContainer::PlotProperty:
+    {
+		Plotter* cb;
+
+		if (have) {
+			cb = dynamic_cast<Plotter *>(m_propertyControllers[name]);
+			assert(cb);
+		} else {
+	#ifdef DEBUG_PROPERTY_BOX 
+			std::cerr << "PropertyBox: creating new Plotter" << std::endl;
+	#endif
+
+			cb = new Plotter();
+			cb->setObjectName(name);
+			//cb->setDuplicatesEnabled(false);
+		}
+		
+		/*if (!have || rangeChanged) {
+            cb->blockSignals(true);
+            cb->clear();
+            if (type == PropertyContainer::ValueProperty) {
+                for (int i = min; i <= max; ++i) {
+                    cb->addItem(m_container->getPropertyValueLabel(name, i));
+                }
+                cb->setEditable(false);
+            } else {
+                QStringList units = UnitDatabase::getInstance()->getKnownUnits();
+                for (int i = 0; i < units.size(); ++i) {
+                    cb->addItem(units[i]);
+                }
+                cb->setEditable(true);
+            }
+            cb->blockSignals(false);
+        }*/
+
+        if (!have) {
+			connect(cb, SIGNAL(activated(int)), this, SLOT(propertyControllerChanged(int)));
+            connect(cb, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
+            connect(cb, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
+
+			if (inGroup) {
+				cb->setToolTip(propertyLabel);
+				m_groupLayouts[groupName]->addWidget(cb);
+			} else {
+				m_layout->addWidget(cb, row, 0, 1, 2);
+			}
+			m_propertyControllers[name] = cb;
+		}
+
+        /*cb->blockSignals(true);
+        if (type == PropertyContainer::ValueProperty) {
+            if (cb->currentIndex() != value) {
+                cb->setCurrentIndex(value);
+            }
+        } else {
+            QString unit = UnitDatabase::getInstance()->getUnitById(value);
+            if (cb->currentText() != unit) {
+                for (int i = 0; i < cb->count(); ++i) {
+                    if (cb->itemText(i) == unit) {
+                        cb->setCurrentIndex(i);
+                        break;
+                    }
+                }
+            }
+        }
+        cb->blockSignals(false);
+
+#ifdef Q_WS_MAC
+		// Crashes on startup without this, for some reason
+		cb->setMinimumSize(QSize(10, 10));
+#endif
+*/
+		break;
+	}
     default:
 	break;
     }