changeset 83:76d4fbab5f20

replace the QDial by sliders
author lbajardsilogic
date Fri, 22 Jun 2007 12:49:50 +0000
parents 8ebc85f6ce4e
children 51a12971e10e
files widgets/AudioDial.h widgets/PropertyBox.cpp widgets/Slider.cpp widgets/Slider.h widgets/svwidgets.vcproj widgets/widgets.pro
diffstat 6 files changed, 223 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/AudioDial.h	Fri Jun 22 09:54:00 2007 +0000
+++ b/widgets/AudioDial.h	Fri Jun 22 12:49:50 2007 +0000
@@ -140,7 +140,6 @@
     RangeMapper *m_rangeMapper;
 };
 
-
-#endif  // __AudioDial_h
+#endif  
 
 // end of AudioDial.h
--- a/widgets/PropertyBox.cpp	Fri Jun 22 09:54:00 2007 +0000
+++ b/widgets/PropertyBox.cpp	Fri Jun 22 12:49:50 2007 +0000
@@ -28,6 +28,7 @@
 #include "plugin/PluginXml.h"
 
 #include "AudioDial.h"
+#include "Slider.h"
 #include "LEDButton.h"
 
 #include "NotifyingCheckBox.h"
@@ -336,67 +337,117 @@
 	break;
     }
 
-    case PropertyContainer::RangeProperty:
+   /* case PropertyContainer::RangeProperty:
     {
-	AudioDial *dial;
+		AudioDial *dial;
 
-	if (have) {
-	    dial = dynamic_cast<AudioDial *>(m_propertyControllers[name]);
-	    assert(dial);
-            if (rangeChanged) {
-                dial->blockSignals(true);
-                dial->setMinimum(min);
-                dial->setMaximum(max);
-                dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name));
-                dial->blockSignals(false);
-            }
-                
-	} else {
-#ifdef DEBUG_PROPERTY_BOX 
-	    std::cerr << "PropertyBox: creating new dial" << std::endl;
-#endif
-	    dial = new AudioDial();
-	    dial->setObjectName(name);
-	    dial->setMinimum(min);
-	    dial->setMaximum(max);
-	    dial->setPageStep(1);
-	    dial->setNotchesVisible((max - min) <= 12);
-	    dial->setDefaultValue(deflt);
-            dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name));
-            dial->setShowToolTip(true);
-	    connect(dial, SIGNAL(valueChanged(int)),
-		    this, SLOT(propertyControllerChanged(int)));
-            connect(dial, SIGNAL(mouseEntered()),
-                    this, SLOT(mouseEnteredWidget()));
-            connect(dial, SIGNAL(mouseLeft()),
-                    this, SLOT(mouseLeftWidget()));
+		if (have) {
+			dial = dynamic_cast<AudioDial *>(m_propertyControllers[name]);
+			assert(dial);
+				if (rangeChanged) {
+					dial->blockSignals(true);
+					dial->setMinimum(min);
+					dial->setMaximum(max);
+					dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name));
+					dial->blockSignals(false);
+				}
+	                
+		} else {
+	#ifdef DEBUG_PROPERTY_BOX 
+			std::cerr << "PropertyBox: creating new dial" << std::endl;
+	#endif
+			dial = new AudioDial();
+			dial->setObjectName(name);
+			dial->setMinimum(min);
+			dial->setMaximum(max);
+			dial->setPageStep(1);
+			dial->setNotchesVisible((max - min) <= 12);
+			dial->setDefaultValue(deflt);
+				dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name));
+				dial->setShowToolTip(true);
+			connect(dial, SIGNAL(valueChanged(int)),
+				this, SLOT(propertyControllerChanged(int)));
+				connect(dial, SIGNAL(mouseEntered()),
+						this, SLOT(mouseEnteredWidget()));
+				connect(dial, SIGNAL(mouseLeft()),
+						this, SLOT(mouseLeftWidget()));
 
-	    if (inGroup) {
-		dial->setFixedWidth(24);
-		dial->setFixedHeight(24);
-		m_groupLayouts[groupName]->addWidget(dial);
-	    } else {
-		dial->setFixedWidth(32);
-		dial->setFixedHeight(32);
-		m_layout->addWidget(dial, row, 1);
-		QLabel *label = new QLabel(m_mainWidget);
-		connect(dial, SIGNAL(valueChanged(int)),
-			label, SLOT(setNum(int)));
-		label->setNum(value);
-		m_layout->addWidget(label, row, 2);
-	    }
+			if (inGroup) {
+			dial->setFixedWidth(24);
+			dial->setFixedHeight(24);
+			m_groupLayouts[groupName]->addWidget(dial);
+			} else {
+			dial->setFixedWidth(32);
+			dial->setFixedHeight(32);
+			m_layout->addWidget(dial, row, 1);
+			QLabel *label = new QLabel(m_mainWidget);
+			connect(dial, SIGNAL(valueChanged(int)),
+				label, SLOT(setNum(int)));
+			label->setNum(value);
+			m_layout->addWidget(label, row, 2);
+			}
 
-	    m_propertyControllers[name] = dial;
+			m_propertyControllers[name] = dial;
+		}
+
+		if (dial->value() != value) {
+			dial->blockSignals(true);
+			dial->setValue(value);
+			dial->blockSignals(false);
+		}
+		break;
+	}*/
+	case PropertyContainer::RangeProperty:
+    {
+		Slider *slider;
+
+		if (have) {
+			slider = dynamic_cast<Slider *>(m_propertyControllers[name]);
+			assert(slider);
+				if (rangeChanged) {
+					slider->blockSignals(true);
+					slider->setMinimum(min);
+					slider->setMaximum(max);
+					slider->blockSignals(false);
+				}
+	                
+		} else {
+			slider = new Slider(Qt::Horizontal);
+			slider->setObjectName(name);
+			slider->setMinimum(min);
+			slider->setMaximum(max);
+			slider->setPageStep(1);
+			connect(slider, SIGNAL(valueChanged(int)),
+						this, SLOT(propertyControllerChanged(int)));
+			connect(slider, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget()));
+			connect(slider, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget()));
+
+			if (inGroup) {
+				slider->setFixedWidth(48);
+				slider->setFixedHeight(24);
+				m_groupLayouts[groupName]->addWidget(slider);
+			} else {
+				slider->setFixedWidth(100);
+				slider->setFixedHeight(32);
+				m_layout->addWidget(slider, row, 1);
+				QLabel *label = new QLabel(m_mainWidget);
+				connect(slider, SIGNAL(valueChanged(int)),
+						label, SLOT(setNum(int)));
+				label->setNum(value);
+				m_layout->addWidget(label, row, 2);
+			}
+
+			m_propertyControllers[name] = slider;
+		}
+
+		if (slider->value() != value) {
+			slider->blockSignals(true);
+			slider->setValue(value);
+			slider->blockSignals(false);
+		}
+		break;
 	}
 
-	if (dial->value() != value) {
-	    dial->blockSignals(true);
-	    dial->setValue(value);
-	    dial->blockSignals(false);
-	}
-	break;
-    }
-
     case PropertyContainer::ValueProperty:
     case PropertyContainer::UnitsProperty:
     {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/widgets/Slider.cpp	Fri Jun 22 12:49:50 2007 +0000
@@ -0,0 +1,37 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
+
+/*	Sound Access	
+		EASAIER client application.	
+		Silogic 2007. Laure Bajard. 
+	
+	This program is free software; you can redistribute it and/or    
+	modify it under the terms of the GNU General Public License as    
+	published by the Free Software Foundation; either version 2 of the    
+	License, or (at your option) any later version.  See the file    
+	COPYING included with this distribution for more information.
+*/
+
+#include "Slider.h"
+
+Slider::~Slider()
+{
+}
+
+void
+Slider::enterEvent(QEvent *e)
+{
+    QSlider::enterEvent(e);
+	QPalette palette;
+	palette.setColor(QPalette::Button,palette.color(QPalette::Highlight));
+	setPalette(palette);
+    emit mouseEntered();
+}
+
+void
+Slider::leaveEvent(QEvent *e)
+{
+    QSlider::enterEvent(e);
+	QPalette palette;
+	setPalette(palette);
+    emit mouseLeft();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/widgets/Slider.h	Fri Jun 22 12:49:50 2007 +0000
@@ -0,0 +1,41 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
+
+/*	Sound Access	
+		EASAIER client application.	
+		Silogic 2007. Laure Bajard. 
+	
+	This program is free software; you can redistribute it and/or    
+	modify it under the terms of the GNU General Public License as    
+	published by the Free Software Foundation; either version 2 of the    
+	License, or (at your option) any later version.  See the file    
+	COPYING included with this distribution for more information.
+*/
+
+#ifndef _SLIDER_H_
+#define _SLIDER_H_
+
+#include <QSlider>
+
+class Slider : public QSlider
+{
+    Q_OBJECT
+public:
+
+    Slider(QWidget *parent = 0) :
+        QSlider(parent) { }
+
+	Slider(Qt::Orientation orientation, QWidget * parent = 0) :
+        QSlider(orientation, parent) { }
+
+    virtual ~Slider();
+
+signals:
+    void mouseEntered();
+    void mouseLeft();
+
+protected:
+    virtual void enterEvent(QEvent *);
+    virtual void leaveEvent(QEvent *);
+};
+
+#endif
\ No newline at end of file
--- a/widgets/svwidgets.vcproj	Fri Jun 22 09:54:00 2007 +0000
+++ b/widgets/svwidgets.vcproj	Fri Jun 22 12:49:50 2007 +0000
@@ -302,6 +302,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\Slider.cpp"
+				>
+			</File>
+			<File
 				RelativePath="SubdividingMenu.cpp"
 				>
 			</File>
@@ -1166,6 +1170,32 @@
 					</FileConfiguration>
 				</File>
 				<File
+					RelativePath=".\Slider.h"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCustomBuildTool"
+							Description="MOC $(InputFileName)"
+							CommandLine="$(QTDIR)\bin\moc.exe -DNDEBUG -DBUILD_RELEASE -DUSE_VC -D_WINDOWS -DUNICODE -DQT_LARGEFILE_SUPPORT -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_BZ2 -DHAVE_PORTAUDIO -DHAVE_PORTAUDIO_V18 -DHAVE_OGGZ -DHAVE_FISHSOUND -DHAVE_FFTW3F -DHAVE_VAMP -DHAVE_VAMP_HOSTSDK -DHAVE_SNDFILE -DHAVE_SAMPLERATE -DQT_THREAD_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB  -I &quot;$(QTDIR)\include\QtCore&quot; -I &quot;$(QTDIR)\include\QtCore&quot; -I &quot;$(QTDIR)\include\QtGui&quot; -I &quot;$(QTDIR)\include\QtGui&quot; -I &quot;$(QTDIR)\include\QtXml&quot; -I &quot;$(QTDIR)\include\QtXml&quot; -I &quot;$(QTDIR)\include&quot; -I &quot;.&quot; -I &quot;..&quot; -I &quot;$(QTDIR)\include\ActiveQt&quot; -I &quot;tmp_moc&quot; -I &quot;.&quot; -I&quot;$(QTDIR)\mkspecs\win32-msvc2005&quot; $(InputPath) -o tmp_moc\moc_$(InputName).cpp"
+							AdditionalDependencies="$(QTDIR)\bin\moc.exe"
+							Outputs="tmp_moc\moc_$(InputName).cpp"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCustomBuildTool"
+							Description="MOC $(InputFileName)"
+							CommandLine="$(QTDIR)\bin\moc.exe -DBUILD_DEBUG -DUSE_VC -D_WINDOWS -DUNICODE -DQT_LARGEFILE_SUPPORT -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_BZ2 -DHAVE_PORTAUDIO -DHAVE_PORTAUDIO_V18 -DHAVE_OGGZ -DHAVE_FISHSOUND -DHAVE_FFTW3F -DHAVE_VAMP -DHAVE_VAMP_HOSTSDK -DHAVE_SNDFILE -DHAVE_SAMPLERATE -DQT_THREAD_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB  -I &quot;$(QTDIR)\include\QtCore&quot; -I &quot;$(QTDIR)\include\QtCore&quot; -I &quot;$(QTDIR)\include\QtGui&quot; -I &quot;$(QTDIR)\include\QtGui&quot; -I &quot;$(QTDIR)\include\QtXml&quot; -I &quot;$(QTDIR)\include\QtXml&quot; -I &quot;$(QTDIR)\include&quot; -I &quot;.&quot; -I &quot;..&quot; -I &quot;$(QTDIR)\include\ActiveQt&quot; -I &quot;tmp_moc&quot; -I &quot;.&quot; -I&quot;$(QTDIR)\mkspecs\win32-msvc2005&quot; $(InputPath) -o tmp_moc\moc_$(InputName).cpp"
+							AdditionalDependencies="$(QTDIR)\bin\moc.exe"
+							Outputs="tmp_moc\moc_$(InputName).cpp"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
 					RelativePath="SubdividingMenu.h"
 					>
 					<FileConfiguration
@@ -1456,6 +1486,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\tmp_moc\moc_Slider.cpp"
+				>
+			</File>
+			<File
 				RelativePath="tmp_moc\moc_SubdividingMenu.cpp"
 				>
 			</File>
--- a/widgets/widgets.pro	Fri Jun 22 09:54:00 2007 +0000
+++ b/widgets/widgets.pro	Fri Jun 22 12:49:50 2007 +0000
@@ -51,7 +51,8 @@
            LayerViewerWidget.h \
            ItemLayerList.h \
            ItemContainer.h \
-           RealTimeFilterPropertyStack.h 
+           RealTimeFilterPropertyStack.h \
+           Slider.h 
 SOURCES += AudioDial.cpp \
            Fader.cpp \
            ItemEditDialog.cpp \
@@ -88,5 +89,6 @@
            LayerViewerWidget.cpp \
            ItemLayerList.cpp \
            ItemContainer.cpp \
-           RealTimeFilterPropertyStack.cpp 
+           RealTimeFilterPropertyStack.cpp \
+           Slider.hcpp