瀏覽代碼

Merge branch 'master' of github.com:commontk/CTK

Daniel Blezek 15 年之前
父節點
當前提交
bb16264c3a
共有 95 個文件被更改,包括 1502 次插入569 次删除
  1. 1 1
      Applications/ctkPluginBrowser/ctkPluginBrowser.cpp
  2. 2 0
      Applications/ctkPluginBrowser/ctkPluginBrowserEditors.cpp
  3. 9 1
      Applications/ctkPluginBrowser/ctkPluginResourcesTreeModel.cpp
  4. 4 0
      Applications/ctkPluginBrowser/ctkPluginTableModel.cpp
  5. 8 0
      Applications/ctkPluginBrowser/ctkQtResourcesTreeModel.cpp
  6. 5 2
      CMake/ctkDashboardDriverScript.cmake
  7. 5 0
      CMake/ctkDashboardScript.EXAMPLE.cmake
  8. 1 1
      CMakeExternals/CTKData.cmake
  9. 1 1
      CMakeExternals/DCMTK.cmake
  10. 1 1
      CMakeExternals/Log4Qt.cmake
  11. 1 1
      CMakeExternals/PythonQt.cmake
  12. 1 1
      CMakeExternals/VTK.cmake
  13. 1 1
      CMakeExternals/ZMQ.cmake
  14. 4 7
      CMakeLists.txt
  15. 2 0
      Libs/Core/ctkCommandLineParser.cpp
  16. 1 1
      Libs/Core/ctkDependencyGraph.h
  17. 1 1
      Libs/Core/ctkTransferFunctionRepresentation.cpp
  18. 2 1
      Libs/PluginFramework/EventBus/ctkEvent.cpp
  19. 1 1
      Libs/PluginFramework/EventBus/ctkEvent.h
  20. 47 46
      Libs/PluginFramework/ctkLDAPSearchFilter.cpp
  21. 1 1
      Libs/PluginFramework/ctkPlugin.cpp
  22. 1 0
      Libs/PluginFramework/ctkPluginArchive.cpp
  23. 1 1
      Libs/PluginFramework/ctkPluginDatabase.cpp
  24. 1 1
      Libs/PluginFramework/ctkPluginEvent.cpp
  25. 1 1
      Libs/PluginFramework/ctkPluginFrameworkEvent.cpp
  26. 4 0
      Libs/PluginFramework/ctkPluginStorage.cpp
  27. 1 0
      Libs/PluginFramework/ctkServiceRegistration.cpp
  28. 1 1
      Libs/PluginFramework/ctkServiceRegistrationPrivate.cpp
  29. 2 2
      Libs/PluginFramework/ctkServices.cpp
  30. 2 0
      Libs/Scripting/Python/Widgets/ctkPythonShell.cpp
  31. 4 0
      Libs/Visualization/VTK/Core/Testing/Cpp/CMakeLists.txt
  32. 147 0
      Libs/Visualization/VTK/Core/Testing/Cpp/ctkVTKConnectionTest1.cpp
  33. 58 0
      Libs/Visualization/VTK/Core/Testing/Cpp/ctkVTKObjectEventsObserverTest1.cpp
  34. 1 0
      Libs/Visualization/VTK/Core/Testing/Cpp/ctkVTKObjectTest1.cpp
  35. 12 5
      Libs/Visualization/VTK/Core/Testing/Cpp/ctkVTKObjectTestHelper.cpp
  36. 2 1
      Libs/Visualization/VTK/Core/Testing/Cpp/ctkVTKObjectTestHelper.h
  37. 4 1
      Libs/Visualization/VTK/Core/ctkVTKCompositeFunction.cpp
  38. 117 108
      Libs/Visualization/VTK/Core/ctkVTKConnection.cpp
  39. 23 18
      Libs/Visualization/VTK/Core/ctkVTKConnection.h
  40. 10 33
      Libs/Visualization/VTK/Core/ctkVTKObjectEventsObserver.cpp
  41. 0 5
      Libs/Visualization/VTK/Core/ctkVTKObjectEventsObserver.h
  42. 2 0
      Libs/Visualization/VTK/Core/ctkVTKPiecewiseFunction.cpp
  43. 19 10
      Libs/Visualization/VTK/Widgets/Testing/Cpp/CMakeLists.txt
  44. 75 0
      Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkTransferFunctionBarsItemTest1.cpp
  45. 14 5
      Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkTransferFunctionWidgetTest1.cpp
  46. 13 4
      Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkTransferFunctionWidgetTest2.cpp
  47. 13 4
      Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkTransferFunctionWidgetTest3.cpp
  48. 13 4
      Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkTransferFunctionWidgetTest4.cpp
  49. 7 6
      Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkTransferFunctionWidgetTest5.cpp
  50. 88 0
      Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKRenderViewTest1.cpp
  51. 96 0
      Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKSliceViewTest1.cpp
  52. 22 0
      Libs/Visualization/VTK/Widgets/ctkVTKRenderView.cpp
  53. 3 0
      Libs/Visualization/VTK/Widgets/ctkVTKRenderView.h
  54. 20 4
      Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp
  55. 14 3
      Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h
  56. 9 7
      Libs/Widgets/CMakeLists.txt
  57. 3 3
      Libs/Widgets/Plugins/CMakeLists.txt
  58. 1 1
      Libs/Widgets/Plugins/ctkCollapsibleButtonPlugin.cpp
  59. 1 1
      Libs/Widgets/Plugins/ctkCollapsibleGroupBoxPlugin.cpp
  60. 1 1
      Libs/Widgets/Plugins/ctkColorPickerButtonPlugin.cpp
  61. 1 1
      Libs/Widgets/Plugins/ctkComboBoxPlugin.cpp
  62. 1 1
      Libs/Widgets/Plugins/ctkCoordinatesWidgetPlugin.cpp
  63. 1 1
      Libs/Widgets/Plugins/ctkDirectoryButtonPlugin.cpp
  64. 1 1
      Libs/Widgets/Plugins/ctkDoubleRangeSliderPlugin.cpp
  65. 1 1
      Libs/Widgets/Plugins/ctkDoubleSliderPlugin.cpp
  66. 1 1
      Libs/Widgets/Plugins/ctkDynamicSpacerPlugin.cpp
  67. 1 1
      Libs/Widgets/Plugins/ctkFittedTextBrowserPlugin.cpp
  68. 1 1
      Libs/Widgets/Plugins/ctkMatrixWidgetPlugin.cpp
  69. 1 1
      Libs/Widgets/Plugins/ctkMenuButtonPlugin.cpp
  70. 1 1
      Libs/Widgets/Plugins/ctkRangeWidgetPlugin.cpp
  71. 1 1
      Libs/Widgets/Plugins/ctkSliderSpinBoxWidgetPlugin.cpp
  72. 14 14
      Libs/Widgets/Plugins/ctkTransferFunctionWidgetPlugin.cpp
  73. 4 4
      Libs/Widgets/Plugins/ctkTransferFunctionWidgetPlugin.h
  74. 1 1
      Libs/Widgets/Plugins/ctkTreeComboBoxPlugin.cpp
  75. 4 4
      Libs/Widgets/Plugins/ctkWidgetsPlugins.h
  76. 8 7
      Libs/Widgets/Resources/UI/ctkRangeWidget.ui
  77. 6 0
      Libs/Widgets/Resources/UI/ctkSliderSpinBoxWidget.ui
  78. 2 0
      Libs/Widgets/Testing/Cpp/CMakeLists.txt
  79. 61 0
      Libs/Widgets/Testing/Cpp/ctkFileDialogTest1.cpp
  80. 5 0
      Libs/Widgets/ctkCollapsibleButton.h
  81. 154 0
      Libs/Widgets/ctkFileDialog.cpp
  82. 58 0
      Libs/Widgets/ctkFileDialog.h
  83. 1 0
      Libs/Widgets/ctkRangeSlider.cpp
  84. 22 3
      Libs/Widgets/ctkRangeWidget.cpp
  85. 6 0
      Libs/Widgets/ctkRangeWidget.h
  86. 108 28
      Libs/Widgets/ctkTransferFunctionBarsItem.cpp
  87. 2 2
      Libs/Widgets/ctkTransferFunctionControlPointsItem.cpp
  88. 1 1
      Libs/Widgets/ctkTransferFunctionItem.cpp
  89. 98 0
      Libs/Widgets/ctkTransferFunctionView.cpp
  90. 7 11
      Libs/Widgets/ctkTransferFunctionWidget.h
  91. 0 184
      Libs/Widgets/ctkTransferFunctionWidget.cpp
  92. 6 1
      Plugins/org.commontk.eventbus/ctkEventBusImpl.cpp
  93. 7 0
      Plugins/org.commontk.eventbus/ctkEventBusPlugin.cpp
  94. 1 0
      Plugins/org.commontk.eventbus/ctkEventHandlerWrapper_p.h
  95. 10 0
      SuperBuild.cmake

+ 1 - 1
Applications/ctkPluginBrowser/ctkPluginBrowser.cpp

@@ -130,7 +130,7 @@ void ctkPluginBrowser::pluginDoubleClicked(const QModelIndex& index)
 
 void ctkPluginBrowser::qtResourceDoubleClicked(const QModelIndex& index)
 {
-
+  Q_UNUSED(index)
 }
 
 void ctkPluginBrowser::dbResourceDoubleClicked(const QModelIndex& index)

+ 2 - 0
Applications/ctkPluginBrowser/ctkPluginBrowserEditors.cpp

@@ -38,6 +38,8 @@ ctkPluginBrowserEditors::ctkPluginBrowserEditors(QWidget* editorArea)
 void ctkPluginBrowserEditors::openEditor(const QString &location, const QByteArray& content,
                                  const QString& title, const QString& tooltip)
 {
+  Q_UNUSED(tooltip)
+
   if (editorLocations.contains(location))
   {
     int index = editorLocations.indexOf(location);

+ 9 - 1
Applications/ctkPluginBrowser/ctkPluginResourcesTreeModel.cpp

@@ -84,6 +84,8 @@ ctkPluginResourceTreeItem::~ctkPluginResourceTreeItem()
 
 ctkPluginResourceTreeItem* ctkPluginResourceTreeItem::child(int row)
 {
+  Q_UNUSED(row)
+
   return 0;
 }
 
@@ -190,7 +192,7 @@ QVariant ctkPluginResourcesTreeModel::data(const QModelIndex &index, int role) c
   if (!index.isValid())
     return QVariant();
 
-  if (role == Qt::DisplayRole | role == Qt::UserRole)
+  if ((role == Qt::DisplayRole) | (role == Qt::UserRole))
   {
     ctkPluginResourceTreeItem* item = static_cast<ctkPluginResourceTreeItem*>(index.internalPointer());
     return item->data(role);
@@ -210,6 +212,10 @@ Qt::ItemFlags ctkPluginResourcesTreeModel::flags(const QModelIndex &index) const
 QVariant ctkPluginResourcesTreeModel::headerData(int section, Qt::Orientation orientation,
                    int role) const
 {
+  Q_UNUSED(section)
+  Q_UNUSED(orientation)
+  Q_UNUSED(role)
+
   return QVariant();
 }
 
@@ -267,5 +273,7 @@ int ctkPluginResourcesTreeModel::rowCount(const QModelIndex &parent) const
 
 int ctkPluginResourcesTreeModel::columnCount(const QModelIndex &parent) const
 {
+  Q_UNUSED(parent)
+
   return 1;
 }

+ 4 - 0
Applications/ctkPluginBrowser/ctkPluginTableModel.cpp

@@ -82,11 +82,15 @@ QVariant ctkPluginTableModel::headerData(int section, Qt::Orientation orientatio
 
 int ctkPluginTableModel::columnCount(const QModelIndex& parent) const
 {
+  Q_UNUSED(parent)
+
   return 3;
 }
 
 int ctkPluginTableModel::rowCount(const QModelIndex& parent) const
 {
+  Q_UNUSED(parent)
+
   return plugins.size();
 }
 

+ 8 - 0
Applications/ctkPluginBrowser/ctkQtResourcesTreeModel.cpp

@@ -81,6 +81,8 @@ ctkQtResourceTreeItem::~ctkQtResourceTreeItem()
 
 ctkQtResourceTreeItem* ctkQtResourceTreeItem::child(int row)
 {
+  Q_UNUSED(row)
+
   return 0;
 }
 
@@ -198,6 +200,10 @@ Qt::ItemFlags ctkQtResourcesTreeModel::flags(const QModelIndex &index) const
 QVariant ctkQtResourcesTreeModel::headerData(int section, Qt::Orientation orientation,
                    int role) const
 {
+  Q_UNUSED(section)
+  Q_UNUSED(orientation)
+  Q_UNUSED(role)
+
   return QVariant();
 }
 
@@ -250,5 +256,7 @@ int ctkQtResourcesTreeModel::rowCount(const QModelIndex &parent) const
 
 int ctkQtResourcesTreeModel::columnCount(const QModelIndex &parent) const
 {
+  Q_UNUSED(parent)
+
   return 1;
 }

+ 5 - 2
CMake/ctkDashboardDriverScript.cmake

@@ -59,7 +59,10 @@ foreach(var ${expected_variables})
   endif()
 endforeach()
 
-set(git_repository http://github.com/commontk/CTK.git)
+# If the dashscript doesn't define a GIT_REPOSITORY variable, let's define it here.
+if (NOT DEFINED GIT_REPOSITORY OR GIT_REPOSITORY STREQUAL "")
+  set(GIT_REPOSITORY http://github.com/commontk/CTK.git)
+endif()
 
 # Should binary directory be cleaned?
 set(empty_binary_directory FALSE)
@@ -98,7 +101,7 @@ if(empty_binary_directory)
 endif()
 
 if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}")
-  set(CTEST_CHECKOUT_COMMAND "${CTEST_GIT_COMMAND} clone ${git_repository} ${CTEST_SOURCE_DIRECTORY}")
+  set(CTEST_CHECKOUT_COMMAND "${CTEST_GIT_COMMAND} clone ${GIT_REPOSITORY} ${CTEST_SOURCE_DIRECTORY}")
 endif()
 
 set(CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}")

+ 5 - 0
CMake/ctkDashboardScript.EXAMPLE.cmake

@@ -77,6 +77,11 @@ find_program(CTEST_COVERAGE_COMMAND NAMES gcov)
 find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
 find_program(CTEST_GIT_COMMAND NAMES git)
 
+#
+# Git repository - Overwrite the default value provided by the driver script
+#
+# set(GIT_REPOSITORY http://github.com/YOURUSERNAME/CTK.git)
+
 ##########################################
 # WARNING: DO NOT EDIT BEYOND THIS POINT #
 ##########################################

+ 1 - 1
CMakeExternals/CTKData.cmake

@@ -14,7 +14,7 @@ IF(BUILD_TESTING)
   #   MESSAGE(STATUS "Adding project:${proj}")
     SET(CTKData_DEPENDS ${proj})
     ExternalProject_Add(${proj}
-        GIT_REPOSITORY git://github.com/commontk/CTKData.git
+        GIT_REPOSITORY ${git_protocol}://github.com/commontk/CTKData.git
         CONFIGURE_COMMAND ""
         BUILD_COMMAND ""
         INSTALL_COMMAND ""

+ 1 - 1
CMakeExternals/DCMTK.cmake

@@ -17,7 +17,7 @@ IF(${add_project})
     SET(DCMTK_DEPENDS ${proj})
 
     ExternalProject_Add(${proj}
-        GIT_REPOSITORY "git://github.com/commontk/DCMTK.git"
+        GIT_REPOSITORY "${git_protocol}://github.com/commontk/DCMTK.git"
         CMAKE_GENERATOR ${gen}
         BUILD_COMMAND ""
         CMAKE_ARGS

+ 1 - 1
CMakeExternals/Log4Qt.cmake

@@ -15,7 +15,7 @@ IF(${add_project})
 #     MESSAGE(STATUS "Adding project:${proj}")
     SET(Log4Qt_DEPENDS ${proj})
     ExternalProject_Add(${proj}
-        GIT_REPOSITORY "git://github.com/commontk/Log4Qt.git"
+        GIT_REPOSITORY "${git_protocol}://github.com/commontk/Log4Qt.git"
         GIT_TAG "patched"
         CMAKE_GENERATOR ${gen}
         BUILD_COMMAND ""

+ 1 - 1
CMakeExternals/PythonQt.cmake

@@ -22,7 +22,7 @@ IF(${add_project})
     ENDIF()
       
     ExternalProject_Add(${proj}
-      GIT_REPOSITORY "git://github.com/commontk/PythonQt.git"
+      GIT_REPOSITORY "${git_protocol}://github.com/commontk/PythonQt.git"
       GIT_TAG "patched"
       CMAKE_GENERATOR ${gen}
       BUILD_COMMAND ""

+ 1 - 1
CMakeExternals/VTK.cmake

@@ -15,7 +15,7 @@ IF(${add_project})
 #     MESSAGE(STATUS "Adding project:${proj}")
     SET(VTK_DEPENDS ${proj})
     ExternalProject_Add(${proj}
-      GIT_REPOSITORY git://vtk.org/VTK.git
+      GIT_REPOSITORY ${git_protocol}://vtk.org/VTK.git
       INSTALL_COMMAND ""
       CMAKE_GENERATOR ${gen}
       CMAKE_ARGS

+ 1 - 1
CMakeExternals/ZMQ.cmake

@@ -15,7 +15,7 @@ IF(${add_project})
   #   MESSAGE(STATUS "Adding project:${proj}")
     SET(ZMQ_DEPENDS ${proj})
     ExternalProject_Add(${proj}
-        GIT_REPOSITORY git://github.com/PatrickCheng/zeromq2.git
+        GIT_REPOSITORY ${git_protocol}://github.com/PatrickCheng/zeromq2.git
         INSTALL_COMMAND ""
         CMAKE_GENERATOR ${gen}
         CMAKE_ARGS

+ 4 - 7
CMakeLists.txt

@@ -217,18 +217,15 @@ MARK_AS_ADVANCED(ADDITIONAL_CXX_FLAGS)
 #-----------------------------------------------------------------------------
 # Set symbol visibility Flags
 #
-IF(CMAKE_CXX_COMPILER_ID)
-  # Set the default symbol visibility to hidden for gcc
-  IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
-    SET(VISIBILITY_CXX_FLAGS "-fvisibility=hidden -fvisibility-inlines-hidden")
-  ENDIF()
+IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+  SET(VISIBILITY_CXX_FLAGS "-fvisibility=hidden -fvisibility-inlines-hidden")
 ENDIF()
 
 #-----------------------------------------------------------------------------
 # Set coverage Flags
 #
 IF(WITH_COVERAGE)
-  IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+  IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
     SET(coverage_flags "-g -fprofile-arcs -ftest-coverage -O3 -DNDEBUG")
     SET(COVERAGE_CXX_FLAGS ${coverage_flags})
     SET(COVERAGE_C_FLAGS ${coverage_flags})
@@ -241,7 +238,7 @@ ENDIF()
 SET(CTK_C_FLAGS "${COVERAGE_C_FLAGS} ${ADDITIONAL_C_FLAGS}")
 SET(CTK_CXX_FLAGS "${VISIBILITY_CXX_FLAGS} ${COVERAGE_CXX_FLAGS} ${ADDITIONAL_CXX_FLAGS}")
 
-IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
   SET(cflags "-Wall -Wextra -Wpointer-arith -Winvalid-pch -Wcast-align -Wwrite-strings -D_FORTIFY_SOURCE=2")
   ctkFunctionCheckCompilerFlags("-fdiagnostics-show-option" cflags)
   ctkFunctionCheckCompilerFlags("-fstack-protector-all" cflags)

+ 2 - 0
Libs/Core/ctkCommandLineParser.cpp

@@ -23,6 +23,7 @@ public:
     this->IgnoreRest = ignoreRest;
     this->NumberOfParametersToProcess = 0;
     }
+  virtual ~CommandLineParserArgumentDescriptionBase(){}
   virtual bool addParameter(const QString& value) = 0;
   QString helpText(int fieldWidth, const char charPad);
   QString LongArg;
@@ -89,6 +90,7 @@ QString CommandLineParserArgumentDescriptionBase::helpText(int fieldWidth, const
       this->RegularExpression = _REGEXP;                                                \
       this->ArgumentType = #_TYPE;                                                      \
       }                                                                                 \
+    virtual ~ CommandLineParser##_NAME##ArgumentDescription(){}                         \
      virtual bool addParameter(const QString& value);                                   \
     _TYPE* Variable;                                                                    \
     _TYPE DefaultValue;                                                                 \

+ 1 - 1
Libs/Core/ctkDependencyGraph.h

@@ -36,7 +36,7 @@ class CTK_CORE_EXPORT ctkDependencyGraph
 {
 public:
   ctkDependencyGraph(int nvertices);
-  ~ctkDependencyGraph();
+  virtual ~ctkDependencyGraph();
   
   void printAdditionalInfo();
   void printGraph();

+ 1 - 1
Libs/Core/ctkTransferFunctionRepresentation.cpp

@@ -191,7 +191,7 @@ void ctkTransferFunctionRepresentation::computeCurve()
     {
     return;
     }
-  qDebug() << "computeCurve" << d->rect();
+
   d->TransferFunction->range(d->WorldRangeX[0], d->WorldRangeX[1]);
   d->WorldRangeY[0] = this->posY(d->TransferFunction->minValue());
   d->WorldRangeY[1] = this->posY(d->TransferFunction->maxValue());

+ 2 - 1
Libs/PluginFramework/EventBus/ctkEvent.cpp

@@ -52,7 +52,7 @@ bool ctkEvent::operator==(const ctkEvent& other) const
   return false;
 }
 
-const QVariant& ctkEvent::property(const QString& name) const
+QVariant ctkEvent::property(const QString& name) const
 {
   return d->properties[name];
 }
@@ -69,6 +69,7 @@ const QString& ctkEvent::topic() const
 
 bool ctkEvent::matches(const ctkLDAPSearchFilter& filter) const
 {
+  Q_UNUSED(filter)
   // TODO
   return true;
 }

+ 1 - 1
Libs/PluginFramework/EventBus/ctkEvent.h

@@ -25,7 +25,7 @@
 
     bool operator==(const ctkEvent& other) const;
 
-    const QVariant& property(const QString& name) const;
+    QVariant property(const QString& name) const;
     QStringList propertyNames() const;
 
     const QString& topic() const;

+ 47 - 46
Libs/PluginFramework/ctkLDAPSearchFilter.cpp

@@ -22,63 +22,64 @@
 #include "ctkLDAPSearchFilter.h"
 
 
-  class ctkLDAPSearchFilterPrivate {
-  public:
+class ctkLDAPSearchFilterPrivate {
+public:
 
-    ctkLDAPSearchFilterPrivate()
-      : ref(1)
-    {}
+  ctkLDAPSearchFilterPrivate()
+    : ref(1)
+  {}
 
-    QAtomicInt ref;
+  QAtomicInt ref;
 
-  };
+};
 
-  ctkLDAPSearchFilter::ctkLDAPSearchFilter(const QString& filter)
-    : d(new ctkLDAPSearchFilterPrivate())
-  {
-
-  }
+ctkLDAPSearchFilter::ctkLDAPSearchFilter(const QString& filter)
+  : d(new ctkLDAPSearchFilterPrivate())
+{
+  Q_UNUSED(filter)
+}
 
-  ctkLDAPSearchFilter::ctkLDAPSearchFilter(const ctkLDAPSearchFilter& filter)
-    : d(filter.d)
-  {
-    d->ref.ref();
-  }
+ctkLDAPSearchFilter::ctkLDAPSearchFilter(const ctkLDAPSearchFilter& filter)
+  : d(filter.d)
+{
+  d->ref.ref();
+}
 
-  ctkLDAPSearchFilter::~ctkLDAPSearchFilter()
-  {
-    if (!d->ref.deref())
-      delete d;
-  }
+ctkLDAPSearchFilter::~ctkLDAPSearchFilter()
+{
+  if (!d->ref.deref())
+    delete d;
+}
 
-  bool ctkLDAPSearchFilter::match(const Dictionary& dictionary) const
-  {
-    return true;
-  }
+bool ctkLDAPSearchFilter::match(const Dictionary& dictionary) const
+{
+  Q_UNUSED(dictionary)
+  return true;
+}
 
-  bool ctkLDAPSearchFilter::matchCase(const Dictionary& dictionary) const
-  {
-    return true;
-  }
+bool ctkLDAPSearchFilter::matchCase(const Dictionary& dictionary) const
+{
+  Q_UNUSED(dictionary)
+  return true;
+}
 
-  bool ctkLDAPSearchFilter::operator==(const ctkLDAPSearchFilter& other) const
-  {
-    // TODO
-    return true;
-  }
+bool ctkLDAPSearchFilter::operator==(const ctkLDAPSearchFilter& other) const
+{
+  // TODO
+  Q_UNUSED(other)
+  return true;
+}
 
-  ctkLDAPSearchFilter& ctkLDAPSearchFilter::operator=(const ctkLDAPSearchFilter& filter)
+ctkLDAPSearchFilter& ctkLDAPSearchFilter::operator=(const ctkLDAPSearchFilter& filter)
+{
+  if (d != filter.d)
   {
-    if (d != filter.d)
-    {
-      if (!d->ref.deref())
-        delete d;
-
-      d = filter.d;
-      d->ref.ref();
-    }
-
-    return *this;
+    if (!d->ref.deref())
+      delete d;
 
+    d = filter.d;
+    d->ref.ref();
+  }
 
+  return *this;
 }

+ 1 - 1
Libs/PluginFramework/ctkPlugin.cpp

@@ -111,7 +111,7 @@
 
   void ctkPlugin::stop(const StopOptions& options)
   {
-
+    Q_UNUSED(options)
   }
 
   ctkPluginContext* ctkPlugin::getPluginContext() const

+ 1 - 0
Libs/PluginFramework/ctkPluginArchive.cpp

@@ -90,6 +90,7 @@
 
   void ctkPluginArchive::setStartLevel(int level)
   {
+    Q_UNUSED(level)
     //TODO
 //    if (startLevel != level)
 //    {

+ 1 - 1
Libs/PluginFramework/ctkPluginDatabase.cpp

@@ -242,7 +242,7 @@ void ctkPluginDatabase::updateDB()
             error == QtMobility::QServiceManager::ComponentNotFound))
       {
         throw ctkServiceException(QString("Removing service named ") + serviceName +
-                               " failed: " + QString::number(serviceManager.error()));
+                               " failed: " + QString::number(static_cast<unsigned int>(error)));
       }
     }
   }

+ 1 - 1
Libs/PluginFramework/ctkPluginEvent.cpp

@@ -30,7 +30,7 @@
   }
 
   ctkPluginEvent::ctkPluginEvent(const ctkPluginEvent& other)
-    : d(other.d)
+    : QObject(), d(other.d)
   {
 
   }

+ 1 - 1
Libs/PluginFramework/ctkPluginFrameworkEvent.cpp

@@ -41,7 +41,7 @@
   }
 
   ctkPluginFrameworkEvent::ctkPluginFrameworkEvent(const ctkPluginFrameworkEvent& other)
-    : d(other.d)
+    : QObject(), d(other.d)
   {
 
   }

+ 4 - 0
Libs/PluginFramework/ctkPluginStorage.cpp

@@ -54,12 +54,16 @@
 
   ctkPluginArchive* ctkPluginStorage::updatePluginArchive(ctkPluginArchive* old, const QString& localPath)
   {
+    Q_UNUSED(old)
+    Q_UNUSED(localPath)
     //return new BundleArchiveImpl((BundleArchiveImpl)old, is);
     return 0;
   }
 
   void ctkPluginStorage::replacePluginArchive(ctkPluginArchive* oldPA, ctkPluginArchive* newPA)
   {
+    Q_UNUSED(oldPA)
+    Q_UNUSED(newPA)
 //    int pos;
 //    long id = oldBA.getBundleId();
 //    synchronized (archives) {

+ 1 - 0
Libs/PluginFramework/ctkServiceRegistration.cpp

@@ -54,6 +54,7 @@
 
   void ctkServiceRegistration::setProperties(const ServiceProperties& properties)
   {
+    Q_UNUSED(properties)
 //    QMutexLocker lock(eventLock);
 //          Set before;
 //          // TBD, optimize the locking of services

+ 1 - 1
Libs/PluginFramework/ctkServiceRegistrationPrivate.cpp

@@ -25,7 +25,7 @@
   ctkServiceRegistrationPrivate::ctkServiceRegistrationPrivate(ctkServiceRegistration* sr,
                                                          ctkPluginPrivate* plugin, QObject* service,
                                                          const ServiceProperties& props)
-                               : q_ptr(sr), plugin(plugin), service(service), reference(new ctkServiceReference(this)),
+                               : q_ptr(sr), service(service), plugin(plugin), reference(new ctkServiceReference(this)),
                                properties(props), available(true), unregistering(false)
   {
 

+ 2 - 2
Libs/PluginFramework/ctkServices.cpp

@@ -146,7 +146,7 @@ ctkServiceRegistration* ctkServices::registerService(ctkPluginPrivate* plugin,
     }
   }
 
-  ctkServiceReference* r = res->getReference();
+  //ctkServiceReference* r = res->getReference();
   // TODO
   //Listeners l = bundle.fwCtx.listeners;
   //l.serviceChanged(l.getMatchingServiceListeners(r),
@@ -421,7 +421,7 @@ QList<ctkServiceRegistration*> ctkServices::getRegisteredByPlugin(ctkPluginPriva
   for (QHashIterator<ctkServiceRegistration*, QStringList> i(services); i.hasNext(); )
   {
     ctkServiceRegistration* sr = i.next().key();
-    if (sr->d_func()->plugin = p)
+    if ((sr->d_func()->plugin = p))
     {
       res.push_back(sr);
     }

+ 2 - 0
Libs/Scripting/Python/Widgets/ctkPythonShell.cpp

@@ -68,10 +68,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <ctkAbstractPythonManager.h>
 #include "ctkPythonShell.h"
 
+#ifdef __GNUC__
 // Disable warnings related to Python macros and functions
 // See http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html
 // Note: Ideally the incriminated functions and macros should be fixed upstream ...
 #pragma GCC diagnostic ignored "-Wold-style-cast"
+#endif
 
 //----------------------------------------------------------------------------
 class ctkPythonShellCompleter : public ctkConsoleWidgetCompleter

+ 4 - 0
Libs/Visualization/VTK/Core/Testing/Cpp/CMakeLists.txt

@@ -39,7 +39,9 @@ CONFIGURE_FILE(
 
 CREATE_TEST_SOURCELIST(Tests ${KIT}CppTests.cpp
   ctkVTKCommandOptionsTest1.cpp
+  ctkVTKConnectionTest1.cpp
   ctkVTKObjectTest1.cpp
+  ctkVTKObjectEventsObserverTest1.cpp
   #EXTRA_INCLUDE TestingMacros.h
   )
 
@@ -65,7 +67,9 @@ ENDMACRO( SIMPLE_TEST  )
 # Add Tests
 #
 
+SIMPLE_TEST( ctkVTKConnectionTest1 )
 SIMPLE_TEST( ctkVTKObjectTest1 )
+SIMPLE_TEST( ctkVTKObjectEventsObserverTest1 )
 
 ADD_TEST( ctkVTKCommandOptionsTest1 ${KIT_TESTS}
           ctkVTKCommandOptionsTest1 --help )

+ 147 - 0
Libs/Visualization/VTK/Core/Testing/Cpp/ctkVTKConnectionTest1.cpp

@@ -0,0 +1,147 @@
+
+// Qt includes
+#include <QApplication>
+#include <QDebug>
+#include <QList>
+#include <QTimer>
+
+// CTKVTK includes
+#include "ctkVTKConnection.h"
+
+// STD includes
+#include <cstdlib>
+#include <iostream>
+
+// VTK includes
+#include <vtkCallbackCommand.h>
+#include <vtkCommand.h>
+#include <vtkObject.h>
+#include <vtkSmartPointer.h>
+#include <vtkTimerLog.h>
+
+void doit(vtkObject* vtkNotUsed(obj), unsigned long vtkNotUsed(event),
+          void* client_data, void* vtkNotUsed(param))
+{
+  QTimer* t = reinterpret_cast<QTimer*>(client_data);
+  t->stop();
+}
+
+int ctkVTKConnectionTest1( int argc, char * argv [] )
+{
+  QApplication app(argc, argv);
+
+  int objects = 1000;
+  int events = 100;
+
+  vtkObject* obj = vtkObject::New();
+  vtkObject* obj2 = vtkObject::New();
+  vtkObject* obj3 = vtkObject::New();
+  vtkObject* obj4 = vtkObject::New();
+  vtkObject* obj5 = vtkObject::New();
+
+  QObject*   topObject = new QObject(0);
+  // It could be here any kind of Qt object, QTimer has a no op slot so use it
+  QTimer*    slotObject = new QTimer(topObject);
+
+  for (int i = 0; i < objects; ++i)
+    {
+    ctkVTKConnection* connection = new ctkVTKConnection(topObject);
+    connection->observeDeletion(false);
+    connection->setup(obj, vtkCommand::ModifiedEvent,
+                      slotObject, SLOT(stop()));
+
+    vtkCallbackCommand* callback = vtkCallbackCommand::New();
+    callback->SetClientData(slotObject);
+    callback->SetCallback(doit);
+
+    obj2->AddObserver(vtkCommand::ModifiedEvent, callback);
+    callback->Delete();
+
+    ctkVTKConnection* connection2 = new ctkVTKConnection(topObject);
+    connection2->observeDeletion(true);
+    connection2->setup(obj3, vtkCommand::ModifiedEvent,
+                      slotObject, SLOT(stop()));
+
+    ctkVTKConnection* connection3 = new ctkVTKConnection(topObject);
+    connection3->observeDeletion(false);
+    connection3->setup(obj4, vtkCommand::ModifiedEvent,
+                      new QTimer(topObject), SLOT(stop()));
+
+    ctkVTKConnection* connection4 = new ctkVTKConnection(topObject);
+    connection4->observeDeletion(true);
+    connection4->setup(obj5, vtkCommand::ModifiedEvent,
+                      slotObject, SLOT(stop()));
+    }
+
+  vtkSmartPointer<vtkTimerLog> timerLog =
+    vtkSmartPointer<vtkTimerLog>::New();
+
+  timerLog->StartTimer();
+  for (int i = 0; i < events; ++i)
+    {
+    obj->Modified();
+    }
+  timerLog->StopTimer();
+
+  double t1 = timerLog->GetElapsedTime();
+  qDebug() << events << "events listened by" << objects << "objects (ctkVTKConnection): " << t1 << "seconds";
+
+  // Callback only
+
+  vtkSmartPointer<vtkTimerLog> timerLog2 =
+    vtkSmartPointer<vtkTimerLog>::New();
+  timerLog2->StartTimer();
+  for (int i = 0; i < events; ++i)
+    {
+    obj2->Modified();
+    }
+  timerLog2->StopTimer();
+
+  double t2 = timerLog2->GetElapsedTime();
+  qDebug() << events << "events listened by" << objects <<"objects (vtkCallbacks): " << t2 << "seconds";
+  double ratio = t1 / t2;
+  qDebug() << "ctkVTKConnection / vtkCallbacks: " << ratio;
+
+  vtkSmartPointer<vtkTimerLog> timerLog3 =
+    vtkSmartPointer<vtkTimerLog>::New();
+
+  timerLog3->StartTimer();
+  for (int i = 0; i < events; ++i)
+    {
+    obj3->Modified();
+    }
+  timerLog3->StopTimer();
+
+  double t3 = timerLog3->GetElapsedTime();
+  qDebug() << events << "events listened by" << objects << "objects (observed ctkVTKConnection): " << t3 << "seconds";
+
+  vtkSmartPointer<vtkTimerLog> timerLog4 =
+    vtkSmartPointer<vtkTimerLog>::New();
+
+  timerLog4->StartTimer();
+  for (int i = 0; i < events; ++i)
+    {
+    obj4->Modified();
+    }
+  timerLog4->StopTimer();
+
+  double t4 = timerLog4->GetElapsedTime();
+  qDebug() << events << "events listened by" << objects << "objects (ctkVTKConnection, 1-1): " << t4 << "seconds";
+
+
+  obj->Delete();
+  obj2->Delete();
+  obj3->Delete();
+
+  delete topObject;
+
+  obj4->Delete();
+  obj5->Delete();
+
+  // Ideally a ratio ~= 1. but the ratio can be more in Debug mode... up to 2.
+  if (ratio > 2.)
+    {
+    return EXIT_FAILURE;
+    }
+  return EXIT_SUCCESS;
+}

+ 58 - 0
Libs/Visualization/VTK/Core/Testing/Cpp/ctkVTKObjectEventsObserverTest1.cpp

@@ -0,0 +1,58 @@
+
+// Qt includes
+#include <QApplication>
+#include <QDebug>
+#include <QList>
+#include <QTimer>
+
+// CTKVTK includes
+#include "ctkVTKObjectEventsObserver.h"
+
+// STD includes
+#include <cstdlib>
+#include <iostream>
+
+// VTK includes
+#include <vtkCallbackCommand.h>
+#include <vtkCommand.h>
+#include <vtkObject.h>
+#include <vtkSmartPointer.h>
+#include <vtkTimerLog.h>
+
+int ctkVTKObjectEventsObserverTest1( int argc, char * argv [] )
+{
+  QApplication app(argc, argv);
+  
+  int objects = 1000;
+  int events = 100;
+  
+  vtkObject* obj = vtkObject::New();
+  QObject*   topObject = new QObject(0);
+  
+  ctkVTKObjectEventsObserver* observer = new ctkVTKObjectEventsObserver(topObject);
+  for (int i = 0; i < objects; ++i)
+    {
+    QTimer*    slotObject = new QTimer(topObject);
+    observer->addConnection(obj, vtkCommand::ModifiedEvent,
+      slotObject, SLOT(stop()));
+    }
+
+  vtkSmartPointer<vtkTimerLog> timerLog = 
+    vtkSmartPointer<vtkTimerLog>::New();
+  
+  timerLog->StartTimer();
+  for (int i = 0; i < events; ++i)
+    {
+    obj->Modified();
+    }
+  timerLog->StopTimer();
+  
+  double t1 = timerLog->GetElapsedTime();
+  qDebug() << events << "events listened by" << objects << "objects (ctkVTKConnection): " << t1 << "seconds";
+
+  obj->Delete();
+
+  delete topObject;
+  
+  return EXIT_SUCCESS;
+}

+ 1 - 0
Libs/Visualization/VTK/Core/Testing/Cpp/ctkVTKObjectTest1.cpp

@@ -20,3 +20,4 @@ int ctkVTKObjectTest1( int argc, char * argv [] )
     }
   return EXIT_SUCCESS;
 }
+

+ 12 - 5
Libs/Visualization/VTK/Core/Testing/Cpp/ctkVTKObjectTestHelper.cpp

@@ -28,7 +28,8 @@ ctkVTKObjectTestPrivate::ctkVTKObjectTestPrivate()
 }
 
 //------------------------------------------------------------------------------
-ctkVTKObjectTest::ctkVTKObjectTest()
+ctkVTKObjectTest::ctkVTKObjectTest(QObject* parentObject)
+:QObject(parentObject)
 {
   CTK_INIT_PRIVATE(ctkVTKObjectTest);
 }
@@ -224,29 +225,35 @@ void ctkVTKObjectTest::resetSlotCalls()
 }
 
 //------------------------------------------------------------------------------
+void ctkVTKObjectTest::emitSignalEmitted()
+{
+  emit signalEmitted();
+}
+
+//------------------------------------------------------------------------------
 void ctkVTKObjectTest::onVTKObjectModifiedPublic()
 {
-  qDebug() << __FUNCTION__;
+  //qDebug() << __FUNCTION__;
   ctk_d()->PublicSlotCalled = true;
 }
 
 //------------------------------------------------------------------------------
 void ctkVTKObjectTest::deleteConnection()
 {
-  qDebug() << __FUNCTION__;
+  //qDebug() << __FUNCTION__;
   this->qvtkDisconnect(0, vtkCommand::NoEvent, 0, 0);
 }
 
 //------------------------------------------------------------------------------
 void ctkVTKObjectTest::onVTKObjectModifiedProtected()
 {
-  qDebug() << __FUNCTION__;
+  //qDebug() << __FUNCTION__;
   ctk_d()->ProtectedSlotCalled = true;
 }
 
 //------------------------------------------------------------------------------
 void ctkVTKObjectTest::onVTKObjectModifiedPrivate()
 {
-  qDebug() << __FUNCTION__;
+  //qDebug() << __FUNCTION__;
   ctk_d()->PrivateSlotCalled = true;
 }

+ 2 - 1
Libs/Visualization/VTK/Core/Testing/Cpp/ctkVTKObjectTestHelper.h

@@ -17,7 +17,7 @@ class ctkVTKObjectTest: public QObject
   Q_OBJECT
   QVTK_OBJECT
 public:
-  ctkVTKObjectTest();
+  ctkVTKObjectTest(QObject* parent = 0);
 
   bool test();
 
@@ -27,6 +27,7 @@ public:
 
   void resetSlotCalls();
 
+  void emitSignalEmitted();
 public slots:
   void onVTKObjectModifiedPublic();
   void deleteConnection();

+ 4 - 1
Libs/Visualization/VTK/Core/ctkVTKCompositeFunction.cpp

@@ -156,9 +156,10 @@ ctkControlPoint* ctkVTKCompositeFunction::controlPoint(int index)const
 
   double valuesPWF[4];
   double valuesCTF[6];
+#ifndef QT_NO_DEBUG
   double* rangePWF = d->PiecewiseFunction->GetRange();
   double* rangeCTF = d->ColorTransferFunction->GetRange();
-
+#endif
   d->PiecewiseFunction->GetNodeValue(index, valuesPWF);
   d->ColorTransferFunction->GetNodeValue(index, valuesCTF);
 
@@ -317,7 +318,9 @@ int ctkVTKCompositeFunction::insertControlPoint(qreal pos)
       d->ColorTransferFunction->AddRGBPoint( pos, color[0], color[1], color[2] );
 
   // Add point to piecewise
+#ifndef QT_NO_DEBUG
   int indexPiecewise =
+#endif
       d->PiecewiseFunction->AddPoint( pos, 0);
 
   // check index

+ 117 - 108
Libs/Visualization/VTK/Core/ctkVTKConnection.cpp

@@ -20,6 +20,7 @@
 
 // Qt includes
 #include <QDebug>
+#include <QPointer>
 #include <QRegExp>
 #include <QString>
 #include <QTextStream>
@@ -65,7 +66,7 @@ public:
 
   /// 
   /// Called by 'DoCallback' to emit signal
-  void Execute(vtkObject* vtk_obj, unsigned long vtk_event, void* client_data, void* call_data);
+  void execute(vtkObject* vtk_obj, unsigned long vtk_event, void* client_data, void* call_data);
 
   vtkSmartPointer<vtkCallbackCommand> Callback;
   vtkObject*                          VTKObject;
@@ -77,7 +78,7 @@ public:
   bool                                Connected;
   bool                                Blocked;
   QString                             Id;
-  bool                                AboutToBeDeleted;
+  bool                                ObserveDeletion;
 };
 
 //-----------------------------------------------------------------------------
@@ -97,19 +98,12 @@ ctkVTKConnectionPrivate::ctkVTKConnectionPrivate()
   this->Connected   = false;
   this->Blocked     = false;
   this->Id          = convertPointerToString(this);
-  this->AboutToBeDeleted = false;
+  this->ObserveDeletion = false;
 }
 
 //-----------------------------------------------------------------------------
 ctkVTKConnectionPrivate::~ctkVTKConnectionPrivate()
 {
-  /*
-  if(this->VTKObject && this->Connected)
-    {
-    this->VTKObject->RemoveObserver(this->Callback);
-    //Qt takes care of disconnecting slots
-    }
-  */
 
 }
 
@@ -118,21 +112,21 @@ void ctkVTKConnectionPrivate::connect()
 {
   CTK_P(ctkVTKConnection);
   
-  if (this->Connected) 
+  if (this->Connected)
     {
     qDebug() << "ctkVTKConnection already connected.";
-    return; 
+    return;
     }
 
   switch (this->SlotType)
     {
     case ctkVTKConnectionPrivate::ARG_VTKOBJECT_AND_VTKOBJECT:
       QObject::connect(p, SIGNAL(emitExecute(vtkObject*, vtkObject*)),
-                       this->QtObject, this->QtSlot.toLatin1().data());
+        this->QtObject, this->QtSlot.toLatin1().data(), Qt::AutoConnection);
       break;
     case ctkVTKConnectionPrivate::ARG_VTKOBJECT_VOID_ULONG_VOID:
       QObject::connect(p, SIGNAL(emitExecute(vtkObject*, void*, unsigned long, void*)),
-                       this->QtObject, this->QtSlot.toLatin1().data());
+                       this->QtObject, this->QtSlot.toLatin1().data(), Qt::AutoConnection);
       break;
     default:
       Q_ASSERT(false);
@@ -147,15 +141,17 @@ void ctkVTKConnectionPrivate::connect()
   this->VTKObject->AddObserver(this->VTKEvent, this->Callback, this->Priority);
 
   // If necessary, observe vtk DeleteEvent
-  if(this->VTKEvent != vtkCommand::DeleteEvent)
+  if(this->ObserveDeletion)
     {
-    this->VTKObject->AddObserver(vtkCommand::DeleteEvent, this->Callback);
+    // don't observe it twice
+    if (this->VTKEvent != vtkCommand::DeleteEvent)
+      {
+      this->VTKObject->AddObserver(vtkCommand::DeleteEvent, this->Callback);
+      }
+    // Remove itself from its parent when vtkObject is deleted
+    QObject::connect(this->QtObject, SIGNAL(destroyed(QObject*)), 
+                     p, SLOT(qobjectDeleted()));
     }
-
-  // Remove itself from its parent when vtkObject is deleted
-  QObject::connect(this->QtObject, SIGNAL(destroyed(QObject*)), 
-                   p, SLOT(deleteConnection()));
-
   this->Connected = true;
 }
 
@@ -166,33 +162,42 @@ void ctkVTKConnectionPrivate::disconnect()
   
   if (!this->Connected) 
     { 
-    Q_ASSERT(this->Connected);
     return; 
     }
 
-  this->VTKObject->RemoveObserver(this->Callback);
+  if (this->QtObject)
+    {
+    switch (this->SlotType)
+      {
+      case ctkVTKConnectionPrivate::ARG_VTKOBJECT_AND_VTKOBJECT:
+        QObject::disconnect(p, SIGNAL(emitExecute(vtkObject*, vtkObject*)),
+                            this->QtObject,this->QtSlot.toLatin1().data());
+        break;
+      case ctkVTKConnectionPrivate::ARG_VTKOBJECT_VOID_ULONG_VOID:
+        QObject::disconnect(p, SIGNAL(emitExecute(vtkObject*, void*, unsigned long, void*)),
+                            this->QtObject, this->QtSlot.toLatin1().data());
+        break;
+      default:
+        Q_ASSERT(false);
+        qCritical() << "Failed to disconnect - "
+                    << "The slot (" << this->QtSlot <<  ") owned by "
+                    << "QObject(" << this->QtObject->objectName() << ")"
+                    << " seems to have a wrong signature.";
+        break;
+      }
+    }
 
-  switch (this->SlotType)
+  if (this->VTKObject)
     {
-    case ctkVTKConnectionPrivate::ARG_VTKOBJECT_AND_VTKOBJECT:
-      QObject::disconnect(p, SIGNAL(emitExecute(vtkObject*, vtkObject*)),
-                          this->QtObject,this->QtSlot.toLatin1().data());
-      break;
-    case ctkVTKConnectionPrivate::ARG_VTKOBJECT_VOID_ULONG_VOID:
-      QObject::disconnect(p, SIGNAL(emitExecute(vtkObject*, void*, unsigned long, void*)),
-                          this->QtObject, this->QtSlot.toLatin1().data());
-      break;
-    default:
-      Q_ASSERT(false);
-      qCritical() << "Failed to disconnect - "
-                  << "The slot (" << this->QtSlot <<  ") owned by "
-                  << "QObject(" << this->QtObject->objectName() << ")"
-                  << " seems to have a wrong signature.";
-      break;
+    this->VTKObject->RemoveObserver(this->Callback);
     }
 
-  QObject::disconnect(this->QtObject, SIGNAL(destroyed(QObject*)),
-                      p, SLOT(deleteConnection()));
+  if (this->ObserveDeletion && this->QtObject)
+    {
+    //this->VTKObject->AddObserver(vtkCommand::DeleteEvent, this->Callback); has already been removed
+    QObject::disconnect(this->QtObject, SIGNAL(destroyed(QObject*)),
+                        p, SIGNAL(isBroke()));
+    }
 
   this->Connected = false;
 }
@@ -210,30 +215,43 @@ ctkVTKConnection::ctkVTKConnection(QObject* _parent):
 //-----------------------------------------------------------------------------
 ctkVTKConnection::~ctkVTKConnection()
 {
-  this->setEnabled(false);
+  CTK_D(ctkVTKConnection);
+  if (d->ObserveDeletion)
+    {
+    d->disconnect();
+    }
 }
 
 //-----------------------------------------------------------------------------
-CTK_GET_CXX(ctkVTKConnection, QString, id, Id);
+QString ctkVTKConnection::id()const
+{
+  CTK_D(const ctkVTKConnection);
+  return d->Id;
+}
 
 //-----------------------------------------------------------------------------
-void ctkVTKConnection::printAdditionalInfo()
+QObject* ctkVTKConnection::object()const
 {
-  this->Superclass::dumpObjectInfo();
+  CTK_D(const ctkVTKConnection);
+  return const_cast<QObject*>(d->QtObject);
+}
 
-  CTK_D(ctkVTKConnection);
-  
-  qDebug() << "ctkVTKConnection:" << this << endl
-           << "Id:" << d->Id << endl
-           << " VTKObject:" << d->VTKObject->GetClassName()
-             << "(" << d->VTKObject << ")" << endl
-           << " QtObject:" << d->QtObject << endl
-           << " VTKEvent:" << d->VTKEvent << endl
-           << " QtSlot:" << d->QtSlot << endl
-           << " SlotType:" << d->SlotType << endl
-           << " Priority:" << d->Priority << endl
-           << " Connected:" << d->Connected << endl
-           << " Blocked:" << d->Blocked;
+//-----------------------------------------------------------------------------
+QDebug operator<<(QDebug dbg, const ctkVTKConnection& connection)
+{
+  const ctkVTKConnectionPrivate* d = connection.ctk_d();
+  dbg.nospace() << "ctkVTKConnection:" << &connection << endl
+                << "Id:" << d->Id << endl
+                << " VTKObject:" << d->VTKObject->GetClassName()
+                << "(" << d->VTKObject << ")" << endl
+                << " QtObject:" << d->QtObject << endl
+                << " VTKEvent:" << d->VTKEvent << endl
+                << " QtSlot:" << d->QtSlot << endl
+                << " SlotType:" << d->SlotType << endl
+                << " Priority:" << d->Priority << endl
+                << " Connected:" << d->Connected << endl
+                << " Blocked:" << d->Blocked;
+  return dbg.space();
 }
 
 //-----------------------------------------------------------------------------
@@ -256,8 +274,8 @@ QString ctkVTKConnection::shortDescription(vtkObject* vtk_obj, unsigned long vtk
 }
 
 //-----------------------------------------------------------------------------
-bool ctkVTKConnection::ValidateParameters(vtkObject* vtk_obj, unsigned long vtk_event,
-                                        const QObject* qt_obj, QString qt_slot)
+bool ctkVTKConnection::isValid(vtkObject* vtk_obj, unsigned long vtk_event,
+                               const QObject* qt_obj, QString qt_slot)
 {
   Q_UNUSED(vtk_event);
   if (!vtk_obj)
@@ -276,12 +294,13 @@ bool ctkVTKConnection::ValidateParameters(vtkObject* vtk_obj, unsigned long vtk_
 }
 
 //-----------------------------------------------------------------------------
-void ctkVTKConnection::SetParameters(vtkObject* vtk_obj, unsigned long vtk_event,
-  const QObject* qt_obj, QString qt_slot, float priority)
+void ctkVTKConnection::setup(vtkObject* vtk_obj, unsigned long vtk_event,
+                             const QObject* qt_obj, QString qt_slot, 
+                             float priority)
 {
   CTK_D(ctkVTKConnection);
   
-  if (!Self::ValidateParameters(vtk_obj, vtk_event, qt_obj, qt_slot)) 
+  if (!Self::isValid(vtk_obj, vtk_event, qt_obj, qt_slot)) 
     { 
     return; 
     }
@@ -300,33 +319,7 @@ void ctkVTKConnection::SetParameters(vtkObject* vtk_obj, unsigned long vtk_event
     {
     d->SlotType = ctkVTKConnectionPrivate::ARG_VTKOBJECT_VOID_ULONG_VOID;
     }
-}
-
-//-----------------------------------------------------------------------------
-void ctkVTKConnection::setEnabled(bool enable)
-{
-  CTK_D(ctkVTKConnection);
-  
-  if (d->Connected == enable)
-    {
-    return;
-    }
-
-  if (enable)
-    {
-    d->connect();
-    }
-  else
-    {
-    d->disconnect();
-    }
-}
-
-//-----------------------------------------------------------------------------
-bool ctkVTKConnection::isEnabled()const
-{
-  CTK_D(const ctkVTKConnection);
-  return d->Connected;
+  d->connect();
 }
 
 //-----------------------------------------------------------------------------
@@ -374,14 +367,14 @@ bool ctkVTKConnection::isEqual(vtkObject* vtk_obj, unsigned long vtk_event,
 void ctkVTKConnectionPrivate::DoCallback(vtkObject* vtk_obj, unsigned long event,
                                  void* client_data, void* call_data)
 {
-  ctkVTKConnectionPrivate* conn = static_cast<ctkVTKConnectionPrivate*>(client_data);
+  ctkVTKConnectionPrivate* conn = reinterpret_cast<ctkVTKConnectionPrivate*>(client_data);
   Q_ASSERT(conn);
-  conn->Execute(vtk_obj, event, client_data, call_data);
+  conn->execute(vtk_obj, event, client_data, call_data);
 }
 
 //-----------------------------------------------------------------------------
 // callback from VTK to emit signal
-void ctkVTKConnectionPrivate::Execute(vtkObject* vtk_obj, unsigned long vtk_event,
+void ctkVTKConnectionPrivate::execute(vtkObject* vtk_obj, unsigned long vtk_event,
   void* client_data, void* call_data)
 {
   CTK_P(ctkVTKConnection);
@@ -391,13 +384,11 @@ void ctkVTKConnectionPrivate::Execute(vtkObject* vtk_obj, unsigned long vtk_even
     { 
     return; 
     }
-  if (vtk_event == vtkCommand::DeleteEvent)
-    {
-    this->AboutToBeDeleted = true;
-    }
 
-  if(vtk_event != vtkCommand::DeleteEvent ||
-     (vtk_event == vtkCommand::DeleteEvent && this->VTKEvent == vtkCommand::DeleteEvent))
+  QPointer<ctkVTKConnection> connection(p);
+  if(!this->ObserveDeletion ||
+     vtk_event != vtkCommand::DeleteEvent ||
+     this->VTKEvent == vtkCommand::DeleteEvent)
     {
     vtkObject* callDataAsVtkObject = 0;
     switch (this->SlotType)
@@ -429,19 +420,37 @@ void ctkVTKConnectionPrivate::Execute(vtkObject* vtk_obj, unsigned long vtk_even
       }
     }
 
-  if(vtk_event == vtkCommand::DeleteEvent)
+  if (!connection.isNull() &&
+      vtk_event == vtkCommand::DeleteEvent)
     {
-    this->AboutToBeDeleted = false;
-    p->deleteConnection();
+    p->vtkObjectDeleted();
     }
 }
 
-void ctkVTKConnection::deleteConnection()
+void ctkVTKConnection::observeDeletion(bool enable)
 {
   CTK_D(ctkVTKConnection);
-  if (d->AboutToBeDeleted)
-    {
-    return;
-    }
-  delete this;
+  d->ObserveDeletion = enable;
+}
+
+bool ctkVTKConnection::deletionObserved()const
+{
+  CTK_D(const ctkVTKConnection);
+  return d->ObserveDeletion;
+}
+
+void ctkVTKConnection::vtkObjectDeleted()
+{
+  CTK_D(ctkVTKConnection);
+  d->VTKObject = 0;
+  d->disconnect();
+  emit isBroke();
+}
+
+void ctkVTKConnection::qobjectDeleted()
+{
+  CTK_D(ctkVTKConnection);
+  d->QtObject = 0;
+  d->disconnect();
+  emit isBroke();
 }

+ 23 - 18
Libs/Visualization/VTK/Core/ctkVTKConnection.h

@@ -40,30 +40,24 @@ Q_OBJECT
 public:
   typedef QObject Superclass;
   explicit ctkVTKConnection(QObject* parent);
+  virtual ~ctkVTKConnection();
 
-  /// 
-  virtual void printAdditionalInfo();
+  ///
   QString shortDescription();
   static QString shortDescription(vtkObject* vtk_obj, unsigned long vtk_event,
     const QObject* qt_obj, QString qt_slot = "");
 
   /// 
-  void SetParameters(vtkObject* vtk_obj, unsigned long vtk_event,
-    const QObject* qt_obj, QString qt_slot, float priority);
+  void setup(vtkObject* vtk_obj, unsigned long vtk_event,
+    const QObject* qt_obj, QString qt_slot, float priority = 0.f);
 
   /// 
   /// Check the validity of the parameters. Parameters must be valid to add 
   /// a connection
-  static bool ValidateParameters(vtkObject* vtk_obj, unsigned long vtk_event,
+  static bool isValid(vtkObject* vtk_obj, unsigned long vtk_event,
     const QObject* qt_obj, QString qt_slot);
 
   /// 
-  /// Actually do the connection. Parameters must have been set prior to it
-  /// Disconnecting (enable = false) removes the connection.
-  void setEnabled(bool enable);
-  bool isEnabled()const;
-
-  /// 
   /// Temporarilly block any signals/slots. If the event is fired, the slot
   /// won't be called. You can restore the connection by calling SetBlocked
   /// with block = false.
@@ -76,12 +70,13 @@ public:
 
   /// 
   /// Return a string uniquely identifying the connection within the current process
-  QString id()const;
-public slots:
-  ///
-  /// Safe deletion
-  void deleteConnection();
+  QString  id()const;
+  QObject* object()const;
 
+  /// false by default, it is slower to observe vtk object deletion
+  void observeDeletion(bool enable);
+  bool deletionObserved()const;
+  
 signals:
   /// 
   /// The qt signal emited by the VTK Callback
@@ -93,11 +88,21 @@ signals:
   /// argument are matching:
   /// connect(obj1,SIGNAL(signalFunc(A,B,C,D)),obj2,SLOT(slotFunc(A)));
   void emitExecute(vtkObject* caller, void* call_data, unsigned long vtk_event, void* client_data);
-protected:
-  virtual ~ctkVTKConnection();
+
+  /// The signal is fired when the observed vtk object or the receiving qt 
+  /// object is deleted. It can conveniently connected to the deleteLater 
+  /// slot
+  void isBroke();
+
+protected slots:
+  void vtkObjectDeleted();
+  void qobjectDeleted();
 
 private:
   CTK_DECLARE_PRIVATE(ctkVTKConnection);
+  friend QDebug operator<<(QDebug dbg, const ctkVTKConnection& connection);
 };
 
+QDebug operator<<(QDebug dbg, const ctkVTKConnection& connection);
+
 #endif

+ 10 - 33
Libs/Visualization/VTK/Core/ctkVTKObjectEventsObserver.cpp

@@ -63,8 +63,8 @@ public:
     return ctk_p()->findChildren<ctkVTKConnection*>();
   }
   
-  bool                            AllEnabled;
-  bool                            AllBlocked;
+  bool AllBlocked;
+  bool ObserveDeletion;
 };
 
 //-----------------------------------------------------------------------------
@@ -83,39 +83,15 @@ void ctkVTKObjectEventsObserver::printAdditionalInfo()
   this->Superclass::dumpObjectInfo();
   CTK_D(ctkVTKObjectEventsObserver);
   qDebug() << "ctkVTKObjectEventsObserver:" << this << endl
-           << " AllEnabled:" << d->AllEnabled << endl
            << " AllBlocked:" << d->AllBlocked << endl
            << " Parent:" << (this->parent()?this->parent()->objectName():"NULL") << endl
            << " Connection count:" << d->connections().count();
 
   // Loop through all connection
-  foreach (ctkVTKConnection* connection, d->connections())
-    {
-    connection->printAdditionalInfo();
-    }
-}
-
-//-----------------------------------------------------------------------------
-bool ctkVTKObjectEventsObserver::allEnabled()const
-{
-  return ctk_d()->AllEnabled;
-}
-
-//-----------------------------------------------------------------------------
-void ctkVTKObjectEventsObserver::setAllEnabled(bool enable)
-{
-  CTK_D(ctkVTKObjectEventsObserver);
-  // FIXME: maybe a particular module has been enabled/disabled
-  if (d->AllEnabled == enable) 
-    { 
-    return; 
-    }
-  // Loop through VTKQtConnections to enable/disable
-  foreach(ctkVTKConnection* connection, d->connections())
+  foreach (const ctkVTKConnection* connection, d->connections())
     {
-    connection->setEnabled(enable);
+    qDebug() << *connection;
     }
-  d->AllEnabled = enable;
 }
 
 //-----------------------------------------------------------------------------
@@ -162,7 +138,7 @@ QString ctkVTKObjectEventsObserver::addConnection(vtkObject* vtk_obj, unsigned l
   const QObject* qt_obj, const char* qt_slot, float priority)
 {
   CTK_D(ctkVTKObjectEventsObserver);
-  if (!ctkVTKConnection::ValidateParameters(vtk_obj, vtk_event, qt_obj, qt_slot))
+  if (!ctkVTKConnection::isValid(vtk_obj, vtk_event, qt_obj, qt_slot))
     {
     qDebug() << "ctkVTKObjectEventsObserver::addConnection(...) - Invalid parameters - "
              << ctkVTKConnection::shortDescription(vtk_obj, vtk_event, qt_obj, qt_slot);
@@ -182,10 +158,10 @@ QString ctkVTKObjectEventsObserver::addConnection(vtkObject* vtk_obj, unsigned l
 
   // Instantiate a new connection, set its parameters and add it to the list
   ctkVTKConnection * connection = new ctkVTKConnection(this);
-  connection->SetParameters(vtk_obj, vtk_event, qt_obj, qt_slot, priority);
+  connection->observeDeletion(d->ObserveDeletion);
+  connection->setup(vtk_obj, vtk_event, qt_obj, qt_slot, priority);
 
   // If required, establish connection
-  connection->setEnabled(d->AllEnabled);
   connection->setBlocked(d->AllBlocked);
 
   return connection->id();
@@ -249,7 +225,7 @@ int ctkVTKObjectEventsObserver::removeConnection(vtkObject* vtk_obj, unsigned lo
   
   foreach (ctkVTKConnection* connection, connections)
     {
-    connection->deleteConnection();
+    delete connection;
     }
   return connections.count();
 }
@@ -260,8 +236,9 @@ int ctkVTKObjectEventsObserver::removeConnection(vtkObject* vtk_obj, unsigned lo
 //-----------------------------------------------------------------------------
 ctkVTKObjectEventsObserverPrivate::ctkVTKObjectEventsObserverPrivate()
 {
-  this->AllEnabled = true;
   this->AllBlocked = false;
+  // ObserveDeletion == false  hasn't been that well tested...
+  this->ObserveDeletion = true;
 }
 
 //-----------------------------------------------------------------------------

+ 0 - 5
Libs/Visualization/VTK/Core/ctkVTKObjectEventsObserver.h

@@ -50,11 +50,6 @@ public:
   virtual void printAdditionalInfo();
 
   /// 
-  /// Enable / Disable all ctkVTKConnections
-  void setAllEnabled( bool enable );
-  bool allEnabled()const;
-
-  /// 
   /// Add a connection, an Id allowing to uniquely identify the connection is also returned
   QString addConnection(vtkObject* vtk_obj, unsigned long vtk_event,
     const QObject* qt_obj, const char* qt_slot, float priority = 0.0);

+ 2 - 0
Libs/Visualization/VTK/Core/ctkVTKPiecewiseFunction.cpp

@@ -139,7 +139,9 @@ ctkControlPoint* ctkVTKPiecewiseFunction::controlPoint(int index)const
   Q_ASSERT(index >= 0 && index < this->count());
 
   double values[4];
+#ifndef QT_NO_DEBUG
   double* range = d->PiecewiseFunction->GetRange();
+#endif
   d->PiecewiseFunction->GetNodeValue(index, values);
 
   QVariant rangeY[2];

+ 19 - 10
Libs/Visualization/VTK/Widgets/Testing/Cpp/CMakeLists.txt

@@ -4,17 +4,22 @@ SET(KIT ${PROJECT_NAME})
 # Tests
 #
 SET(TEST_SOURCES
-  ctkTransferFunctionWidgetTest1.cpp
-  ctkTransferFunctionWidgetTest2.cpp
-  ctkTransferFunctionWidgetTest3.cpp
-  ctkTransferFunctionWidgetTest4.cpp
-  ctkTransferFunctionWidgetTest5.cpp
+  ctkTransferFunctionBarsItemTest1.cpp
+  ctkTransferFunctionViewTest1.cpp
+  ctkTransferFunctionViewTest2.cpp
+  ctkTransferFunctionViewTest3.cpp
+  ctkTransferFunctionViewTest4.cpp
+  ctkTransferFunctionViewTest5.cpp
   )
 
 #
 # Tests expecting CTKData to be set
 #
 IF(EXISTS "${CTKData_DIR}")
+  LIST(APPEND TEST_SOURCES
+    ctkVTKSliceViewTest1.cpp
+    ctkVTKRenderViewTest1.cpp
+    )
 ENDIF()
 
 CREATE_TEST_SOURCELIST(Tests ${KIT}CppTests.cpp
@@ -44,14 +49,18 @@ ENDMACRO( SIMPLE_TEST  )
 # Add Tests
 #
 
-SIMPLE_TEST( ctkTransferFunctionWidgetTest1 )
-SIMPLE_TEST( ctkTransferFunctionWidgetTest2 )
-SIMPLE_TEST( ctkTransferFunctionWidgetTest3 )
-SIMPLE_TEST( ctkTransferFunctionWidgetTest4 )
-SIMPLE_TEST( ctkTransferFunctionWidgetTest5 )
+SIMPLE_TEST( ctkTransferFunctionBarsItemTest1 )
+SIMPLE_TEST( ctkTransferFunctionViewTest1 )
+SIMPLE_TEST( ctkTransferFunctionViewTest2 )
+SIMPLE_TEST( ctkTransferFunctionViewTest3 )
+SIMPLE_TEST( ctkTransferFunctionViewTest4 )
+SIMPLE_TEST( ctkTransferFunctionViewTest5 )
 
 #
 # Add Tests expecting CTKData to be set
 #
 IF(EXISTS "${CTKData_DIR}")
+  #
+  SIMPLE_TEST( ctkVTKSliceViewTest1 )
+  SIMPLE_TEST( ctkVTKRenderViewTest1 )
 ENDIF()

+ 75 - 0
Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkTransferFunctionBarsItemTest1.cpp

@@ -0,0 +1,75 @@
+/*=========================================================================
+
+  Library:   CTK
+ 
+  Copyright (c) 2010  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.
+ 
+=========================================================================*/
+
+// Qt includes
+#include <QApplication>
+#include <QSharedPointer>
+#include <QTimer>
+
+// CTK includes
+#include "ctkTransferFunction.h"
+#include "ctkTransferFunctionBarsItem.h"
+#include "ctkTransferFunctionScene.h"
+#include "ctkTransferFunctionView.h"
+#include "ctkVTKHistogram.h"
+
+// VTK includes
+#include <vtkIntArray.h>
+#include <vtkSmartPointer.h>
+
+// STD includes
+#include <iostream>
+
+//-----------------------------------------------------------------------------
+int ctkTransferFunctionBarsItemTest1(int argc, char * argv [] )
+{
+  QApplication app(argc, argv);
+  
+  vtkSmartPointer<vtkIntArray> intArray = 
+    vtkSmartPointer<vtkIntArray>::New();
+  intArray->SetNumberOfComponents(1);
+  intArray->SetNumberOfTuples(20000);
+  for (int i = 0; i < 20000; ++i)
+    {
+    intArray->SetValue(i, rand() % 10);
+    }
+  QSharedPointer<ctkVTKHistogram> histogram = 
+    QSharedPointer<ctkVTKHistogram>(new ctkVTKHistogram(intArray));
+  histogram->build();
+  
+  ctkTransferFunctionView transferFunctionView;
+  
+  ctkTransferFunctionBarsItem * histogramItem = new ctkTransferFunctionBarsItem;
+  histogramItem->setTransferFunction(histogram.data());
+  histogramItem->setBarWidth(1.);
+  transferFunctionView.scene()->addItem(histogramItem);
+  
+  // the widget is not really shown here, only when app.exec() is called
+  transferFunctionView.show();
+  
+  QTimer autoExit;
+  if (argc < 2 || QString(argv[1]) != "-I")
+    {
+    QObject::connect(&autoExit, SIGNAL(timeout()), &app, SLOT(quit()));
+    autoExit.start(100);
+    }
+
+  return app.exec();
+}

+ 14 - 5
Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkTransferFunctionWidgetTest1.cpp

@@ -25,7 +25,9 @@
 
 // CTK includes
 #include "ctkTransferFunction.h"
-#include "ctkTransferFunctionWidget.h"
+#include "ctkTransferFunctionControlPointsItem.h"
+#include "ctkTransferFunctionGradientItem.h"
+#include "ctkTransferFunctionView.h"
 #include "ctkVTKColorTransferFunction.h"
 
 // VTK includes
@@ -36,7 +38,7 @@
 #include <iostream>
 
 //-----------------------------------------------------------------------------
-int ctkTransferFunctionWidgetTest1(int argc, char * argv [] )
+int ctkTransferFunctionViewTest1(int argc, char * argv [] )
 {
   QApplication app(argc, argv);
   
@@ -51,12 +53,19 @@ int ctkTransferFunctionWidgetTest1(int argc, char * argv [] )
 
   QSharedPointer<ctkTransferFunction> transferFunction = 
     QSharedPointer<ctkTransferFunction>(new ctkVTKColorTransferFunction(ctf));
-  ctkTransferFunctionWidget transferFunctionWidget(transferFunction.data(), 0);
+  ctkTransferFunctionView transferFunctionView(0);
+  ctkTransferFunctionGradientItem* gradient = 
+    new ctkTransferFunctionGradientItem(transferFunction.data());
+  ctkTransferFunctionControlPointsItem* controlPoints = 
+    new ctkTransferFunctionControlPointsItem(transferFunction.data());
+  
+  transferFunctionView.scene()->addItem(gradient);
+  transferFunctionView.scene()->addItem(controlPoints);
   // the widget is not really shown here, only when app.exec() is called
-  transferFunctionWidget.show();
+  transferFunctionView.show();
 
   //ctf->AddRGBPoint(0.7, 0.0,0.0,0.0);
-  //ctkTransferFunctionWidget* toto = new ctkTransferFunctionWidget();
+  //ctkTransferFunctionView* toto = new ctkTransferFunctionView();
   QTimer autoExit;
   if (argc < 2 || QString(argv[1]) != "-I")
     {

+ 13 - 4
Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkTransferFunctionWidgetTest2.cpp

@@ -25,7 +25,9 @@
 
 // CTK includes
 #include "ctkTransferFunction.h"
-#include "ctkTransferFunctionWidget.h"
+#include "ctkTransferFunctionControlPointsItem.h"
+#include "ctkTransferFunctionGradientItem.h"
+#include "ctkTransferFunctionView.h"
 #include "ctkVTKLookupTable.h"
 
 // VTK includes
@@ -36,7 +38,7 @@
 #include <iostream>
 
 //-----------------------------------------------------------------------------
-int ctkTransferFunctionWidgetTest2(int argc, char * argv [] )
+int ctkTransferFunctionViewTest2(int argc, char * argv [] )
 {
   QApplication app(argc, argv);
   
@@ -52,9 +54,16 @@ int ctkTransferFunctionWidgetTest2(int argc, char * argv [] )
 
   QSharedPointer<ctkTransferFunction> transferFunction = 
     QSharedPointer<ctkTransferFunction>(new ctkVTKLookupTable(ctf));
-  ctkTransferFunctionWidget transferFunctionWidget(transferFunction.data(), 0);
+  ctkTransferFunctionView transferFunctionView(0);
+    ctkTransferFunctionGradientItem* gradient = 
+    new ctkTransferFunctionGradientItem(transferFunction.data());
+  ctkTransferFunctionControlPointsItem* controlPoints = 
+    new ctkTransferFunctionControlPointsItem(transferFunction.data());
+  
+  transferFunctionView.scene()->addItem(gradient);
+  transferFunctionView.scene()->addItem(controlPoints);
   // the widget is not really shown here, only when app.exec() is called
-  transferFunctionWidget.show();
+  transferFunctionView.show();
 
   QTimer autoExit;
   if (argc < 2 || QString(argv[1]) != "-I")

+ 13 - 4
Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkTransferFunctionWidgetTest3.cpp

@@ -25,7 +25,9 @@
 
 // CTK includes
 #include "ctkTransferFunction.h"
-#include "ctkTransferFunctionWidget.h"
+#include "ctkTransferFunctionControlPointsItem.h"
+#include "ctkTransferFunctionGradientItem.h"
+#include "ctkTransferFunctionView.h"
 #include "ctkVTKPiecewiseFunction.h"
 
 // VTK includes
@@ -36,7 +38,7 @@
 #include <iostream>
 
 //-----------------------------------------------------------------------------
-int ctkTransferFunctionWidgetTest3(int argc, char * argv [] )
+int ctkTransferFunctionViewTest3(int argc, char * argv [] )
 {
   QApplication app(argc, argv);
 
@@ -51,9 +53,16 @@ int ctkTransferFunctionWidgetTest3(int argc, char * argv [] )
 
   QSharedPointer<ctkTransferFunction> transferFunction =
     QSharedPointer<ctkTransferFunction>(new ctkVTKPiecewiseFunction(pwf));
-  ctkTransferFunctionWidget transferFunctionWidget(transferFunction.data(), 0);
+  ctkTransferFunctionView transferFunctionView(0);
+  ctkTransferFunctionGradientItem* gradient = 
+    new ctkTransferFunctionGradientItem(transferFunction.data());
+  ctkTransferFunctionControlPointsItem* controlPoints = 
+    new ctkTransferFunctionControlPointsItem(transferFunction.data());
+  
+  transferFunctionView.scene()->addItem(gradient);
+  transferFunctionView.scene()->addItem(controlPoints);
   // the widget is not really shown here, only when app.exec() is called
-  transferFunctionWidget.show();
+  transferFunctionView.show();
 
   QTimer autoExit;
   if (argc < 2 || QString(argv[1]) != "-I")

+ 13 - 4
Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkTransferFunctionWidgetTest4.cpp

@@ -25,7 +25,9 @@
 
 // CTK includes
 #include "ctkTransferFunction.h"
-#include "ctkTransferFunctionWidget.h"
+#include "ctkTransferFunctionControlPointsItem.h"
+#include "ctkTransferFunctionGradientItem.h"
+#include "ctkTransferFunctionView.h"
 #include "ctkVTKCompositeFunction.h"
 
 // VTK includes
@@ -37,7 +39,7 @@
 #include <iostream>
 
 //-----------------------------------------------------------------------------
-int ctkTransferFunctionWidgetTest4(int argc, char * argv [] )
+int ctkTransferFunctionViewTest4(int argc, char * argv [] )
 {
   QApplication app(argc, argv);
 
@@ -61,9 +63,16 @@ int ctkTransferFunctionWidgetTest4(int argc, char * argv [] )
 
   QSharedPointer<ctkTransferFunction> transferFunction =
     QSharedPointer<ctkTransferFunction>(new ctkVTKCompositeFunction(pwf, ctf));
-  ctkTransferFunctionWidget transferFunctionWidget(transferFunction.data(), 0);
+  ctkTransferFunctionView transferFunctionView(0);
+  ctkTransferFunctionGradientItem* gradient = 
+    new ctkTransferFunctionGradientItem(transferFunction.data());
+  ctkTransferFunctionControlPointsItem* controlPoints = 
+    new ctkTransferFunctionControlPointsItem(transferFunction.data());
+  
+  transferFunctionView.scene()->addItem(gradient);
+  transferFunctionView.scene()->addItem(controlPoints);
   // the widget is not really shown here, only when app.exec() is called
-  transferFunctionWidget.show();
+  transferFunctionView.show();
 
   QTimer autoExit;
   if (argc < 2 || QString(argv[1]) != "-I")

+ 7 - 6
Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkTransferFunctionWidgetTest5.cpp

@@ -26,8 +26,8 @@
 // CTK includes
 #include "ctkTransferFunction.h"
 #include "ctkTransferFunctionBarsItem.h"
-#include "ctkTransferFunctionWidget.h"
 #include "ctkTransferFunctionScene.h"
+#include "ctkTransferFunctionView.h"
 #include "ctkVTKHistogram.h"
 
 // VTK includes
@@ -38,7 +38,7 @@
 #include <iostream>
 
 //-----------------------------------------------------------------------------
-int ctkTransferFunctionWidgetTest5(int argc, char * argv [] )
+int ctkTransferFunctionViewTest5(int argc, char * argv [] )
 {
   QApplication app(argc, argv);
   
@@ -54,14 +54,15 @@ int ctkTransferFunctionWidgetTest5(int argc, char * argv [] )
     QSharedPointer<ctkVTKHistogram>(new ctkVTKHistogram(intArray));
   histogram->build();
   //ctkTransferFunctionWidget transferFunctionWidget(histogram.data(), 0);
-  ctkTransferFunctionWidget transferFunctionWidget;
-  // the widget is not really shown here, only when app.exec() is called
-  transferFunctionWidget.show();
+  ctkTransferFunctionView transferFunctionWidget;
+  
   ctkTransferFunctionBarsItem * histogramItem = new ctkTransferFunctionBarsItem;
   histogramItem->setTransferFunction(histogram.data());
   //qobject_cast<ctkTransferFunctionScene*>(transferFunctionWidget.scene())->setTransferFunction(histogram.data());
   transferFunctionWidget.scene()->addItem(histogramItem);
-
+  // the widget is not really shown here, only when app.exec() is called
+  transferFunctionWidget.show();
+  
   QTimer autoExit;
   if (argc < 2 || QString(argv[1]) != "-I")
     {

+ 88 - 0
Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKRenderViewTest1.cpp

@@ -0,0 +1,88 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) 2010  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.
+
+=========================================================================*/
+
+// Qt includes
+#include <QApplication>
+#include <QTimer>
+#include <QGroupBox>
+#include <QDebug>
+
+// VTK includes
+#include <vtkSmartPointer.h>
+#include <vtkRenderer.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkSphereSource.h>
+
+// CTK includes
+#include "ctkVTKRenderView.h"
+#include "ctkCommandLineParser.h"
+
+// STD includes
+#include <iostream>
+
+// Convenient macro
+#define VTK_CREATE(type, name) \
+  vtkSmartPointer<type> name = vtkSmartPointer<type>::New()
+
+//-----------------------------------------------------------------------------
+int ctkVTKRenderViewTest1(int argc, char * argv [] )
+{
+  QApplication app(argc, argv);
+
+  // Test arguments
+  bool interactive = false;
+  QString data_directory;
+
+  // Command line parser
+  ctkCommandLineParser parser;
+  parser.addBooleanArgument(0, "-I", &interactive);
+  parser.addStringArgument(0, "-D", &data_directory);
+  if (!parser.parseArguments(app.arguments()))
+    {
+    std::cerr << qPrintable(parser.errorString()) << std::endl;
+    return EXIT_FAILURE;
+    }
+
+  // Instanciate widget
+  ctkVTKRenderView renderView;
+  renderView.resize(300, 300);
+  renderView.setBackgroundColor(QColor(Qt::red));
+  renderView.setCornerAnnotationText("CTK Rocks !");
+  renderView.show();
+
+  // Instanciate VTK objects
+  VTK_CREATE(vtkSphereSource, sphere);
+  VTK_CREATE(vtkPolyDataMapper, sphereMapper);
+  VTK_CREATE(vtkActor, sphereActor);
+
+  // Configure actor
+  sphere->SetRadius(0.25);
+  sphereMapper->SetInputConnection(sphere->GetOutputPort());
+  sphereActor->SetMapper(sphereMapper);
+
+  // Add actor
+  renderView.renderer()->AddActor(sphereActor);
+
+  if (!interactive)
+    {
+    QTimer::singleShot(1000, &app, SLOT(quit()));
+    }
+  return app.exec();
+}

+ 96 - 0
Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKSliceViewTest1.cpp

@@ -0,0 +1,96 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) 2010  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.
+
+=========================================================================*/
+
+// Qt includes
+#include <QApplication>
+#include <QTimer>
+#include <QDebug>
+
+// CTK includes
+#include "ctkCommandLineParser.h"
+#include "ctkVTKSliceView.h"
+
+// VTK includes
+#include <vtkImageReader2Factory.h>
+#include <vtkImageReader2.h>
+#include <vtkImageData.h>
+#include <vtkSmartPointer.h>
+#include <vtkInteractorStyleImage.h>
+#include <vtkRenderWindowInteractor.h>
+
+// STD includes
+#include <iostream>
+
+//-----------------------------------------------------------------------------
+int ctkVTKSliceViewTest1(int argc, char * argv [] )
+{
+  QApplication app(argc, argv);
+
+  // Test arguments
+  bool interactive = false;
+  QString data_directory;
+  QString filename = "HeadMRVolume.mhd";
+
+  // Command line parser
+  ctkCommandLineParser parser;
+  parser.addBooleanArgument(0, "-I", &interactive);
+  parser.addStringArgument(0, "-D", &data_directory);
+  if (!parser.parseArguments(app.arguments()))
+    {
+    std::cerr << qPrintable(parser.errorString()) << std::endl;
+    return EXIT_FAILURE;
+    }
+
+  QString imageFilename = data_directory + "/" + filename;
+
+  // Instanciate the reader factory
+  vtkSmartPointer<vtkImageReader2Factory> imageFactory =
+      vtkSmartPointer<vtkImageReader2Factory>::New();
+
+  // Instanciate an image reader
+  vtkSmartPointer<vtkImageReader2> imageReader;
+  imageReader.TakeReference(imageFactory->CreateImageReader2(imageFilename.toLatin1()));
+  if (!imageReader)
+    {
+    std::cerr << "Failed to instanciate image reader using: " 
+              << qPrintable(imageFilename) << std::endl;
+    return EXIT_FAILURE;
+    }
+
+  // Read image
+  imageReader->SetFileName(imageFilename.toLatin1());
+  imageReader->Update();
+  vtkSmartPointer<vtkImageData> image = imageReader->GetOutput();
+
+  ctkVTKSliceView sliceView;
+  sliceView.resize(300, 300);
+  sliceView.setImageData(image);
+  sliceView.setRenderWindowLayout(4, 4);
+  sliceView.setHighlighted(0, 0, true);
+  sliceView.setCornerAnnotationText("CTK");
+  sliceView.scheduleRender();
+  sliceView.show();
+
+  if (!interactive)
+    {
+    QTimer::singleShot(1000, &app, SLOT(quit()));
+    }
+  return app.exec();
+}

+ 22 - 0
Libs/Visualization/VTK/Widgets/ctkVTKRenderView.cpp

@@ -25,12 +25,17 @@
 // CTK includes
 #include "ctkVTKRenderView.h"
 #include "ctkVTKRenderView_p.h"
+#include "ctkLogger.h"
 
 // VTK includes
 #include <vtkRendererCollection.h>
 #include <vtkRenderWindowInteractor.h>
 #include <vtkTextProperty.h>
 
+//--------------------------------------------------------------------------
+static ctkLogger logger("org.commontk.visualization.vtk.widgets.ctkVTKRenderView");
+//--------------------------------------------------------------------------
+
 // --------------------------------------------------------------------------
 // ctkVTKRenderViewPrivate methods
 
@@ -49,6 +54,7 @@ ctkVTKRenderViewPrivate::ctkVTKRenderViewPrivate()
 // --------------------------------------------------------------------------
 void ctkVTKRenderViewPrivate::setupCornerAnnotation()
 {
+  logger.trace("setupCornerAnnotation");
   if (!this->Renderer->HasViewProp(this->CornerAnnotation))
     {
     this->Renderer->AddViewProp(this->CornerAnnotation);
@@ -62,6 +68,7 @@ void ctkVTKRenderViewPrivate::setupCornerAnnotation()
 //---------------------------------------------------------------------------
 void ctkVTKRenderViewPrivate::setupRendering()
 {
+  logger.trace("setupRendering");
   Q_ASSERT(this->RenderWindow);
   this->RenderWindow->SetAlphaBitPlanes(1);
   this->RenderWindow->SetMultiSamples(0);
@@ -81,6 +88,7 @@ void ctkVTKRenderViewPrivate::setupRendering()
 //---------------------------------------------------------------------------
 void ctkVTKRenderViewPrivate::setupDefaultInteractor()
 {
+  logger.trace("setupDefaultInteractor");
   CTK_P(ctkVTKRenderView);
   p->setInteractor(this->RenderWindow->GetInteractor());
 }
@@ -113,6 +121,10 @@ ctkVTKRenderView::~ctkVTKRenderView()
 void ctkVTKRenderView::scheduleRender()
 {
   CTK_D(ctkVTKRenderView);
+
+  logger.trace(QString("scheduleRender - RenderEnabled: %1 - RenderPending: %2").
+               arg(d->RenderEnabled).arg(d->RenderPending));
+
   if (!d->RenderEnabled)
     {
     return;
@@ -128,6 +140,9 @@ void ctkVTKRenderView::scheduleRender()
 void ctkVTKRenderView::forceRender()
 {
   CTK_D(ctkVTKRenderView);
+
+  logger.trace(QString("forceRender - RenderEnabled: %1").arg(d->RenderEnabled));
+
   if (!d->RenderEnabled)
     {
     return;
@@ -146,6 +161,9 @@ CTK_GET_CXX(ctkVTKRenderView, vtkRenderWindowInteractor*, interactor, CurrentInt
 void ctkVTKRenderView::setInteractor(vtkRenderWindowInteractor* newInteractor)
 {
   CTK_D(ctkVTKRenderView);
+
+  logger.trace("setInteractor");
+
   d->RenderWindow->SetInteractor(newInteractor);
   d->Orientation->SetOrientationMarker(d->Axes);
   d->Orientation->SetInteractor(newInteractor);
@@ -172,6 +190,7 @@ vtkInteractorObserver* ctkVTKRenderView::interactorStyle()
 void ctkVTKRenderView::setCornerAnnotationText(const QString& text)
 {
   CTK_D(ctkVTKRenderView);
+  logger.trace(QString("setCornerAnnotationText: %1").arg(text));
   d->CornerAnnotation->ClearAllTexts();
   d->CornerAnnotation->SetText(2, text.toLatin1());
 }
@@ -188,6 +207,8 @@ void ctkVTKRenderView::setBackgroundColor(const QColor& newBackgroundColor)
 {
   CTK_D(ctkVTKRenderView);
 
+  logger.trace(QString("setBackgroundColor: %1").arg(newBackgroundColor.name()));
+
   d->Renderer->SetBackground(newBackgroundColor.redF(),
                              newBackgroundColor.greenF(),
                              newBackgroundColor.blueF());
@@ -220,6 +241,7 @@ vtkCamera* ctkVTKRenderView::activeCamera()
 void ctkVTKRenderView::resetCamera()
 {
   CTK_D(ctkVTKRenderView);
+  logger.trace("resetCamera");
   d->Renderer->ResetCamera();
 }
 

+ 3 - 0
Libs/Visualization/VTK/Widgets/ctkVTKRenderView.h

@@ -48,12 +48,15 @@ public:
   explicit ctkVTKRenderView(QWidget* parent = 0);
   virtual ~ctkVTKRenderView();
 
+public slots:
+
   /// If a render has already been scheduled, this called is a no-op
   void scheduleRender();
 
   /// Force a render even if a render is already ocurring
   void forceRender();
 
+public:
   /// Get underlying RenderWindow
   vtkRenderWindow* renderWindow()const;
   

+ 20 - 4
Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp

@@ -26,6 +26,7 @@
 // CTK includes
 #include "ctkVTKSliceView.h"
 #include "ctkVTKSliceView_p.h"
+#include "ctkLogger.h"
 
 // VTK includes
 #include <vtkRendererCollection.h>
@@ -43,6 +44,10 @@
 #define VTK_CREATE(type, name) \
   vtkSmartPointer<type> name = vtkSmartPointer<type>::New()
 
+//--------------------------------------------------------------------------
+static ctkLogger logger("org.commontk.visualization.vtk.widgets.ctkVTKSliceView");
+//--------------------------------------------------------------------------
+
 // --------------------------------------------------------------------------
 // RenderWindowItem methods
 
@@ -277,6 +282,7 @@ void ctkVTKSliceView::scheduleRender()
 {
   CTK_D(ctkVTKSliceView);
 
+  logger.trace("scheduleRender");
   if (!d->RenderEnabled)
     {
     return;
@@ -296,6 +302,7 @@ void ctkVTKSliceView::forceRender()
     {
     return;
     }
+  logger.trace("forceRender");
   d->RenderWindow->Render();
   d->RenderPending = false;
 }
@@ -521,6 +528,7 @@ void ctkVTKSliceView::setRenderWindowLayout(int rowCount, int columnCount)
   d->RenderWindowColumnCount = columnCount;
 
   d->setupRendering();
+  d->setupCornerAnnotation();
 
   if (d->ImageData)
     {
@@ -550,20 +558,28 @@ CTK_GET_CXX(ctkVTKSliceView, double, colorWindow, ColorWindow);
 CTK_GET_CXX(ctkVTKSliceView, double, colorLevel, ColorLevel);
 
 //----------------------------------------------------------------------------
-void ctkVTKSliceView::setImageData(vtkImageData* imageDataToSet)
+void ctkVTKSliceView::setImageData(vtkImageData* newImageData)
 {
   CTK_D(ctkVTKSliceView);
 
   foreach(const QSharedPointer<RenderWindowItem>& item, d->RenderWindowItemList)
     {
-    item->ImageMapper->SetInput(imageDataToSet);
+    item->ImageMapper->SetInput(newImageData);
     }
 
-  if (imageDataToSet)
+  if (newImageData)
     {
     d->updateRenderWindowItemsZIndex(d->RenderWindowLayoutType);
     }
 
-  d->ImageData = imageDataToSet;
+  d->ImageData = newImageData;
+}
+
+
+//----------------------------------------------------------------------------
+void ctkVTKSliceView::resizeEvent(QResizeEvent * event)
+{
+  this->QWidget::resizeEvent(event);
+  emit this->resized(event);
 }
 

+ 14 - 3
Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h

@@ -58,9 +58,16 @@ public:
   /// If a render has already been scheduled, this called is a no-op
   void scheduleRender();
 
+public slots:
+
   /// Force a render even if a render is already ocurring
   void forceRender();
 
+  /// Reset cameras associated with all renderWindowItem
+  void resetCamera();
+
+public:
+
   /// Get underlying RenderWindow
   vtkRenderWindow* renderWindow() const;
   
@@ -85,9 +92,6 @@ public:
 
   /// Set actice camera
   void setActiveCamera(vtkCamera* newActiveCamera);
-
-  /// Reset cameras associated with all renderWindowItem
-  void resetCamera();
   
   /// Return number of underlying renderer
   int rendererCount();
@@ -142,6 +146,13 @@ public:
   /// Set image data
   void setImageData(vtkImageData* newImageData);
   
+
+signals:
+  void resized(QResizeEvent*);
+
+protected:
+  virtual void resizeEvent(QResizeEvent * event);
+
 private:
   CTK_DECLARE_PRIVATE(ctkVTKSliceView);
 }; 

+ 9 - 7
Libs/Widgets/CMakeLists.txt

@@ -40,6 +40,8 @@ SET(KIT_SRCS
   ctkDoubleSlider.h
   ctkDynamicSpacer.cpp
   ctkDynamicSpacer.h
+  ctkFileDialog.cpp
+  ctkFileDialog.h
   ctkFittedTextBrowser.cpp
   ctkFittedTextBrowser.h
   ctkMatrixWidget.cpp
@@ -56,18 +58,18 @@ SET(KIT_SRCS
   ctkSliderSpinBoxWidget.h
   ctkTestApplication.cpp
   ctkTestApplication.h
+  ctkTransferFunctionBarsItem.cpp
+  ctkTransferFunctionBarsItem.h
   ctkTransferFunctionControlPointsItem.cpp
   ctkTransferFunctionControlPointsItem.h
   ctkTransferFunctionGradientItem.cpp
   ctkTransferFunctionGradientItem.h
-  ctkTransferFunctionBarsItem.cpp
-  ctkTransferFunctionBarsItem.h
   ctkTransferFunctionItem.cpp
   ctkTransferFunctionItem.h
-  ctkTransferFunctionWidget.cpp
-  ctkTransferFunctionWidget.h
   ctkTransferFunctionScene.cpp
   ctkTransferFunctionScene.h
+  ctkTransferFunctionView.cpp
+  ctkTransferFunctionView.h
   ctkTreeComboBox.cpp
   ctkTreeComboBox.h
   )
@@ -88,6 +90,7 @@ SET(KIT_MOC_SRCS
   ctkDoubleRangeSlider.h
   ctkDoubleSlider.h
   ctkDynamicSpacer.h
+  ctkFileDialog.h
   ctkFittedTextBrowser.h
   ctkMatrixWidget.h
   ctkMenuButton.h
@@ -96,13 +99,12 @@ SET(KIT_MOC_SRCS
   ctkSettings.h
   ctkSliderSpinBoxWidget.h
   ctkTestApplication.h
+  ctkTransferFunctionBarsItem.h
   ctkTransferFunctionControlPointsItem.h
   ctkTransferFunctionGradientItem.h
-  ctkTransferFunctionBarsItem.h
   ctkTransferFunctionItem.h
-  ctkTransferFunctionControlPointsItem.h
-  ctkTransferFunctionWidget.h
   ctkTransferFunctionScene.h
+  ctkTransferFunctionView.h
   ctkTreeComboBox.h
   )
 

+ 3 - 3
Libs/Widgets/Plugins/CMakeLists.txt

@@ -43,8 +43,8 @@ SET(PLUGIN_SRCS
   ctkRangeSliderPlugin.h
   ctkRangeWidgetPlugin.cpp
   ctkRangeWidgetPlugin.h
-  ctkTransferFunctionWidgetPlugin.cpp
-  ctkTransferFunctionWidgetPlugin.h
+  ctkTransferFunctionViewPlugin.cpp
+  ctkTransferFunctionViewPlugin.h
   ctkTreeComboBoxPlugin.cpp
   ctkTreeComboBoxPlugin.h
   ctkSliderSpinBoxWidgetPlugin.cpp
@@ -70,7 +70,7 @@ SET(PLUGIN_MOC_SRCS
   ctkMenuButtonPlugin.h
   ctkRangeSliderPlugin.h
   ctkRangeWidgetPlugin.h
-  ctkTransferFunctionWidgetPlugin.h
+  ctkTransferFunctionViewPlugin.h
   ctkTreeComboBoxPlugin.h
   ctkSliderSpinBoxWidgetPlugin.h
   )

+ 1 - 1
Libs/Widgets/Plugins/ctkCollapsibleButtonPlugin.cpp

@@ -39,7 +39,7 @@ QWidget *ctkCollapsibleButtonPlugin::createWidget(QWidget *_parent)
 QString ctkCollapsibleButtonPlugin::domXml() const
 {
   return "<widget class=\"ctkCollapsibleButton\" \
-          name=\"CTKCollapsibleButton\">\n"
+          name=\"CollapsibleButton\">\n"
           " <property name=\"geometry\">\n"
           "  <rect>\n"
           "   <x>0</x>\n"

+ 1 - 1
Libs/Widgets/Plugins/ctkCollapsibleGroupBoxPlugin.cpp

@@ -41,7 +41,7 @@ QWidget *ctkCollapsibleGroupBoxPlugin::createWidget(QWidget *_parent)
 QString ctkCollapsibleGroupBoxPlugin::domXml() const
 {
   return "<widget class=\"ctkCollapsibleGroupBox\" \
-          name=\"CTKCollapsibleGroupBox\">\n"
+          name=\"CollapsibleGroupBox\">\n"
           " <property name=\"geometry\">\n"
           "  <rect>\n"
           "   <x>0</x>\n"

+ 1 - 1
Libs/Widgets/Plugins/ctkColorPickerButtonPlugin.cpp

@@ -38,7 +38,7 @@ QWidget *ctkColorPickerButtonPlugin::createWidget(QWidget *_parent)
 QString ctkColorPickerButtonPlugin::domXml() const
 {
   return "<widget class=\"ctkColorPickerButton\" \
-          name=\"CTKColorPickerButton\">\n"
+          name=\"ColorPickerButton\">\n"
           "</widget>\n";
 }
 

+ 1 - 1
Libs/Widgets/Plugins/ctkComboBoxPlugin.cpp

@@ -40,7 +40,7 @@ QWidget *ctkComboBoxPlugin::createWidget(QWidget *_parent)
 QString ctkComboBoxPlugin::domXml() const
 {
   return "<widget class=\"ctkComboBox\" \
-          name=\"CTKTitleComboBox\">\n"
+          name=\"ComboBox\">\n"
           "</widget>\n";
 }
 

+ 1 - 1
Libs/Widgets/Plugins/ctkCoordinatesWidgetPlugin.cpp

@@ -39,7 +39,7 @@ QWidget *ctkCoordinatesWidgetPlugin::createWidget(QWidget *_parent)
 QString ctkCoordinatesWidgetPlugin::domXml() const
 {
   return "<widget class=\"ctkCoordinatesWidget\" \
-          name=\"CTKCoordinatesWidget\">\n"
+          name=\"CoordinatesWidget\">\n"
           "</widget>\n";
 }
 

+ 1 - 1
Libs/Widgets/Plugins/ctkDirectoryButtonPlugin.cpp

@@ -40,7 +40,7 @@ QWidget *ctkDirectoryButtonPlugin::createWidget(QWidget *_parent)
 QString ctkDirectoryButtonPlugin::domXml() const
 {
   return "<widget class=\"ctkDirectoryButton\" \
-          name=\"CTKDirectoryButton\">\n"
+          name=\"DirectoryButton\">\n"
           "</widget>\n";
 }
 

+ 1 - 1
Libs/Widgets/Plugins/ctkDoubleRangeSliderPlugin.cpp

@@ -38,7 +38,7 @@ QWidget *ctkDoubleRangeSliderPlugin::createWidget(QWidget *_parent)
 // --------------------------------------------------------------------------
 QString ctkDoubleRangeSliderPlugin::domXml() const
 {
-  return "<widget class=\"ctkDoubleRangeSlider\" name=\"CTKSlider\">\n"
+  return "<widget class=\"ctkDoubleRangeSlider\" name=\"DoubleRangeSlider\">\n"
     "<property name=\"orientation\">\n"
     "  <enum>Qt::Horizontal</enum>\n"
     " </property>\n"

+ 1 - 1
Libs/Widgets/Plugins/ctkDoubleSliderPlugin.cpp

@@ -38,7 +38,7 @@ QWidget *ctkDoubleSliderPlugin::createWidget(QWidget *_parent)
 // --------------------------------------------------------------------------
 QString ctkDoubleSliderPlugin::domXml() const
 {
-  return "<widget class=\"ctkDoubleSlider\" name=\"CTKSlider\">\n"
+  return "<widget class=\"ctkDoubleSlider\" name=\"DoubleSlider\">\n"
     "<property name=\"orientation\">\n"
     "  <enum>Qt::Horizontal</enum>\n"
     " </property>\n"

+ 1 - 1
Libs/Widgets/Plugins/ctkDynamicSpacerPlugin.cpp

@@ -38,7 +38,7 @@ QWidget *ctkDynamicSpacerPlugin::createWidget(QWidget *_parent)
 // --------------------------------------------------------------------------
 QString ctkDynamicSpacerPlugin::domXml() const
 {
-  return "<widget class=\"ctkDynamicSpacer\" name=\"CTKSpacer\">\n"
+  return "<widget class=\"ctkDynamicSpacer\" name=\"DynamicSpacer\">\n"
     "</widget>\n";
 }
 

+ 1 - 1
Libs/Widgets/Plugins/ctkFittedTextBrowserPlugin.cpp

@@ -40,7 +40,7 @@ QWidget *ctkFittedTextBrowserPlugin::createWidget(QWidget *_parent)
 QString ctkFittedTextBrowserPlugin::domXml() const
 {
   return "<widget class=\"ctkFittedTextBrowser\" \
-          name=\"CTKFittedTextBrowser\">\n"
+          name=\"FittedTextBrowser\">\n"
           "</widget>\n";
 }
 

+ 1 - 1
Libs/Widgets/Plugins/ctkMatrixWidgetPlugin.cpp

@@ -40,7 +40,7 @@ QWidget *ctkMatrixWidgetPlugin::createWidget(QWidget *_parent)
 QString ctkMatrixWidgetPlugin::domXml() const
 {
   return "<widget class=\"ctkMatrixWidget\" \
-          name=\"CTKMatrixWidget\">\n"
+          name=\"MatrixWidget\">\n"
           "</widget>\n";
 }
 

+ 1 - 1
Libs/Widgets/Plugins/ctkMenuButtonPlugin.cpp

@@ -46,7 +46,7 @@ QWidget *ctkMenuButtonPlugin::createWidget(QWidget *_parent)
 // --------------------------------------------------------------------------
 QString ctkMenuButtonPlugin::domXml() const
 {
-  return "<widget class=\"ctkMenuButton\" name=\"CTKMenuButton\">\n"
+  return "<widget class=\"ctkMenuButton\" name=\"MenuButton\">\n"
          " <property name=\"text\">"
          "  <string>MenuButton</string>"
          " </property>"

+ 1 - 1
Libs/Widgets/Plugins/ctkRangeWidgetPlugin.cpp

@@ -40,7 +40,7 @@ QWidget *ctkRangeWidgetPlugin::createWidget(QWidget *_parent)
 QString ctkRangeWidgetPlugin::domXml() const
 {
   return "<widget class=\"ctkRangeWidget\" \
-          name=\"ctkRangeWidget\">\n"
+          name=\"RangeWidget\">\n"
           "</widget>\n";
 }
 

+ 1 - 1
Libs/Widgets/Plugins/ctkSliderSpinBoxWidgetPlugin.cpp

@@ -40,7 +40,7 @@ QWidget *ctkSliderSpinBoxWidgetPlugin::createWidget(QWidget *_parent)
 QString ctkSliderSpinBoxWidgetPlugin::domXml() const
 {
   return "<widget class=\"ctkSliderSpinBoxWidget\" \
-          name=\"ctkSliderSpinBoxWidget\">\n"
+          name=\"SliderSpinBoxWidget\">\n"
           "</widget>\n";
 }
 

+ 14 - 14
Libs/Widgets/Plugins/ctkTransferFunctionWidgetPlugin.cpp

@@ -19,51 +19,51 @@
 =========================================================================*/
 
 // CTK includes
-#include "ctkTransferFunctionWidgetPlugin.h"
-#include "ctkTransferFunctionWidget.h"
+#include "ctkTransferFunctionViewPlugin.h"
+#include "ctkTransferFunctionView.h"
 
 //-----------------------------------------------------------------------------
-ctkTransferFunctionWidgetPlugin::ctkTransferFunctionWidgetPlugin(QObject *_parent)
+ctkTransferFunctionViewPlugin::ctkTransferFunctionViewPlugin(QObject *_parent)
         : QObject(_parent)
 {
 
 }
 
 //-----------------------------------------------------------------------------
-QWidget *ctkTransferFunctionWidgetPlugin::createWidget(QWidget *_parent)
+QWidget *ctkTransferFunctionViewPlugin::createWidget(QWidget *_parent)
 {
-  ctkTransferFunctionWidget* _widget = new ctkTransferFunctionWidget(_parent);
+  ctkTransferFunctionView* _widget = new ctkTransferFunctionView(_parent);
   return _widget;
 }
 
 //-----------------------------------------------------------------------------
-QString ctkTransferFunctionWidgetPlugin::domXml() const
+QString ctkTransferFunctionViewPlugin::domXml() const
 {
-  return "<widget class=\"ctkTransferFunctionWidget\" \
-          name=\"ctkTransferFunctionWidget\">\n"
+  return "<widget class=\"ctkTransferFunctionView\" \
+          name=\"TransferFunctionView\">\n"
           "</widget>\n";
 }
 
 // --------------------------------------------------------------------------
-QIcon ctkTransferFunctionWidgetPlugin::icon() const
+QIcon ctkTransferFunctionViewPlugin::icon() const
 {
   return QIcon();
 }
 
 //-----------------------------------------------------------------------------
-QString ctkTransferFunctionWidgetPlugin::includeFile() const
+QString ctkTransferFunctionViewPlugin::includeFile() const
 {
-  return "ctkTransferFunctionWidget.h";
+  return "ctkTransferFunctionView.h";
 }
 
 //-----------------------------------------------------------------------------
-bool ctkTransferFunctionWidgetPlugin::isContainer() const
+bool ctkTransferFunctionViewPlugin::isContainer() const
 {
   return false;
 }
 
 //-----------------------------------------------------------------------------
-QString ctkTransferFunctionWidgetPlugin::name() const
+QString ctkTransferFunctionViewPlugin::name() const
 {
-  return "ctkTransferFunctionWidget";
+  return "ctkTransferFunctionView";
 }

+ 4 - 4
Libs/Widgets/Plugins/ctkTransferFunctionWidgetPlugin.h

@@ -18,20 +18,20 @@
  
 =========================================================================*/
 
-#ifndef __ctkTransferFunctionWidgetPlugin_h
-#define __ctkTransferFunctionWidgetPlugin_h
+#ifndef __ctkTransferFunctionViewPlugin_h
+#define __ctkTransferFunctionViewPlugin_h
 
 // CTK includes
 #include "ctkWidgetsAbstractPlugin.h"
 
-class CTK_WIDGETS_PLUGINS_EXPORT ctkTransferFunctionWidgetPlugin :
+class CTK_WIDGETS_PLUGINS_EXPORT ctkTransferFunctionViewPlugin :
   public QObject,
   public ctkWidgetsAbstractPlugin
 {
   Q_OBJECT
 
 public:
-  ctkTransferFunctionWidgetPlugin(QObject *_parent = 0);
+  ctkTransferFunctionViewPlugin(QObject *_parent = 0);
 
   QWidget *createWidget(QWidget *_parent);
   QString  domXml() const;

+ 1 - 1
Libs/Widgets/Plugins/ctkTreeComboBoxPlugin.cpp

@@ -40,7 +40,7 @@ QWidget *ctkTreeComboBoxPlugin::createWidget(QWidget *_parent)
 QString ctkTreeComboBoxPlugin::domXml() const
 {
   return "<widget class=\"ctkTreeComboBox\" \
-          name=\"CTKTreeComboBox\">\n"
+          name=\"TreeComboBox\">\n"
           "</widget>\n";
 }
 

+ 4 - 4
Libs/Widgets/Plugins/ctkWidgetsPlugins.h

@@ -40,7 +40,7 @@
 #include "ctkMenuButtonPlugin.h"
 #include "ctkRangeSliderPlugin.h"
 #include "ctkRangeWidgetPlugin.h"
-#include "ctkTransferFunctionWidgetPlugin.h"
+#include "ctkTransferFunctionViewPlugin.h"
 #include "ctkTreeComboBoxPlugin.h"
 #include "ctkSliderSpinBoxWidgetPlugin.h"
 
@@ -69,9 +69,9 @@ public:
             << new ctkMenuButtonPlugin
             << new ctkRangeSliderPlugin
             << new ctkRangeWidgetPlugin
-            << new ctkTransferFunctionWidgetPlugin
-            << new ctkTreeComboBoxPlugin
-            << new ctkSliderSpinBoxWidgetPlugin;
+            << new ctkSliderSpinBoxWidgetPlugin
+            << new ctkTransferFunctionViewPlugin
+            << new ctkTreeComboBoxPlugin;
     return plugins;
     }
 };

+ 8 - 7
Libs/Widgets/Resources/UI/ctkRangeWidget.ui

@@ -7,9 +7,15 @@
     <x>0</x>
     <y>0</y>
     <width>302</width>
-    <height>20</height>
+    <height>27</height>
    </rect>
   </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
   <property name="windowTitle">
    <string>ctkSliderSpinBoxWidget</string>
   </property>
@@ -34,13 +40,8 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>ctkRangeSlider</class>
-   <extends>QSlider</extends>
-   <header>ctkRangeSlider.h</header>
-  </customwidget>
-  <customwidget>
    <class>ctkDoubleRangeSlider</class>
-   <extends>ctkRangeSlider</extends>
+   <extends>QWidget</extends>
    <header>ctkDoubleRangeSlider.h</header>
   </customwidget>
  </customwidgets>

+ 6 - 0
Libs/Widgets/Resources/UI/ctkSliderSpinBoxWidget.ui

@@ -10,6 +10,12 @@
     <height>32</height>
    </rect>
   </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
   <property name="windowTitle">
    <string>ctkSliderSpinBoxWidget</string>
   </property>

+ 2 - 0
Libs/Widgets/Testing/Cpp/CMakeLists.txt

@@ -12,6 +12,7 @@ CREATE_TEST_SOURCELIST(Tests ${KIT}CppTests.cxx
   ctkCoordinatesWidgetTest1.cpp
   ctkDoubleRangeSliderTest1.cpp
   ctkDoubleSliderTest1.cpp
+  ctkFileDialogTest1.cpp
   ctkFittedTextBrowserTest1.cpp
   ctkMatrixWidgetTest1.cpp
   ctkRangeSliderTest1.cpp
@@ -53,6 +54,7 @@ SIMPLE_TEST( ctkComboBoxTest1 )
 SIMPLE_TEST( ctkCoordinatesWidgetTest1 )
 SIMPLE_TEST( ctkDoubleRangeSliderTest1 )
 SIMPLE_TEST( ctkDoubleSliderTest1 )
+SIMPLE_TEST( ctkFileDialogTest1 )
 SIMPLE_TEST( ctkFittedTextBrowserTest1 )
 SIMPLE_TEST( ctkMatrixWidgetTest1 )
 SIMPLE_TEST( ctkRangeSliderTest1 )

+ 61 - 0
Libs/Widgets/Testing/Cpp/ctkFileDialogTest1.cpp

@@ -0,0 +1,61 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) 2010  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.
+
+=========================================================================*/
+
+// Qt includes
+#include <QApplication>
+#include <QCheckBox>
+
+// CTK includes
+#include "ctkFileDialog.h"
+
+// STD includes
+#include <cstdlib>
+#include <iostream>
+
+//-----------------------------------------------------------------------------
+int ctkFileDialogTest1(int argc, char * argv [] )
+{
+  QApplication app(argc, argv);
+
+  ctkFileDialog fileDialog;
+  fileDialog.setFileMode(QFileDialog::AnyFile);
+  fileDialog.setNameFilter("Images (*.png *.xpm *.jpg)");
+  fileDialog.setViewMode(QFileDialog::Detail);
+  QCheckBox* checkBox = new QCheckBox;
+  fileDialog.setBottomWidget(checkBox, "Foo Bar:");
+  if (checkBox != fileDialog.bottomWidget())
+    {
+    return EXIT_FAILURE;
+    }
+  // the following is only in interactive mode
+  if (argc < 2 || QString(argv[1]) != "-I" )
+    {
+    return EXIT_SUCCESS;
+    }
+  QObject::connect(checkBox, SIGNAL(toggled(bool)),
+                   &fileDialog, SLOT(setAcceptButtonEnable(bool)));
+  fileDialog.setAcceptButtonEnable(false);
+  if (!fileDialog.exec())
+    {
+    return EXIT_FAILURE;
+    }
+  return EXIT_SUCCESS;
+
+}

+ 5 - 0
Libs/Widgets/ctkCollapsibleButton.h

@@ -34,6 +34,11 @@ class QStyleOptionButton;
 
 /// Description
 /// A Collapsible widget that show/hide its children depending on its checked/collapsed properties
+/// Warning: As ctkCollapsibleButton forces the Visiblity of its children to
+/// true when it get expanded, any Visibility property is lost. All the widgets
+/// will be visible. To avoid this behavior, use an intermediate widget that
+/// contains all the children (they would become grandchildren and their
+/// will remain relative to their parent: ctkCollapsibleButton's unique child.
 class CTK_WIDGETS_EXPORT ctkCollapsibleButton : public QAbstractButton
 {
   Q_OBJECT

+ 154 - 0
Libs/Widgets/ctkFileDialog.cpp

@@ -0,0 +1,154 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) 2010  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.
+
+=========================================================================*/
+
+// QT includes
+#include <QDebug>
+#include <QDialogButtonBox>
+#include <QEvent>
+#include <QGridLayout>
+#include <QLabel>
+#include <QPushButton>
+
+// CTK includes
+#include "ctkFileDialog.h"
+
+//------------------------------------------------------------------------------
+class ctkFileDialogPrivate: public ctkPrivate<ctkFileDialog>
+{
+public:
+  ctkFileDialogPrivate();
+  void init();
+  QPushButton* acceptButton()const;
+  bool AcceptButtonEnable;
+  bool AcceptButtonState;
+  bool IgnoreEvent;
+};
+
+//------------------------------------------------------------------------------
+ctkFileDialogPrivate::ctkFileDialogPrivate()
+{
+  this->IgnoreEvent = false;
+  this->AcceptButtonEnable = true;
+  this->AcceptButtonState = true;
+}
+
+//------------------------------------------------------------------------------
+void ctkFileDialogPrivate::init()
+{
+  CTK_P(ctkFileDialog);
+  QPushButton* button = this->acceptButton();
+  Q_ASSERT(button);
+  this->AcceptButtonState =
+    button->isEnabledTo(qobject_cast<QWidget*>(button->parent()));
+  button->installEventFilter(p);
+}
+
+//------------------------------------------------------------------------------
+QPushButton* ctkFileDialogPrivate::acceptButton()const
+{
+  CTK_P(const ctkFileDialog);
+  QDialogButtonBox* buttonBox = p->findChild<QDialogButtonBox*>();
+  Q_ASSERT(buttonBox);
+  QDialogButtonBox::StandardButton button =
+    (p->acceptMode() == QFileDialog::AcceptOpen ? QDialogButtonBox::Open : QDialogButtonBox::Save);
+  return buttonBox->button(button);
+}
+
+//------------------------------------------------------------------------------
+ctkFileDialog::ctkFileDialog(QWidget *parentWidget,
+              const QString &caption,
+              const QString &directory,
+              const QString &filter)
+  :QFileDialog(parentWidget, caption, directory, filter)
+{
+  CTK_INIT_PRIVATE(ctkFileDialog);
+  CTK_D(ctkFileDialog);
+  d->init();
+}
+
+//------------------------------------------------------------------------------
+ctkFileDialog::~ctkFileDialog()
+{
+}
+
+//------------------------------------------------------------------------------
+void ctkFileDialog::setBottomWidget(QWidget* widget, const QString& label)
+{
+  QGridLayout* gridLayout = qobject_cast<QGridLayout*>(this->layout());
+  QWidget* oldBottomWidget = this->bottomWidget();
+  if (oldBottomWidget)
+    {
+    if (oldBottomWidget == widget)
+      {
+      return;
+      }
+    gridLayout->removeWidget(oldBottomWidget);
+    delete oldBottomWidget;
+    }
+  if (widget == 0)
+    {
+    return;
+    }
+  if (!label.isEmpty())
+    {
+    gridLayout->addWidget(new QLabel(label), 4, 0);
+    gridLayout->addWidget(widget,4, 1,1, 1);
+    }
+  else
+    {
+    gridLayout->addWidget(widget,4, 0,1, 2);
+    }
+  QDialogButtonBox* buttonBox = this->findChild<QDialogButtonBox*>();
+  Q_ASSERT(buttonBox);
+  gridLayout->removeWidget(buttonBox);
+  gridLayout->addWidget(buttonBox, 2, 2, 3, 1);
+}
+
+//------------------------------------------------------------------------------
+QWidget* ctkFileDialog::bottomWidget()const
+{
+  QGridLayout* gridLayout = qobject_cast<QGridLayout*>(this->layout());
+  QLayoutItem* item = gridLayout->itemAtPosition(4,1);
+  return item ? item->widget() : 0;
+}
+
+//------------------------------------------------------------------------------
+void ctkFileDialog::setAcceptButtonEnable(bool enable)
+{
+  CTK_D(ctkFileDialog);
+  d->AcceptButtonEnable = enable;
+  d->acceptButton()->setEnabled(d->AcceptButtonEnable && d->AcceptButtonState);
+}
+
+//------------------------------------------------------------------------------
+bool ctkFileDialog::eventFilter(QObject *obj, QEvent *event)
+{
+  CTK_D(ctkFileDialog);
+  QPushButton* button = d->acceptButton();
+  if (obj == button && event->type() == QEvent::EnabledChange &&
+      !d->IgnoreEvent)
+    {
+    d->IgnoreEvent = true;
+    d->AcceptButtonState = button->isEnabledTo(qobject_cast<QWidget*>(button->parent()));
+    button->setEnabled(d->AcceptButtonEnable && d->AcceptButtonState);
+    d->IgnoreEvent = false;
+    }
+  return QFileDialog::eventFilter(obj, event);
+}

+ 58 - 0
Libs/Widgets/ctkFileDialog.h

@@ -0,0 +1,58 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) 2010  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 __ctkFileDialog_h
+#define __ctkFileDialog_h
+
+// Qt includes
+#include <QFileDialog>
+
+// CTK includes
+#include <ctkPimpl.h>
+#include "CTKWidgetsExport.h"
+
+class ctkFileDialogPrivate;
+
+class CTK_WIDGETS_EXPORT ctkFileDialog : public QFileDialog
+{
+  Q_OBJECT
+
+public:
+  // Superclass typedef
+  typedef QFileDialog Superclass;
+  // Constructors
+  explicit ctkFileDialog(QWidget *parent = 0,
+              const QString &caption = QString(),
+              const QString &directory = QString(),
+              const QString &filter = QString());
+  virtual ~ctkFileDialog();
+
+  void setBottomWidget(QWidget* widget, const QString& label=QString());
+  QWidget* bottomWidget()const;
+
+  bool eventFilter(QObject *obj, QEvent *event);
+public slots:
+  void setAcceptButtonEnable(bool enable);
+
+private:
+  CTK_DECLARE_PRIVATE(ctkFileDialog);
+};
+
+#endif

+ 1 - 0
Libs/Widgets/ctkRangeSlider.cpp

@@ -423,6 +423,7 @@ void ctkRangeSlider::paintEvent( QPaintEvent* )
 
   QStylePainter painter(this);
   option.subControls = QStyle::SC_SliderGroove;
+  option.sliderPosition = this->minimum(); // don't highlight the SliderGroove
   painter.drawComplexControl(QStyle::CC_Slider, option);
 
   option.sliderPosition = d->m_MinimumPosition;

+ 22 - 3
Libs/Widgets/ctkRangeWidget.cpp

@@ -251,6 +251,16 @@ double ctkRangeWidget::previousSliderPosition()
 */
 
 // --------------------------------------------------------------------------
+void ctkRangeWidget::values(double &minValue, double &maxValue)const
+{
+  CTK_D(const ctkRangeWidget);
+  Q_ASSERT(d->equal(d->Slider->minimumValue(), d->MinimumSpinBox->value()));
+  Q_ASSERT(d->equal(d->Slider->maximumValue(), d->MaximumSpinBox->value()));
+  minValue = d->Changing ? d->MinimumValueBeforeChange : d->Slider->minimumValue();
+  maxValue = d->Changing ? d->MaximumValueBeforeChange : d->Slider->maximumValue();
+}
+
+// --------------------------------------------------------------------------
 double ctkRangeWidget::minimumValue()const
 {
   CTK_D(const ctkRangeWidget);
@@ -350,11 +360,18 @@ void ctkRangeWidget::stopChanging()
     return;
     }
   d->Changing = false;
-  if (qAbs(this->minimumValue() - d->MinimumValueBeforeChange) > (this->singleStep() * 0.000000001))
+  bool emitMinValChanged = qAbs(this->minimumValue() - d->MinimumValueBeforeChange) > (this->singleStep() * 0.000000001);
+  bool emitMaxValChanged = qAbs(this->maximumValue() - d->MaximumValueBeforeChange) > (this->singleStep() * 0.000000001);
+  if (emitMinValChanged || emitMaxValChanged)
+    {
+	// emit the valuesChanged signal first
+    emit this->valuesChanged(this->minimumValue(), this->maximumValue());
+    }
+  if (emitMinValChanged)
     {
     emit this->minimumValueChanged(this->minimumValue());
     }
-  if (qAbs(this->maximumValue() - d->MaximumValueBeforeChange) > (this->singleStep() * 0.000000001))
+  if (emitMaxValChanged)
     {
     emit this->maximumValueChanged(this->maximumValue());
     }
@@ -370,8 +387,9 @@ void ctkRangeWidget::changeMinimumValue(double newValue)
     }
   if (!d->Changing)
     {
+    emit this->valuesChanged(newValue, this->maximumValue());
     emit this->minimumValueChanged(newValue);
-    }
+	}
 }
 
 // --------------------------------------------------------------------------
@@ -384,6 +402,7 @@ void ctkRangeWidget::changeMaximumValue(double newValue)
     }
   if (!d->Changing)
     {
+    emit this->valuesChanged(this->minimumValue(), newValue);
     emit this->maximumValueChanged(newValue);
     }
 }

+ 6 - 0
Libs/Widgets/ctkRangeWidget.h

@@ -95,6 +95,11 @@ public:
   double maximumValue()const;
 
   ///
+  /// Utility function that returns both values at the same time
+  /// Returns minimumValue and maximumValue
+  void values(double &minValue, double &maxValue)const;
+
+  ///
   /// This property holds the single step.
   /// The smaller of two natural steps that the
   /// slider provides and typically corresponds to the
@@ -180,6 +185,7 @@ signals:
   void minimumValueIsChanging(double value);
   void maximumValueChanged(double value);
   void maximumValueIsChanging(double value);
+  void valuesChanged(double minValue, double maxValue);
 
 protected slots:
   void startChanging();

+ 108 - 28
Libs/Widgets/ctkTransferFunctionBarsItem.cpp

@@ -19,10 +19,12 @@
 =========================================================================*/
 
 /// Qt includes
+#include <QApplication>
 #include <QColor>
 #include <QDebug>
 #include <QGraphicsSceneMouseEvent>
 #include <QPainter>
+#include <QPalette>
 #include <QtGlobal>
 #include <QVariant>
 
@@ -40,16 +42,24 @@ class ctkTransferFunctionBarsItemPrivate: public ctkPrivate<ctkTransferFunctionB
 {
 public:
   ctkTransferFunctionBarsItemPrivate();
-  qreal  BarWidth;
+
+  QPainterPath createBarsPath(ctkTransferFunction* tf, const QList<QPointF>& points, qreal barWidth, bool useLog, const QRectF& rect);
+  QPainterPath createAreaPath(ctkTransferFunction* tf, const QList<QPointF>& points, qreal barWidth, bool useLog, const QRectF& rect);
+  qreal barWidth()const;
+  bool useLog()const;
+
+  qreal  BarWidthRatio;
   QColor BarColor;
-  bool   LogMode;
+  ctkTransferFunctionBarsItem::LogMode   LogMode;
 };
 
 //-----------------------------------------------------------------------------
 ctkTransferFunctionBarsItemPrivate::ctkTransferFunctionBarsItemPrivate()
 {
-  this->BarWidth = 0.6180; // golden ratio... why not.
+  this->BarWidthRatio = 0.6180; // golden ratio... why not.
   this->BarColor = QColor(191, 191, 191, 127);
+  this->BarColor = QApplication::palette().color(QPalette::Normal, QPalette::Highlight);
+  this->BarColor.setAlphaF(0.2);
   this->LogMode = ctkTransferFunctionBarsItem::AutoLog;
 }
 
@@ -74,15 +84,15 @@ ctkTransferFunctionBarsItem::~ctkTransferFunctionBarsItem()
 }
 
 //-----------------------------------------------------------------------------
-void ctkTransferFunctionBarsItem::setBarWidth(qreal newBarWidth)
+void ctkTransferFunctionBarsItem::setBarWidth(qreal newBarWidthRatio)
 {
   CTK_D(ctkTransferFunctionBarsItem);
-  newBarWidth = qBound(0., newBarWidth, 1.);
-  if (d->BarWidth == newBarWidth)
+  newBarWidthRatio = qBound(0., newBarWidthRatio, 1.);
+  if (d->BarWidthRatio == newBarWidthRatio)
     {
     return;
     }
-  d->BarWidth = newBarWidth;
+  d->BarWidthRatio = newBarWidthRatio;
   this->update();
 }
 
@@ -90,7 +100,7 @@ void ctkTransferFunctionBarsItem::setBarWidth(qreal newBarWidth)
 qreal ctkTransferFunctionBarsItem::barWidth()const
 {
   CTK_D(const ctkTransferFunctionBarsItem);
-  return d->BarWidth;
+  return d->BarWidthRatio;
 }
 
 //-----------------------------------------------------------------------------
@@ -111,37 +121,74 @@ QColor ctkTransferFunctionBarsItem::barColor()const
 void ctkTransferFunctionBarsItem::paint(
   QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget)
 {
+  CTK_D(ctkTransferFunctionBarsItem);
   Q_UNUSED(option);
   Q_UNUSED(widget);
-  CTK_D(ctkTransferFunctionBarsItem);
-  int count = this->transferFunction() ? this->transferFunction()->count() : 0;
-  if (count <= 0)
+
+  // setup colors 
+  QColor penColor = d->BarColor;
+  penColor.setAlphaF(1.);
+  QPen pen;
+  if (penColor == QApplication::palette().color(QPalette::Normal, QPalette::Highlight))
+    {
+    pen = QPen(penColor, 1);
+    }
+  else
+    {
+    pen = QPen(QColor(255, 255, 255, 191), 1);
+    }
+  pen.setCosmetic(true);
+
+  // setup drawing
+  ctkTransferFunction* tf = this->transferFunction();
+  if (tf == 0 || tf->count() < 1)
     {
     return;
     }
 
-  ctkTransferFunctionRepresentation* tfRep = this->transferFunction()->representation();
-  //ctkTransferFunctionScene* tfScene = dynamic_cast<ctkTransferFunctionScene*>(this->scene());
-  //Q_ASSERT(tfScene);
-  //const QList<QPointF>& points = tfScene->points();
-  const QList<QPointF>& points = tfRep->points();
+  Q_ASSERT(tf->representation());
+  const QList<QPointF>& points = tf->representation()->points();
+
+  qreal barWidth = d->barWidth(); 
+  bool useLog = d->useLog();
 
   QPainterPath bars;
-  QPen pen( QColor(255, 255, 255, 191), 1);
-  pen.setCosmetic(true);
-  if (qFuzzyCompare(d->BarWidth, 1.))
+  if (qFuzzyCompare(d->BarWidthRatio, 1.))
+    {
+    bars = d->createAreaPath(tf, points, barWidth, useLog, this->rect());
+    pen.setWidth(2);
+    }
+  else
     {
-    pen = QPen(QBrush(), 0, Qt::NoPen);
+    bars = d->createBarsPath(tf, points, barWidth, useLog, this->rect());
     }
+  
   painter->setPen(pen);
   painter->setBrush(QBrush(d->BarColor));
+  painter->drawPath(bars);
+}
+
+//-----------------------------------------------------------------------------
+qreal ctkTransferFunctionBarsItemPrivate::barWidth()const
+{
+  CTK_P(const ctkTransferFunctionBarsItem);
+  ctkTransferFunction* tf = p->transferFunction();
+  Q_ASSERT(tf);
+  return this->BarWidthRatio * (p->rect().width() / (tf->representation()->points().size() - 1));
+}
+
+//-----------------------------------------------------------------------------
+bool ctkTransferFunctionBarsItemPrivate::useLog()const
+{
+  CTK_P(const ctkTransferFunctionBarsItem);
+  ctkTransferFunction* tf = p->transferFunction();
+  Q_ASSERT(tf);
 
-  qreal barWidth = d->BarWidth * (this->rect().width() / (points.size() - 1));
   bool useLog = false;
-  switch (d->LogMode)
+  switch (this->LogMode)
     {
     case ctkTransferFunctionBarsItem::AutoLog:
-      useLog = this->transferFunction()->maxValue().toReal() - this->transferFunction()->minValue().toReal() > 1000.;
+      useLog = tf->maxValue().toReal() - tf->minValue().toReal() > 1000.;
       break;
     case ctkTransferFunctionBarsItem::UseLog:
       useLog = true;
@@ -150,17 +197,50 @@ void ctkTransferFunctionBarsItem::paint(
     case ctkTransferFunctionBarsItem::NoLog:
       useLog = false;
     }
+  return useLog;
+}
+
+//-----------------------------------------------------------------------------
+QPainterPath ctkTransferFunctionBarsItemPrivate::createBarsPath(ctkTransferFunction* tf, const QList<QPointF>& points, qreal barWidth, bool useLog, const QRectF& rect)
+{
+  ctkTransferFunctionRepresentation* tfRep = tf->representation();
+  Q_ASSERT(tfRep);
+
+  QPainterPath bars;
   foreach(const QPointF& point, points)
     {
     qreal barHeight = point.y();
     if (useLog && barHeight != 1.)
       {
-      //barHeight = this->rect().height() - log( tfScene->mapYFromScene(barHeight) )/log(this->transferFunction()->maxValue().toReal());// 1. - (-log(barHeight)/100.);
-      barHeight = this->rect().height() - log( tfRep->mapYFromScene(barHeight) )/log(this->transferFunction()->maxValue().toReal());// 1. - (-log(barHeight)/100.);
+      barHeight = rect.height() - log( tfRep->mapYFromScene(barHeight) )/log(tf->maxValue().toReal());
       }
-    bars.addRect(point.x() - barWidth/2, this->rect().height(),
-                 barWidth, barHeight - this->rect().height() );
+    bars.addRect(point.x() - barWidth/2, rect.height(),
+                 barWidth, barHeight - rect.height() );
     }
-  painter->drawPath(bars);
+  return bars;
 }
 
+//-----------------------------------------------------------------------------
+QPainterPath ctkTransferFunctionBarsItemPrivate::createAreaPath(ctkTransferFunction* tf, const QList<QPointF>& points, qreal barWidth, bool useLog, const QRectF& rect)
+{
+  ctkTransferFunctionRepresentation* tfRep = tf->representation();
+  Q_ASSERT(tfRep);
+
+  QPainterPath bars;
+  // 0.001 is here to ensure the outer border is not displayed on the screen
+  bars.moveTo(-barWidth/2, rect.height() + 0.1);
+  foreach(const QPointF& point, points)
+    {
+    qreal barHeight = point.y();
+    if (useLog && barHeight != 1.)
+      {
+      barHeight = rect.height() - log( tfRep->mapYFromScene(barHeight) )/log(tf->maxValue().toReal());
+      }
+    bars.lineTo(point.x() - barWidth/2, barHeight);
+    bars.lineTo(point.x() + barWidth/2, barHeight);
+    }
+  // close the path ?
+  bars.lineTo(rect.width() + barWidth/2, rect.height() + 0.1);
+  bars.lineTo(-barWidth/2, rect.height()  + 0.1);
+  return bars;
+}

+ 2 - 2
Libs/Widgets/ctkTransferFunctionControlPointsItem.cpp

@@ -32,7 +32,7 @@
 #include "ctkTransferFunctionControlPointsItem.h"
 #include "ctkTransferFunctionRepresentation.h"
 #include "ctkTransferFunctionScene.h"
-#include "ctkTransferFunctionWidget.h"
+#include "ctkTransferFunctionView.h"
 
 //-----------------------------------------------------------------------------
 class ctkTransferFunctionControlPointsItemPrivate: 
@@ -125,7 +125,7 @@ void ctkTransferFunctionControlPointsItem::paint(
 void ctkTransferFunctionControlPointsItem::mousePressEvent(QGraphicsSceneMouseEvent* e)
 {
   CTK_D(ctkTransferFunctionControlPointsItem);
-  ctkTransferFunctionWidget* view = qobject_cast<ctkTransferFunctionWidget*>(e->widget()->parentWidget());
+  ctkTransferFunctionView* view = qobject_cast<ctkTransferFunctionView*>(e->widget()->parentWidget());
   Q_ASSERT(view);
   // e->pos() is ok, pointArea should be in the world coordiate
   QRect pointViewArea(QPoint(-d->PointSize.width() / 2, -d->PointSize.height() / 2), d->PointSize);

+ 1 - 1
Libs/Widgets/ctkTransferFunctionItem.cpp

@@ -322,7 +322,7 @@ QPointF ctkTransferFunctionItem::screen2TransferFunctionCoordinates( qreal x, qr
 QVariant ctkTransferFunctionItem::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant& value)
 {
   QVariant res = this->QGraphicsObject::itemChange(change, value);
-  if (change == QGraphicsItem::ItemSceneChange && this->scene())
+  if (change == QGraphicsItem::ItemSceneHasChanged && this->scene())
     {
     connect(this->transferFunction(),SIGNAL(changed()),
             this->scene(), SLOT(update()),Qt::UniqueConnection);

+ 98 - 0
Libs/Widgets/ctkTransferFunctionView.cpp

@@ -0,0 +1,98 @@
+/*=========================================================================
+
+  Library:   CTK
+ 
+  Copyright (c) 2010  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.
+ 
+=========================================================================*/
+/// Qt includes
+#include <QDebug>
+//#include <QGLWidget>
+#include <QGraphicsScene>
+#include <QResizeEvent>
+
+/// CTK includes
+#include "ctkHistogram.h"
+#include "ctkTransferFunction.h"
+#include "ctkTransferFunctionBarsItem.h"
+#include "ctkTransferFunctionControlPointsItem.h"
+#include "ctkTransferFunctionGradientItem.h"
+#include "ctkTransferFunctionScene.h"
+#include "ctkTransferFunctionView.h"
+
+//-----------------------------------------------------------------------------
+class ctkTransferFunctionViewPrivate: public ctkPrivate<ctkTransferFunctionView>
+{
+  CTK_DECLARE_PUBLIC(ctkTransferFunctionView);
+public:
+  ctkTransferFunctionViewPrivate();
+  void init();
+};
+
+//-----------------------------------------------------------------------------
+ctkTransferFunctionViewPrivate::ctkTransferFunctionViewPrivate()
+{
+}
+
+//-----------------------------------------------------------------------------
+void ctkTransferFunctionViewPrivate::init()
+{
+  CTK_P(ctkTransferFunctionView);
+  p->setScene(new ctkTransferFunctionScene(p));
+  p->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+  p->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+  //p->setViewport(new QGLWidget);
+  p->setRenderHint(QPainter::Antialiasing);
+}
+
+//-----------------------------------------------------------------------------
+ctkTransferFunctionView::ctkTransferFunctionView(QWidget* parentWidget)
+  :QGraphicsView(parentWidget)
+{
+  CTK_INIT_PRIVATE(ctkTransferFunctionView);
+  ctk_d()->init();
+}
+
+//-----------------------------------------------------------------------------
+ctkTransferFunctionView::~ctkTransferFunctionView()
+{
+}
+
+//-----------------------------------------------------------------------------
+void ctkTransferFunctionView::resizeEvent(QResizeEvent * event)
+{
+  /*
+  QRectF sceneRect(QPointF(0,0),event->size());
+  this->scene()->setSceneRect(sceneRect);
+  foreach(QGraphicsItem * item, this->scene()->items())
+    {
+    ctkTransferFunctionItem* rectItem = 
+      qgraphicsitem_cast<ctkTransferFunctionItem*>(item);
+    if (rectItem)
+      {
+      rectItem->setRect(sceneRect);
+      }
+    }
+  */
+  QMatrix zoomMatrix;
+  zoomMatrix.scale(event->size().width(), event->size().height());
+  bool blocked = this->blockSignals(true);
+  this->setMatrix(zoomMatrix);
+  this->blockSignals(blocked);
+  this->QGraphicsView::resizeEvent(event);
+  // Control points are resized by the view transform, we want
+  // fixed size control points, lines...
+  //this->fitInView(this->scene()->sceneRect());
+}

+ 7 - 11
Libs/Widgets/ctkTransferFunctionWidget.h

@@ -18,8 +18,8 @@
  
 =========================================================================*/
 
-#ifndef __ctkTransferFunctionWidget_h
-#define __ctkTransferFunctionWidget_h
+#ifndef __ctkTransferFunctionView_h
+#define __ctkTransferFunctionView_h
 
 /// Qt includes
 #include <QGraphicsView>
@@ -29,19 +29,15 @@
 #include "ctkPimpl.h"
 
 class ctkTransferFunction;
-class ctkTransferFunctionWidgetPrivate;
+class ctkTransferFunctionViewPrivate;
 
 //-----------------------------------------------------------------------------
-class CTK_WIDGETS_EXPORT ctkTransferFunctionWidget: public QGraphicsView
+class CTK_WIDGETS_EXPORT ctkTransferFunctionView: public QGraphicsView
 {
   Q_OBJECT;
 public:
-  ctkTransferFunctionWidget(QWidget* parent = 0);
-  ctkTransferFunctionWidget(ctkTransferFunction* transferFunction, QWidget* parent = 0);
-  virtual ~ctkTransferFunctionWidget();
-
-  void setTransferFunction(ctkTransferFunction* transferFunction);
-  ctkTransferFunction* transferFunction()const;
+  ctkTransferFunctionView(QWidget* parent = 0);
+  virtual ~ctkTransferFunctionView();
 protected:
   virtual void resizeEvent(QResizeEvent * event);
   /*
@@ -50,7 +46,7 @@ protected:
   virtual void mouseReleaseEvent ( QMouseEvent * event );*/
 
 private:
-  CTK_DECLARE_PRIVATE(ctkTransferFunctionWidget);
+  CTK_DECLARE_PRIVATE(ctkTransferFunctionView);
 };
 
 #endif

+ 0 - 184
Libs/Widgets/ctkTransferFunctionWidget.cpp

@@ -1,184 +0,0 @@
-/*=========================================================================
-
-  Library:   CTK
- 
-  Copyright (c) 2010  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.
- 
-=========================================================================*/
-/// Qt includes
-#include <QDebug>
-//#include <QGLWidget>
-#include <QGraphicsScene>
-#include <QResizeEvent>
-
-/// CTK includes
-#include "ctkHistogram.h"
-#include "ctkTransferFunction.h"
-#include "ctkTransferFunctionWidget.h"
-#include "ctkTransferFunctionScene.h"
-#include "ctkTransferFunctionGradientItem.h"
-#include "ctkTransferFunctionControlPointsItem.h"
-#include "ctkTransferFunctionBarsItem.h"
-
-//-----------------------------------------------------------------------------
-class ctkTransferFunctionWidgetPrivate: public ctkPrivate<ctkTransferFunctionWidget>
-{
-  CTK_DECLARE_PUBLIC(ctkTransferFunctionWidget);
-public:
-  ctkTransferFunctionWidgetPrivate();
-  void init();
-  ctkTransferFunction* TransferFunction;
-};
-
-//-----------------------------------------------------------------------------
-ctkTransferFunctionWidgetPrivate::ctkTransferFunctionWidgetPrivate()
-{
-  this->TransferFunction = 0;
-}
-
-//-----------------------------------------------------------------------------
-void ctkTransferFunctionWidgetPrivate::init()
-{
-  CTK_P(ctkTransferFunctionWidget);
-  p->setScene(new ctkTransferFunctionScene(p));
-  p->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-  p->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-  //p->setViewport(new QGLWidget);
-  p->setRenderHint(QPainter::Antialiasing);
-}
-
-//-----------------------------------------------------------------------------
-ctkTransferFunctionWidget::ctkTransferFunctionWidget(QWidget* parentWidget)
-  :QGraphicsView(parentWidget)
-{
-  CTK_INIT_PRIVATE(ctkTransferFunctionWidget);
-  ctk_d()->init();
-}
-
-//-----------------------------------------------------------------------------
-ctkTransferFunctionWidget::ctkTransferFunctionWidget(
-  ctkTransferFunction* transferFunction, QWidget* parentWidget)
-  :QGraphicsView(parentWidget)
-{
-  CTK_INIT_PRIVATE(ctkTransferFunctionWidget);
-  ctk_d()->init();
-  this->setTransferFunction(transferFunction);
-}
-//-----------------------------------------------------------------------------
-ctkTransferFunctionWidget::~ctkTransferFunctionWidget()
-{
-}
-
-//-----------------------------------------------------------------------------
-void ctkTransferFunctionWidget::setTransferFunction(ctkTransferFunction* transferFunction)
-{
-  CTK_D(ctkTransferFunctionWidget);
-  d->TransferFunction = transferFunction;
-  ctkTransferFunctionScene* tfScene = dynamic_cast<ctkTransferFunctionScene*>(this->scene());
-  Q_ASSERT(tfScene);
-  tfScene->clear();
-  //tfScene->setTransferFunction(transferFunction);
-
-  ctkTransferFunctionGradientItem* gradient = 
-    new ctkTransferFunctionGradientItem(transferFunction);
-  //gradient->setRect(tfScene->sceneRect());
-  this->scene()->addItem(gradient);
-
-  if (qobject_cast<ctkHistogram*>(transferFunction) != 0)
-    {
-    gradient->setMask(false);
-    ctkTransferFunctionBarsItem* histogramItem = 
-      new ctkTransferFunctionBarsItem(transferFunction);
-    //controlPoints->setRect(tfScene->sceneRect());
-    this->scene()->addItem(histogramItem);
-    }
-  else
-    {
-    ctkTransferFunctionControlPointsItem* controlPoints = 
-      new ctkTransferFunctionControlPointsItem(transferFunction);
-    // Useful for key events
-    controlPoints->setFlags(QGraphicsItem::ItemIsFocusable);
-    //controlPoints->setRect(tfScene->sceneRect());
-    this->scene()->addItem(controlPoints);
-    } 
-}
-
-//-----------------------------------------------------------------------------
-ctkTransferFunction* ctkTransferFunctionWidget::transferFunction()const
-{
-  return ctk_d()->TransferFunction;
-}
-
-//-----------------------------------------------------------------------------
-void ctkTransferFunctionWidget::resizeEvent(QResizeEvent * event)
-{
-  /*
-  QRectF sceneRect(QPointF(0,0),event->size());
-  this->scene()->setSceneRect(sceneRect);
-  foreach(QGraphicsItem * item, this->scene()->items())
-    {
-    ctkTransferFunctionItem* rectItem = 
-      qgraphicsitem_cast<ctkTransferFunctionItem*>(item);
-    if (rectItem)
-      {
-      rectItem->setRect(sceneRect);
-      }
-    }
-  */
-  QMatrix zoomMatrix;
-  zoomMatrix.scale(event->size().width(), event->size().height());
-  bool blocked = this->blockSignals(true);
-  this->setMatrix(zoomMatrix);
-  this->blockSignals(blocked);
-  this->QGraphicsView::resizeEvent(event);
-  // Control points are resized by the view transform, we want
-  // fixed size control points, lines...
-  //this->fitInView(this->scene()->sceneRect());
-  qDebug() << "resize event caught";
-}
-/*
-//-----------------------------------------------------------------------------
-void ctkTransferFunctionWidget::dragEnterEvent ( QDragEnterEvent * event )
-{
-  qDebug() << "drag event caught";
-
-  this->QGraphicsView::dragEnterEvent(event);
-
-}
-
-//-----------------------------------------------------------------------------
-void ctkTransferFunctionWidget::mousePressEvent ( QMouseEvent * event )
-{
-  qDebug() << "press event caught";
-  //One control point is added to the scene
-  // 1 - get position of the mouse
-  qDebug() << "x position " << event->x();
-  qDebug() << "y position " << event->y();
-
-  this->scene()->items()[1]->;
-
-  // 2nd item are the control points
-
-  this->QGraphicsView::mousePressEvent(event);
-}
-
-//-----------------------------------------------------------------------------
-void ctkTransferFunctionWidget::mouseReleaseEvent ( QMouseEvent * event )
-{
-  qDebug() << "release event caught";
-
-  this->QGraphicsView::mouseReleaseEvent(event);
-}
-*/

+ 6 - 1
Plugins/org.commontk.eventbus/ctkEventBusImpl.cpp

@@ -28,7 +28,8 @@ void ctkEventBusImpl::sendEvent(const ctkEvent& event)
 
 void ctkEventBusImpl::publishSignal(const QObject* publisher, const char* signal)
 {
-
+  Q_UNUSED(publisher)
+  Q_UNUSED(signal)
 }
 
 void ctkEventBusImpl::subscribeSlot(const QObject* subscriber, const char* member, const Properties& properties)
@@ -45,6 +46,8 @@ void ctkEventBusImpl::subscribeSlot(const QObject* subscriber, const char* membe
 
 void ctkEventBusImpl::dispatchEvent(const ctkEvent& event, bool isAsync)
 {
+  Q_UNUSED(isAsync)
+
   QString topic = event.topic();
 
   QSet<ctkEventHandlerWrapper*> eventHandlers = this->handlers(topic);
@@ -65,6 +68,8 @@ void ctkEventBusImpl::bucket(ctkEventHandlerWrapper* wrapper)
 
 QSet<ctkEventHandlerWrapper*> ctkEventBusImpl::handlers(const QString& topic)
 {
+  Q_UNUSED(topic)
+
   // TODO
   return globalWildcard.toSet();
 }

+ 7 - 0
Plugins/org.commontk.eventbus/ctkEventBusPlugin.cpp

@@ -18,11 +18,13 @@ using namespace QtMobility;
 
 void ctkEventBusPlugin::start(ctkPluginContext* context)
 {
+  Q_UNUSED(context)
   std::cout << "ctkCore Plugin started\n";
 }
 
 void ctkEventBusPlugin::stop(ctkPluginContext* context)
 {
+  Q_UNUSED(context)
   std::cout << "ctkCore Plugin stopped\n";
 }
 
@@ -30,11 +32,16 @@ QObject* ctkEventBusPlugin::createInstance(const QServiceInterfaceDescriptor& de
                             QServiceContext* context,
                             QAbstractSecuritySession* session)
 {
+  Q_UNUSED(context)
+  Q_UNUSED(session)
+
   std::cout << "Creating service instance for " << descriptor.interfaceName().toStdString() << std::endl;
   if (descriptor.interfaceName() == "org.commontk.core.EventBus")
   {
     return ctkEventBusImpl::instance();
   }
+
+  return 0;
 }
 
 Q_EXPORT_PLUGIN2(org_commontk_eventbus, ctkEventBusPlugin)

+ 1 - 0
Plugins/org.commontk.eventbus/ctkEventHandlerWrapper_p.h

@@ -47,6 +47,7 @@ public:
 
     v = properties[EventConstants::EVENT_FILTER];
     filter = ctkLDAPSearchFilter(v.toString());
+    return true;
   }
 
   void handleEvent(const ctkEvent& event /*, const Permission& perm */)

+ 10 - 0
SuperBuild.cmake

@@ -44,6 +44,16 @@ IF(NOT EXISTS ${CTK_BINARY_DIR}/CTK-build/bin)
 ENDIF()
 
 #-----------------------------------------------------------------------------
+# Git protocole option
+#
+option(CTK_USE_GIT_PROTOCOL "If behind a firewall turn this OFF to use http instead." ON)
+
+set(git_protocol "git")
+if(NOT CTK_USE_GIT_PROTOCOL)
+  set(git_protocol "http")
+endif()
+
+#-----------------------------------------------------------------------------
 # Enable and setup External project global properties
 #
 INCLUDE(ExternalProject)