[opengtl-commits] [614] make Base not Kernel specific anymore

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


Revision: 614
Author:   cyrille
Date:     2009-03-14 11:08:48 +0100 (Sat, 14 Mar 2009)

Log Message:
-----------
make Base not Kernel specific anymore

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


Modified: trunk/libQtGTL/QtShiva/ParametersWidgetBase.cpp
===================================================================
--- trunk/libQtGTL/QtShiva/ParametersWidgetBase.cpp	2009-03-14 09:06:41 UTC (rev 613)
+++ trunk/libQtGTL/QtShiva/ParametersWidgetBase.cpp	2009-03-14 10:08:48 UTC (rev 614)
@@ -27,7 +27,6 @@
 
 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 );
@@ -35,13 +34,15 @@
 
 ParametersWidgetBase::~ParametersWidgetBase()
 {
+  delete d->parametrisation;
   delete d;
 }
 
-void ParametersWidgetBase::setKernel( OpenShiva::Kernel* _kernel )
+void ParametersWidgetBase::setParametrisation( Parametrisation* _parametrisation)
 {
-  d->kernel = _kernel;
-  d->regenerateWidget();
+  delete d->parametrisation;
+  d->parametrisation = _parametrisation;
+  d->parametrisation->p = d;
 }
 
 #include "ParametersWidgetBase.moc"

Modified: trunk/libQtGTL/QtShiva/ParametersWidgetBase.h
===================================================================
--- trunk/libQtGTL/QtShiva/ParametersWidgetBase.h	2009-03-14 09:06:41 UTC (rev 613)
+++ trunk/libQtGTL/QtShiva/ParametersWidgetBase.h	2009-03-14 10:08:48 UTC (rev 614)
@@ -32,10 +32,12 @@
     public:
       ParametersWidgetBase( QWidget* );
       ~ParametersWidgetBase();
-    public:
-      void setKernel( OpenShiva::Kernel* _kernel );
     signals:
       void configurationChanged();
+    public:
+      class Parametrisation;
+    protected:
+      void setParametrisation( Parametrisation* );
     private:
       struct Private;
       Private* const d;

Modified: trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.cpp
===================================================================
--- trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.cpp	2009-03-14 09:06:41 UTC (rev 613)
+++ trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.cpp	2009-03-14 10:08:48 UTC (rev 614)
@@ -19,8 +19,6 @@
 
 #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>
@@ -43,9 +41,9 @@
 {
   delete currentWidget;
   
-  if( kernel->metadata() and kernel->metadata()->parameters() )
+  if( parametrisation->parameters() )
   {
-    const GTLCore::Metadata::Group* parameters = kernel->metadata()->parameters();
+    const GTLCore::Metadata::Group* parameters = parametrisation->parameters();
     // Is tabWidget ?
     QTabWidget* tabWidget = 0;
     QWidget* widget = new QWidget();
@@ -57,7 +55,7 @@
         {
           tabWidget = new QTabWidget( self );
           widget = new QWidget( );
-          tabWidget->addTab( widget, kernel->name().c_str() );
+          tabWidget->addTab( widget, parametrisation->name().c_str() );
         }
         break;
       }
@@ -115,7 +113,7 @@
   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 );
+  Proxy* proxy = new Proxy( _parent, _parameterEntry->name(), parametrisation );
   switch( _parameterEntry->widgetType() )
   {
     case GTLCore::Metadata::ParameterEntry::IntegerWidget:

Modified: trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.h
===================================================================
--- trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.h	2009-03-14 09:06:41 UTC (rev 613)
+++ trunk/libQtGTL/QtShiva/ParametersWidgetBase_p.h	2009-03-14 10:08:48 UTC (rev 614)
@@ -25,17 +25,30 @@
 class QGridLayout;
 
 namespace GTLCore {
+  class String;
+  class Value;
   namespace Metadata {
     class ParameterEntry;
+    class Group;
   }
 }
 
 namespace QtShiva {
+  class ParametersWidgetBase::Parametrisation {
+    friend class ParametersWidgetBase;
+    public:
+      virtual const GTLCore::Metadata::Group* parameters() const = 0;
+      virtual const GTLCore::String& name() const = 0;
+      virtual void setParameter( const GTLCore::String& _name, GTLCore::Value ) = 0;
+    protected:
+      ParametersWidgetBase::Private* p;
+  };
+
   class ParametersWidgetBase::Private : public QObject {
       Q_OBJECT
     public:
-      Private() : kernel(0), self(0), currentWidget(0) {}
-      OpenShiva::Kernel* kernel;
+      Private() : parametrisation(0), self(0), currentWidget(0) {}
+      Parametrisation* parametrisation;
       QWidget* self;
       QWidget* currentWidget;
       QGridLayout* selfLayout;

Modified: trunk/libQtGTL/QtShiva/Proxy_p.cpp
===================================================================
--- trunk/libQtGTL/QtShiva/Proxy_p.cpp	2009-03-14 09:06:41 UTC (rev 613)
+++ trunk/libQtGTL/QtShiva/Proxy_p.cpp	2009-03-14 10:08:48 UTC (rev 614)
@@ -26,9 +26,12 @@
 #include <GTLCore/Value.h>
 #include <OpenShiva/Kernel.h>
 
+#include "ParametersWidgetBase_p.h"
+
+
 using namespace QtShiva;
 
-Proxy::Proxy( QObject* parent, const GTLCore::String& _name, OpenShiva::Kernel* _kernel ) : QObject( parent ), m_name(_name), m_kernel( _kernel )
+Proxy::Proxy( QObject* parent, const GTLCore::String& _name, ParametersWidgetBase::Parametrisation* _kernel ) : QObject( parent ), m_name(_name), m_kernel( _kernel )
 {
   
 }

Modified: trunk/libQtGTL/QtShiva/Proxy_p.h
===================================================================
--- trunk/libQtGTL/QtShiva/Proxy_p.h	2009-03-14 09:06:41 UTC (rev 613)
+++ trunk/libQtGTL/QtShiva/Proxy_p.h	2009-03-14 10:08:48 UTC (rev 614)
@@ -23,6 +23,8 @@
 #include <QObject>
 #include <GTLCore/String.h>
 
+#include "ParametersWidgetBase.h"
+
 namespace OpenShiva {
   class Kernel;
 }
@@ -33,7 +35,7 @@
   class Proxy : public QObject {
     Q_OBJECT
     public:
-      Proxy( QObject* parent, const GTLCore::String& _name, OpenShiva::Kernel* _kernel );
+      Proxy( QObject* parent, const GTLCore::String& _name, ParametersWidgetBase::Parametrisation* _kernel );
       ~Proxy();
     public slots:
       void setIntValue( int );
@@ -42,7 +44,7 @@
       void setRgba( const QColor& );
     private:
       GTLCore::String m_name;
-      OpenShiva::Kernel* m_kernel;
+      ParametersWidgetBase::Parametrisation* m_kernel;
   };
 }
 


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