Explorar o código

Use Qt5 CMake 2.8.12 features.

Also move Widget dependent classes from Core to Widgets. Closes #278.
Sascha Zelzer %!s(int64=11) %!d(string=hai) anos
pai
achega
f49c19a821
Modificáronse 48 ficheiros con 687 adicións e 538 borrados
  1. 3 21
      CMake/ctkMacroBuildLib.cmake
  2. 8 22
      CMake/ctkMacroBuildQtPlugin.cmake
  3. 1 1
      CMake/ctkMacroSetupQt.cmake
  4. 1 1
      CMakeLists.txt
  5. 11 20
      Libs/Core/CMakeLists.txt
  6. 0 24
      Libs/Core/Testing/Cpp/CMakeLists.txt
  7. 151 0
      Libs/Core/ctkErrorLogAbstractMessageHandler.cpp
  8. 80 0
      Libs/Core/ctkErrorLogAbstractMessageHandler.h
  9. 4 4
      Libs/Core/ctkErrorLogFDMessageHandler.cpp
  10. 1 1
      Libs/Core/ctkErrorLogFDMessageHandler.h
  11. 4 3
      Libs/Core/ctkErrorLogFDMessageHandler_p.h
  12. 44 0
      Libs/Core/ctkErrorLogLevel.cpp
  13. 61 0
      Libs/Core/ctkErrorLogLevel.h
  14. 1 0
      Libs/Core/ctkErrorLogQtMessageHandler.cpp
  15. 1 1
      Libs/Core/ctkErrorLogQtMessageHandler.h
  16. 1 0
      Libs/Core/ctkErrorLogStreamMessageHandler.cpp
  17. 1 1
      Libs/Core/ctkErrorLogStreamMessageHandler.h
  18. 139 0
      Libs/Core/ctkErrorLogTerminalOutput.cpp
  19. 72 0
      Libs/Core/ctkErrorLogTerminalOutput.h
  20. 2 4
      Libs/Core/target_libraries.cmake
  21. 23 5
      Libs/Widgets/CMakeLists.txt
  22. 29 0
      Libs/Widgets/Testing/Cpp/CMakeLists.txt
  23. 0 0
      Libs/Widgets/Testing/Cpp/ctkCheckableModelHelperTest1.cpp
  24. 0 0
      Libs/Widgets/Testing/Cpp/ctkErrorLogFDMessageHandlerWithThreadsTest1.cpp
  25. 0 0
      Libs/Widgets/Testing/Cpp/ctkErrorLogModelEntryGroupingTest1.cpp
  26. 4 4
      Libs/Core/Testing/Cpp/ctkErrorLogModelTerminalOutputTest1.cpp
  27. 0 0
      Libs/Widgets/Testing/Cpp/ctkErrorLogModelTest1.cpp
  28. 0 0
      Libs/Widgets/Testing/Cpp/ctkErrorLogModelTest4.cpp
  29. 0 0
      Libs/Widgets/Testing/Cpp/ctkErrorLogModelTestHelper.cpp
  30. 0 0
      Libs/Widgets/Testing/Cpp/ctkErrorLogQtMessageHandlerWithThreadsTest1.cpp
  31. 0 0
      Libs/Widgets/Testing/Cpp/ctkErrorLogStreamMessageHandlerWithThreadsTest1.cpp
  32. 0 0
      Libs/Widgets/Testing/Cpp/ctkHistogramTest1.cpp
  33. 0 0
      Libs/Widgets/Testing/Cpp/ctkTransferFunctionRepresentationTest1.cpp
  34. 0 0
      Libs/Widgets/Testing/Cpp/ctkTransferFunctionRepresentationTest2.cpp
  35. 0 0
      Libs/Widgets/Testing/Cpp/ctkTransferFunctionTest1.cpp
  36. 0 0
      Libs/Widgets/ctkCheckableModelHelper.cpp
  37. 3 3
      Libs/Core/ctkCheckableModelHelper.h
  38. 10 273
      Libs/Core/ctkErrorLogModel.cpp
  39. 10 120
      Libs/Core/ctkErrorLogModel.h
  40. 1 1
      Libs/Widgets/ctkErrorLogStatusMessageHandler.h
  41. 0 0
      Libs/Widgets/ctkHistogram.cpp
  42. 0 0
      Libs/Widgets/ctkHistogram.h
  43. 0 8
      Libs/Widgets/ctkIconEnginePlugin.cpp
  44. 1 1
      Libs/Widgets/ctkMaterialPropertyPreviewLabel.cpp
  45. 0 0
      Libs/Widgets/ctkTransferFunction.cpp
  46. 17 17
      Libs/Core/ctkTransferFunction.h
  47. 0 0
      Libs/Widgets/ctkTransferFunctionRepresentation.cpp
  48. 3 3
      Libs/Core/ctkTransferFunctionRepresentation.h

+ 3 - 21
CMake/ctkMacroBuildLib.cmake

@@ -28,7 +28,7 @@
 #! \ingroup CMakeAPI
 macro(ctkMacroBuildLib)
   ctkMacroParseArguments(MY
-    "NAME;EXPORT_DIRECTIVE;SRCS;MOC_SRCS;GENERATE_MOC_SRCS;UI_FORMS;INCLUDE_DIRECTORIES;QT5_MODULES;TARGET_LIBRARIES;RESOURCES;LIBRARY_TYPE"
+    "NAME;EXPORT_DIRECTIVE;SRCS;MOC_SRCS;GENERATE_MOC_SRCS;UI_FORMS;INCLUDE_DIRECTORIES;TARGET_LIBRARIES;RESOURCES;LIBRARY_TYPE"
     "ENABLE_QTTESTING"
     ${ARGN}
     )
@@ -47,24 +47,10 @@ macro(ctkMacroBuildLib)
   if(NOT DEFINED MY_LIBRARY_TYPE)
     set(MY_LIBRARY_TYPE "SHARED")
   endif()
-  
-  if(MY_QT5_MODULES)
-    set(qt5_use_modules_list)
-    if(CTK_QT_VERSION VERSION_LESS "5")
-      message(WARNING "Argument QT5_MODULES ignored because Qt version < 5.")
-    else()
-      foreach(qt5_module ${MY_QT5_MODULES})
-        find_package(${qt5_module} REQUIRED)
-        # strip the "Qt5" string from the module name
-        string(SUBSTRING ${qt5_module} 3 -1 _qt5_module_name)
-        list(APPEND qt5_use_modules_list ${_qt5_module_name})
-      endforeach()
-    endif()
-  endif()
 
   # Define library name
   set(lib_name ${MY_NAME})
-  
+
   # Library target names must not contain a '_' (reserved for plug-in target names)
   if(lib_name MATCHES _)
     message(FATAL_ERROR "The library name ${lib_name} must not contain a '_' character.")
@@ -119,7 +105,7 @@ macro(ctkMacroBuildLib)
   if(MY_MOC_SRCS)
     # this is a workaround for Visual Studio. The relative include paths in the generated
     # moc files can get very long and can't be resolved by the MSVC compiler.
-    if(Qt5Core_FOUND)
+    if(CTK_QT_VERSION VERSION_GREATER "4")
       foreach(moc_src ${MY_MOC_SRCS})
         qt5_wrap_cpp(MY_MOC_CPP ${moc_src} OPTIONS -f${moc_src})
       endforeach()
@@ -169,10 +155,6 @@ macro(ctkMacroBuildLib)
     ${MY_UI_CPP}
     ${MY_QRC_SRCS}
     )
-    
-  if(CTK_QT_VERSION VERSION_GREATER "4" AND qt5_use_modules_list)
-    qt5_use_modules(${lib_name} ${qt5_use_modules_list})
-  endif()
 
   # Set labels associated with the target.
   set_target_properties(${lib_name} PROPERTIES LABELS ${lib_name})

+ 8 - 22
CMake/ctkMacroBuildQtPlugin.cmake

@@ -28,7 +28,7 @@ macro(ctkMacroBuildQtPlugin)
   cmake_parse_arguments(MY
     "" # no options
     "NAME;EXPORT_DIRECTIVE;PLUGIN_DIR" # one value args
-    "SRCS;MOC_SRCS;UI_FORMS;INCLUDE_DIRECTORIES;TARGET_LIBRARIES;QT5_MODULES;RESOURCES" # multi value args
+    "SRCS;MOC_SRCS;UI_FORMS;INCLUDE_DIRECTORIES;TARGET_LIBRARIES;RESOURCES" # multi value args
     ${ARGN}
     )
 
@@ -43,20 +43,6 @@ macro(ctkMacroBuildQtPlugin)
     message(FATAL_ERROR "PLUGIN_DIR (e.g. designer, iconengines, imageformats...) is mandatory")
   endif()
   set(MY_LIBRARY_TYPE "MODULE")
-  
-  if(MY_QT5_MODULES)
-    set(qt5_use_modules_list)
-    if(CTK_QT_VERSION VERSION_LOWER "5")
-      message(WARNING "Argument QT5_MODULES ignored because Qt version < 5")
-    else()
-      foreach(qt5_module ${MY_QT5_MODULES})
-        find_package(${qt5_module} REQUIRED)
-        # strip the "Qt5" string from the module name
-        string(SUBSTRING ${qt5_module} 3 -1 _qt5_module_name)
-        list(APPEND qt5_use_modules_list ${_qt5_module_name})
-      endforeach()
-    endif()
-  endif()
 
   # Define library name
   set(lib_name ${MY_NAME})
@@ -98,8 +84,8 @@ macro(ctkMacroBuildQtPlugin)
 
   # Wrap
   set(MY_QRC_SRCS "")
-  if(Qt5Core_FOUND)
-    qt5_wrap_cpp(MY_MOC_CPP ${MY_MOC_SRCS})
+  if(CTK_QT_VERSION VERSION_GREATER "4")
+    qt5_wrap_cpp(MY_MOC_CPP ${MY_MOC_SRCS} TARGET ${lib_name})
     if(DEFINED MY_RESOURCES)
       qt5_add_resources(MY_QRC_SRCS ${MY_RESOURCES})
     endif()
@@ -109,7 +95,7 @@ macro(ctkMacroBuildQtPlugin)
       QT4_ADD_RESOURCES(MY_QRC_SRCS ${MY_RESOURCES})
     endif()
   endif()
-  
+
   if(CTK_QT_VERSION VERSION_GREATER "4")
     if(Qt5Widgets_FOUND)
       qt5_wrap_ui(MY_UI_CPP ${MY_UI_FORMS})
@@ -137,10 +123,6 @@ macro(ctkMacroBuildQtPlugin)
     ${MY_UI_CPP}
     ${MY_QRC_SRCS}
     )
-  
-  if(CTK_QT_VERSION VERSION_GREATER "4" AND qt5_use_modules_list)
-    qt5_use_modules(${lib_name} ${qt5_use_modules_list})
-  endif()
 
   # Extract library name associated with the plugin and use it as label
   string(REGEX REPLACE "(.*)Plugin[s]?" "\\1" label ${lib_name})
@@ -196,6 +178,10 @@ macro(ctkMacroBuildQtDesignerPlugin)
   ctkMacroBuildQtPlugin(
     PLUGIN_DIR designer
     ${ARGN})
+  if(CTK_QT_VERSION VERSION_GREATER "4")
+    find_package(Qt5Designer REQUIRED)
+    target_link_libraries(${lib_name} Qt5::Designer)
+  endif()
 endmacro()
 
 macro(ctkMacroBuildQtIconEnginesPlugin)

+ 1 - 1
CMake/ctkMacroSetupQt.cmake

@@ -31,7 +31,7 @@ macro(ctkMacroSetupQt)
 
 
   if(CTK_QT_VERSION VERSION_GREATER "4")
-    cmake_minimum_required(VERSION 2.8.9)
+    cmake_minimum_required(VERSION 2.8.12)
     set(QT5_INSTALL_PREFIX "" CACHE PATH "The install location of Qt5")
     if(NOT QT5_INSTALL_PREFIX OR NOT EXISTS ${QT5_INSTALL_PREFIX}/bin/qmake)
       message(FATAL_ERROR "You must specify the install location of Qt5")

+ 1 - 1
CMakeLists.txt

@@ -18,7 +18,7 @@
 #
 ###########################################################################
 
-cmake_minimum_required(VERSION 2.8.4)
+cmake_minimum_required(VERSION 2.8.9)
 
 #-----------------------------------------------------------------------------
 # Superbuild

+ 11 - 20
Libs/Core/CMakeLists.txt

@@ -35,21 +35,23 @@ set(KIT_SRCS
   ctkBooleanMapper.h
   ctkCallback.cpp
   ctkCallback.h
-  ctkCheckableModelHelper.cpp
-  ctkCheckableModelHelper.h
   ctkCommandLineParser.cpp
   ctkCommandLineParser.h
   ctkDependencyGraph.cpp
   ctkDependencyGraph.h
-  ctkErrorLogModel.cpp
-  ctkErrorLogModel.h
+  ctkErrorLogAbstractMessageHandler.cpp
+  ctkErrorLogAbstractMessageHandler.h
   ctkErrorLogFDMessageHandler.cpp
   ctkErrorLogFDMessageHandler.h
   ctkErrorLogFDMessageHandler_p.h
+  ctkErrorLogLevel.cpp
+  ctkErrorLogLevel.h
   ctkErrorLogQtMessageHandler.cpp
   ctkErrorLogQtMessageHandler.h
   ctkErrorLogStreamMessageHandler.cpp
   ctkErrorLogStreamMessageHandler.h
+  ctkErrorLogTerminalOutput.cpp
+  ctkErrorLogTerminalOutput.h
   ctkException.cpp
   ctkException.h
   ctkHighPrecisionTimer.cpp
@@ -57,18 +59,12 @@ set(KIT_SRCS
   ctkLinearValueProxy.h
   ctkLogger.cpp
   ctkLogger.h
-  ctkHistogram.cpp
-  ctkHistogram.h
   ctkModelTester.cpp
   ctkModelTester.h
   ctkPimpl.h
   ctkScopedCurrentDir.cpp
   ctkScopedCurrentDir.h
   ctkSingleton.h
-  ctkTransferFunction.cpp
-  ctkTransferFunction.h
-  ctkTransferFunctionRepresentation.cpp
-  ctkTransferFunctionRepresentation.h
   ctkUtils.cpp
   ctkUtils.h
   ctkValueProxy.cpp
@@ -95,18 +91,16 @@ endif()
 set(KIT_MOC_SRCS
   ctkBooleanMapper.h
   ctkCallback.h
-  ctkCheckableModelHelper.h
   ctkCommandLineParser.h
+  ctkErrorLogAbstractMessageHandler.h
   ctkErrorLogFDMessageHandler_p.h
-  ctkErrorLogModel.h
+  ctkErrorLogLevel.h
   ctkErrorLogQtMessageHandler.h
+  ctkErrorLogTerminalOutput.h
   ctkLinearValueProxy.h
   ctkLogger.h
-  ctkHistogram.h
   ctkModelTester.h
   ctkErrorLogQtMessageHandler.h
-  ctkTransferFunction.h
-  ctkTransferFunctionRepresentation.h
   ctkValueProxy.h
   ctkWorkflow.h
   ctkWorkflow_p.h
@@ -129,10 +123,8 @@ set(KIT_target_libraries)
 ctkFunctionGetTargetLibraries(KIT_target_libraries)
 
 if(CTK_QT_VERSION VERSION_GREATER "4")
-  # This line below should actually be
-  # set(qt5_modules Qt5Core)
-  # see https://github.com/commontk/CTK/issues/278
-  set(qt5_modules Qt5Widgets)
+  find_package(Qt5Core REQUIRED)
+  list(APPEND KIT_target_libraries Qt5::Core)
 endif()
 
 ctkMacroBuildLib(
@@ -144,7 +136,6 @@ ctkMacroBuildLib(
   TARGET_LIBRARIES ${KIT_target_libraries}
   RESOURCES ${KIT_resources}
   LIBRARY_TYPE ${CTK_LIBRARY_MODE}
-  QT5_MODULES ${qt5_modules}
   )
 
 # Needed for ctkBackTrace

+ 0 - 24
Libs/Core/Testing/Cpp/CMakeLists.txt

@@ -26,18 +26,9 @@ set(KITTests_SRCS
   ctkBackTraceTest.cpp
   ctkBooleanMapperTest.cpp
   ctkCallbackTest1.cpp
-  ctkCheckableModelHelperTest1.cpp
   ctkCommandLineParserTest1.cpp
-  ctkErrorLogModelTest1.cpp
-  ctkErrorLogModelEntryGroupingTest1.cpp
-  ctkErrorLogModelTerminalOutputTest1.cpp
-  ctkErrorLogModelTest4.cpp
-  ctkErrorLogFDMessageHandlerWithThreadsTest1.cpp
-  ctkErrorLogQtMessageHandlerWithThreadsTest1.cpp
-  ctkErrorLogStreamMessageHandlerWithThreadsTest1.cpp
   ctkExceptionTest.cpp
   ctkHighPrecisionTimerTest.cpp
-  ctkHistogramTest1.cpp
   ctkLinearValueProxyTest.cpp
   ctkLoggerTest1.cpp
   ctkModelTesterTest1.cpp
@@ -54,9 +45,6 @@ set(KITTests_SRCS
   ctkPimplTest1.cpp
   ctkScopedCurrentDirTest1.cpp
   ctkSingletonTest1.cpp
-  ctkTransferFunctionTest1.cpp
-  ctkTransferFunctionRepresentationTest1.cpp
-  ctkTransferFunctionRepresentationTest2.cpp
   ctkWorkflowTest1.cpp
   ctkWorkflowTest2.cpp
   ctkWorkflowTest3.cpp
@@ -152,20 +140,11 @@ if(HAVE_BFD)
 endif()
 SIMPLE_TEST( ctkBooleanMapperTest )
 SIMPLE_TEST( ctkCallbackTest1 )
-SIMPLE_TEST( ctkCheckableModelHelperTest1 )
 SIMPLE_TEST( ctkCommandLineParserTest1 )
 SIMPLE_TEST( ctkDependencyGraphTest1 )
 SIMPLE_TEST( ctkDependencyGraphTest2 )
-SIMPLE_TEST( ctkErrorLogModelTest1 )
-SIMPLE_TEST( ctkErrorLogModelEntryGroupingTest1 )
-SIMPLE_TEST( ctkErrorLogModelTerminalOutputTest1 --test-launcher $<TARGET_FILE:${KIT}CppTests>)
-SIMPLE_TEST( ctkErrorLogModelTest4 )
-SIMPLE_TEST( ctkErrorLogFDMessageHandlerWithThreadsTest1 )
-SIMPLE_TEST( ctkErrorLogQtMessageHandlerWithThreadsTest1 )
-SIMPLE_TEST( ctkErrorLogStreamMessageHandlerWithThreadsTest1 )
 SIMPLE_TEST( ctkExceptionTest )
 SIMPLE_TEST( ctkHighPrecisionTimerTest )
-SIMPLE_TEST( ctkHistogramTest1 )
 SIMPLE_TEST( ctkLinearValueProxyTest )
 SIMPLE_TEST( ctkLoggerTest1 )
 set_property(TEST ctkLoggerTest1 PROPERTY PASS_REGULAR_EXPRESSION "logger.debug\nlogger.info\nlogger.trace\nlogger.warn\nlogger.error\nlogger.fatal")
@@ -174,9 +153,6 @@ SIMPLE_TEST( ctkModelTesterTest2 )
 SIMPLE_TEST( ctkPimplTest1 )
 SIMPLE_TEST( ctkScopedCurrentDirTest1 )
 SIMPLE_TEST( ctkSingletonTest1 )
-SIMPLE_TEST( ctkTransferFunctionTest1 )
-SIMPLE_TEST( ctkTransferFunctionRepresentationTest1 )
-SIMPLE_TEST( ctkTransferFunctionRepresentationTest2 )
 SIMPLE_TEST( ctkUtilsCopyDirRecursivelyTest1 )
 SIMPLE_TEST( ctkUtilsQtHandleToStringTest1 )
 SIMPLE_TEST( ctkUtilsTest )

+ 151 - 0
Libs/Core/ctkErrorLogAbstractMessageHandler.cpp

@@ -0,0 +1,151 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0.txt
+
+  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.
+
+=========================================================================*/
+
+#include "ctkErrorLogAbstractMessageHandler.h"
+
+#include <QHash>
+#include <QDateTime>
+
+// --------------------------------------------------------------------------
+// ctkErrorLogAbstractMessageHandlerPrivate
+
+// --------------------------------------------------------------------------
+class ctkErrorLogAbstractMessageHandlerPrivate
+{
+public:
+  ctkErrorLogAbstractMessageHandlerPrivate();
+  ~ctkErrorLogAbstractMessageHandlerPrivate();
+
+  bool                        Enabled;
+  QString                     HandlerPrettyName;
+
+  // Use "int" instead of "ctkErrorLogModel::TerminalOutput" to avoid compilation warning ...
+  // qhash.h:879: warning: passing ‘ctkErrorLogModel::TerminalOutput’ chooses ‘int’ over ‘uint’ [-Wsign-promo]
+  QHash<int, ctkErrorLogTerminalOutput*> TerminalOutputs;
+};
+
+// --------------------------------------------------------------------------
+ctkErrorLogAbstractMessageHandlerPrivate::
+ctkErrorLogAbstractMessageHandlerPrivate()
+  : Enabled(false)
+{
+}
+
+// --------------------------------------------------------------------------
+ctkErrorLogAbstractMessageHandlerPrivate::~ctkErrorLogAbstractMessageHandlerPrivate()
+{
+}
+
+// --------------------------------------------------------------------------
+// ctkErrorLogAbstractMessageHandlerPrivate methods
+
+// --------------------------------------------------------------------------
+ctkErrorLogAbstractMessageHandler::ctkErrorLogAbstractMessageHandler()
+  : Superclass(), d_ptr(new ctkErrorLogAbstractMessageHandlerPrivate)
+{
+}
+
+// --------------------------------------------------------------------------
+ctkErrorLogAbstractMessageHandler::~ctkErrorLogAbstractMessageHandler()
+{
+}
+
+// --------------------------------------------------------------------------
+QString ctkErrorLogAbstractMessageHandler::handlerPrettyName()const
+{
+  Q_D(const ctkErrorLogAbstractMessageHandler);
+  if (d->HandlerPrettyName.isEmpty())
+    {
+    return this->handlerName();
+    }
+  else
+    {
+    return d->HandlerPrettyName;
+    }
+}
+
+// --------------------------------------------------------------------------
+void ctkErrorLogAbstractMessageHandler::setHandlerPrettyName(const QString& newHandlerPrettyName)
+{
+  Q_D(ctkErrorLogAbstractMessageHandler);
+  d->HandlerPrettyName = newHandlerPrettyName;
+}
+
+// --------------------------------------------------------------------------
+bool ctkErrorLogAbstractMessageHandler::enabled()const
+{
+  Q_D(const ctkErrorLogAbstractMessageHandler);
+  return d->Enabled;
+}
+
+// --------------------------------------------------------------------------
+void ctkErrorLogAbstractMessageHandler::setEnabled(bool value)
+{
+  Q_D(ctkErrorLogAbstractMessageHandler);
+  if (value == d->Enabled)
+    {
+    return;
+    }
+  this->setEnabledInternal(value);
+  d->Enabled = value;
+}
+
+// --------------------------------------------------------------------------
+void ctkErrorLogAbstractMessageHandler::handleMessage(const QString& threadId,
+                                                      ctkErrorLogLevel::LogLevel logLevel,
+                                                      const QString& origin, const QString& text)
+{
+  Q_D(ctkErrorLogAbstractMessageHandler);
+  if (logLevel <= ctkErrorLogLevel::Info)
+    {
+    if(d->TerminalOutputs.contains(ctkErrorLogTerminalOutput::StandardOutput))
+      {
+      d->TerminalOutputs.value(ctkErrorLogTerminalOutput::StandardOutput)->output(text);
+      }
+    }
+  else
+    {
+    if(d->TerminalOutputs.contains(ctkErrorLogTerminalOutput::StandardError))
+      {
+      d->TerminalOutputs.value(ctkErrorLogTerminalOutput::StandardError)->output(text);
+      }
+    }
+  emit this->messageHandled(QDateTime::currentDateTime(), threadId, logLevel, origin, text);
+}
+
+// --------------------------------------------------------------------------
+ctkErrorLogTerminalOutput* ctkErrorLogAbstractMessageHandler::terminalOutput(
+    ctkErrorLogTerminalOutput::TerminalOutput terminalOutputType)const
+{
+  Q_D(const ctkErrorLogAbstractMessageHandler);
+  if(d->TerminalOutputs.contains(terminalOutputType))
+    {
+    return d->TerminalOutputs.value(terminalOutputType);
+    }
+  return 0;
+}
+
+// --------------------------------------------------------------------------
+void ctkErrorLogAbstractMessageHandler::setTerminalOutput(
+    ctkErrorLogTerminalOutput::TerminalOutput terminalOutputType, ctkErrorLogTerminalOutput* terminalOutput)
+{
+  Q_D(ctkErrorLogAbstractMessageHandler);
+  d->TerminalOutputs.insert(terminalOutputType, terminalOutput);
+}

+ 80 - 0
Libs/Core/ctkErrorLogAbstractMessageHandler.h

@@ -0,0 +1,80 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0.txt
+
+  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 CTKERRORLOGABSTRACTMESSAGEHANDLER_H
+#define CTKERRORLOGABSTRACTMESSAGEHANDLER_H
+
+// Qt includes
+#include <QObject>
+#include <QDateTime>
+
+// CTK includes
+#include "ctkCoreExport.h"
+#include "ctkErrorLogLevel.h"
+#include "ctkErrorLogTerminalOutput.h"
+
+//------------------------------------------------------------------------------
+class ctkErrorLogAbstractMessageHandlerPrivate;
+
+//------------------------------------------------------------------------------
+/// \ingroup Core
+class CTK_CORE_EXPORT ctkErrorLogAbstractMessageHandler : public QObject
+{
+  Q_OBJECT
+public:
+  typedef QObject Superclass;
+  /// Disabled by default.
+  ctkErrorLogAbstractMessageHandler();
+  virtual ~ctkErrorLogAbstractMessageHandler();
+
+  virtual QString handlerName()const = 0;
+
+  QString handlerPrettyName()const;
+
+  bool enabled()const;
+  void setEnabled(bool value);
+
+  void handleMessage(const QString& threadId, ctkErrorLogLevel::LogLevel logLevel,
+                     const QString& origin, const QString& text);
+
+  ctkErrorLogTerminalOutput* terminalOutput(ctkErrorLogTerminalOutput::TerminalOutput terminalOutputType)const;
+  void setTerminalOutput(ctkErrorLogTerminalOutput::TerminalOutput terminalOutputType,
+                         ctkErrorLogTerminalOutput * terminalOutput);
+
+Q_SIGNALS:
+  void messageHandled(const QDateTime& currentDateTime, const QString& threadId,
+                      ctkErrorLogLevel::LogLevel logLevel, const QString& origin,
+                      const QString& text);
+
+protected:
+  void setHandlerPrettyName(const QString& newHandlerPrettyName);
+
+  virtual void setEnabledInternal(bool value) = 0;
+
+protected:
+  QScopedPointer<ctkErrorLogAbstractMessageHandlerPrivate> d_ptr;
+
+private:
+  Q_DECLARE_PRIVATE(ctkErrorLogAbstractMessageHandler)
+  Q_DISABLE_COPY(ctkErrorLogAbstractMessageHandler)
+};
+
+
+#endif // CTKERRORLOGABSTRACTMESSAGEHANDLER_H

+ 4 - 4
Libs/Core/ctkErrorLogFDMessageHandler.cpp

@@ -44,7 +44,7 @@
 // --------------------------------------------------------------------------
 ctkFDHandler::ctkFDHandler(ctkErrorLogFDMessageHandler* messageHandler,
                            ctkErrorLogLevel::LogLevel logLevel,
-                           ctkErrorLogModel::TerminalOutput terminalOutput)
+                           ctkErrorLogTerminalOutput::TerminalOutput terminalOutput)
 {
   this->MessageHandler = messageHandler;
   this->LogLevel = logLevel;
@@ -76,7 +76,7 @@ void ctkFDHandler::setupPipe()
 // --------------------------------------------------------------------------
 FILE* ctkFDHandler::terminalOutputFile()
 {
-  return this->TerminalOutput == ctkErrorLogModel::StandardOutput ? stdout : stderr;
+  return this->TerminalOutput == ctkErrorLogTerminalOutput::StandardOutput ? stdout : stderr;
 }
 
 // --------------------------------------------------------------------------
@@ -252,8 +252,8 @@ ctkErrorLogFDMessageHandler::ctkErrorLogFDMessageHandler() :
   Superclass(), d_ptr(new ctkErrorLogFDMessageHandlerPrivate())
 {
   Q_D(ctkErrorLogFDMessageHandler);
-  d->StdOutFDHandler = new ctkFDHandler(this, ctkErrorLogLevel::Info, ctkErrorLogModel::StandardOutput);
-  d->StdErrFDHandler = new ctkFDHandler(this, ctkErrorLogLevel::Critical, ctkErrorLogModel::StandardError);
+  d->StdOutFDHandler = new ctkFDHandler(this, ctkErrorLogLevel::Info, ctkErrorLogTerminalOutput::StandardOutput);
+  d->StdErrFDHandler = new ctkFDHandler(this, ctkErrorLogLevel::Critical, ctkErrorLogTerminalOutput::StandardError);
 }
 
 // --------------------------------------------------------------------------

+ 1 - 1
Libs/Core/ctkErrorLogFDMessageHandler.h

@@ -22,7 +22,7 @@
 #define __ctkErrorLogFDMessageHandler_h
 
 // CTK includes
-#include <ctkErrorLogModel.h>
+#include <ctkErrorLogAbstractMessageHandler.h>
 #include "ctkCoreExport.h"
 
 class ctkErrorLogFDMessageHandlerPrivate;

+ 4 - 3
Libs/Core/ctkErrorLogFDMessageHandler_p.h

@@ -26,7 +26,8 @@
 #include <QThread>
 
 // CTK includes
-#include "ctkErrorLogModel.h"
+#include "ctkErrorLogAbstractMessageHandler.h"
+#include "ctkErrorLogTerminalOutput.h"
 
 // STD includes
 #include <cstdio>
@@ -47,7 +48,7 @@ public:
 
   ctkFDHandler(ctkErrorLogFDMessageHandler* messageHandler,
                ctkErrorLogLevel::LogLevel logLevel,
-               ctkErrorLogModel::TerminalOutput terminalOutput);
+               ctkErrorLogTerminalOutput::TerminalOutput terminalOutput);
   virtual ~ctkFDHandler();
 
   /// Enable/Disable the handler.
@@ -67,7 +68,7 @@ private:
   ctkErrorLogFDMessageHandler * MessageHandler;
   ctkErrorLogLevel::LogLevel LogLevel;
 
-  ctkErrorLogModel::TerminalOutput TerminalOutput;
+  ctkErrorLogTerminalOutput::TerminalOutput TerminalOutput;
 
   int    SavedFDNumber;
   fpos_t SavedFDPos;

+ 44 - 0
Libs/Core/ctkErrorLogLevel.cpp

@@ -0,0 +1,44 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0.txt
+
+  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.
+
+=========================================================================*/
+
+#include "ctkErrorLogLevel.h"
+
+// Qt includes
+#include <QMetaEnum>
+
+// --------------------------------------------------------------------------
+ctkErrorLogLevel::ctkErrorLogLevel()
+{
+  qRegisterMetaType<ctkErrorLogLevel::LogLevel>("ctkErrorLogLevel::LogLevel");
+}
+
+// --------------------------------------------------------------------------
+QString ctkErrorLogLevel::operator()(ctkErrorLogLevel::LogLevel logLevel)
+{
+  return ctkErrorLogLevel::logLevelAsString(logLevel);
+}
+
+// --------------------------------------------------------------------------
+QString ctkErrorLogLevel::logLevelAsString(ctkErrorLogLevel::LogLevel logLevel)
+{
+  QMetaEnum logLevelEnum = ctkErrorLogLevel::staticMetaObject.enumerator(0);
+  Q_ASSERT(QString("LogLevel").compare(logLevelEnum.name()) == 0);
+  return QLatin1String(logLevelEnum.valueToKey(logLevel));
+}

+ 61 - 0
Libs/Core/ctkErrorLogLevel.h

@@ -0,0 +1,61 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0.txt
+
+  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 CTKERRORLOGLEVEL_H
+#define CTKERRORLOGLEVEL_H
+
+// Qt includes
+#include <QObject>
+
+// CTK includes
+#include "ctkCoreExport.h"
+
+//------------------------------------------------------------------------------
+/// \ingroup Core
+class CTK_CORE_EXPORT ctkErrorLogLevel : public QObject
+{
+  Q_OBJECT
+  Q_FLAGS(LogLevel)
+public:
+  ctkErrorLogLevel();
+
+  enum LogLevel
+    {
+    None     = 0x0,
+    Unknown  = 0x1,
+    Status   = 0x2,
+    Trace    = 0x4,
+    Debug    = 0x8,
+    Info     = 0x10,
+    Warning  = 0x20,
+    Error    = 0x40,
+    Critical = 0x80,
+    Fatal    = 0x100
+    };
+  Q_DECLARE_FLAGS(LogLevels, LogLevel)
+
+  QString operator ()(LogLevel logLevel);
+
+  static QString logLevelAsString(ctkErrorLogLevel::LogLevel logLevel);
+};
+Q_DECLARE_OPERATORS_FOR_FLAGS(ctkErrorLogLevel::LogLevels)
+
+
+#endif // CTKERRORLOGLEVEL_H

+ 1 - 0
Libs/Core/ctkErrorLogQtMessageHandler.cpp

@@ -21,6 +21,7 @@
 // Qt includes
 #include <QCoreApplication>
 #include <QThread>
+#include <QVariant>
 
 // CTK includes
 #include "ctkErrorLogQtMessageHandler.h"

+ 1 - 1
Libs/Core/ctkErrorLogQtMessageHandler.h

@@ -22,7 +22,7 @@
 #define __ctkErrorLogQtMessageHandler_h
 
 // CTK includes
-#include <ctkErrorLogModel.h>
+#include "ctkErrorLogAbstractMessageHandler.h"
 #include "ctkCoreExport.h"
 
 // Qt includes

+ 1 - 0
Libs/Core/ctkErrorLogStreamMessageHandler.cpp

@@ -21,6 +21,7 @@
 // Qt includes
 #include <QMutexLocker>
 #include <QThread>
+#include <QHash>
 
 // CTK includes
 #include "ctkErrorLogStreamMessageHandler.h"

+ 1 - 1
Libs/Core/ctkErrorLogStreamMessageHandler.h

@@ -22,7 +22,7 @@
 #define __ctkErrorLogStreamMessageHandler_h
 
 // CTK includes
-#include <ctkErrorLogModel.h>
+#include <ctkErrorLogAbstractMessageHandler.h>
 #include "ctkCoreExport.h"
 
 class ctkErrorLogStreamMessageHandlerPrivate;

+ 139 - 0
Libs/Core/ctkErrorLogTerminalOutput.cpp

@@ -0,0 +1,139 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0.txt
+
+  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.
+
+=========================================================================*/
+
+#include "ctkErrorLogTerminalOutput.h"
+
+// Qt includes
+#include <QMutex>
+#include <QString>
+
+// STD includes
+#include <cstdio> // For _fileno or fileno
+#ifdef _MSC_VER
+# include <io.h> // For _write()
+#else
+# include <unistd.h>
+#endif
+
+// --------------------------------------------------------------------------
+// ctkErrorLogTerminalOutputPrivate
+
+// --------------------------------------------------------------------------
+class ctkErrorLogTerminalOutputPrivate
+{
+public:
+  ctkErrorLogTerminalOutputPrivate();
+  ~ctkErrorLogTerminalOutputPrivate();
+
+  bool Enabled;
+  mutable QMutex EnableMutex;
+
+  int FD;
+  mutable QMutex OutputMutex;
+};
+
+// --------------------------------------------------------------------------
+ctkErrorLogTerminalOutputPrivate::ctkErrorLogTerminalOutputPrivate()
+  : Enabled(false)
+{
+#ifdef Q_OS_WIN32
+  this->FD = _fileno(stdout);
+#else
+  this->FD = fileno(stdout);
+#endif
+}
+
+// --------------------------------------------------------------------------
+ctkErrorLogTerminalOutputPrivate::~ctkErrorLogTerminalOutputPrivate()
+{
+}
+
+// --------------------------------------------------------------------------
+// ctkErrorLogTerminalOutput methods
+
+// --------------------------------------------------------------------------
+ctkErrorLogTerminalOutput::ctkErrorLogTerminalOutput()
+  : d_ptr(new ctkErrorLogTerminalOutputPrivate)
+{
+}
+
+// --------------------------------------------------------------------------
+ctkErrorLogTerminalOutput::~ctkErrorLogTerminalOutput()
+{
+}
+
+// --------------------------------------------------------------------------
+bool ctkErrorLogTerminalOutput::enabled()const
+{
+  Q_D(const ctkErrorLogTerminalOutput);
+  QMutexLocker locker(&d->EnableMutex);
+  return d->Enabled;
+}
+
+// --------------------------------------------------------------------------
+void ctkErrorLogTerminalOutput::setEnabled(bool value)
+{
+  Q_D(ctkErrorLogTerminalOutput);
+  QMutexLocker locker(&d->EnableMutex);
+  d->Enabled = value;
+}
+
+// --------------------------------------------------------------------------
+int ctkErrorLogTerminalOutput::fileDescriptor()const
+{
+  Q_D(const ctkErrorLogTerminalOutput);
+  QMutexLocker locker(&d->OutputMutex);
+  return d->FD;
+}
+
+// --------------------------------------------------------------------------
+void ctkErrorLogTerminalOutput::setFileDescriptor(int fd)
+{
+  Q_D(ctkErrorLogTerminalOutput);
+  QMutexLocker locker(&d->OutputMutex);
+  d->FD = fd;
+}
+
+// --------------------------------------------------------------------------
+void ctkErrorLogTerminalOutput::output(const QString& text)
+{
+  Q_D(ctkErrorLogTerminalOutput);
+  {
+    QMutexLocker locker(&d->EnableMutex);
+    if (!d->Enabled)
+      {
+      return;
+      }
+  }
+
+  {
+    QMutexLocker locker(&d->OutputMutex);
+    QString textWithNewLine = text + "\n";
+#ifdef _MSC_VER
+    int res = _write(d->FD, qPrintable(textWithNewLine), textWithNewLine.size());
+#else
+    ssize_t res = write(d->FD, qPrintable(textWithNewLine), textWithNewLine.size());
+#endif
+    if (res == -1)
+      {
+      return;
+      }
+  }
+}

+ 72 - 0
Libs/Core/ctkErrorLogTerminalOutput.h

@@ -0,0 +1,72 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0.txt
+
+  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 CTKERRORLOGTERMINALOUTPUT_H
+#define CTKERRORLOGTERMINALOUTPUT_H
+
+// Qt includes
+#include <QScopedPointer>
+#include <QObject>
+
+// CTK includes
+#include <ctkCoreExport.h>
+
+//------------------------------------------------------------------------------
+class ctkErrorLogTerminalOutputPrivate;
+
+//------------------------------------------------------------------------------
+/// \ingroup Core
+class CTK_CORE_EXPORT ctkErrorLogTerminalOutput : public QObject
+{
+  Q_OBJECT
+  Q_FLAGS(TerminalOutputs)
+
+public:
+  ctkErrorLogTerminalOutput();
+  virtual ~ctkErrorLogTerminalOutput();
+
+  enum TerminalOutput
+    {
+    None            = 0x0,
+    StandardError   = 0x1,
+    StandardOutput  = 0x2,
+    All             = StandardError | StandardOutput
+    };
+  Q_DECLARE_FLAGS(TerminalOutputs, TerminalOutput)
+
+  bool enabled()const;
+  void setEnabled(bool value);
+
+  int fileDescriptor()const;
+  void setFileDescriptor(int fd);
+
+  void output(const QString& text);
+
+protected:
+  QScopedPointer<ctkErrorLogTerminalOutputPrivate> d_ptr;
+
+private:
+  Q_DECLARE_PRIVATE(ctkErrorLogTerminalOutput)
+  Q_DISABLE_COPY(ctkErrorLogTerminalOutput)
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(ctkErrorLogTerminalOutput::TerminalOutputs)
+
+#endif // CTKERRORLOGTERMINALOUTPUT_H

+ 2 - 4
Libs/Core/target_libraries.cmake

@@ -8,8 +8,6 @@ set(target_libraries
   BFD_LIBRARIES
   )
 
-if (CTK_QT_VERSION VERSION_GREATER "4")
-  list(APPEND target_libraries Qt5Core_LIBRARIES Qt5Widgets_LIBRARIES )
-else()
+if (CTK_QT_VERSION VERSION_LESS "5")
   list(APPEND target_libraries QT_LIBRARIES)
-endif()
+endif()

+ 23 - 5
Libs/Widgets/CMakeLists.txt

@@ -34,6 +34,8 @@ set(KIT_SRCS
   ctkCheckableComboBox.h
   ctkCheckableHeaderView.cpp
   ctkCheckableHeaderView.h
+  ctkCheckableModelHelper.cpp
+  ctkCheckableModelHelper.h
   ctkCheckBox.cpp
   ctkCheckBox.h
   ctkCheckBoxPixmaps.cpp
@@ -72,6 +74,8 @@ set(KIT_SRCS
   ctkDoubleSpinBox.h
   ctkDynamicSpacer.cpp
   ctkDynamicSpacer.h
+  ctkErrorLogModel.cpp
+  ctkErrorLogModel.h
   ctkErrorLogStatusMessageHandler.cpp
   ctkErrorLogStatusMessageHandler.h
   ctkErrorLogWidget.cpp
@@ -90,6 +94,8 @@ set(KIT_SRCS
   ctkFlowLayout.h
   ctkFontButton.cpp
   ctkFontButton.h
+  ctkHistogram.cpp
+  ctkHistogram.h
   ctkIconEnginePlugin.cpp
   ctkIconEnginePlugin.h
   ctkLanguageComboBox.cpp
@@ -162,6 +168,8 @@ set(KIT_SRCS
   ctkThumbnailListWidget_p.h
   ctkToolTipTrapper.cpp
   ctkToolTipTrapper.h
+  ctkTransferFunction.cpp
+  ctkTransferFunction.h
   ctkTransferFunctionBarsItem.cpp
   ctkTransferFunctionBarsItem.h
   ctkTransferFunctionControlPointsItem.cpp
@@ -170,6 +178,8 @@ set(KIT_SRCS
   ctkTransferFunctionGradientItem.h
   ctkTransferFunctionItem.cpp
   ctkTransferFunctionItem.h
+  ctkTransferFunctionRepresentation.cpp
+  ctkTransferFunctionRepresentation.h
   ctkTransferFunctionScene.cpp
   ctkTransferFunctionScene.h
   ctkTransferFunctionView.cpp
@@ -205,6 +215,7 @@ set(KIT_MOC_SRCS
   ctkButtonGroup.h
   ctkCheckableComboBox.h
   ctkCheckableHeaderView.h
+  ctkCheckableModelHelper.h
   ctkCheckablePushButton.h
   ctkCheckBox.h
   ctkCheckBoxPixmaps.h
@@ -226,6 +237,7 @@ set(KIT_MOC_SRCS
   ctkDoubleSpinBox.h
   ctkDoubleSpinBox_p.h
   ctkDynamicSpacer.h
+  ctkErrorLogModel.h
   ctkErrorLogWidget.h
   ctkErrorLogStatusMessageHandler.h
   ctkExpandButton.h
@@ -235,6 +247,7 @@ set(KIT_MOC_SRCS
   ctkFlatProxyModel.h
   ctkFlowLayout.h
   ctkFontButton.h
+  ctkHistogram.h
   ctkIconEnginePlugin.h
   ctkLanguageComboBox.h
   ctkLayoutManager.h
@@ -269,10 +282,12 @@ set(KIT_MOC_SRCS
   ctkThumbnailLabel.h
   ctkThumbnailListWidget.h
   ctkToolTipTrapper.h
+  ctkTransferFunction.h
   ctkTransferFunctionBarsItem.h
   ctkTransferFunctionControlPointsItem.h
   ctkTransferFunctionGradientItem.h
   ctkTransferFunctionItem.h
+  ctkTransferFunctionRepresentation.h
   ctkTransferFunctionScene.h
   ctkTransferFunctionView.h
   ctkTreeComboBox.h
@@ -319,6 +334,13 @@ set(KIT_resources
 # The following macro will read the target libraries from the file 'target_libraries.cmake'
 ctkFunctionGetTargetLibraries(KIT_target_libraries)
 
+if(CTK_QT_VERSION VERSION_GREATER "4")
+  find_package(Qt5Widgets REQUIRED)
+  find_package(Qt5Xml REQUIRED)
+  find_package(Qt5OpenGL REQUIRED)
+  list(APPEND KIT_target_libraries Qt5::Widgets Qt5::Xml Qt5::OpenGL)
+endif()
+
 # A player and a translator must be added for custom Qt widgets
 if(CTK_USE_QTTESTING)
   list(APPEND KIT_SRCS
@@ -382,6 +404,7 @@ if(CTK_USE_QTTESTING)
     ctkCheckableComboBoxEventTranslator.h
     ctkCheckableHeaderViewEventPlayer.h
     ctkCheckableHeaderViewEventTranslator.h
+    ctkCheckableModelHelper.h
     ctkConsoleEventPlayer.h
     ctkConsoleEventTranslator.h
     ctkDoubleRangeSliderEventPlayer.h
@@ -406,10 +429,6 @@ if(CTK_USE_QTTESTING)
   list(APPEND KIT_target_libraries QtTesting)
 endif()
 
-if(CTK_QT_VERSION VERSION_GREATER "4")
-  set(qt5_modules Qt5Widgets Qt5Xml Qt5OpenGL)
-endif()
-
 ctkMacroBuildLib(
   NAME ${PROJECT_NAME}
   EXPORT_DIRECTIVE ${KIT_export_directive}
@@ -420,7 +439,6 @@ ctkMacroBuildLib(
   TARGET_LIBRARIES ${KIT_target_libraries}
   RESOURCES ${KIT_resources}
   LIBRARY_TYPE ${CTK_LIBRARY_MODE}
-  QT5_MODULES ${qt5_modules}
   )
 
 if(CTK_WRAP_PYTHONQT_LIGHT)

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

@@ -5,6 +5,7 @@ set(TEST_SOURCES
   ctkAddRemoveComboBoxTest1.cpp
   ctkAxesWidgetTest1.cpp
   ctkButtonGroupTest1.cpp
+  ctkCheckableModelHelperTest1.cpp
   ctkCheckBoxPixmapsTest1.cpp
   ctkCheckBoxTest1.cpp
   ctkCheckableComboBoxTest1.cpp
@@ -38,6 +39,13 @@ set(TEST_SOURCES
   ctkDoubleSpinBoxValueProxyTest.cpp
   ctkDynamicSpacerTest1.cpp
   ctkDynamicSpacerTest2.cpp
+  ctkErrorLogFDMessageHandlerWithThreadsTest1.cpp
+  ctkErrorLogModelTest1.cpp
+  ctkErrorLogModelEntryGroupingTest1.cpp
+  ctkErrorLogModelTerminalOutputTest1.cpp
+  ctkErrorLogModelTest4.cpp
+  ctkErrorLogQtMessageHandlerWithThreadsTest1.cpp
+  ctkErrorLogStreamMessageHandlerWithThreadsTest1.cpp
   ctkErrorLogWidgetTest1.cpp
   ctkExpandButtonTest1.cpp
   ctkExpandableWidgetTest1.cpp
@@ -46,6 +54,7 @@ set(TEST_SOURCES
   ctkFittedTextBrowserTest1.cpp
   ctkFlowLayoutTest1.cpp
   ctkFontButtonTest.cpp
+  ctkHistogramTest1.cpp
   ctkLayoutManagerTest1.cpp
   ctkMaterialPropertyPreviewLabelTest1.cpp
   ctkMaterialPropertyWidgetTest1.cpp
@@ -87,6 +96,9 @@ set(TEST_SOURCES
   ctkThumbnailListWidgetTest1.cpp
   ctkThumbnailLabelTest1.cpp
   ctkToolTipTrapperTest1.cpp
+  ctkTransferFunctionTest1.cpp
+  ctkTransferFunctionRepresentationTest1.cpp
+  ctkTransferFunctionRepresentationTest2.cpp
   ctkTreeComboBoxTest1.cpp
   ctkWidgetsUtilsTest1.cpp
   ctkWidgetsUtilsTestGrabWidget.cpp
@@ -234,6 +246,11 @@ endif()
 add_executable(${KIT}CppTests ${Tests} ${Tests_SRCS} ${Tests_MOC_CPP} ${Tests_UI_CPP} ${Tests_RESOURCES_SRCS})
 target_link_libraries(${KIT}CppTests ${LIBRARY_NAME})
 
+if(CTK_QT_VERSION VERSION_GREATER "4")
+  find_package(Qt5Test REQUIRED)
+  target_link_libraries(${KIT}CppTests Qt5::Test)
+endif()
+
 #
 # Add Tests
 #
@@ -242,6 +259,7 @@ SIMPLE_TEST( ctkActionsWidgetTest1 )
 SIMPLE_TEST( ctkAddRemoveComboBoxTest1 )
 SIMPLE_TEST( ctkAxesWidgetTest1 )
 SIMPLE_TEST( ctkButtonGroupTest1 )
+SIMPLE_TEST( ctkCheckableModelHelperTest1 )
 SIMPLE_TEST( ctkCheckBoxPixmapsTest1 )
 SIMPLE_TEST( ctkCheckBoxTest1 )
 SIMPLE_TEST( ctkCheckableComboBoxTest1 )
@@ -276,6 +294,13 @@ SIMPLE_TEST( ctkDoubleSpinBoxTest1 )
 SIMPLE_TEST( ctkDoubleSpinBoxValueProxyTest )
 SIMPLE_TEST( ctkDynamicSpacerTest1 )
 SIMPLE_TEST( ctkDynamicSpacerTest2 )
+SIMPLE_TEST( ctkErrorLogFDMessageHandlerWithThreadsTest1 )
+SIMPLE_TEST( ctkErrorLogModelTest1 )
+SIMPLE_TEST( ctkErrorLogModelEntryGroupingTest1 )
+SIMPLE_TEST( ctkErrorLogModelTerminalOutputTest1 --test-launcher $<TARGET_FILE:${KIT}CppTests>)
+SIMPLE_TEST( ctkErrorLogModelTest4 )
+SIMPLE_TEST( ctkErrorLogQtMessageHandlerWithThreadsTest1 )
+SIMPLE_TEST( ctkErrorLogStreamMessageHandlerWithThreadsTest1 )
 SIMPLE_TEST( ctkErrorLogWidgetTest1 )
 SIMPLE_TEST( ctkExampleUseOfWorkflowWidgetUsingDerivedSteps )
 SIMPLE_TEST( ctkExampleUseOfWorkflowWidgetUsingSignalsAndSlots )
@@ -286,6 +311,7 @@ SIMPLE_TEST( ctkFileDialogTest1 )
 SIMPLE_TEST( ctkFittedTextBrowserTest1 )
 SIMPLE_TEST( ctkFlowLayoutTest1 )
 SIMPLE_TEST( ctkFontButtonTest )
+SIMPLE_TEST( ctkHistogramTest1 )
 SIMPLE_TEST( ctkLanguageComboBoxTest )
 SIMPLE_TEST( ctkLayoutManagerTest1 )
 SIMPLE_TEST( ctkMaterialPropertyPreviewLabelTest1 )
@@ -327,6 +353,9 @@ SIMPLE_TEST( ctkSliderWidgetValueProxyTest )
 SIMPLE_TEST( ctkThumbnailListWidgetTest1 )
 SIMPLE_TEST( ctkThumbnailLabelTest1 )
 SIMPLE_TEST( ctkToolTipTrapperTest1 )
+SIMPLE_TEST( ctkTransferFunctionTest1 )
+SIMPLE_TEST( ctkTransferFunctionRepresentationTest1 )
+SIMPLE_TEST( ctkTransferFunctionRepresentationTest2 )
 SIMPLE_TEST( ctkTreeComboBoxTest1 )
 SIMPLE_TEST( ctkWidgetsUtilsTest1 )
 SIMPLE_TEST( ctkWidgetsUtilsTestGrabWidget )

Libs/Core/Testing/Cpp/ctkCheckableModelHelperTest1.cpp → Libs/Widgets/Testing/Cpp/ctkCheckableModelHelperTest1.cpp


Libs/Core/Testing/Cpp/ctkErrorLogFDMessageHandlerWithThreadsTest1.cpp → Libs/Widgets/Testing/Cpp/ctkErrorLogFDMessageHandlerWithThreadsTest1.cpp


Libs/Core/Testing/Cpp/ctkErrorLogModelEntryGroupingTest1.cpp → Libs/Widgets/Testing/Cpp/ctkErrorLogModelEntryGroupingTest1.cpp


+ 4 - 4
Libs/Core/Testing/Cpp/ctkErrorLogModelTerminalOutputTest1.cpp

@@ -109,9 +109,9 @@ int ctkErrorLogModelTerminalOutputTest1(int argc, char * argv [])
   QString errorMsg;
 
   ctkErrorLogModel model;
-  ctkErrorLogModel::TerminalOutputs currentTerminalOutputEnabled = model.terminalOutputs();
+  ctkErrorLogTerminalOutput::TerminalOutputs currentTerminalOutputEnabled = model.terminalOutputs();
   errorMsg = checkBoolean(__LINE__, "TerminalOutputEnabled",
-                          currentTerminalOutputEnabled, ctkErrorLogModel::None);
+                          currentTerminalOutputEnabled, ctkErrorLogTerminalOutput::None);
   if (!errorMsg.isEmpty())
     {
     model.disableAllMsgHandler();
@@ -120,11 +120,11 @@ int ctkErrorLogModelTerminalOutputTest1(int argc, char * argv [])
     return EXIT_FAILURE;
     }
 
-  model.setTerminalOutputs(ctkErrorLogModel::All);
+  model.setTerminalOutputs(ctkErrorLogTerminalOutput::All);
 
   currentTerminalOutputEnabled = model.terminalOutputs();
   errorMsg = checkBoolean(__LINE__, "TerminalOutputEnabled",
-                          currentTerminalOutputEnabled, ctkErrorLogModel::All);
+                          currentTerminalOutputEnabled, ctkErrorLogTerminalOutput::All);
   if (!errorMsg.isEmpty())
     {
     model.disableAllMsgHandler();

Libs/Core/Testing/Cpp/ctkErrorLogModelTest1.cpp → Libs/Widgets/Testing/Cpp/ctkErrorLogModelTest1.cpp


Libs/Core/Testing/Cpp/ctkErrorLogModelTest4.cpp → Libs/Widgets/Testing/Cpp/ctkErrorLogModelTest4.cpp


Libs/Core/Testing/Cpp/ctkErrorLogModelTestHelper.cpp → Libs/Widgets/Testing/Cpp/ctkErrorLogModelTestHelper.cpp


Libs/Core/Testing/Cpp/ctkErrorLogQtMessageHandlerWithThreadsTest1.cpp → Libs/Widgets/Testing/Cpp/ctkErrorLogQtMessageHandlerWithThreadsTest1.cpp


Libs/Core/Testing/Cpp/ctkErrorLogStreamMessageHandlerWithThreadsTest1.cpp → Libs/Widgets/Testing/Cpp/ctkErrorLogStreamMessageHandlerWithThreadsTest1.cpp


Libs/Core/Testing/Cpp/ctkHistogramTest1.cpp → Libs/Widgets/Testing/Cpp/ctkHistogramTest1.cpp


Libs/Core/Testing/Cpp/ctkTransferFunctionRepresentationTest1.cpp → Libs/Widgets/Testing/Cpp/ctkTransferFunctionRepresentationTest1.cpp


Libs/Core/Testing/Cpp/ctkTransferFunctionRepresentationTest2.cpp → Libs/Widgets/Testing/Cpp/ctkTransferFunctionRepresentationTest2.cpp


Libs/Core/Testing/Cpp/ctkTransferFunctionTest1.cpp → Libs/Widgets/Testing/Cpp/ctkTransferFunctionTest1.cpp


Libs/Core/ctkCheckableModelHelper.cpp → Libs/Widgets/ctkCheckableModelHelper.cpp


+ 3 - 3
Libs/Core/ctkCheckableModelHelper.h

@@ -58,14 +58,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 class QAbstractItemModel;
 
 // CTK includes
-#include "ctkCoreExport.h"
+#include "ctkWidgetsExport.h"
 
 class ctkCheckableModelHelperPrivate;
 
-/// \ingroup Core
+/// \ingroup Widgets
 ///
 /// ctkCheckableModelHelper expose functions to handle checkable models
-class CTK_CORE_EXPORT ctkCheckableModelHelper : public QObject
+class CTK_WIDGETS_EXPORT ctkCheckableModelHelper : public QObject
 {
   Q_OBJECT;
   Q_PROPERTY(bool forceCheckability READ forceCheckability WRITE setForceCheckability);

+ 10 - 273
Libs/Core/ctkErrorLogModel.cpp

@@ -30,144 +30,8 @@
 
 // CTK includes
 #include "ctkErrorLogModel.h"
-#include <ctkPimpl.h>
+#include "ctkErrorLogAbstractMessageHandler.h"
 
-// STD includes
-#include <cstdio> // For _fileno or fileno
-#ifdef _MSC_VER
-# include <io.h> // For _write()
-#else
-# include <unistd.h>
-#endif
-
-// --------------------------------------------------------------------------
-// ctkErrorLogLevel methods
-
-// --------------------------------------------------------------------------
-ctkErrorLogLevel::ctkErrorLogLevel()
-{
-  qRegisterMetaType<ctkErrorLogLevel::LogLevel>("ctkErrorLogLevel::LogLevel");
-}
-
-// --------------------------------------------------------------------------
-QString ctkErrorLogLevel::operator()(ctkErrorLogLevel::LogLevel logLevel)
-{
-  return ctkErrorLogLevel::logLevelAsString(logLevel);
-}
-
-// --------------------------------------------------------------------------
-QString ctkErrorLogLevel::logLevelAsString(ctkErrorLogLevel::LogLevel logLevel)
-{
-  QMetaEnum logLevelEnum = ctkErrorLogLevel::staticMetaObject.enumerator(0);
-  Q_ASSERT(QString("LogLevel").compare(logLevelEnum.name()) == 0);
-  return QLatin1String(logLevelEnum.valueToKey(logLevel));
-}
-
-// --------------------------------------------------------------------------
-// ctkErrorLogTerminalOutputPrivate
-
-// --------------------------------------------------------------------------
-class ctkErrorLogTerminalOutputPrivate
-{
-public:
-  ctkErrorLogTerminalOutputPrivate();
-  ~ctkErrorLogTerminalOutputPrivate();
-
-  bool Enabled;
-  mutable QMutex EnableMutex;
-
-  int FD;
-  mutable QMutex OutputMutex;
-};
-
-// --------------------------------------------------------------------------
-ctkErrorLogTerminalOutputPrivate::ctkErrorLogTerminalOutputPrivate()
-  : Enabled(false)
-{
-#ifdef Q_OS_WIN32
-  this->FD = _fileno(stdout);
-#else
-  this->FD = fileno(stdout);
-#endif
-}
-
-// --------------------------------------------------------------------------
-ctkErrorLogTerminalOutputPrivate::~ctkErrorLogTerminalOutputPrivate()
-{
-}
-
-// --------------------------------------------------------------------------
-// ctkErrorLogTerminalOutput methods
-
-// --------------------------------------------------------------------------
-ctkErrorLogTerminalOutput::ctkErrorLogTerminalOutput()
-  : d_ptr(new ctkErrorLogTerminalOutputPrivate)
-{
-}
-
-// --------------------------------------------------------------------------
-ctkErrorLogTerminalOutput::~ctkErrorLogTerminalOutput()
-{
-}
-
-// --------------------------------------------------------------------------
-bool ctkErrorLogTerminalOutput::enabled()const
-{
-  Q_D(const ctkErrorLogTerminalOutput);
-  QMutexLocker locker(&d->EnableMutex);
-  return d->Enabled;
-}
-
-// --------------------------------------------------------------------------
-void ctkErrorLogTerminalOutput::setEnabled(bool value)
-{
-  Q_D(ctkErrorLogTerminalOutput);
-  QMutexLocker locker(&d->EnableMutex);
-  d->Enabled = value;
-}
-
-// --------------------------------------------------------------------------
-int ctkErrorLogTerminalOutput::fileDescriptor()const
-{
-  Q_D(const ctkErrorLogTerminalOutput);
-  QMutexLocker locker(&d->OutputMutex);
-  return d->FD;
-}
-
-// --------------------------------------------------------------------------
-void ctkErrorLogTerminalOutput::setFileDescriptor(int fd)
-{
-  Q_D(ctkErrorLogTerminalOutput);
-  QMutexLocker locker(&d->OutputMutex);
-  d->FD = fd;
-}
-
-// --------------------------------------------------------------------------
-void ctkErrorLogTerminalOutput::output(const QString& text)
-{
-  Q_D(ctkErrorLogTerminalOutput);
-  {
-    QMutexLocker locker(&d->EnableMutex);
-    if (!d->Enabled)
-      {
-      return;
-      }
-  }
-
-  {
-    QMutexLocker locker(&d->OutputMutex);
-    QString textWithNewLine = text + "\n";
-#ifdef _MSC_VER
-    int res = _write(d->FD, qPrintable(textWithNewLine), textWithNewLine.size());
-#else
-    ssize_t res = write(d->FD, qPrintable(textWithNewLine), textWithNewLine.size());
-#endif
-    if (res == -1)
-      {
-      return;
-      }
-  }
-}
 
 // --------------------------------------------------------------------------
 // ctkErrorLogModelPrivate
@@ -303,8 +167,8 @@ bool ctkErrorLogModel::registerMsgHandler(ctkErrorLogAbstractMessageHandler * ms
 
   d->setMessageHandlerConnection(msgHandler, d->AsynchronousLogging);
 
-  msgHandler->setTerminalOutput(Self::StandardError, &d->StdErrTerminalOutput);
-  msgHandler->setTerminalOutput(Self::StandardOutput, &d->StdOutTerminalOutput);
+  msgHandler->setTerminalOutput(ctkErrorLogTerminalOutput::StandardError, &d->StdErrTerminalOutput);
+  msgHandler->setTerminalOutput(ctkErrorLogTerminalOutput::StandardOutput, &d->StdOutTerminalOutput);
 
   d->RegisteredHandlers.insert(msgHandler->handlerName(), msgHandler);
   return true;
@@ -388,22 +252,22 @@ void ctkErrorLogModel::setAllMsgHandlerEnabled(bool enabled)
 }
 
 //------------------------------------------------------------------------------
-ctkErrorLogModel::TerminalOutputs ctkErrorLogModel::terminalOutputs()const
+ctkErrorLogTerminalOutput::TerminalOutputs ctkErrorLogModel::terminalOutputs()const
 {
   Q_D(const ctkErrorLogModel);
-  ctkErrorLogModel::TerminalOutputs currentTerminalOutputs;
-  currentTerminalOutputs |= d->StdErrTerminalOutput.enabled() ? Self::StandardError : Self::None;
-  currentTerminalOutputs |= d->StdOutTerminalOutput.enabled() ? Self::StandardOutput : Self::None;
+  ctkErrorLogTerminalOutput::TerminalOutputs currentTerminalOutputs;
+  currentTerminalOutputs |= d->StdErrTerminalOutput.enabled() ? ctkErrorLogTerminalOutput::StandardError : ctkErrorLogTerminalOutput::None;
+  currentTerminalOutputs |= d->StdOutTerminalOutput.enabled() ? ctkErrorLogTerminalOutput::StandardOutput : ctkErrorLogTerminalOutput::None;
   return currentTerminalOutputs;
 }
 
 //------------------------------------------------------------------------------
 void ctkErrorLogModel::setTerminalOutputs(
-    const ctkErrorLogModel::TerminalOutputs& terminalOutput)
+    const ctkErrorLogTerminalOutput::TerminalOutputs& terminalOutput)
 {
   Q_D(ctkErrorLogModel);
-  d->StdErrTerminalOutput.setEnabled(terminalOutput & ctkErrorLogModel::StandardOutput);
-  d->StdOutTerminalOutput.setEnabled(terminalOutput & ctkErrorLogModel::StandardError);
+  d->StdErrTerminalOutput.setEnabled(terminalOutput & ctkErrorLogTerminalOutput::StandardOutput);
+  d->StdOutTerminalOutput.setEnabled(terminalOutput & ctkErrorLogTerminalOutput::StandardError);
 }
 
 //------------------------------------------------------------------------------
@@ -668,130 +532,3 @@ int ctkErrorLogModel::logEntryCount()const
   Q_D(const ctkErrorLogModel);
   return d->StandardItemModel.rowCount();
 }
-
-// --------------------------------------------------------------------------
-// ctkErrorLogAbstractMessageHandlerPrivate
-
-// --------------------------------------------------------------------------
-class ctkErrorLogAbstractMessageHandlerPrivate
-{
-public:
-  ctkErrorLogAbstractMessageHandlerPrivate();
-  ~ctkErrorLogAbstractMessageHandlerPrivate();
-
-  bool                        Enabled;
-  QString                     HandlerPrettyName;
-
-  // Use "int" instead of "ctkErrorLogModel::TerminalOutput" to avoid compilation warning ...
-  // qhash.h:879: warning: passing ‘ctkErrorLogModel::TerminalOutput’ chooses ‘int’ over ‘uint’ [-Wsign-promo]
-  QHash<int, ctkErrorLogTerminalOutput*> TerminalOutputs;
-};
-
-// --------------------------------------------------------------------------
-ctkErrorLogAbstractMessageHandlerPrivate::
-ctkErrorLogAbstractMessageHandlerPrivate()
-  : Enabled(false)
-{
-}
-
-// --------------------------------------------------------------------------
-ctkErrorLogAbstractMessageHandlerPrivate::~ctkErrorLogAbstractMessageHandlerPrivate()
-{
-}
-
-// --------------------------------------------------------------------------
-// ctkErrorLogAbstractMessageHandlerPrivate methods
-
-// --------------------------------------------------------------------------
-ctkErrorLogAbstractMessageHandler::ctkErrorLogAbstractMessageHandler()
-  : Superclass(), d_ptr(new ctkErrorLogAbstractMessageHandlerPrivate)
-{
-}
-
-// --------------------------------------------------------------------------
-ctkErrorLogAbstractMessageHandler::~ctkErrorLogAbstractMessageHandler()
-{
-}
-
-// --------------------------------------------------------------------------
-QString ctkErrorLogAbstractMessageHandler::handlerPrettyName()const
-{
-  Q_D(const ctkErrorLogAbstractMessageHandler);
-  if (d->HandlerPrettyName.isEmpty())
-    {
-    return this->handlerName();
-    }
-  else
-    {
-    return d->HandlerPrettyName;
-    }
-}
-
-// --------------------------------------------------------------------------
-void ctkErrorLogAbstractMessageHandler::setHandlerPrettyName(const QString& newHandlerPrettyName)
-{
-  Q_D(ctkErrorLogAbstractMessageHandler);
-  d->HandlerPrettyName = newHandlerPrettyName;
-}
-
-// --------------------------------------------------------------------------
-bool ctkErrorLogAbstractMessageHandler::enabled()const
-{
-  Q_D(const ctkErrorLogAbstractMessageHandler);
-  return d->Enabled;
-}
-
-// --------------------------------------------------------------------------
-void ctkErrorLogAbstractMessageHandler::setEnabled(bool value)
-{
-  Q_D(ctkErrorLogAbstractMessageHandler);
-  if (value == d->Enabled)
-    {
-    return;
-    }
-  this->setEnabledInternal(value);
-  d->Enabled = value;
-}
-
-// --------------------------------------------------------------------------
-void ctkErrorLogAbstractMessageHandler::handleMessage(const QString& threadId,
-                                                      ctkErrorLogLevel::LogLevel logLevel,
-                                                      const QString& origin, const QString& text)
-{
-  Q_D(ctkErrorLogAbstractMessageHandler);
-  if (logLevel <= ctkErrorLogLevel::Info)
-    {
-    if(d->TerminalOutputs.contains(ctkErrorLogModel::StandardOutput))
-      {
-      d->TerminalOutputs.value(ctkErrorLogModel::StandardOutput)->output(text);
-      }
-    }
-  else
-    {
-    if(d->TerminalOutputs.contains(ctkErrorLogModel::StandardError))
-      {
-      d->TerminalOutputs.value(ctkErrorLogModel::StandardError)->output(text);
-      }
-    }
-  emit this->messageHandled(QDateTime::currentDateTime(), threadId, logLevel, origin, text);
-}
-
-// --------------------------------------------------------------------------
-ctkErrorLogTerminalOutput* ctkErrorLogAbstractMessageHandler::terminalOutput(
-    ctkErrorLogModel::TerminalOutput terminalOutputType)const
-{
-  Q_D(const ctkErrorLogAbstractMessageHandler);
-  if(d->TerminalOutputs.contains(terminalOutputType))
-    {
-    return d->TerminalOutputs.value(terminalOutputType);
-    }
-  return 0;
-}
-
-// --------------------------------------------------------------------------
-void ctkErrorLogAbstractMessageHandler::setTerminalOutput(
-    ctkErrorLogModel::TerminalOutput terminalOutputType, ctkErrorLogTerminalOutput* terminalOutput)
-{
-  Q_D(ctkErrorLogAbstractMessageHandler);
-  d->TerminalOutputs.insert(terminalOutputType, terminalOutput);
-}

+ 10 - 120
Libs/Core/ctkErrorLogModel.h

@@ -25,77 +25,22 @@
 #include <QSortFilterProxyModel>
 
 // CTK includes
-#include "ctkCoreExport.h"
+#include "ctkWidgetsExport.h"
+#include "ctkErrorLogLevel.h"
+#include "ctkErrorLogTerminalOutput.h"
 
-//------------------------------------------------------------------------------
-/// \ingroup Core
-class CTK_CORE_EXPORT ctkErrorLogLevel : public QObject
-{
-  Q_OBJECT
-  Q_FLAGS(LogLevel)
-public:
-  ctkErrorLogLevel();
-
-  enum LogLevel
-    {
-    None     = 0x0,
-    Unknown  = 0x1,
-    Status   = 0x2,
-    Trace    = 0x4,
-    Debug    = 0x8,
-    Info     = 0x10,
-    Warning  = 0x20,
-    Error    = 0x40,
-    Critical = 0x80,
-    Fatal    = 0x100
-    };
-  Q_DECLARE_FLAGS(LogLevels, LogLevel)
-
-  QString operator ()(LogLevel logLevel);
-
-  static QString logLevelAsString(ctkErrorLogLevel::LogLevel logLevel);
-};
-Q_DECLARE_OPERATORS_FOR_FLAGS(ctkErrorLogLevel::LogLevels)
-
-//------------------------------------------------------------------------------
-class ctkErrorLogTerminalOutputPrivate;
-
-//------------------------------------------------------------------------------
-/// \ingroup Core
-class CTK_CORE_EXPORT ctkErrorLogTerminalOutput
-{
-public:
-  ctkErrorLogTerminalOutput();
-  virtual ~ctkErrorLogTerminalOutput();
-
-  bool enabled()const;
-  void setEnabled(bool value);
-
-  int fileDescriptor()const;
-  void setFileDescriptor(int fd);
-
-  void output(const QString& text);
-
-protected:
-  QScopedPointer<ctkErrorLogTerminalOutputPrivate> d_ptr;
-
-private:
-  Q_DECLARE_PRIVATE(ctkErrorLogTerminalOutput);
-  Q_DISABLE_COPY(ctkErrorLogTerminalOutput);
-};
 
 //------------------------------------------------------------------------------
 class ctkErrorLogAbstractMessageHandler;
 class ctkErrorLogModelPrivate;
 
 //------------------------------------------------------------------------------
-/// \ingroup Core
-class CTK_CORE_EXPORT ctkErrorLogModel : public QSortFilterProxyModel
+/// \ingroup Widgets
+class CTK_WIDGETS_EXPORT ctkErrorLogModel : public QSortFilterProxyModel
 {
   Q_OBJECT
-  Q_FLAGS(TerminalOutput)
   Q_PROPERTY(bool logEntryGrouping READ logEntryGrouping WRITE setLogEntryGrouping)
-  Q_PROPERTY(TerminalOutput terminalOutputs READ terminalOutputs WRITE  setTerminalOutputs)
+  Q_PROPERTY(ctkErrorLogTerminalOutput::TerminalOutputs terminalOutputs READ terminalOutputs WRITE setTerminalOutputs)
   Q_PROPERTY(bool asynchronousLogging READ asynchronousLogging WRITE  setAsynchronousLogging)
 public:
   typedef QSortFilterProxyModel Superclass;
@@ -138,23 +83,14 @@ public:
   void disableAllMsgHandler();
   void setAllMsgHandlerEnabled(bool enabled);
 
-  enum TerminalOutput
-    {
-    None            = 0x0,
-    StandardError   = 0x1,
-    StandardOutput  = 0x2,
-    All             = StandardError | StandardOutput
-    };
-  Q_DECLARE_FLAGS(TerminalOutputs, TerminalOutput)
-
   /// Return if messages are both printed into the terminal and added to ctkErrorLogModel.
   /// \note If TerminalOutput::None is returned, message will only be added to the model.
-  TerminalOutputs terminalOutputs()const;
+  ctkErrorLogTerminalOutput::TerminalOutputs terminalOutputs()const;
 
   /// Set terminal output mode
   /// \sa terminalOutputs()
   /// \sa TerminalOutput
-  void setTerminalOutputs(const TerminalOutputs& terminalOutput);
+  void setTerminalOutputs(const ctkErrorLogTerminalOutput::TerminalOutputs& terminalOutput);
 
   ctkErrorLogLevel::LogLevels logLevelFilter()const;
 
@@ -199,54 +135,8 @@ protected:
   QScopedPointer<ctkErrorLogModelPrivate> d_ptr;
 
 private:
-  Q_DECLARE_PRIVATE(ctkErrorLogModel);
-  Q_DISABLE_COPY(ctkErrorLogModel);
+  Q_DECLARE_PRIVATE(ctkErrorLogModel)
+  Q_DISABLE_COPY(ctkErrorLogModel)
 };
-Q_DECLARE_OPERATORS_FOR_FLAGS(ctkErrorLogModel::TerminalOutputs)
-
-//------------------------------------------------------------------------------
-class ctkErrorLogAbstractMessageHandlerPrivate;
-
-//------------------------------------------------------------------------------
-/// \ingroup Core
-class CTK_CORE_EXPORT ctkErrorLogAbstractMessageHandler : public QObject
-{
-  Q_OBJECT
-public:
-  typedef QObject Superclass;
-  /// Disabled by default.
-  ctkErrorLogAbstractMessageHandler();
-  virtual ~ctkErrorLogAbstractMessageHandler();
-
-  virtual QString handlerName()const = 0;
-
-  QString handlerPrettyName()const;
 
-  bool enabled()const;
-  void setEnabled(bool value);
-
-  void handleMessage(const QString& threadId, ctkErrorLogLevel::LogLevel logLevel,
-                     const QString& origin, const QString& text);
-
-  ctkErrorLogTerminalOutput* terminalOutput(ctkErrorLogModel::TerminalOutput terminalOutputType)const;
-  void setTerminalOutput(ctkErrorLogModel::TerminalOutput terminalOutputType,
-                         ctkErrorLogTerminalOutput * terminalOutput);
-
-Q_SIGNALS:
-  void messageHandled(const QDateTime& currentDateTime, const QString& threadId,
-                      ctkErrorLogLevel::LogLevel logLevel, const QString& origin,
-                      const QString& text);
-
-protected:
-  void setHandlerPrettyName(const QString& newHandlerPrettyName);
-
-  virtual void setEnabledInternal(bool value) = 0;
-
-protected:
-  QScopedPointer<ctkErrorLogAbstractMessageHandlerPrivate> d_ptr;
-
-private:
-  Q_DECLARE_PRIVATE(ctkErrorLogAbstractMessageHandler);
-  Q_DISABLE_COPY(ctkErrorLogAbstractMessageHandler);
-};
 #endif

+ 1 - 1
Libs/Widgets/ctkErrorLogStatusMessageHandler.h

@@ -22,7 +22,7 @@
 #define __ctkErrorLogStatusMessageHandler_h
 
 // CTK includes
-#include <ctkErrorLogModel.h>
+#include <ctkErrorLogAbstractMessageHandler.h>
 #include "ctkWidgetsExport.h"
 
 // Qt includes

Libs/Core/ctkHistogram.cpp → Libs/Widgets/ctkHistogram.cpp


Libs/Core/ctkHistogram.h → Libs/Widgets/ctkHistogram.h


+ 0 - 8
Libs/Widgets/ctkIconEnginePlugin.cpp

@@ -35,11 +35,7 @@ public:
 
 //------------------------------------------------------------------------------
 ctkIconEnginePlugin::ctkIconEnginePlugin(QObject* parentObject)
-#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
   : QIconEnginePlugin(parentObject)
-#else
-  : QIconEnginePluginV2(parentObject)
-#endif
   , d_ptr(new ctkIconEnginePluginPrivate)
 {
 }
@@ -50,11 +46,7 @@ ctkIconEnginePlugin::~ctkIconEnginePlugin()
 }
 
 //------------------------------------------------------------------------------
-#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
 QIconEngine* ctkIconEnginePlugin::create(const QString& fileName)
-#else
-QIconEngineV2* ctkIconEnginePlugin::create(const QString& fileName)
-#endif
 {
   Q_D(ctkIconEnginePlugin);
   Q_UNUSED(fileName);

+ 1 - 1
Libs/Widgets/ctkMaterialPropertyPreviewLabel.cpp

@@ -297,7 +297,7 @@ void ctkMaterialPropertyPreviewLabel::draw(QImage& image)
 
         qreal diffuseComp = qMax(diffuse * dot, 0.);
 
-        qreal specularDot = qMax(QVector3D::dotProduct(ref, view), static_cast<float>(0));
+        qreal specularDot = qMax(static_cast<qreal>(QVector3D::dotProduct(ref, view)), static_cast<qreal>(0));
 
         qreal specularComp = specular*pow(specularDot, specular_power);
 

Libs/Core/ctkTransferFunction.cpp → Libs/Widgets/ctkTransferFunction.cpp


+ 17 - 17
Libs/Core/ctkTransferFunction.h

@@ -29,14 +29,14 @@
 
 /// CTK includes
 #include "ctkPimpl.h"
-#include "ctkCoreExport.h"
+#include "ctkWidgetsExport.h"
 
 class ctkTransferFunctionPrivate;
 class ctkTransferFunctionRepresentation;
 
 //-----------------------------------------------------------------------------
-/// \ingroup Core
-struct CTK_CORE_EXPORT ctkPoint
+/// \ingroup Widgets
+struct CTK_WIDGETS_EXPORT ctkPoint
 {
   ctkPoint()
     :X(0),Value(0)
@@ -44,7 +44,7 @@ struct CTK_CORE_EXPORT ctkPoint
   }
   ctkPoint(qreal x, const QVariant& v)
     :X(x),Value(v)
-  {  
+  {
   }
   qreal X;
   // QColor or qreal.
@@ -52,10 +52,10 @@ struct CTK_CORE_EXPORT ctkPoint
 };
 
 //-----------------------------------------------------------------------------
-/// \ingroup Core
-/// assumes the mapping is linear by default, if not, then subclasses must be 
+/// \ingroup Widgets
+/// assumes the mapping is linear by default, if not, then subclasses must be
 /// used
-struct CTK_CORE_EXPORT ctkControlPoint
+struct CTK_WIDGETS_EXPORT ctkControlPoint
 {
   virtual ~ctkControlPoint();
   inline const qreal& x()const {return this->P.X;}
@@ -64,8 +64,8 @@ struct CTK_CORE_EXPORT ctkControlPoint
 };
 
 //-----------------------------------------------------------------------------
-/// \ingroup Core
-struct CTK_CORE_EXPORT ctkBezierControlPoint : public ctkControlPoint
+/// \ingroup Widgets
+struct CTK_WIDGETS_EXPORT ctkBezierControlPoint : public ctkControlPoint
 {
   virtual ~ctkBezierControlPoint();
   ctkPoint P1;
@@ -73,26 +73,26 @@ struct CTK_CORE_EXPORT ctkBezierControlPoint : public ctkControlPoint
 };
 
 //-----------------------------------------------------------------------------
-/// \ingroup Core
-struct CTK_CORE_EXPORT ctkNonLinearControlPoint : public ctkControlPoint
+/// \ingroup Widgets
+struct CTK_WIDGETS_EXPORT ctkNonLinearControlPoint : public ctkControlPoint
 {
   virtual ~ctkNonLinearControlPoint();
   QList<ctkPoint> SubPoints;
 };
 
 //-----------------------------------------------------------------------------
-/// \ingroup Core
-class CTK_CORE_EXPORT ctkTransferFunction: public QObject
+/// \ingroup Widgets
+class CTK_WIDGETS_EXPORT ctkTransferFunction: public QObject
 {
   Q_OBJECT
 public:
   ctkTransferFunction(QObject* parent = 0);
   virtual ~ctkTransferFunction();
-  
+
   virtual ctkControlPoint* controlPoint(int index)const = 0;
   inline QVariant value(int index)const;
   virtual QVariant value(qreal pos)const = 0;
-  
+
   virtual int count()const = 0;
   virtual bool isDiscrete()const = 0;
   virtual bool isEditable()const = 0;
@@ -108,11 +108,11 @@ public:
 
   virtual void removeControlPoint( qreal pos ) = 0;
 
-  /// 
+  ///
   /// be careful with it, as changing the value might require
   /// more changes to ctkControlPoint.
   virtual void setControlPointPos(int index, qreal pos)=0;
-  /// 
+  ///
   /// be careful with it, as changing the value might require
   /// more changes to ctkControlPoint.
   virtual void setControlPointValue(int index, const QVariant& value)=0;

Libs/Core/ctkTransferFunctionRepresentation.cpp → Libs/Widgets/ctkTransferFunctionRepresentation.cpp


+ 3 - 3
Libs/Core/ctkTransferFunctionRepresentation.h

@@ -30,14 +30,14 @@
 /// CTK includes
 #include "ctkPimpl.h"
 #include "ctkTransferFunction.h"
-#include "ctkCoreExport.h"
+#include "ctkWidgetsExport.h"
 
 class ctkTransferFunction;
 class ctkTransferFunctionRepresentationPrivate;
 
 //-----------------------------------------------------------------------------
-/// \ingroup Core
-class CTK_CORE_EXPORT ctkTransferFunctionRepresentation: public QObject
+/// \ingroup Widgets
+class CTK_WIDGETS_EXPORT ctkTransferFunctionRepresentation: public QObject
 {
   Q_OBJECT
   Q_PROPERTY(QColor verticalGradientColor READ verticalGradientColor WRITE setVerticalGradientColor)