浏览代码

ENH: add qCTKDCMTK from Jc

Steve Pieper 15 年之前
父节点
当前提交
f20ee81e81

+ 12 - 0
Libs/qCTKDMCTK/Applications/CMakeLists.txt

@@ -0,0 +1,12 @@
+
+
+# Create executable
+ADD_EXECUTABLE(ctkDMCTK
+  Main.cxx
+)
+
+SET(KIT_LIBRARIES
+  ${qCTK_BASE_LIBRARIES}
+  )
+
+TARGET_LINK_LIBRARIES(ctkDMCTK ${KIT_LIBRARIES})

+ 15 - 0
Libs/qCTKDMCTK/Applications/Main.cxx

@@ -0,0 +1,15 @@
+
+// QT includes
+#include <QApplication>
+#include <QPushButton>
+// STD includes
+//#include <cstdlib>
+
+int main(int argc, char** argv)
+{
+  QApplication app(argc, argv);
+  
+  QPushButton b("Hello world");
+  b.show();
+  return app.exec();
+}

+ 66 - 0
Libs/qCTKDMCTK/Base/CMakeLists.txt

@@ -0,0 +1,66 @@
+
+PROJECT(qCTKDMCTK)
+
+#
+# See CMake/Slicer3QTBaseLibraryMacros.cmake for details
+#
+
+SET(KIT_export_directive "Q_CTKDMCTK_EXPORT")
+
+# Additional directories to include
+SET(KIT_include_directories
+  )
+  
+# Source files
+SET(KIT_SRCS
+  qCTKDCMTK.cxx
+  qCTKDCMTK.h
+  qCTKDCMTKListenerWidget.cxx
+  qCTKDCMTKListenerWidget.h
+  qCTKDCMTKLocationWidget.cxx
+  qCTKDCMTKLocationWidget.h
+  qCTKDCMTKQueryRetrieveWidget.cxx
+  qCTKDCMTKQueryRetrieveWidget.h
+  )
+
+# Headers that should run through moc
+SET(KIT_MOC_SRCS
+  qCTKDCMTK.h
+  )
+
+# UI files
+SET(KIT_UI_FORMS
+  Resources/UI/qCTKDCMTKLocationWidget.ui
+  Resources/UI/qCTKDCMTKListenerWidget.ui
+  Resources/UI/qCTKDCMTKQueryRetrieveWidget.ui
+)
+
+# Resources
+SET(KIT_resources
+)
+
+# Additional Target libraries (QT libs already included)
+SET(KIT_target_libraries
+  ${QT_LIBRARIES}
+  )
+
+qctk_build_qtlib( 
+  NAME ${PROJECT_NAME}
+  EXPORT_TEMPLATE ${CTKDCMTK_SOURCE_DIR}/qCTKExport.h.in
+  EXPORT_DIRECTIVE ${KIT_export_directive}
+  INCLUDE_DIRECTORIES ${KIT_include_directories}
+  SRCS ${KIT_SRCS}
+  MOC_SRCS ${KIT_MOC_SRCS}
+  UI_FORMS ${KIT_UI_FORMS}
+  TARGET_LIBRARIES ${KIT_target_libraries}
+  RESOURCES ${KIT_resources}
+  LIBRARY_TYPE ${qCTK_LIBRARY_MODE}
+  )
+
+# Plugins
+#ADD_SUBDIRECTORY(Plugins)
+
+# Testing
+IF(BUILD_TESTING)
+  #ADD_SUBDIRECTORY(Testing)
+ENDIF(BUILD_TESTING)

+ 19 - 0
Libs/qCTKDMCTK/Base/Resources/UI/qCTKDCMTKListenerWidget.ui

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>qCTKDCMTKListenerWidget</class>
+ <widget class="QWidget" name="qCTKDCMTKListenerWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 19 - 0
Libs/qCTKDMCTK/Base/Resources/UI/qCTKDCMTKLocationWidget.ui

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>qCTKDCMTKLocationWidget</class>
+ <widget class="QWidget" name="qCTKDCMTKLocationWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 19 - 0
Libs/qCTKDMCTK/Base/Resources/UI/qCTKDCMTKQueryRetrieveWidget.ui

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>qCTKDCMTKQueryRetrieveWidget</class>
+ <widget class="QWidget" name="qCTKDCMTKQueryRetrieveWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 27 - 0
Libs/qCTKDMCTK/Base/qCTKDCMTK.cxx

@@ -0,0 +1,27 @@
+
+// qCTKDCMTK includes
+#include "qCTKDCMTK.h"
+
+//----------------------------------------------------------------------------
+class qCTKDCMTKPrivate: public qCTKPrivate<qCTKDCMTK>
+{
+public:
+  qCTKDCMTKPrivate(){}
+};
+
+//----------------------------------------------------------------------------
+// qCTKDCMTKPrivate methods
+
+
+//----------------------------------------------------------------------------
+// qCTKDCMTKWidget methods
+
+qCTKDCMTK::qCTKDCMTK(QObject* _parent):Superclass(_parent)
+{
+  QCTK_INIT_PRIVATE(qCTKDCMTK);
+}
+
+qCTKDCMTK::~qCTKDCMTK()
+{
+}
+

+ 25 - 0
Libs/qCTKDMCTK/Base/qCTKDCMTK.h

@@ -0,0 +1,25 @@
+#ifndef __qCTKDCMTK_h
+#define __qCTKDCMTK_h
+
+// QT includes 
+#include <QObject>
+
+// qCTK includes
+#include <qCTKPimpl.h>
+
+#include "qCTKDMCTKExport.h"
+
+class qCTKDCMTKPrivate;
+class Q_CTKDMCTK_EXPORT qCTKDCMTK : public QObject
+{
+  Q_OBJECT
+public:
+  typedef QObject Superclass;
+  explicit qCTKDCMTK(QObject* parent = 0);
+  virtual ~qCTKDCMTK();
+
+private:
+  QCTK_DECLARE_PRIVATE(qCTKDCMTK);
+};
+
+#endif

+ 33 - 0
Libs/qCTKDMCTK/Base/qCTKDCMTKListenerWidget.cxx

@@ -0,0 +1,33 @@
+
+// qCTKDCMTK includes
+#include "qCTKDCMTKListenerWidget.h"
+#include "ui_qCTKDCMTKListenerWidget.h"
+
+//----------------------------------------------------------------------------
+class qCTKDCMTKListenerWidgetPrivate: public qCTKPrivate<qCTKDCMTKListenerWidget>, 
+                                       public Ui_qCTKDCMTKListenerWidget
+{
+public:
+  qCTKDCMTKListenerWidgetPrivate(){}
+};
+
+//----------------------------------------------------------------------------
+// qCTKDCMTKListenerWidgetPrivate methods
+
+
+//----------------------------------------------------------------------------
+// qCTKDCMTKListenerWidget methods
+
+qCTKDCMTKListenerWidget::qCTKDCMTKListenerWidget(QWidget* _parent):Superclass(_parent)
+{
+  QCTK_INIT_PRIVATE(qCTKDCMTKListenerWidget);
+  QCTK_D(qCTKDCMTKListenerWidget);
+  
+  d->setupUi(this);
+}
+
+qCTKDCMTKListenerWidget::~qCTKDCMTKListenerWidget()
+{
+}
+
+

+ 25 - 0
Libs/qCTKDMCTK/Base/qCTKDCMTKListenerWidget.h

@@ -0,0 +1,25 @@
+#ifndef __qCTKDCMTKListenerWidget_h
+#define __qCTKDCMTKListenerWidget_h
+
+// QT includes 
+#include <QWidget>
+
+// qCTK includes
+#include <qCTKPimpl.h>
+
+#include "qCTKDMCTKExport.h"
+
+class qCTKDCMTKListenerWidgetPrivate; 
+
+class Q_CTKDMCTK_EXPORT qCTKDCMTKListenerWidget : public QWidget
+{
+public:
+  typedef QWidget Superclass;
+  explicit qCTKDCMTKListenerWidget(QWidget* parent=0);
+  virtual ~qCTKDCMTKListenerWidget();
+
+private:
+  QCTK_DECLARE_PRIVATE(qCTKDCMTKListenerWidget);
+};
+
+#endif

+ 33 - 0
Libs/qCTKDMCTK/Base/qCTKDCMTKLocationWidget.cxx

@@ -0,0 +1,33 @@
+
+// qCTKDCMTK includes
+#include "qCTKDCMTKLocationWidget.h"
+#include "ui_qCTKDCMTKLocationWidget.h"
+
+//----------------------------------------------------------------------------
+class qCTKDCMTKLocationWidgetPrivate: public qCTKPrivate<qCTKDCMTKLocationWidget>, 
+                                      public Ui_qCTKDCMTKLocationWidget
+{
+public:
+  qCTKDCMTKLocationWidgetPrivate(){}
+};
+
+//----------------------------------------------------------------------------
+// qCTKDCMTKLocationWidgetPrivate methods
+
+
+//----------------------------------------------------------------------------
+// qCTKDCMTKLocationWidget methods
+
+qCTKDCMTKLocationWidget::qCTKDCMTKLocationWidget(QWidget* _parent):Superclass(_parent)
+{
+  QCTK_INIT_PRIVATE(qCTKDCMTKLocationWidget);
+  QCTK_D(qCTKDCMTKLocationWidget);
+  
+  d->setupUi(this);
+}
+
+qCTKDCMTKLocationWidget::~qCTKDCMTKLocationWidget()
+{
+}
+
+

+ 25 - 0
Libs/qCTKDMCTK/Base/qCTKDCMTKLocationWidget.h

@@ -0,0 +1,25 @@
+#ifndef __qCTKDCMTKLocationWidget_h
+#define __qCTKDCMTKLocationWidget_h
+
+// QT includes 
+#include <QWidget>
+
+// qCTK includes
+#include <qCTKPimpl.h>
+
+#include "qCTKDMCTKExport.h"
+
+class qCTKDCMTKLocationWidgetPrivate; 
+
+class Q_CTKDMCTK_EXPORT qCTKDCMTKLocationWidget : public QWidget
+{
+public:
+  typedef QWidget Superclass;
+  explicit qCTKDCMTKLocationWidget(QWidget* parent=0);
+  virtual ~qCTKDCMTKLocationWidget();
+
+private:
+  QCTK_DECLARE_PRIVATE(qCTKDCMTKLocationWidget);
+};
+
+#endif

+ 33 - 0
Libs/qCTKDMCTK/Base/qCTKDCMTKQueryRetrieveWidget.cxx

@@ -0,0 +1,33 @@
+
+// qCTKDCMTK includes
+#include "qCTKDCMTKQueryRetrieveWidget.h"
+#include "ui_qCTKDCMTKQueryRetrieveWidget.h"
+
+//----------------------------------------------------------------------------
+class qCTKDCMTKQueryRetrieveWidgetPrivate: public qCTKPrivate<qCTKDCMTKQueryRetrieveWidget>, 
+                                      public Ui_qCTKDCMTKQueryRetrieveWidget
+{
+public:
+  qCTKDCMTKQueryRetrieveWidgetPrivate(){}
+};
+
+//----------------------------------------------------------------------------
+// qCTKDCMTKQueryRetrieveWidgetPrivate methods
+
+
+//----------------------------------------------------------------------------
+// qCTKDCMTKQueryRetrieveWidget methods
+
+qCTKDCMTKQueryRetrieveWidget::qCTKDCMTKQueryRetrieveWidget(QWidget* _parent):Superclass(_parent)
+{
+  QCTK_INIT_PRIVATE(qCTKDCMTKQueryRetrieveWidget);
+  QCTK_D(qCTKDCMTKQueryRetrieveWidget);
+  
+  d->setupUi(this);
+}
+
+qCTKDCMTKQueryRetrieveWidget::~qCTKDCMTKQueryRetrieveWidget()
+{
+}
+
+

+ 25 - 0
Libs/qCTKDMCTK/Base/qCTKDCMTKQueryRetrieveWidget.h

@@ -0,0 +1,25 @@
+#ifndef __qCTKDCMTKQueryRetrieveWidget_h
+#define __qCTKDCMTKQueryRetrieveWidget_h
+
+// QT includes 
+#include <QWidget>
+
+// qCTK includes
+#include <qCTKPimpl.h>
+
+#include "qCTKDMCTKExport.h"
+
+class qCTKDCMTKQueryRetrieveWidgetPrivate; 
+
+class Q_CTKDMCTK_EXPORT qCTKDCMTKQueryRetrieveWidget : public QWidget
+{
+public:
+  typedef QWidget Superclass;
+  explicit qCTKDCMTKQueryRetrieveWidget(QWidget* parent=0);
+  virtual ~qCTKDCMTKQueryRetrieveWidget();
+
+private:
+  QCTK_DECLARE_PRIVATE(qCTKDCMTKQueryRetrieveWidget);
+};
+
+#endif

+ 251 - 0
Libs/qCTKDMCTK/Base/qCTKPimpl.h

@@ -0,0 +1,251 @@
+/**
+\class qCTKPimpl qCTKPimpl
+\brief Hide private details of a class
+
+Application code generally doesn't have to be concerned about hiding its
+implementation details, but when writing library code it is important to
+maintain a constant interface, both source and binary. Maintaining a constant
+source interface is easy enough, but keeping the binary interface constant
+means moving implementation details into a private class. The PIMPL, or
+d-pointer, idiom is a common method of implementing this separation. qCTKPimpl
+offers a convenient way to connect the public and private sides of your class.
+
+\section start Getting Started
+Before you declare the public class, you need to make a forward declaration
+of the private class. The private class must have the same name as the public
+class, followed by the word Private.
+
+\subsection pub The Public Class
+Generally, you shouldn't keep any data members in the public class without a
+good reason. Functions that are part of the public interface should be declared
+in the public class, and functions that need to be available to subclasses (for
+calling or overriding) should be in the protected section of the public class.
+To connect the private class to the public class, include the
+QCTK_DECLARE_PRIVATE macro in the private section of the public class. In the
+example above, the private class is connected as follows:
+
+Additionally, you must include the QCTK_INIT_PRIVATE macro in the public class's
+constructor.
+
+\subsection priv The Private Class
+As mentioned above, data members should usually be kept in the private class.
+This allows the memory layout of the private class to change without breaking
+binary compatibility for the public class. Functions that exist only as
+implementation details, or functions that need access to private data members,
+should be implemented here.
+
+To define the private class, inherit from the template qCTKPrivate class, and
+include the QCTK_DECLARE_PUBLIC macro in its public section. The template
+parameter should be the name of the public class.
+
+\section cross Accessing Private Members
+Use the qctk_d() function (actually a function-like object) from functions in
+the public class to access the private class. Similarly, functions in the
+private class can invoke functions in the public class by using the qctk_p()
+function (this one's actually a function).
+*/
+
+#ifndef __qCTKPimpl_h
+#define __qCTKPimpl_h
+
+#include <QtGlobal>
+
+/*! \relates qCTKPimpl
+ * Define a public class constructor with no argument
+ *
+ * Also make sure the Pimpl is initalized
+ */
+#define QCTK_CONSTRUCTOR_NO_ARG_CXX(PUB) \
+  PUB::PUB()                             \
+    {                                    \
+    QCTK_INIT_PRIVATE(PUB);              \
+    }
+
+/*! \relates qCTKPimpl
+ * Define a public class constructor with one argument
+ *
+ * Also make sure the Pimpl is initalized
+ */
+#define QCTK_CONSTRUCTOR_1_ARG_CXX(PUB, _ARG1)  \
+  PUB::PUB(_ARG1 _parent) :                     \
+    Superclass( _parent )                       \
+    {                                           \
+    QCTK_INIT_PRIVATE(PUB);                     \
+    }
+    
+/*! \relates qCTKPimpl
+ * Define the setter in the public class.
+ *
+ * This should be put in the .cxx file of the public class. The parameter are
+ * the name of the public class (PUB), the type of the argument to return (_TYPE),
+ * the name of the getter(_NAME) and the name of the variable in the Private class(_VARNAME).
+ */
+#define QCTK_SET_CXX(PUB, _TYPE, _NAME, _VARNAME)   \
+  void PUB::_NAME(_TYPE var)                        \
+  {                                                 \
+    qctk_d.ref()._VARNAME =  var;                   \
+  }
+
+/*! \relates qCTKPimpl
+ * Define the setter in the public class.
+ *
+ * This should be put in the .cxx file of the public class. The parameter are
+ * the name of the public class (PUB), the type of the argument to return (_TYPE),
+ * the name of the setter(_NAME) and the name of the variable in the Private class(_VARNAME).
+ */
+#define QCTK_GET_CXX(PUB, _TYPE, _NAME, _VARNAME)  \
+  _TYPE PUB::_NAME()const                          \
+  {                                                \
+    return qctk_d.ref()._VARNAME;                  \
+  }
+
+/*! \relates qCTKPimpl
+ * Declares that a public class has a related private class.
+ *
+ * This should be put in the private section of the public class. The parameter is the name of the public class.
+ * For convenience, this macro also add 'typedef PUB Self;'
+ */
+#define QCTK_DECLARE_PRIVATE(PUB)                                          \
+friend class PUB##Private; qCTKPrivateInterface<PUB, PUB##Private> qctk_d; \
+typedef PUB Self;
+
+/*! \relates qCTKPimpl
+ * Declares that a private class has a related public class.
+ *
+ * This may be put anywhere in the declaration of the private class. The parameter is the name of the public class.
+ */
+#define QCTK_DECLARE_PUBLIC(PUB) friend class PUB;
+/*! \relates qCTKPimpl
+ * Initializes resources owned by the private class.
+ *
+ * This should be called from the public class's constructor,
+ * before qctk_d() is used for the first time. The parameter is the name of the public class.
+ */
+#define QCTK_INIT_PRIVATE(PUB) qctk_d.setPublic(this)
+/*! \relates qCTKPimpl
+ * Returns a pointer (or reference) in the current scope named "d" to the private class.
+ *
+ * This function is only available in a class using \a QCTK_DECLARE_PRIVATE.
+ */
+#define QCTK_D(PUB) PUB##Private* d = qctk_d()
+#define QCTK_D_REF(PUB) PUB##Private& d = qctk_d.ref()
+/*! \relates qCTKPimpl
+ * Creates a pointer ( or reference) in the current scope named "q" to the public class.
+ *
+ * This macro only works in a class using \a QCTK_DECLARE_PUBLIC.
+ */
+#define QCTK_P(PUB) PUB* p = qctk_p()
+#define QCTK_P_REF(PUB) PUB& p = qctk_p_ref()
+
+#ifdef QCTK_DOXYGEN_RUN
+/*! \relates qCTKPimpl
+ * Returns a pointer to the private class.
+ *
+ * This function is only available in a class using \a QCTK_DECLARE_PRIVATE.
+ */
+qCTKPrivate<PUB>* qctk_d();
+
+/*! \relates qCTKPimpl
+ * Returns a const pointer to the private class.
+ *
+ * This function is only available in a class using \a QCTK_DECLARE_PRIVATE.
+ * This overload will be automatically used in const functions.
+ */
+const qCTKPrivate<PUB>* qctk_d();
+
+/*! \relates qCTKPimpl
+ * Returns a reference or pointer to the public class.
+ *
+ * This function is only available in a class using \a QCTK_DECLARE_PUBLIC.
+ */
+PUB& qctk_p_ref();
+PUB* qctk_p();
+
+/*! \relates qCTKPimpl
+ * Returns a const reference or pointer to the public class.
+ *
+ * This function is only available in a class using \a QCTK_DECLARE_PUBLIC.
+ * This overload will be automatically used in const functions.
+ */
+const PUB& qctk_p_ref();
+const PUB* qctk_p();
+#endif
+
+template <typename PUB>
+class qCTKPrivate
+{
+public:
+  virtual ~qCTKPrivate(){}
+  inline void QCTK_setPublic(PUB* pub)
+    {
+    Q_ASSERT(pub);
+    qctk_p_ptr = pub;
+    }
+
+protected:
+  inline PUB& qctk_p_ref()
+    {
+    Q_ASSERT(this->qctk_p_ptr);
+    return *this->qctk_p_ptr;
+    }
+  inline const PUB& qctk_p_ref() const
+    {
+    Q_ASSERT(this->qctk_p_ptr);
+    return *this->qctk_p_ptr;
+    }
+
+  inline PUB* qctk_p()
+    {
+    Q_ASSERT(this->qctk_p_ptr);
+    return this->qctk_p_ptr;
+    }
+  inline const PUB* qctk_p() const
+    {
+    Q_ASSERT(this->qctk_p_ptr);
+    return this->qctk_p_ptr;
+    }
+
+private:
+  PUB* qctk_p_ptr;
+};
+
+template <typename PUB, typename PVT>
+class qCTKPrivateInterface
+{
+  friend class qCTKPrivate<PUB>;
+public:
+  qCTKPrivateInterface()
+    {
+    this->pvt = new PVT;
+    }
+  ~qCTKPrivateInterface()
+    {
+    delete this->pvt;
+    }
+
+  inline void setPublic(PUB* pub)
+    {
+    Q_ASSERT(pub);
+    this->pvt->QCTK_setPublic(pub);
+    }
+  inline PVT& ref()
+    {
+    return *static_cast<PVT*>(this->pvt);
+    }
+  inline const PVT& ref() const
+    {
+    return *static_cast<PVT*>(this->pvt);
+    }
+  inline PVT* operator()()
+    {
+    return static_cast<PVT*>(this->pvt);
+    }
+  inline const PVT* operator()() const
+    {
+    return static_cast<PVT*>(this->pvt);
+    }
+private:
+  qCTKPrivate<PUB>* pvt;
+};
+
+#endif

+ 104 - 0
Libs/qCTKDMCTK/CMake/qCTKBuildLibMacro.cmake

@@ -0,0 +1,104 @@
+
+#
+#
+#
+MACRO(qctk_build_qtlib)
+  qCTK_PARSE_ARGUMENTS(MYQTLIB
+    "NAME;EXPORT_TEMPLATE;EXPORT_DIRECTIVE;SRCS;MOC_SRCS;UI_FORMS;INCLUDE_DIRECTORIES;TARGET_LIBRARIES;RESOURCES;LIBRARY_TYPE"
+    ""
+    ${ARGN}
+    )
+
+  # Sanity checks
+  IF(NOT DEFINED MYQTLIB_NAME)
+    MESSAGE(SEND_ERROR "NAME is mandatory")
+  ENDIF(NOT DEFINED MYQTLIB_NAME)
+  IF(NOT DEFINED MYQTLIB_EXPORT_DIRECTIVE)
+    MESSAGE(SEND_ERROR "EXPORT_DIRECTIVE is mandatory")
+  ENDIF(NOT DEFINED MYQTLIB_EXPORT_DIRECTIVE)
+  IF(NOT DEFINED MYQTLIB_EXPORT_TEMPLATE)
+    MESSAGE(SEND_ERROR "EXPORT_TEMPLATE is mandatory")
+  ENDIF(NOT DEFINED MYQTLIB_EXPORT_TEMPLATE)
+  IF(NOT DEFINED MYQTLIB_LIBRARY_TYPE)
+    SET(MYQTLIB_LIBRARY_TYPE "SHARED")
+  ENDIF(NOT DEFINED MYQTLIB_LIBRARY_TYPE)
+
+  # Define library name
+  SET(lib_name ${MYQTLIB_NAME})
+
+  # --------------------------------------------------------------------------
+  # Include dirs
+  SET(my_includes
+    ${qCTK_BASE_INCLUDE_DIRS}
+    ${CMAKE_CURRENT_SOURCE_DIR}
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${MYQTLIB_INCLUDE_DIRECTORIES}
+    )  
+  SET(qCTK_BASE_INCLUDE_DIRS ${my_includes} CACHE INTERNAL "qCTK Base includes" FORCE)
+  INCLUDE_DIRECTORIES(
+    ${qCTK_BASE_INCLUDE_DIRS}
+    )  
+ 
+  SET(MY_LIBRARY_EXPORT_DIRECTIVE ${MYQTLIB_EXPORT_DIRECTIVE})
+  SET(MY_EXPORT_HEADER_PREFIX ${MYQTLIB_NAME})
+  SET(MY_LIBNAME ${lib_name})
+  
+  CONFIGURE_FILE(
+    ${MYQTLIB_EXPORT_TEMPLATE}
+    ${CMAKE_CURRENT_BINARY_DIR}/${MY_EXPORT_HEADER_PREFIX}Export.h
+    )
+  SET(dynamicHeaders
+    "${dynamicHeaders};${CMAKE_CURRENT_BINARY_DIR}/${MY_EXPORT_HEADER_PREFIX}Export.h")
+
+  QT4_WRAP_CPP(MYQTLIB_SRCS ${MYQTLIB_MOC_SRCS})
+  QT4_WRAP_UI(MYQTLIB_UI_CXX ${MYQTLIB_UI_FORMS})
+  SET(MYQTLIB_QRC_SRCS "")
+  IF(DEFINED MYQTLIB_RESOURCES)
+    QT4_ADD_RESOURCES(MYQTLIB_QRC_SRCS ${MYQTLIB_RESOURCES})
+  ENDIF(DEFINED MYQTLIB_RESOURCES)
+
+  SOURCE_GROUP("Resources" FILES
+    ${MYQTLIB_RESOURCES}
+    ${MYQTLIB_UI_FORMS}
+    )
+
+  SOURCE_GROUP("Generated" FILES
+    ${MYQTLIB_MOC_SRCS}
+    ${MYQTLIB_QRC_SRCS}
+    ${MYQTLIB_UI_CXX}
+    )
+  
+  ADD_LIBRARY(${lib_name} ${MYQTLIB_LIBRARY_TYPE}
+    ${MYQTLIB_SRCS}
+    ${MYQTLIB_UI_CXX}
+    ${MYQTLIB_QRC_SRCS}
+    )
+
+  # Install rules
+  #IF(qCTK_BUILD_SHARED_LIBS)
+  #  INSTALL(TARGETS ${lib_name}
+  #    RUNTIME DESTINATION ${qCTK_INSTALL_BIN_DIR} COMPONENT Runtime
+  #    LIBRARY DESTINATION ${qCTK_INSTALL_LIB_DIR} COMPONENT Runtime
+  #    ARCHIVE DESTINATION ${qCTK_INSTALL_LIB_DIR} COMPONENT Development)
+  #ENDIF(qCTK_BUILD_SHARED_LIBS)
+  
+  SET(my_libs
+    ${qCTK_BASE_LIBRARIES}
+    ${MYQTLIB_TARGET_LIBRARIES}
+    )
+  TARGET_LINK_LIBRARIES(${lib_name} ${my_libs})
+
+  # Update qCTK_BASE_LIBRARIES
+  SET(qCTK_BASE_LIBRARIES ${my_libs} ${lib_name} CACHE INTERNAL "qCTK Base libraries" FORCE)  
+  
+  # Install headers
+  #FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
+  #INSTALL(FILES
+  #  ${headers}
+  #  ${dynamicHeaders}
+  #  DESTINATION ${qCTK_INSTALL_INCLUDE_DIR} COMPONENT Development
+  #  )
+
+ENDMACRO(qctk_build_qtlib)
+
+

+ 95 - 0
Libs/qCTKDMCTK/CMake/qCTKBuildPluginMacro.cmake

@@ -0,0 +1,95 @@
+
+#
+#
+#
+MACRO(ov_build_qtplugin)
+  OV_PARSE_ARGUMENTS(MYQTPLUGIN
+    "NAME;EXPORT_DIRECTIVE;SRCS;MOC_SRCS;UI_FORMS;INCLUDE_DIRECTORIES;TARGET_LIBRARIES;UI_RESOURCES"
+    ""
+    ${ARGN}
+    )
+
+  # Sanity checks
+  IF(NOT DEFINED MYQTPLUGIN_NAME)
+    MESSAGE(SEND_ERROR "NAME is mandatory")
+  ENDIF(NOT DEFINED MYQTPLUGIN_NAME)
+  IF(NOT DEFINED MYQTPLUGIN_EXPORT_DIRECTIVE)
+    MESSAGE(SEND_ERROR "EXPORT_DIRECTIVE is mandatory")
+  ENDIF(NOT DEFINED MYQTPLUGIN_EXPORT_DIRECTIVE)
+
+  # Define library name
+  SET(lib_name qOV${MYQTPLUGIN_NAME})
+
+  # --------------------------------------------------------------------------
+  # Include dirs
+  SET(my_includes
+    ${OmicsView_BASE_INCLUDE_DIRS}
+    ${CMAKE_CURRENT_SOURCE_DIR}
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${MYQTPLUGIN_INCLUDE_DIRECTORIES}
+    )  
+  INCLUDE_DIRECTORIES(
+    ${my_includes}
+    )  
+ 
+  SET(MY_LIBRARY_EXPORT_DIRECTIVE ${MYQTPLUGIN_EXPORT_DIRECTIVE})
+  SET(MY_EXPORT_HEADER_PREFIX qOV${MYQTPLUGIN_NAME})
+  SET(MY_LIBNAME ${lib_name})
+  
+  CONFIGURE_FILE(
+    ${OmicsView_SOURCE_DIR}/qOVExport.h.in
+    ${CMAKE_CURRENT_BINARY_DIR}/${MY_EXPORT_HEADER_PREFIX}Export.h
+    )
+  SET(dynamicHeaders
+    "${dynamicHeaders};${CMAKE_CURRENT_BINARY_DIR}/${MY_EXPORT_HEADER_PREFIX}Export.h")
+
+  QT4_WRAP_CPP(MYQTPLUGIN_SRCS ${MYQTPLUGIN_MOC_SRCS})
+  QT4_WRAP_UI(MYQTPLUGIN_UI_CXX ${MYQTPLUGIN_UI_FORMS})
+  SET(MYQTPLUGIN_QRC_SRCS "")
+  IF(DEFINED MYQTPLUGIN_UI_RESOURCES)
+    QT4_ADD_RESOURCES(MYQTPLUGIN_QRC_SRCS ${MYQTPLUGIN_UI_RESOURCES})
+  ENDIF(DEFINED MYQTPLUGIN_UI_RESOURCES)
+
+  SOURCE_GROUP("Resources" FILES
+    ${MYQTPLUGIN_UI_RESOURCES}
+    ${MYQTPLUGIN_UI_FORMS}
+    )
+
+  SOURCE_GROUP("Generated" FILES
+    ${MYQTPLUGIN_MOC_SRCS}
+    ${MYQTPLUGIN_QRC_SRCS}
+    ${MYQTPLUGIN_UI_CXX}
+    )
+  
+  ADD_LIBRARY(${lib_name} ${OV_LIBRARY_TYPE}
+    ${MYQTPLUGIN_SRCS}
+    ${MYQTPLUGIN_UI_CXX}
+    ${MYQTPLUGIN_QRC_SRCS}
+    )
+
+  # Note: The plugin may be installed in some other location ???
+  # Install rules
+  IF(OV_BUILD_SHARED_LIBS)
+    INSTALL(TARGETS ${lib_name}
+      RUNTIME DESTINATION ${OV_INSTALL_BIN_DIR} COMPONENT Runtime
+      LIBRARY DESTINATION ${OV_INSTALL_LIB_DIR} COMPONENT Runtime
+      ARCHIVE DESTINATION ${OV_INSTALL_LIB_DIR} COMPONENT Development)
+  ENDIF(OV_BUILD_SHARED_LIBS)
+  
+  SET(my_libs
+    ${OmicsView_BASE_LIBRARIES}
+    ${MYQTPLUGIN_TARGET_LIBRARIES}
+    )
+  TARGET_LINK_LIBRARIES(${lib_name} ${my_libs})
+  
+  # Install headers
+  FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
+  INSTALL(FILES
+    ${headers}
+    ${dynamicHeaders}
+    DESTINATION ${OV_INSTALL_INCLUDE_DIR} COMPONENT Development
+    )
+
+ENDMACRO(ov_build_qtplugin)
+
+

+ 34 - 0
Libs/qCTKDMCTK/CMake/qCTKParseArgumentsMacro.cmake

@@ -0,0 +1,34 @@
+
+#
+# See http://www.cmake.org/Wiki/CMakeMacroParseArguments
+#
+MACRO(qCTK_PARSE_ARGUMENTS prefix arg_names option_names)
+  SET(DEFAULT_ARGS)
+  FOREACH(arg_name ${arg_names})
+    SET(${prefix}_${arg_name})
+  ENDFOREACH(arg_name)
+  FOREACH(option ${option_names})
+    SET(${prefix}_${option} FALSE)
+  ENDFOREACH(option)
+
+  SET(current_arg_name DEFAULT_ARGS)
+  SET(current_arg_list)
+  FOREACH(arg ${ARGN})
+    SET(larg_names ${arg_names})
+    LIST(FIND larg_names "${arg}" is_arg_name)
+    IF (is_arg_name GREATER -1)
+      SET(${prefix}_${current_arg_name} ${current_arg_list})
+      SET(current_arg_name ${arg})
+      SET(current_arg_list)
+    ELSE (is_arg_name GREATER -1)
+      SET(loption_names ${option_names})    
+      LIST(FIND loption_names "${arg}" is_option)
+      IF (is_option GREATER -1)
+        SET(${prefix}_${arg} TRUE)
+      ELSE (is_option GREATER -1)
+        SET(current_arg_list ${current_arg_list} ${arg})
+      ENDIF (is_option GREATER -1)
+    ENDIF (is_arg_name GREATER -1)
+  ENDFOREACH(arg)
+  SET(${prefix}_${current_arg_name} ${current_arg_list})
+ENDMACRO(qCTK_PARSE_ARGUMENTS)

+ 67 - 0
Libs/qCTKDMCTK/CMakeLists.txt

@@ -0,0 +1,67 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+IF(COMMAND CMAKE_POLICY)
+  CMAKE_POLICY(SET CMP0003 NEW)
+ENDIF(COMMAND CMAKE_POLICY)
+
+PROJECT(CTKDCMTK)
+
+#-----------------------------------------------------------------------------
+# Advanced options
+#
+
+#-----------------------------------------------------------------------------
+# External libraries.  
+#
+SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} 
+  "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
+
+INCLUDE(CMake/qCTKParseArgumentsMacro.cmake)
+INCLUDE(CMake/qCTKBuildLibMacro.cmake)
+  
+#-----------------------------------------------------------------------------
+# Build shared lib by default
+#
+OPTION(qCTK_BUILD_SHARED_LIBS "Build ${PROJECT_NAME} with shared libraries." ON)
+SET(qCTK_LIBRARY_MODE "")
+IF( qCTK_BUILD_SHARED_LIBS)
+  SET(qCTK_LIBRARY_MODE "SHARED")
+ENDIF(qCTK_BUILD_SHARED_LIBS)
+MARK_AS_ADVANCED(qCTK_BUILD_SHARED_LIBS)
+
+#-----------------------------------------------------------------------------
+# Output directories.
+#
+IF(NOT LIBRARY_OUTPUT_PATH)
+  SET(LIBRARY_OUTPUT_PATH ${CTKDCMTK_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all libraries.")
+ENDIF(NOT LIBRARY_OUTPUT_PATH)
+IF(NOT EXECUTABLE_OUTPUT_PATH)
+  SET(EXECUTABLE_OUTPUT_PATH ${CTKDCMTK_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")
+ENDIF(NOT EXECUTABLE_OUTPUT_PATH)
+SET(CTKDCMTK_LIBRARY_PATH ${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
+SET(CTKDCMTK_EXECUTABLE_PATH ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
+SET(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})
+
+#-----------------------------------------------------------------------------
+# Install directories, used for install rules.
+SET(qCTK_INSTALL_BIN_DIR "bin")
+SET(qCTK_INSTALL_LIB_DIR "lib")
+SET(qCTK_INSTALL_INCLUDE_DIR "include")
+#SET(qCTK_INSTALL_DOC_DIR "doc")
+
+#
+# QT
+#
+FIND_PACKAGE(Qt4)
+IF(QT4_FOUND)
+  SET(QT_USE_QTNETWORK ON)
+  INCLUDE(${QT_USE_FILE})
+ELSE(QT4_FOUND)
+  MESSAGE("Qt4 was not found on your system. You probably need to set the QT_QMAKE_EXECUTABLE variable")
+ENDIF(QT4_FOUND)
+
+# Build the code Base  
+ADD_SUBDIRECTORY(Base)
+
+# Build the application(s)
+ADD_SUBDIRECTORY(Applications)
+

+ 21 - 0
Libs/qCTKDMCTK/qCTKExport.h.in

@@ -0,0 +1,21 @@
+
+
+// .NAME __@MY_EXPORT_HEADER_PREFIX@Export - manage Windows system differences
+// .SECTION Description
+// The __@MY_EXPORT_HEADER_PREFIX@Export captures some system differences between Unix
+// and Windows operating systems. 
+
+#ifndef __@MY_EXPORT_HEADER_PREFIX@Export_h
+#define __@MY_EXPORT_HEADER_PREFIX@Export_h
+
+#if defined(WIN32) && !defined(@MY_LIBNAME@_STATIC)
+ #if defined(@MY_LIBNAME@_EXPORTS)
+  #define @MY_LIBRARY_EXPORT_DIRECTIVE@ __declspec( dllexport ) 
+ #else
+  #define @MY_LIBRARY_EXPORT_DIRECTIVE@ __declspec( dllimport ) 
+ #endif
+#else
+ #define @MY_LIBRARY_EXPORT_DIRECTIVE@
+#endif
+
+#endif