[opengtl-commits] [628] * allow to change a parameter

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 628
Author:   cyrille
Date:     2009-03-15 16:12:36 +0100 (Sun, 15 Mar 2009)

Log Message:
-----------
* allow to change a parameter
* fix double proxy

Modified Paths:
--------------
    trunk/libQtGTL/QtShiva/ParametersWidgetBase.cpp
    trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.cpp
    trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.h


Modified: trunk/libQtGTL/QtShiva/ParametersWidgetBase.cpp
===================================================================
--- trunk/libQtGTL/QtShiva/ParametersWidgetBase.cpp	2009-03-15 12:15:24 UTC (rev 627)
+++ trunk/libQtGTL/QtShiva/ParametersWidgetBase.cpp	2009-03-15 15:12:36 UTC (rev 628)
@@ -22,6 +22,7 @@
 #include <QGridLayout>
 
 #include "ParametersWidgetBase_p.h"
+#include "Proxy_p.h"
 
 using namespace QtShiva;
 
@@ -40,7 +41,7 @@
 
 void ParametersWidgetBase::setParameter(const GTLCore::String& _name, const GTLCore::Value& _value)
 {
-  Q_ASSERT(false);
+  d->proxies[_name]->setValue(_value);
 }
 
 void ParametersWidgetBase::setParametrisation( Parametrisation* _parametrisation)

Modified: trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.cpp
===================================================================
--- trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.cpp	2009-03-15 12:15:24 UTC (rev 627)
+++ trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.cpp	2009-03-15 15:12:36 UTC (rev 628)
@@ -40,7 +40,8 @@
 void ParametersWidgetBase::Private::regenerateWidget()
 {
   delete currentWidget;
-  
+  currentWidget = 0;
+  proxies.clear();
   if( parametrisation->parameters() )
   {
     const GTLCore::Metadata::Group* parameters = parametrisation->parameters();
@@ -161,7 +162,7 @@
       SpinBoxSliderConnector* connector = new SpinBoxSliderConnector( _parent, doubleSpinBox, horizontalSlider);
       connect( connector, SIGNAL(valueChanged(double)), self, SIGNAL(configurationChanged()));
       connect( connector, SIGNAL(valueChanged(double)), proxy, SLOT(setDoubleValue(double)));
-      connect( proxy, SIGNAL(intValueChanged(int)), doubleSpinBox, SLOT(setValue(double)));
+      connect( proxy, SIGNAL(doubleValueChanged(double)), doubleSpinBox, SLOT(setValue(double)));
       
       // Set parameters
       doubleSpinBox->setMinimum( _parameterEntry->minimumValue().asFloat() );
@@ -189,6 +190,7 @@
       break;
   }
   proxy->setValue(_parameterEntry->defaultValue());
+  proxies[ _parameterEntry->name() ] = proxy;
 }
 
 #include "ParametersWidgetBase_p.moc"

Modified: trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.h
===================================================================
--- trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.h	2009-03-15 12:15:24 UTC (rev 627)
+++ trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.h	2009-03-15 15:12:36 UTC (rev 628)
@@ -22,6 +22,9 @@
 #ifndef _QTGTL_PARAMETERS_WIDGET_P_H_
 #define _QTGTL_PARAMETERS_WIDGET_P_H_
 
+#include <QMap>
+#include <GTLCore/String.h>
+
 class QGridLayout;
 
 namespace GTLCore {
@@ -34,6 +37,7 @@
 }
 
 namespace QtShiva {
+  class Proxy;
   class ParametersWidgetBase::Parametrisation {
     friend class ParametersWidgetBase;
     public:
@@ -54,6 +58,7 @@
       QGridLayout* selfLayout;
       // Functions
       void regenerateWidget();
+      QMap<GTLCore::String, Proxy*> proxies;
     private:
       void createParameterEntryWidget( QWidget* _parent, QGridLayout* _gridLayout, int _layoutIndex, const GTLCore::Metadata::ParameterEntry* _parameterEntry );
   };


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/