Browse Source

Add plugin to ctkSettingsWidget and ctkSettingsPanel

Julien Finet 14 years ago
parent
commit
4b5aa8292d

+ 6 - 0
Libs/Widgets/Plugins/CMakeLists.txt

@@ -55,6 +55,10 @@ SET(PLUGIN_SRCS
   ctkTransferFunctionViewPlugin.h
   ctkTreeComboBoxPlugin.cpp
   ctkTreeComboBoxPlugin.h
+  ctkSettingsPanelPlugin.cpp
+  ctkSettingsPanelPlugin.h
+  ctkSettingsWidgetPlugin.cpp
+  ctkSettingsWidgetPlugin.h
   ctkSliderWidgetPlugin.cpp
   ctkSliderWidgetPlugin.h
   ctkWorkflowButtonBoxWidgetPlugin.cpp
@@ -88,6 +92,8 @@ SET(PLUGIN_MOC_SRCS
   ctkRangeWidgetPlugin.h
   ctkTransferFunctionViewPlugin.h
   ctkTreeComboBoxPlugin.h
+  ctkSettingsPanelPlugin.h
+  ctkSettingsWidgetPlugin.h
   ctkSliderWidgetPlugin.h
   ctkWorkflowButtonBoxWidgetPlugin.h
   ctkWorkflowWidgetStepPlugin.h

+ 6 - 5
Libs/Widgets/Plugins/ctkMaterialPropertyWidgetPlugin.cpp

@@ -23,15 +23,16 @@
 #include "ctkMaterialPropertyWidget.h"
 
 //-----------------------------------------------------------------------------
-ctkMaterialPropertyWidgetPlugin::ctkMaterialPropertyWidgetPlugin(QObject *_parent) : QObject(_parent)
+ctkMaterialPropertyWidgetPlugin::ctkMaterialPropertyWidgetPlugin(QObject *pluginParent)
+  : QObject(pluginParent)
 {
 }
 
 //-----------------------------------------------------------------------------
-QWidget *ctkMaterialPropertyWidgetPlugin::createWidget(QWidget *_parent)
+QWidget *ctkMaterialPropertyWidgetPlugin::createWidget(QWidget *widgetParent)
 {
-  ctkMaterialPropertyWidget* _widget = new ctkMaterialPropertyWidget(_parent);
-  return _widget;
+  ctkMaterialPropertyWidget* newWidget = new ctkMaterialPropertyWidget(widgetParent);
+  return newWidget;
 }
 
 //-----------------------------------------------------------------------------
@@ -45,7 +46,7 @@ QString ctkMaterialPropertyWidgetPlugin::domXml() const
 //-----------------------------------------------------------------------------
 QIcon ctkMaterialPropertyWidgetPlugin::icon() const
 {
-  return QIcon(":/Icons/pushbutton.png");
+  return QIcon(":/Icons/widget.png");
 }
 
 //-----------------------------------------------------------------------------

+ 68 - 0
Libs/Widgets/Plugins/ctkSettingsPanelPlugin.cpp

@@ -0,0 +1,68 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.commontk.org/LICENSE
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=========================================================================*/
+
+// CTK includes
+#include "ctkSettingsPanelPlugin.h"
+#include "ctkSettingsPanel.h"
+
+//-----------------------------------------------------------------------------
+ctkSettingsPanelPlugin::ctkSettingsPanelPlugin(QObject *pluginParent)
+  : QObject(pluginParent)
+{
+}
+
+//-----------------------------------------------------------------------------
+QWidget *ctkSettingsPanelPlugin::createWidget(QWidget* widgetParent)
+{
+  ctkSettingsPanel* newWidget = new ctkSettingsPanel(widgetParent);
+  return newWidget;
+}
+
+//-----------------------------------------------------------------------------
+QString ctkSettingsPanelPlugin::domXml() const
+{
+  return "<widget class=\"ctkSettingsPanel\" \
+          name=\"SettingsPanel\">\n"
+          "</widget>\n";
+}
+
+//-----------------------------------------------------------------------------
+QIcon ctkSettingsPanelPlugin::icon() const
+{
+  return QIcon(":/Icons/widget.png");
+}
+
+//-----------------------------------------------------------------------------
+QString ctkSettingsPanelPlugin::includeFile() const
+{
+  return "ctkSettingsPanel.h";
+}
+
+//-----------------------------------------------------------------------------
+bool ctkSettingsPanelPlugin::isContainer() const
+{
+  return true;
+}
+
+//-----------------------------------------------------------------------------
+QString ctkSettingsPanelPlugin::name() const
+{
+  return "ctkSettingsPanel";
+}

+ 44 - 0
Libs/Widgets/Plugins/ctkSettingsPanelPlugin.h

@@ -0,0 +1,44 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.commontk.org/LICENSE
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=========================================================================*/
+
+#ifndef __ctkSettingsPanelPlugin_h
+#define __ctkSettingsPanelPlugin_h
+
+// CTK includes
+#include "ctkWidgetsAbstractPlugin.h"
+
+class CTK_WIDGETS_PLUGINS_EXPORT ctkSettingsPanelPlugin :
+  public QObject,
+  public ctkWidgetsAbstractPlugin
+{
+  Q_OBJECT
+
+public:
+  ctkSettingsPanelPlugin(QObject *_parent = 0);
+  
+  QWidget *createWidget(QWidget *_parent);
+  QString  domXml() const;
+  QIcon    icon() const;
+  QString  includeFile() const;
+  bool     isContainer() const;
+  QString  name() const;
+};
+
+#endif

+ 68 - 0
Libs/Widgets/Plugins/ctkSettingsWidgetPlugin.cpp

@@ -0,0 +1,68 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.commontk.org/LICENSE
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=========================================================================*/
+
+// CTK includes
+#include "ctkSettingsWidgetPlugin.h"
+#include "ctkSettingsWidget.h"
+
+//-----------------------------------------------------------------------------
+ctkSettingsWidgetPlugin::ctkSettingsWidgetPlugin(QObject *pluginParent)
+  : QObject(pluginParent)
+{
+}
+
+//-----------------------------------------------------------------------------
+QWidget *ctkSettingsWidgetPlugin::createWidget(QWidget* widgetParent)
+{
+  ctkSettingsWidget* newWidget = new ctkSettingsWidget(widgetParent);
+  return newWidget;
+}
+
+//-----------------------------------------------------------------------------
+QString ctkSettingsWidgetPlugin::domXml() const
+{
+  return "<widget class=\"ctkSettingsWidget\" \
+          name=\"SettingsWidget\">\n"
+          "</widget>\n";
+}
+
+//-----------------------------------------------------------------------------
+QIcon ctkSettingsWidgetPlugin::icon() const
+{
+  return QIcon(":/Icons/widget.png");
+}
+
+//-----------------------------------------------------------------------------
+QString ctkSettingsWidgetPlugin::includeFile() const
+{
+  return "ctkSettingsWidget.h";
+}
+
+//-----------------------------------------------------------------------------
+bool ctkSettingsWidgetPlugin::isContainer() const
+{
+  return false;
+}
+
+//-----------------------------------------------------------------------------
+QString ctkSettingsWidgetPlugin::name() const
+{
+  return "ctkSettingsWidget";
+}

+ 44 - 0
Libs/Widgets/Plugins/ctkSettingsWidgetPlugin.h

@@ -0,0 +1,44 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.commontk.org/LICENSE
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=========================================================================*/
+
+#ifndef __ctkSettingsWidgetPlugin_h
+#define __ctkSettingsWidgetPlugin_h
+
+// CTK includes
+#include "ctkWidgetsAbstractPlugin.h"
+
+class CTK_WIDGETS_PLUGINS_EXPORT ctkSettingsWidgetPlugin :
+  public QObject,
+  public ctkWidgetsAbstractPlugin
+{
+  Q_OBJECT
+
+public:
+  ctkSettingsWidgetPlugin(QObject *_parent = 0);
+  
+  QWidget *createWidget(QWidget *_parent);
+  QString  domXml() const;
+  QIcon    icon() const;
+  QString  includeFile() const;
+  bool     isContainer() const;
+  QString  name() const;
+};
+
+#endif

+ 5 - 1
Libs/Widgets/Plugins/ctkWidgetsPlugins.h

@@ -44,9 +44,11 @@
 #include "ctkMenuButtonPlugin.h"
 #include "ctkRangeSliderPlugin.h"
 #include "ctkRangeWidgetPlugin.h"
+#include "ctkSettingsPanelPlugin.h"
+#include "ctkSettingsWidgetPlugin.h"
+#include "ctkSliderWidgetPlugin.h"
 #include "ctkTransferFunctionViewPlugin.h"
 #include "ctkTreeComboBoxPlugin.h"
-#include "ctkSliderWidgetPlugin.h"
 #include "ctkWorkflowButtonBoxWidgetPlugin.h"
 #include "ctkWorkflowWidgetStepPlugin.h"
 
@@ -79,6 +81,8 @@ public:
             << new ctkMenuButtonPlugin
             << new ctkRangeSliderPlugin
             << new ctkRangeWidgetPlugin
+            << new ctkSettingsPanelPlugin
+            << new ctkSettingsWidgetPlugin
             << new ctkSliderWidgetPlugin
             << new ctkTransferFunctionViewPlugin
             << new ctkTreeComboBoxPlugin