[opengtl-commits] [613] rename ParemetersWidget into ParemetersWidgetBase , add to empty shell KernelParemetersWidget and SourceParemetersWidget

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


Revision: 613
Author:   cyrille
Date:     2009-03-14 10:06:41 +0100 (Sat, 14 Mar 2009)

Log Message:
-----------
rename ParemetersWidget into ParemetersWidgetBase , add to empty shell KernelParemetersWidget and SourceParemetersWidget

Modified Paths:
--------------
    trunk/libQtGTL/QtShiva/CMakeLists.txt
    trunk/libQtGTL/examples/QtShiva/MainWindow.ui

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

Removed Paths:
-------------
    trunk/libQtGTL/QtShiva/ParametersWidget.cpp
    trunk/libQtGTL/QtShiva/ParametersWidget.h
    trunk/libQtGTL/QtShiva/ParametersWidget_p.cpp
    trunk/libQtGTL/QtShiva/ParametersWidget_p.h

Property Changed:
----------------
    trunk/libQtGTL/


Property changes on: trunk/libQtGTL
___________________________________________________________________
Name: svn:ignore
   - libQtGTL.kdevses
libQtGTL.kdevelop.pcs
libQtGTL.kdevelop.filelist
libQtGTL.kdevelop

   + libQtGTL.kdevses
libQtGTL.kdevelop.pcs
libQtGTL.kdevelop.filelist
libQtGTL.kdevelop
..kdev4


Modified: trunk/libQtGTL/QtShiva/CMakeLists.txt
===================================================================
--- trunk/libQtGTL/QtShiva/CMakeLists.txt	2009-03-13 20:41:44 UTC (rev 612)
+++ trunk/libQtGTL/QtShiva/CMakeLists.txt	2009-03-14 09:06:41 UTC (rev 613)
@@ -6,11 +6,13 @@
 ############################### libQtShiva ###############################
 
 set(libQtShiva_SRCS
-  ParametersWidget.cpp
+  KernelParametersWidget.cpp
+  ParametersWidgetBase.cpp
+  SourceParametersWidget.cpp
 # Private
   ColorButton_p.cpp
   ColorConversions_p.cpp
-  ParametersWidget_p.cpp
+  ParametersWidgetBase_p.cpp
   SpinBoxSliderConnector_p.cpp
   TriangleColorSelector_p.cpp
   RgbaDialog_p.cpp

Deleted: trunk/libQtGTL/QtShiva/ParametersWidget.cpp
===================================================================
--- trunk/libQtGTL/QtShiva/ParametersWidget.cpp	2009-03-13 20:41:44 UTC (rev 612)
+++ trunk/libQtGTL/QtShiva/ParametersWidget.cpp	2009-03-14 09:06:41 UTC (rev 613)
@@ -1,47 +0,0 @@
-/*
- *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2 of the license.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "ParametersWidget.h"
-
-#include <QGridLayout>
-
-#include "ParametersWidget_p.h"
-
-using namespace QtShiva;
-
-ParametersWidget::ParametersWidget( QWidget* _parent ) : QWidget( _parent ), d(new Private)
-{
-  d->kernel = 0;
-  d->self = this;
-  d->selfLayout = new QGridLayout( this );
-  d->selfLayout->setRowStretch( 1, 10 );
-}
-
-ParametersWidget::~ParametersWidget()
-{
-  delete d;
-}
-
-void ParametersWidget::setKernel( OpenShiva::Kernel* _kernel )
-{
-  d->kernel = _kernel;
-  d->regenerateWidget();
-}
-
-#include "ParametersWidget.moc"

Deleted: trunk/libQtGTL/QtShiva/ParametersWidget.h
===================================================================
--- trunk/libQtGTL/QtShiva/ParametersWidget.h	2009-03-13 20:41:44 UTC (rev 612)
+++ trunk/libQtGTL/QtShiva/ParametersWidget.h	2009-03-14 09:06:41 UTC (rev 613)
@@ -1,45 +0,0 @@
-/*
- *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2 of the license.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _QTGTL_PARAMETERS_WIDGET_H_
-#define _QTGTL_PARAMETERS_WIDGET_H_
-
-#include <QWidget>
-
-namespace OpenShiva {
-  class Kernel;
-};
-
-namespace QtShiva {
-  class ParametersWidget : public QWidget {
-    Q_OBJECT
-    public:
-      ParametersWidget( QWidget* );
-      ~ParametersWidget();
-    public:
-      void setKernel( OpenShiva::Kernel* _kernel );
-    signals:
-      void configurationChanged();
-    private:
-      struct Private;
-      Private* const d;
-  };
-}
-
-#endif

Copied: trunk/libQtGTL/QtShiva/ParametersWidgetBase.cpp (from rev 612, trunk/libQtGTL/QtShiva/ParametersWidget.cpp)
===================================================================
--- trunk/libQtGTL/QtShiva/ParametersWidgetBase.cpp	                        (rev 0)
+++ trunk/libQtGTL/QtShiva/ParametersWidgetBase.cpp	2009-03-14 09:06:41 UTC (rev 613)
@@ -0,0 +1,47 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2 of the license.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "ParametersWidgetBase.h"
+
+#include <QGridLayout>
+
+#include "ParametersWidgetBase_p.h"
+
+using namespace QtShiva;
+
+ParametersWidgetBase::ParametersWidgetBase( QWidget* _parent ) : QWidget( _parent ), d(new Private)
+{
+  d->kernel = 0;
+  d->self = this;
+  d->selfLayout = new QGridLayout( this );
+  d->selfLayout->setRowStretch( 1, 10 );
+}
+
+ParametersWidgetBase::~ParametersWidgetBase()
+{
+  delete d;
+}
+
+void ParametersWidgetBase::setKernel( OpenShiva::Kernel* _kernel )
+{
+  d->kernel = _kernel;
+  d->regenerateWidget();
+}
+
+#include "ParametersWidgetBase.moc"

Copied: trunk/libQtGTL/QtShiva/ParametersWidgetBase.h (from rev 612, trunk/libQtGTL/QtShiva/ParametersWidget.h)
===================================================================
--- trunk/libQtGTL/QtShiva/ParametersWidgetBase.h	                        (rev 0)
+++ trunk/libQtGTL/QtShiva/ParametersWidgetBase.h	2009-03-14 09:06:41 UTC (rev 613)
@@ -0,0 +1,45 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2 of the license.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _QTGTL_PARAMETERS_WIDGET_H_
+#define _QTGTL_PARAMETERS_WIDGET_H_
+
+#include <QWidget>
+
+namespace OpenShiva {
+  class Kernel;
+};
+
+namespace QtShiva {
+  class ParametersWidgetBase : public QWidget {
+    Q_OBJECT
+    public:
+      ParametersWidgetBase( QWidget* );
+      ~ParametersWidgetBase();
+    public:
+      void setKernel( OpenShiva::Kernel* _kernel );
+    signals:
+      void configurationChanged();
+    private:
+      struct Private;
+      Private* const d;
+  };
+}
+
+#endif

Copied: trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.cpp (from rev 612, trunk/libQtGTL/QtShiva/ParametersWidget_p.cpp)
===================================================================
--- trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.cpp	                        (rev 0)
+++ trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.cpp	2009-03-14 09:06:41 UTC (rev 613)
@@ -0,0 +1,209 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2 of the license.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "ParametersWidgetBase_p.h"
+
+#include <OpenShiva/Kernel.h>
+#include <OpenShiva/Metadata.h>
+#include <GTLCore/Value.h>
+#include <GTLCore/Metadata/Entry.h>
+#include <GTLCore/Metadata/Group.h>
+#include <GTLCore/Metadata/ParameterEntry.h>
+
+#include <QDebug>
+#include <QDoubleSpinBox>
+#include <QGridLayout>
+#include <QLabel>
+#include <QTabWidget>
+#include <QSlider>
+
+#include "ColorButton_p.h"
+#include "Proxy_p.h"
+#include "SpinBoxSliderConnector_p.h"
+
+using namespace QtShiva;
+
+void ParametersWidgetBase::Private::regenerateWidget()
+{
+  delete currentWidget;
+  
+  if( kernel->metadata() and kernel->metadata()->parameters() )
+  {
+    const GTLCore::Metadata::Group* parameters = kernel->metadata()->parameters();
+    // Is tabWidget ?
+    QTabWidget* tabWidget = 0;
+    QWidget* widget = new QWidget();
+    foreach( const GTLCore::Metadata::Entry* entry, parameters->entries() )
+    {
+      if( entry->asGroup() and not entry->asParameterEntry() )
+      {
+        if(not tabWidget )
+        {
+          tabWidget = new QTabWidget( self );
+          widget = new QWidget( );
+          tabWidget->addTab( widget, kernel->name().c_str() );
+        }
+        break;
+      }
+    }
+    // Set the currentWidget
+    if( tabWidget )
+    {
+      currentWidget = tabWidget;
+    } else {
+      currentWidget = widget;
+    }
+    
+    // Create widgets
+    QGridLayout* widgetGridLayout = new QGridLayout(widget);
+    int posInGrid = 0;
+    foreach( const GTLCore::Metadata::Entry* entry, parameters->entries() )
+    {
+      if( const GTLCore::Metadata::ParameterEntry* pe = entry->asParameterEntry() )
+      {
+        createParameterEntryWidget( widget, widgetGridLayout, posInGrid, pe );
+        ++posInGrid;
+      } else if( const GTLCore::Metadata::Group* gr = entry->asGroup() )
+      {
+        Q_ASSERT( tabWidget );
+        QWidget* groupWidget = new QWidget( );
+        QGridLayout* groupWidgetGridLayout = new QGridLayout(groupWidget);
+        int groupPosInGrid = 0;
+        foreach( const GTLCore::Metadata::Entry* groupEntry, gr->entries() )
+        {
+          if( const GTLCore::Metadata::ParameterEntry* gpe = groupEntry->asParameterEntry() )
+          {
+            createParameterEntryWidget( groupWidget, groupWidgetGridLayout, groupPosInGrid, gpe );
+            ++groupPosInGrid;
+          } else {
+            qDebug() << "Non parameter entry: " << groupEntry->name().c_str() ;
+          }
+        }
+        QString caption = ( ( gr->label() == "" ) ? gr->name() : gr->label() ).c_str();
+        tabWidget->addTab( groupWidget, caption );
+      }
+    }
+    
+  } else {
+    currentWidget = new QLabel( QObject::tr( "No configuration" ), self );
+  }
+  
+  currentWidget->setVisible( true );
+  selfLayout->addWidget(currentWidget, 0, 0, 1, 1);
+  
+}
+
+void ParametersWidgetBase::Private::createParameterEntryWidget( QWidget* _parent, QGridLayout* _gridLayout, int _layoutIndex, const GTLCore::Metadata::ParameterEntry* _parameterEntry )
+{
+  // Label
+  QString caption = ( ( _parameterEntry->label() == "" ) ? _parameterEntry->name() : _parameterEntry->label() ).c_str();
+  QLabel* label = new QLabel( caption + ":", _parent);
+  _gridLayout->addWidget(label, _layoutIndex, 0, 1, 1);
+  Proxy* proxy = new Proxy( _parent, _parameterEntry->name(), kernel );
+  switch( _parameterEntry->widgetType() )
+  {
+    case GTLCore::Metadata::ParameterEntry::IntegerWidget:
+    {
+      // Integer spinbox
+      QSpinBox* spinBox = new QSpinBox(_parent);
+      _gridLayout->addWidget(spinBox, _layoutIndex, 1, 1, 1);
+      
+      // Slider
+      QSlider* horizontalSlider = new QSlider(_parent);
+      horizontalSlider->setOrientation(Qt::Horizontal);
+      _gridLayout->addWidget(horizontalSlider, _layoutIndex, 2, 1, 1);
+      
+      connect( spinBox, SIGNAL(valueChanged(int)), horizontalSlider, SLOT(setValue(int)));
+      connect( horizontalSlider, SIGNAL(valueChanged(int)), spinBox, SLOT(setValue(int)));
+      connect( spinBox, SIGNAL(valueChanged(int)), self, SIGNAL(configurationChanged()));
+      
+      connect( spinBox, SIGNAL(valueChanged(int)), proxy, SLOT(setIntValue(int)));
+      
+      int min = _parameterEntry->minimumValue().asInt32();
+      int max = _parameterEntry->maximumValue().asInt32();
+      int val = _parameterEntry->defaultValue().asInt32();
+      spinBox->setMinimum( min );
+      spinBox->setMaximum( max );
+      spinBox->setValue( val );
+      horizontalSlider->setMinimum( min );
+      horizontalSlider->setMaximum( max );
+      horizontalSlider->setValue( val );
+    }
+      break;
+    case GTLCore::Metadata::ParameterEntry::FloatWidget:
+    {
+      
+      // Double spinbox
+      QDoubleSpinBox* doubleSpinBox = new QDoubleSpinBox(_parent);
+      _gridLayout->addWidget(doubleSpinBox, _layoutIndex, 1, 1, 1);
+      doubleSpinBox->setSingleStep( 0.1 );
+      
+      // Slider
+      QSlider* horizontalSlider = new QSlider(_parent);
+      horizontalSlider->setOrientation(Qt::Horizontal);
+      _gridLayout->addWidget(horizontalSlider, _layoutIndex, 2, 1, 1);
+      horizontalSlider->setMinimum( 0 );
+      horizontalSlider->setMaximum( 1000 );
+      
+      SpinBoxSliderConnector* connector = new SpinBoxSliderConnector( _parent, doubleSpinBox, horizontalSlider);
+      connect( connector, SIGNAL(valueChanged(double)), self, SIGNAL(configurationChanged()));
+      connect( connector, SIGNAL(valueChanged(double)), proxy, SLOT(setDoubleValue(double)));
+      
+      // Set parameters
+      doubleSpinBox->setMinimum( _parameterEntry->minimumValue().asFloat() );
+      doubleSpinBox->setMaximum( _parameterEntry->maximumValue().asFloat() );
+      doubleSpinBox->setValue( _parameterEntry->defaultValue().asFloat() );
+    }
+      break;
+    case GTLCore::Metadata::ParameterEntry::CurveWidget:
+      
+      break;
+    case GTLCore::Metadata::ParameterEntry::RgbColorWidget:
+    {
+      ColorButton* colorButton = new ColorButton( _parent, false );
+      const std::vector< GTLCore::Value >* valArr = _parameterEntry->defaultValue().asArray();
+      Q_ASSERT( valArr );
+      Q_ASSERT( valArr->size() >= 3 );
+      double r = (*valArr)[0].asFloat() * 255;
+      double g = (*valArr)[1].asFloat() * 255;
+      double b = (*valArr)[2].asFloat() * 255;
+      colorButton->setCurrentColor( QColor(r,g,b ) );
+      _gridLayout->addWidget(colorButton, _layoutIndex, 1, 1, 1);
+      connect( colorButton, SIGNAL(colorChanged(const QColor&)), proxy, SLOT(setRgb(const QColor&)));
+    }
+      break;
+    case GTLCore::Metadata::ParameterEntry::RgbaColorWidget:
+    {
+      ColorButton* colorButton = new ColorButton( _parent, true );
+      const std::vector< GTLCore::Value >* valArr = _parameterEntry->defaultValue().asArray();
+      Q_ASSERT( valArr );
+      Q_ASSERT( valArr->size() >= 3 );
+      double r = (*valArr)[0].asFloat() * 255;
+      double g = (*valArr)[1].asFloat() * 255;
+      double b = (*valArr)[2].asFloat() * 255;
+      double a = (*valArr)[3].asFloat() * 255;
+      colorButton->setCurrentColor( QColor(r,g,b, a ) );
+      _gridLayout->addWidget(colorButton, _layoutIndex, 1, 1, 1);
+      connect( colorButton, SIGNAL(colorChanged(const QColor&)), proxy, SLOT(setRgba(const QColor&)));
+    }
+      break;
+  }
+}
+
+#include "ParametersWidgetBase_p.moc"

Copied: trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.h (from rev 612, trunk/libQtGTL/QtShiva/ParametersWidget_p.h)
===================================================================
--- trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.h	                        (rev 0)
+++ trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.h	2009-03-14 09:06:41 UTC (rev 613)
@@ -0,0 +1,49 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2 of the license.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "ParametersWidgetBase.h"
+
+#ifndef _QTGTL_PARAMETERS_WIDGET_P_H_
+#define _QTGTL_PARAMETERS_WIDGET_P_H_
+
+class QGridLayout;
+
+namespace GTLCore {
+  namespace Metadata {
+    class ParameterEntry;
+  }
+}
+
+namespace QtShiva {
+  class ParametersWidgetBase::Private : public QObject {
+      Q_OBJECT
+    public:
+      Private() : kernel(0), self(0), currentWidget(0) {}
+      OpenShiva::Kernel* kernel;
+      QWidget* self;
+      QWidget* currentWidget;
+      QGridLayout* selfLayout;
+      // Functions
+      void regenerateWidget();
+    private:
+      void createParameterEntryWidget( QWidget* _parent, QGridLayout* _gridLayout, int _layoutIndex, const GTLCore::Metadata::ParameterEntry* _parameterEntry );
+  };
+}
+
+#endif

Deleted: trunk/libQtGTL/QtShiva/ParametersWidget_p.cpp
===================================================================
--- trunk/libQtGTL/QtShiva/ParametersWidget_p.cpp	2009-03-13 20:41:44 UTC (rev 612)
+++ trunk/libQtGTL/QtShiva/ParametersWidget_p.cpp	2009-03-14 09:06:41 UTC (rev 613)
@@ -1,209 +0,0 @@
-/*
- *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2 of the license.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "ParametersWidget_p.h"
-
-#include <OpenShiva/Kernel.h>
-#include <OpenShiva/Metadata.h>
-#include <GTLCore/Value.h>
-#include <GTLCore/Metadata/Entry.h>
-#include <GTLCore/Metadata/Group.h>
-#include <GTLCore/Metadata/ParameterEntry.h>
-
-#include <QDebug>
-#include <QDoubleSpinBox>
-#include <QGridLayout>
-#include <QLabel>
-#include <QTabWidget>
-#include <QSlider>
-
-#include "ColorButton_p.h"
-#include "Proxy_p.h"
-#include "SpinBoxSliderConnector_p.h"
-
-using namespace QtShiva;
-
-void ParametersWidget::Private::regenerateWidget()
-{
-  delete currentWidget;
-  
-  if( kernel->metadata() and kernel->metadata()->parameters() )
-  {
-    const GTLCore::Metadata::Group* parameters = kernel->metadata()->parameters();
-    // Is tabWidget ?
-    QTabWidget* tabWidget = 0;
-    QWidget* widget = new QWidget();
-    foreach( const GTLCore::Metadata::Entry* entry, parameters->entries() )
-    {
-      if( entry->asGroup() and not entry->asParameterEntry() )
-      {
-        if(not tabWidget )
-        {
-          tabWidget = new QTabWidget( self );
-          widget = new QWidget( );
-          tabWidget->addTab( widget, kernel->name().c_str() );
-        }
-        break;
-      }
-    }
-    // Set the currentWidget
-    if( tabWidget )
-    {
-      currentWidget = tabWidget;
-    } else {
-      currentWidget = widget;
-    }
-    
-    // Create widgets
-    QGridLayout* widgetGridLayout = new QGridLayout(widget);
-    int posInGrid = 0;
-    foreach( const GTLCore::Metadata::Entry* entry, parameters->entries() )
-    {
-      if( const GTLCore::Metadata::ParameterEntry* pe = entry->asParameterEntry() )
-      {
-        createParameterEntryWidget( widget, widgetGridLayout, posInGrid, pe );
-        ++posInGrid;
-      } else if( const GTLCore::Metadata::Group* gr = entry->asGroup() )
-      {
-        Q_ASSERT( tabWidget );
-        QWidget* groupWidget = new QWidget( );
-        QGridLayout* groupWidgetGridLayout = new QGridLayout(groupWidget);
-        int groupPosInGrid = 0;
-        foreach( const GTLCore::Metadata::Entry* groupEntry, gr->entries() )
-        {
-          if( const GTLCore::Metadata::ParameterEntry* gpe = groupEntry->asParameterEntry() )
-          {
-            createParameterEntryWidget( groupWidget, groupWidgetGridLayout, groupPosInGrid, gpe );
-            ++groupPosInGrid;
-          } else {
-            qDebug() << "Non parameter entry: " << groupEntry->name().c_str() ;
-          }
-        }
-        QString caption = ( ( gr->label() == "" ) ? gr->name() : gr->label() ).c_str();
-        tabWidget->addTab( groupWidget, caption );
-      }
-    }
-    
-  } else {
-    currentWidget = new QLabel( QObject::tr( "No configuration" ), self );
-  }
-  
-  currentWidget->setVisible( true );
-  selfLayout->addWidget(currentWidget, 0, 0, 1, 1);
-  
-}
-
-void ParametersWidget::Private::createParameterEntryWidget( QWidget* _parent, QGridLayout* _gridLayout, int _layoutIndex, const GTLCore::Metadata::ParameterEntry* _parameterEntry )
-{
-  // Label
-  QString caption = ( ( _parameterEntry->label() == "" ) ? _parameterEntry->name() : _parameterEntry->label() ).c_str();
-  QLabel* label = new QLabel( caption + ":", _parent);
-  _gridLayout->addWidget(label, _layoutIndex, 0, 1, 1);
-  Proxy* proxy = new Proxy( _parent, _parameterEntry->name(), kernel );
-  switch( _parameterEntry->widgetType() )
-  {
-    case GTLCore::Metadata::ParameterEntry::IntegerWidget:
-    {
-      // Integer spinbox
-      QSpinBox* spinBox = new QSpinBox(_parent);
-      _gridLayout->addWidget(spinBox, _layoutIndex, 1, 1, 1);
-      
-      // Slider
-      QSlider* horizontalSlider = new QSlider(_parent);
-      horizontalSlider->setOrientation(Qt::Horizontal);
-      _gridLayout->addWidget(horizontalSlider, _layoutIndex, 2, 1, 1);
-      
-      connect( spinBox, SIGNAL(valueChanged(int)), horizontalSlider, SLOT(setValue(int)));
-      connect( horizontalSlider, SIGNAL(valueChanged(int)), spinBox, SLOT(setValue(int)));
-      connect( spinBox, SIGNAL(valueChanged(int)), self, SIGNAL(configurationChanged()));
-      
-      connect( spinBox, SIGNAL(valueChanged(int)), proxy, SLOT(setIntValue(int)));
-      
-      int min = _parameterEntry->minimumValue().asInt32();
-      int max = _parameterEntry->maximumValue().asInt32();
-      int val = _parameterEntry->defaultValue().asInt32();
-      spinBox->setMinimum( min );
-      spinBox->setMaximum( max );
-      spinBox->setValue( val );
-      horizontalSlider->setMinimum( min );
-      horizontalSlider->setMaximum( max );
-      horizontalSlider->setValue( val );
-    }
-      break;
-    case GTLCore::Metadata::ParameterEntry::FloatWidget:
-    {
-      
-      // Double spinbox
-      QDoubleSpinBox* doubleSpinBox = new QDoubleSpinBox(_parent);
-      _gridLayout->addWidget(doubleSpinBox, _layoutIndex, 1, 1, 1);
-      doubleSpinBox->setSingleStep( 0.1 );
-      
-      // Slider
-      QSlider* horizontalSlider = new QSlider(_parent);
-      horizontalSlider->setOrientation(Qt::Horizontal);
-      _gridLayout->addWidget(horizontalSlider, _layoutIndex, 2, 1, 1);
-      horizontalSlider->setMinimum( 0 );
-      horizontalSlider->setMaximum( 1000 );
-      
-      SpinBoxSliderConnector* connector = new SpinBoxSliderConnector( _parent, doubleSpinBox, horizontalSlider);
-      connect( connector, SIGNAL(valueChanged(double)), self, SIGNAL(configurationChanged()));
-      connect( connector, SIGNAL(valueChanged(double)), proxy, SLOT(setDoubleValue(double)));
-      
-      // Set parameters
-      doubleSpinBox->setMinimum( _parameterEntry->minimumValue().asFloat() );
-      doubleSpinBox->setMaximum( _parameterEntry->maximumValue().asFloat() );
-      doubleSpinBox->setValue( _parameterEntry->defaultValue().asFloat() );
-    }
-      break;
-    case GTLCore::Metadata::ParameterEntry::CurveWidget:
-      
-      break;
-    case GTLCore::Metadata::ParameterEntry::RgbColorWidget:
-    {
-      ColorButton* colorButton = new ColorButton( _parent, false );
-      const std::vector< GTLCore::Value >* valArr = _parameterEntry->defaultValue().asArray();
-      Q_ASSERT( valArr );
-      Q_ASSERT( valArr->size() >= 3 );
-      double r = (*valArr)[0].asFloat() * 255;
-      double g = (*valArr)[1].asFloat() * 255;
-      double b = (*valArr)[2].asFloat() * 255;
-      colorButton->setCurrentColor( QColor(r,g,b ) );
-      _gridLayout->addWidget(colorButton, _layoutIndex, 1, 1, 1);
-      connect( colorButton, SIGNAL(colorChanged(const QColor&)), proxy, SLOT(setRgb(const QColor&)));
-    }
-      break;
-    case GTLCore::Metadata::ParameterEntry::RgbaColorWidget:
-    {
-      ColorButton* colorButton = new ColorButton( _parent, true );
-      const std::vector< GTLCore::Value >* valArr = _parameterEntry->defaultValue().asArray();
-      Q_ASSERT( valArr );
-      Q_ASSERT( valArr->size() >= 3 );
-      double r = (*valArr)[0].asFloat() * 255;
-      double g = (*valArr)[1].asFloat() * 255;
-      double b = (*valArr)[2].asFloat() * 255;
-      double a = (*valArr)[3].asFloat() * 255;
-      colorButton->setCurrentColor( QColor(r,g,b, a ) );
-      _gridLayout->addWidget(colorButton, _layoutIndex, 1, 1, 1);
-      connect( colorButton, SIGNAL(colorChanged(const QColor&)), proxy, SLOT(setRgba(const QColor&)));
-    }
-      break;
-  }
-}
-
-#include "ParametersWidget_p.moc"

Deleted: trunk/libQtGTL/QtShiva/ParametersWidget_p.h
===================================================================
--- trunk/libQtGTL/QtShiva/ParametersWidget_p.h	2009-03-13 20:41:44 UTC (rev 612)
+++ trunk/libQtGTL/QtShiva/ParametersWidget_p.h	2009-03-14 09:06:41 UTC (rev 613)
@@ -1,49 +0,0 @@
-/*
- *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2 of the license.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "ParametersWidget.h"
-
-#ifndef _QTGTL_PARAMETERS_WIDGET_P_H_
-#define _QTGTL_PARAMETERS_WIDGET_P_H_
-
-class QGridLayout;
-
-namespace GTLCore {
-  namespace Metadata {
-    class ParameterEntry;
-  }
-}
-
-namespace QtShiva {
-  class ParametersWidget::Private : public QObject {
-      Q_OBJECT
-    public:
-      Private() : kernel(0), self(0), currentWidget(0) {}
-      OpenShiva::Kernel* kernel;
-      QWidget* self;
-      QWidget* currentWidget;
-      QGridLayout* selfLayout;
-      // Functions
-      void regenerateWidget();
-    private:
-      void createParameterEntryWidget( QWidget* _parent, QGridLayout* _gridLayout, int _layoutIndex, const GTLCore::Metadata::ParameterEntry* _parameterEntry );
-  };
-}
-
-#endif

Modified: trunk/libQtGTL/examples/QtShiva/MainWindow.ui
===================================================================
--- trunk/libQtGTL/examples/QtShiva/MainWindow.ui	2009-03-13 20:41:44 UTC (rev 612)
+++ trunk/libQtGTL/examples/QtShiva/MainWindow.ui	2009-03-14 09:06:41 UTC (rev 613)
@@ -115,7 +115,7 @@
         </attribute>
         <layout class="QGridLayout" name="gridLayout" >
          <item row="0" column="0" >
-          <widget class="QtShiva::ParametersWidget" native="1" name="parametersWidget" />
+          <widget class="QtShiva::KernelParametersWidget" native="1" name="parametersWidget" />
          </item>
         </layout>
        </widget>
@@ -161,9 +161,9 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>QtShiva::ParametersWidget</class>
+   <class>QtShiva::KernelParametersWidget</class>
    <extends>QWidget</extends>
-   <header>QtShiva/ParametersWidget.h</header>
+   <header>QtShiva/KernelParametersWidget.h</header>
    <container>1</container>
   </customwidget>
  </customwidgets>


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