Forráskód Böngészése

Fixed coding style to be consistent

- Alphabetically listed source files in CMakeLists.txt
- Added missing license text
- Fixed indentation and source code formatting
Sascha Zelzer 14 éve
szülő
commit
4e223b3aac
24 módosított fájl, 960 hozzáadás és 643 törlés
  1. 1 1
      Applications/ctkExampleHost/CMakeLists.txt
  2. 50 30
      Applications/ctkExampleHost/ctkHostAppExampleWidget.cpp
  3. 42 16
      Applications/ctkExampleHost/ctkHostAppExampleWidget.h
  4. 4 4
      Plugins/org.commontk.dah.app/CMakeLists.txt
  5. 25 1
      Plugins/org.commontk.dah.app/ctkDicomAbstractApp.cpp
  6. 31 8
      Plugins/org.commontk.dah.app/ctkDicomAbstractApp.h
  7. 7 5
      Plugins/org.commontk.dah.core/CMakeLists.txt
  8. 501 426
      Plugins/org.commontk.dah.core/ctkDicomAppHostingTypesHelper.h
  9. 25 24
      Plugins/org.commontk.dah.core/ctkDicomExchangeService.cpp
  10. 1 0
      Plugins/org.commontk.dah.core/ctkDicomExchangeService.h
  11. 10 9
      Plugins/org.commontk.dah.core/ctkDicomServicePrivate.cpp
  12. 16 16
      Plugins/org.commontk.dah.core/ctkSoapMessageProcessorList.cpp
  13. 5 6
      Plugins/org.commontk.dah.core/ctkSoapMessageProcessorList.h
  14. 2 2
      Plugins/org.commontk.dah.exampleapp/CMakeLists.txt
  15. 2 2
      Plugins/org.commontk.dah.examplehost/CMakeLists.txt
  16. 57 33
      Plugins/org.commontk.dah.examplehost/ctkExampleDicomHost.cpp
  17. 53 25
      Plugins/org.commontk.dah.examplehost/ctkExampleDicomHost.h
  18. 21 0
      Plugins/org.commontk.dah.examplehost/ctkHostedAppPlaceholderWidget.cpp
  19. 39 13
      Plugins/org.commontk.dah.examplehost/ctkHostedAppPlaceholderWidget.h
  20. 4 4
      Plugins/org.commontk.dah.host/CMakeLists.txt
  21. 24 1
      Plugins/org.commontk.dah.host/ctkDicomAbstractHost.cpp
  22. 36 11
      Plugins/org.commontk.dah.host/ctkDicomAbstractHost.h
  23. 0 1
      Plugins/org.commontk.dah.host/ctkDicomAppService.cpp
  24. 4 5
      Plugins/org.commontk.dah.host/ctkDicomHostServer.h

+ 1 - 1
Applications/ctkExampleHost/CMakeLists.txt

@@ -16,8 +16,8 @@ SET(KIT_MOC_SRCS
 
 
 # UI files
 # UI files
 SET(KIT_UI_FORMS
 SET(KIT_UI_FORMS
-  ctkHostAppExampleWidget.ui
   ctkExampleHostMainWindow.ui
   ctkExampleHostMainWindow.ui
+  ctkHostAppExampleWidget.ui
 )
 )
 
 
 # Resources
 # Resources

+ 50 - 30
Applications/ctkExampleHost/ctkHostAppExampleWidget.cpp

@@ -1,3 +1,24 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) 2010 German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  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
+
+  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 "ctkHostAppExampleWidget.h"
 #include "ctkHostAppExampleWidget.h"
 #include "ui_ctkHostAppExampleWidget.h"
 #include "ui_ctkHostAppExampleWidget.h"
 #include "ctkExampleDicomHost.h"
 #include "ctkExampleDicomHost.h"
@@ -12,20 +33,18 @@ ctkHostAppExampleWidget::ctkHostAppExampleWidget(QWidget *parent) :
     QWidget(parent),
     QWidget(parent),
     ui(new Ui::ctkHostAppExampleWidget)
     ui(new Ui::ctkHostAppExampleWidget)
 {
 {
-    qDebug() << "setup ui";
-    ui->setupUi(this);
-    ui->crashLabel->setVisible(false);
-    ui->messageOutput->setVisible(false);
-    this->host = new ctkExampleDicomHost(ui->placeholderFrame);
-
-    connect(&this->host->getAppProcess(),SIGNAL(error(QProcess::ProcessError)),SLOT(appProcessError(QProcess::ProcessError)));
-    connect(&this->host->getAppProcess(),SIGNAL(stateChanged(QProcess::ProcessState)),SLOT(appProcessStateChanged(QProcess::ProcessState)));
-    connect(ui->placeholderFrame,SIGNAL(resized()),SLOT(placeholderResized()));
-    connect(this->host,SIGNAL( stateChangeReceived(ctkDicomAppHosting::State)),SLOT(appStateChanged(ctkDicomAppHosting::State)));
-
-  }
+  qDebug() << "setup ui";
+  ui->setupUi(this);
+  ui->crashLabel->setVisible(false);
+  ui->messageOutput->setVisible(false);
+  this->host = new ctkExampleDicomHost(ui->placeholderFrame);
 
 
+  connect(&this->host->getAppProcess(),SIGNAL(error(QProcess::ProcessError)),SLOT(appProcessError(QProcess::ProcessError)));
+  connect(&this->host->getAppProcess(),SIGNAL(stateChanged(QProcess::ProcessState)),SLOT(appProcessStateChanged(QProcess::ProcessState)));
+  connect(ui->placeholderFrame,SIGNAL(resized()),SLOT(placeholderResized()));
+  connect(this->host,SIGNAL( stateChangeReceived(ctkDicomAppHosting::State)),SLOT(appStateChanged(ctkDicomAppHosting::State)));
 
 
+}
 
 
 ctkHostAppExampleWidget::~ctkHostAppExampleWidget()
 ctkHostAppExampleWidget::~ctkHostAppExampleWidget()
 {
 {
@@ -35,32 +54,32 @@ ctkHostAppExampleWidget::~ctkHostAppExampleWidget()
 
 
 void ctkHostAppExampleWidget::startButtonClicked()
 void ctkHostAppExampleWidget::startButtonClicked()
 {
 {
-    qDebug() << "start button clicked";
-    if (host)
-    {
-      host->StartApplication(appFileName);
-    }
+  qDebug() << "start button clicked";
+  if (host)
+  {
+    host->StartApplication(appFileName);
+  }
 }
 }
 
 
 void ctkHostAppExampleWidget::runButtonClicked()
 void ctkHostAppExampleWidget::runButtonClicked()
 {
 {
-    qDebug() << "run button clicked";
-    if (host)
-    {
-      bool reply = host->getDicomAppService()->setState(ctkDicomAppHosting::INPROGRESS);
-      qDebug() << "  setState(INPROGRESS) returned: " << reply;
-    }
+  qDebug() << "run button clicked";
+  if (host)
+  {
+    bool reply = host->getDicomAppService()->setState(ctkDicomAppHosting::INPROGRESS);
+    qDebug() << "  setState(INPROGRESS) returned: " << reply;
+  }
 }
 }
 
 
 void ctkHostAppExampleWidget::stopButtonClicked()
 void ctkHostAppExampleWidget::stopButtonClicked()
 {
 {
-    qDebug() << "stop button clicked";
+  qDebug() << "stop button clicked";
 }
 }
 
 
 void ctkHostAppExampleWidget::loadButtonClicked()
 void ctkHostAppExampleWidget::loadButtonClicked()
 {
 {
-    qDebug() << "load button clicked";
-    this->setAppFileName(QFileDialog::getOpenFileName(this,"Choose hosted application",QApplication::applicationDirPath()));
+  qDebug() << "load button clicked";
+  this->setAppFileName(QFileDialog::getOpenFileName(this,"Choose hosted application",QApplication::applicationDirPath()));
 }
 }
 
 
 void ctkHostAppExampleWidget::setAppFileName(QString name)
 void ctkHostAppExampleWidget::setAppFileName(QString name)
@@ -83,7 +102,7 @@ void ctkHostAppExampleWidget::appProcessError(QProcess::ProcessError error)
     qDebug() << "crash detected";
     qDebug() << "crash detected";
     ui->crashLabel->setVisible(true);
     ui->crashLabel->setVisible(true);
   }
   }
-  }
+}
 
 
 void ctkHostAppExampleWidget::appProcessStateChanged(QProcess::ProcessState state)
 void ctkHostAppExampleWidget::appProcessStateChanged(QProcess::ProcessState state)
 {
 {
@@ -95,7 +114,7 @@ void ctkHostAppExampleWidget::appProcessStateChanged(QProcess::ProcessState stat
   case QProcess::NotRunning:
   case QProcess::NotRunning:
     if (host->getAppProcess().exitStatus() == QProcess::CrashExit )
     if (host->getAppProcess().exitStatus() == QProcess::CrashExit )
     {
     {
-        labelText = "crashed";
+      labelText = "crashed";
     }
     }
     else
     else
     {
     {
@@ -110,7 +129,8 @@ void ctkHostAppExampleWidget::appProcessStateChanged(QProcess::ProcessState stat
   default:
   default:
     ;
     ;
   }
   }
-  }
+}
+
 void ctkHostAppExampleWidget::placeholderResized()
 void ctkHostAppExampleWidget::placeholderResized()
 {
 {
   qDebug() << "resized";
   qDebug() << "resized";
@@ -119,5 +139,5 @@ void ctkHostAppExampleWidget::placeholderResized()
 
 
 void ctkHostAppExampleWidget::appStateChanged(ctkDicomAppHosting::State state)
 void ctkHostAppExampleWidget::appStateChanged(ctkDicomAppHosting::State state)
 {
 {
-   ui->statusLabel->setText(ctkDicomSoapState::toStringValue(state));
+  ui->statusLabel->setText(ctkDicomSoapState::toStringValue(state));
 }
 }

+ 42 - 16
Applications/ctkExampleHost/ctkHostAppExampleWidget.h

@@ -1,3 +1,24 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) 2010 German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  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
+
+  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 CTKHOSTAPPEXAMPLEWIDGET_H
 #ifndef CTKHOSTAPPEXAMPLEWIDGET_H
 #define CTKHOSTAPPEXAMPLEWIDGET_H
 #define CTKHOSTAPPEXAMPLEWIDGET_H
 
 
@@ -9,35 +30,40 @@
 class ctkExampleDicomHost;
 class ctkExampleDicomHost;
 
 
 namespace Ui {
 namespace Ui {
-    class ctkHostAppExampleWidget;
+  class ctkHostAppExampleWidget;
 }
 }
 
 
 class ctkHostAppExampleWidget : public QWidget
 class ctkHostAppExampleWidget : public QWidget
 {
 {
-    Q_OBJECT
+  Q_OBJECT
 
 
 public:
 public:
-    explicit ctkHostAppExampleWidget(QWidget *parent = 0);
-    void setAppFileName(QString name);
 
 
-    virtual ~ctkHostAppExampleWidget();
+  explicit ctkHostAppExampleWidget(QWidget *parent = 0);
+  void setAppFileName(QString name);
+
+  virtual ~ctkHostAppExampleWidget();
+
 public slots:
 public slots:
-    void loadButtonClicked();
-    void startButtonClicked();
-    void runButtonClicked();
-    void stopButtonClicked();
-    void appProcessError(QProcess::ProcessError error);
-    void appProcessStateChanged(QProcess::ProcessState state);
-    void appStateChanged(ctkDicomAppHosting::State state);
 
 
-    void placeholderResized();
+  void loadButtonClicked();
+  void startButtonClicked();
+  void runButtonClicked();
+  void stopButtonClicked();
+  void appProcessError(QProcess::ProcessError error);
+  void appProcessStateChanged(QProcess::ProcessState state);
+  void appStateChanged(ctkDicomAppHosting::State state);
+
+  void placeholderResized();
 
 
 protected:
 protected:
-    ctkExampleDicomHost* host;
-    QString appFileName;
+
+  ctkExampleDicomHost* host;
+  QString appFileName;
 
 
 private:
 private:
-    Ui::ctkHostAppExampleWidget *ui;
+
+  Ui::ctkHostAppExampleWidget *ui;
 
 
 };
 };
 
 

+ 4 - 4
Plugins/org.commontk.dah.app/CMakeLists.txt

@@ -8,18 +8,18 @@ ENDIF()
 SET(PLUGIN_export_directive "org_commontk_dah_app_EXPORT")
 SET(PLUGIN_export_directive "org_commontk_dah_app_EXPORT")
 
 
 SET(PLUGIN_SRCS
 SET(PLUGIN_SRCS
+  ctkAppSoapMessageProcessor.cpp
+  ctkDicomAbstractApp.cpp
+  ctkDicomAppPlugin.cpp
   ctkDicomAppServer.cpp
   ctkDicomAppServer.cpp
   ctkDicomAppServerPrivate.cpp
   ctkDicomAppServerPrivate.cpp
-  ctkDicomAppPlugin.cpp
-  ctkDicomAbstractApp.cpp
   ctkDicomHostService.cpp
   ctkDicomHostService.cpp
-  ctkAppSoapMessageProcessor.cpp
 )
 )
 
 
 # Files which should be processed by Qts moc
 # Files which should be processed by Qts moc
 SET(PLUGIN_MOC_SRCS
 SET(PLUGIN_MOC_SRCS
-  ctkDicomAppServerPrivate.h
   ctkDicomAppPlugin_p.h
   ctkDicomAppPlugin_p.h
+  ctkDicomAppServerPrivate.h
 )
 )
 
 
 # Qt Designer files which should be processed by Qts uic
 # Qt Designer files which should be processed by Qts uic

+ 25 - 1
Plugins/org.commontk.dah.app/ctkDicomAbstractApp.cpp

@@ -1,9 +1,32 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) 2010 German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  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
+
+  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 "ctkDicomAbstractApp.h"
 #include "ctkDicomAbstractApp.h"
 #include "ctkDicomAppServer.h"
 #include "ctkDicomAppServer.h"
 
 
 class ctkDicomAbstractAppPrivate
 class ctkDicomAbstractAppPrivate
 {
 {
-  public:
+
+public:
+
   ctkDicomAbstractAppPrivate(ctkDicomAbstractApp* appInterface, int port) : port(port)
   ctkDicomAbstractAppPrivate(ctkDicomAbstractApp* appInterface, int port) : port(port)
   {
   {
     Q_UNUSED(appInterface)
     Q_UNUSED(appInterface)
@@ -14,6 +37,7 @@ class ctkDicomAbstractAppPrivate
     }
     }
     server = new ctkDicomAppServer(port);
     server = new ctkDicomAppServer(port);
   }
   }
+
   ~ctkDicomAbstractAppPrivate()
   ~ctkDicomAbstractAppPrivate()
   {
   {
     delete server;
     delete server;

+ 31 - 8
Plugins/org.commontk.dah.app/ctkDicomAbstractApp.h

@@ -1,3 +1,24 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) 2010 German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  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
+
+  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 CTKDICOMABSTRACTAPP_H
 #ifndef CTKDICOMABSTRACTAPP_H
 #define CTKDICOMABSTRACTAPP_H
 #define CTKDICOMABSTRACTAPP_H
 
 
@@ -17,17 +38,19 @@ class ctkDicomAbstractAppPrivate;
   */
   */
 class ctkDicomAbstractApp : public ctkDicomAppInterface
 class ctkDicomAbstractApp : public ctkDicomAppInterface
 {
 {
+
 public:
 public:
-    /**
-      * Start the soap sever on the specified port or choose port automatically.
-      */
-    ctkDicomAbstractApp(int port = 0);
-    int getPort() const;
-    ~ctkDicomAbstractApp();
+
+  /**
+   * Start the soap sever on the specified port or choose port automatically.
+   */
+  ctkDicomAbstractApp(int port = 0);
+  int getPort() const;
+  ~ctkDicomAbstractApp();
 
 
 private:
 private:
-    Q_DECLARE_PRIVATE(ctkDicomAbstractApp)
-    const QScopedPointer<ctkDicomAbstractAppPrivate> d_ptr;
+  Q_DECLARE_PRIVATE(ctkDicomAbstractApp)
+  const QScopedPointer<ctkDicomAbstractAppPrivate> d_ptr;
 
 
 };
 };
 
 

+ 7 - 5
Plugins/org.commontk.dah.core/CMakeLists.txt

@@ -17,23 +17,25 @@ SET(PLUGIN_include_directories
 
 
 SET(PLUGIN_SRCS
 SET(PLUGIN_SRCS
   ctkDicomAppHostingCorePlugin.cpp
   ctkDicomAppHostingCorePlugin.cpp
-  ctkSimpleSoapServer.cpp
-  ctkSoapConnectionRunnable.cpp
-  ctkDicomServicePrivate.cpp
   ctkDicomAppHostingTypes.h
   ctkDicomAppHostingTypes.h
   ctkDicomAppHostingTypesHelper.h
   ctkDicomAppHostingTypesHelper.h
+  ctkDicomAppInterface.h
   ctkDicomExchangeService.cpp
   ctkDicomExchangeService.cpp
-  ctkSoapMessageProcessorList.cpp
+  ctkDicomHostInterface.h
+  ctkDicomServicePrivate.cpp
   ctkExchangeSoapMessageProcessor.cpp
   ctkExchangeSoapMessageProcessor.cpp
+  ctkSimpleSoapServer.cpp
+  ctkSoapConnectionRunnable.cpp
+  ctkSoapMessageProcessorList.cpp
 )
 )
 
 
 # Files which should be processed by Qts moc
 # Files which should be processed by Qts moc
 SET(PLUGIN_MOC_SRCS
 SET(PLUGIN_MOC_SRCS
+  ctkDicomAppHostingCorePlugin_p.h
   ctkDicomAppInterface.h
   ctkDicomAppInterface.h
   ctkDicomExchangeInterface.h
   ctkDicomExchangeInterface.h
   ctkDicomHostInterface.h
   ctkDicomHostInterface.h
   ctkDicomServicePrivate.h
   ctkDicomServicePrivate.h
-  ctkDicomAppHostingCorePlugin_p.h
   ctkSimpleSoapServer.h
   ctkSimpleSoapServer.h
   ctkSoapConnectionRunnable_p.h
   ctkSoapConnectionRunnable_p.h
 )
 )

+ 501 - 426
Plugins/org.commontk.dah.core/ctkDicomAppHostingTypesHelper.h

@@ -30,473 +30,548 @@
 
 
 #include <stdexcept>
 #include <stdexcept>
 
 
-class ctkDicomSoapRectangle :public QtSoapStruct {
-    public: 
-    ctkDicomSoapRectangle(const QString & name,const QRect& rect):
-        QtSoapStruct(QtSoapQName(name)){
-        this->insert(new QtSoapSimpleType(QtSoapQName("Height"), 
-                    rect.height()));
-        this->insert(new QtSoapSimpleType(QtSoapQName("Width"), 
-                    rect.width()));
-        this->insert(new QtSoapSimpleType(QtSoapQName("RefPointX"),
-                    rect.x()));
-        this->insert(new QtSoapSimpleType(QtSoapQName("RefPointY"), 
-                    rect.y()));
-    };
-
-    static QRect getQRect (const QtSoapType& type){
-        return QRect (type["RefPointX"].value().toInt(),
-                        type["RefPointY"].value().toInt(),
-                        type["Width"].value().toInt(),
-                        type["Height"].value().toInt());
-    };
+class ctkDicomSoapRectangle :public QtSoapStruct
+{
+
+public:
+
+  ctkDicomSoapRectangle(const QString & name,const QRect& rect):
+      QtSoapStruct(QtSoapQName(name))
+  {
+    this->insert(new QtSoapSimpleType(QtSoapQName("Height"),
+                                      rect.height()));
+    this->insert(new QtSoapSimpleType(QtSoapQName("Width"),
+                                      rect.width()));
+    this->insert(new QtSoapSimpleType(QtSoapQName("RefPointX"),
+                                      rect.x()));
+    this->insert(new QtSoapSimpleType(QtSoapQName("RefPointY"),
+                                      rect.y()));
+  }
+
+  static QRect getQRect (const QtSoapType& type)
+  {
+    return QRect (type["RefPointX"].value().toInt(),
+                  type["RefPointY"].value().toInt(),
+                  type["Width"].value().toInt(),
+                  type["Height"].value().toInt());
+  }
 };
 };
 
 
-class ctkDicomSoapState : public QtSoapSimpleType{
-    public:
-   ctkDicomSoapState ( const QString & name, ctkDicomAppHosting::State s ):
-       QtSoapSimpleType ( QtSoapQName(name), toStringValue(s) ){};
-
-   static ctkDicomAppHosting::State getState(const QtSoapType& type){
-        return fromString( type.value().toString() );
-   };
-
-   static ctkDicomAppHosting::State fromString(QString string)
-   {
-     if (string == "IDLE") return ctkDicomAppHosting::IDLE;
-     if (string == "INPROGRESS") return ctkDicomAppHosting::INPROGRESS;
-     if (string == "COMPLETED") return ctkDicomAppHosting::COMPLETED;
-     if (string == "SUSPENDED") return ctkDicomAppHosting::SUSPENDED;
-     if (string == "CANCELED") return ctkDicomAppHosting::CANCELED;
-     if (string == "EXIT") return ctkDicomAppHosting::EXIT;
-     throw std::runtime_error( string.prepend("Invalid STATE:").toStdString() );
-     return ctkDicomAppHosting::EXIT;
-   }
-   static QString toStringValue(ctkDicomAppHosting::State state)
-   {
-     switch(state)
-     {
-     case ctkDicomAppHosting::IDLE:
-         return "IDLE";
-     case ctkDicomAppHosting::INPROGRESS:
-         return "INPROGRESS";
-     case ctkDicomAppHosting::COMPLETED:
-         return "COMPLETED";
-     case ctkDicomAppHosting::SUSPENDED:
-         return "SUSPENDED";
-     case ctkDicomAppHosting::CANCELED:
-         return "CANCELED";
-     case ctkDicomAppHosting::EXIT:
-         return "EXIT";
-     default:
-       throw std::runtime_error( "Invalid value for state" );
-
-     }
-   }
+class ctkDicomSoapState : public QtSoapSimpleType
+{
+
+public:
+
+  ctkDicomSoapState ( const QString & name, ctkDicomAppHosting::State s ):
+      QtSoapSimpleType ( QtSoapQName(name), toStringValue(s) )
+  {}
+
+  static ctkDicomAppHosting::State getState(const QtSoapType& type)
+  {
+    return fromString( type.value().toString() );
+  }
+
+  static ctkDicomAppHosting::State fromString(QString string)
+  {
+    if (string == "IDLE") return ctkDicomAppHosting::IDLE;
+    if (string == "INPROGRESS") return ctkDicomAppHosting::INPROGRESS;
+    if (string == "COMPLETED") return ctkDicomAppHosting::COMPLETED;
+    if (string == "SUSPENDED") return ctkDicomAppHosting::SUSPENDED;
+    if (string == "CANCELED") return ctkDicomAppHosting::CANCELED;
+    if (string == "EXIT") return ctkDicomAppHosting::EXIT;
+    throw std::runtime_error( string.prepend("Invalid STATE:").toStdString() );
+    return ctkDicomAppHosting::EXIT;
+  }
+
+  static QString toStringValue(ctkDicomAppHosting::State state)
+  {
+    switch(state)
+    {
+    case ctkDicomAppHosting::IDLE:
+      return "IDLE";
+    case ctkDicomAppHosting::INPROGRESS:
+      return "INPROGRESS";
+    case ctkDicomAppHosting::COMPLETED:
+      return "COMPLETED";
+    case ctkDicomAppHosting::SUSPENDED:
+      return "SUSPENDED";
+    case ctkDicomAppHosting::CANCELED:
+      return "CANCELED";
+    case ctkDicomAppHosting::EXIT:
+      return "EXIT";
+    default:
+      throw std::runtime_error( "Invalid value for state" );
+
+    }
+  }
 
 
 };
 };
 
 
 
 
-class ctkDicomSoapStatus : public QtSoapStruct{
-    public: 
-    ctkDicomSoapStatus ( const QString & name,
-            const ctkDicomAppHosting::Status& s ):
-       QtSoapStruct ( QtSoapQName(name) ){
-        this->insert(new QtSoapSimpleType(QtSoapQName("StatusType"), 
-                    s.statusType) );
-        this->insert(new QtSoapSimpleType(
-                    QtSoapQName("CodingSchemeDesignator"), 
-                    s.codingSchemeDesignator) );
-        this->insert(new QtSoapSimpleType(
-                    QtSoapQName("CodeValue"), 
-                    s.codeValue) );
-        this->insert(new QtSoapSimpleType(
-                    QtSoapQName("CodeMeaning"), 
-                    s.codeMeaning) );
-    };
-   static ctkDicomAppHosting::Status getStatus(const QtSoapType& type){
-        ctkDicomAppHosting::Status s;
-        
-        s.statusType = static_cast<ctkDicomAppHosting::StatusType>
-            (type["StatusType"].value().toInt());
-        s.codingSchemeDesignator = 
-            type["CodingSchemeDesignator"].value().toString();
-        s.codeValue = 
-            type["CodeValue"].value().toString();
-        s.codeMeaning = 
-            type["CodeMeaning"].value().toString();
-        return s;
-   };
+class ctkDicomSoapStatus : public QtSoapStruct
+{
+
+public:
+
+  ctkDicomSoapStatus ( const QString & name,
+                       const ctkDicomAppHosting::Status& s ):
+  QtSoapStruct ( QtSoapQName(name) )
+  {
+    this->insert(new QtSoapSimpleType(QtSoapQName("StatusType"),
+                                      s.statusType) );
+    this->insert(new QtSoapSimpleType(
+        QtSoapQName("CodingSchemeDesignator"),
+        s.codingSchemeDesignator) );
+    this->insert(new QtSoapSimpleType(
+        QtSoapQName("CodeValue"),
+        s.codeValue) );
+    this->insert(new QtSoapSimpleType(
+        QtSoapQName("CodeMeaning"),
+        s.codeMeaning) );
+  }
+
+  static ctkDicomAppHosting::Status getStatus(const QtSoapType& type)
+  {
+    ctkDicomAppHosting::Status s;
+
+    s.statusType = static_cast<ctkDicomAppHosting::StatusType>
+                   (type["StatusType"].value().toInt());
+    s.codingSchemeDesignator =
+        type["CodingSchemeDesignator"].value().toString();
+    s.codeValue =
+        type["CodeValue"].value().toString();
+    s.codeMeaning =
+        type["CodeMeaning"].value().toString();
+    return s;
+  }
 };
 };
 
 
-class ctkDicomSoapUID : public QtSoapSimpleType{
-    public:
-    ctkDicomSoapUID ( const QString & name, const QString& uid ):
-   QtSoapSimpleType ( QtSoapQName(name), uid ){};
+class ctkDicomSoapUID : public QtSoapSimpleType
+{
+
+public:
+
+  ctkDicomSoapUID ( const QString & name, const QString& uid ):
+      QtSoapSimpleType ( QtSoapQName(name), uid )
+  {}
 
 
-    static QString getUID(const QtSoapType& type){
-        return type.value().toString();
-    };
+  static QString getUID(const QtSoapType& type)
+  {
+    return type.value().toString();
+  }
 };
 };
 
 
-class ctkDicomSoapBool : public QtSoapSimpleType{
-    public:
-    ctkDicomSoapBool ( const QString & name, const bool& boolean ):
-   QtSoapSimpleType ( QtSoapQName(name), boolean ){};
+class ctkDicomSoapBool : public QtSoapSimpleType
+{
+
+public:
+
+  ctkDicomSoapBool ( const QString & name, const bool& boolean ):
+      QtSoapSimpleType ( QtSoapQName(name), boolean )
+  {}
 
 
-    static bool getBool(const QtSoapType& type){
-        return  type.value().toBool();
-    };
+  static bool getBool(const QtSoapType& type)
+  {
+    return  type.value().toBool();
+  }
 
 
 };
 };
 
 
 //Not easy to template, will see later for other types
 //Not easy to template, will see later for other types
-class ctkDicomSoapArrayOfStringType : public QtSoapArray{
-    public:
-    ctkDicomSoapArrayOfStringType ( const QString& typeName,
-                                const QString & name, const QStringList array):
-            QtSoapArray ( QtSoapQName(name),QtSoapType::String,
-                          array.size()){
-
-        for (QStringList::ConstIterator it = array.constBegin();
-                it < array.constEnd(); it++){
-            this->append(new QtSoapSimpleType(QtSoapQName(typeName),*it));
-        }
-    };
-
-    static QStringList* getArray(const QtSoapArray& array){
-        QStringList * list = new QStringList();
-        for (int i = 0; i < array.count() ; i++ ){
-            const QString str = array.at(i).value().toString();
-            list->append( str);
-        }
-        return list;
-    };
+class ctkDicomSoapArrayOfStringType : public QtSoapArray
+{
+
+public:
+
+  ctkDicomSoapArrayOfStringType ( const QString& typeName,
+                                  const QString & name, const QStringList array):
+      QtSoapArray ( QtSoapQName(name),QtSoapType::String, array.size())
+  {
+
+    for (QStringList::ConstIterator it = array.constBegin();
+         it < array.constEnd(); it++)
+    {
+      this->append(new QtSoapSimpleType(QtSoapQName(typeName),*it));
+    }
+  }
+
+  static QStringList* getArray(const QtSoapArray& array)
+  {
+    QStringList * list = new QStringList();
+    for (int i = 0; i < array.count() ; i++ ){
+      const QString str = array.at(i).value().toString();
+      list->append( str);
+    }
+    return list;
+  }
 
 
 };
 };
 
 
-class ctkDicomSoapArrayOfUUIDS : public QtSoapArray{
-    public:
-    ctkDicomSoapArrayOfUUIDS ( const QString & name, const QList<QUuid> &array):
-            QtSoapArray ( QtSoapQName(name),QtSoapType::String,
-                          array.size()){
-
-        for (QList<QUuid>::ConstIterator it = array.constBegin();
-                it < array.constEnd(); it++){
-            this->append(new QtSoapSimpleType(QtSoapQName("UUID"),(*it).toString()));
-        }
-    };
-
-    static QList<QUuid>* getArray(const QtSoapArray& array){
-        QList<QUuid> * list = new QList<QUuid>();
-        for (int i = 0; i < array.count() ; i++ ){
-            const QString str = array.at(i).value().toString();
-            list->append( QUuid(str));
-        }
-        return list;
-    };
+class ctkDicomSoapArrayOfUUIDS : public QtSoapArray
+{
+
+public:
+
+  ctkDicomSoapArrayOfUUIDS ( const QString & name, const QList<QUuid> &array):
+      QtSoapArray ( QtSoapQName(name),QtSoapType::String,
+                    array.size()){
+
+    for (QList<QUuid>::ConstIterator it = array.constBegin();
+         it < array.constEnd(); it++)
+    {
+      this->append(new QtSoapSimpleType(QtSoapQName("UUID"),(*it).toString()));
+    }
+  }
+
+  static QList<QUuid>* getArray(const QtSoapArray& array)
+  {
+    QList<QUuid> * list = new QList<QUuid>();
+    for (int i = 0; i < array.count() ; i++ )
+    {
+      const QString str = array.at(i).value().toString();
+      list->append( QUuid(str));
+    }
+    return list;
+  }
 
 
 };
 };
 
 
-class ctkDicomSoapObjectDescriptor : public QtSoapStruct{
+class ctkDicomSoapObjectDescriptor : public QtSoapStruct
+{
+
 public:
 public:
-    ctkDicomSoapObjectDescriptor ( const QString & name,
-        const ctkDicomAppHosting::ObjectDescriptor& od ):
-    QtSoapStruct ( QtSoapQName(name) ){
-        this->insert(new QtSoapSimpleType(QtSoapQName("DescriptorUUID"),
-                od.descriptorUUID) );
-        this->insert(new QtSoapSimpleType(
-                QtSoapQName("MimeType"),
-                od.mimeType) );
-        this->insert(new QtSoapSimpleType(
-                QtSoapQName("ClassUID"),
-                od.classUID) );
-        this->insert(new QtSoapSimpleType(
-                QtSoapQName("TransferSyntaxUID"),
-                od.transferSyntaxUID) );
-        this->insert(new QtSoapSimpleType(
-                QtSoapQName("Modality"),
-                od.modality) );
-    };
-
-    static ctkDicomAppHosting::ObjectDescriptor getObjectDescriptor(const QtSoapType& type){
-         ctkDicomAppHosting::ObjectDescriptor od;
-
-         od.descriptorUUID = QUuid(type["DescriptorUUID"].value().toString());
-         od.mimeType =
-             type["MimeType"].value().toString();
-         od.classUID =
-             type["ClassUID"].value().toString();
-         od.transferSyntaxUID =
-             type["TransferSyntaxUID"].value().toString();
-         od.modality =
-             type["Modality"].value().toString();
-         return od;
-     };
+
+  ctkDicomSoapObjectDescriptor ( const QString & name,
+                                 const ctkDicomAppHosting::ObjectDescriptor& od ):
+      QtSoapStruct ( QtSoapQName(name) )
+  {
+    this->insert(new QtSoapSimpleType(QtSoapQName("DescriptorUUID"),
+                                      od.descriptorUUID) );
+    this->insert(new QtSoapSimpleType(
+        QtSoapQName("MimeType"),
+        od.mimeType) );
+    this->insert(new QtSoapSimpleType(
+        QtSoapQName("ClassUID"),
+        od.classUID) );
+    this->insert(new QtSoapSimpleType(
+        QtSoapQName("TransferSyntaxUID"),
+        od.transferSyntaxUID) );
+    this->insert(new QtSoapSimpleType(
+        QtSoapQName("Modality"),
+        od.modality) );
+  }
+
+  static ctkDicomAppHosting::ObjectDescriptor getObjectDescriptor(const QtSoapType& type)
+  {
+    ctkDicomAppHosting::ObjectDescriptor od;
+
+    od.descriptorUUID = QUuid(type["DescriptorUUID"].value().toString());
+    od.mimeType =
+        type["MimeType"].value().toString();
+    od.classUID =
+        type["ClassUID"].value().toString();
+    od.transferSyntaxUID =
+        type["TransferSyntaxUID"].value().toString();
+    od.modality =
+        type["Modality"].value().toString();
+    return od;
+  }
 };
 };
 
 
-class ctkDicomSoapSeries : public QtSoapStruct{
-    public:
-        ctkDicomSoapSeries ( const QString & name,
-            const ctkDicomAppHosting::Series& s ):
-        QtSoapStruct ( QtSoapQName(name) ){
-            this->insert(new QtSoapSimpleType(QtSoapQName("SeriesUID"),
-                    s.seriesUID) );
-        QtSoapArray * odescriptors = new QtSoapArray( QtSoapQName("ObjectDescriptors"),QtSoapType::Other,
-                          s.objectDescriptors.size());
-
-        for (QList<ctkDicomAppHosting::ObjectDescriptor>::ConstIterator it = s.objectDescriptors.constBegin();
-                it < s.objectDescriptors.constEnd(); it++){
-            odescriptors->append(new ctkDicomSoapObjectDescriptor("ObjectDescriptor",*it));
-        }
-        this->insert(odescriptors);
-    };
-
-    static ctkDicomAppHosting::Series getSeries(const QtSoapType& type){
-         ctkDicomAppHosting::Series s;
-
-         s.seriesUID = type["SeriesUID"].value().toString();
-         QList<ctkDicomAppHosting::ObjectDescriptor> list;
-         const QtSoapArray& array = static_cast<const QtSoapArray&> (type["ObjectDescriptors"]);
-         for (int i = 0; i < array.count() ; i++ ){
-             const ctkDicomAppHosting::ObjectDescriptor od =
-                     ctkDicomSoapObjectDescriptor::getObjectDescriptor(array.at(i));
-             list.append(od);
-         }
-         s.objectDescriptors = list;
-         return s;
-     };
+class ctkDicomSoapSeries : public QtSoapStruct
+{
+
+public:
+
+  ctkDicomSoapSeries ( const QString & name,
+                       const ctkDicomAppHosting::Series& s ):
+      QtSoapStruct ( QtSoapQName(name) )
+  {
+    this->insert(new QtSoapSimpleType(QtSoapQName("SeriesUID"),
+                                      s.seriesUID) );
+    QtSoapArray * odescriptors = new QtSoapArray( QtSoapQName("ObjectDescriptors"),QtSoapType::Other,
+                                                  s.objectDescriptors.size());
+
+    for (QList<ctkDicomAppHosting::ObjectDescriptor>::ConstIterator it = s.objectDescriptors.constBegin();
+    it < s.objectDescriptors.constEnd(); it++){
+      odescriptors->append(new ctkDicomSoapObjectDescriptor("ObjectDescriptor",*it));
+    }
+    this->insert(odescriptors);
+  }
+
+  static ctkDicomAppHosting::Series getSeries(const QtSoapType& type)
+  {
+    ctkDicomAppHosting::Series s;
+
+    s.seriesUID = type["SeriesUID"].value().toString();
+    QList<ctkDicomAppHosting::ObjectDescriptor> list;
+    const QtSoapArray& array = static_cast<const QtSoapArray&> (type["ObjectDescriptors"]);
+    for (int i = 0; i < array.count() ; i++ ){
+      const ctkDicomAppHosting::ObjectDescriptor od =
+          ctkDicomSoapObjectDescriptor::getObjectDescriptor(array.at(i));
+      list.append(od);
+    }
+    s.objectDescriptors = list;
+    return s;
+  }
 };
 };
 
 
 
 
 
 
-class ctkDicomSoapStudy : public QtSoapStruct{
-    public:
-        ctkDicomSoapStudy ( const QString & name,
-            const ctkDicomAppHosting::Study& s ):
-        QtSoapStruct ( QtSoapQName(name) ){
-            this->insert(new QtSoapSimpleType(QtSoapQName("StudyUID"),
-                    s.studyUID) );
-        QtSoapArray * odescriptors = new QtSoapArray( QtSoapQName("ObjectDescriptors"),QtSoapType::Other,
-                          s.objectDescriptors.size());
-
-        for (QList<ctkDicomAppHosting::ObjectDescriptor>::ConstIterator it = s.objectDescriptors.constBegin();
-                it < s.objectDescriptors.constEnd(); it++){
-            odescriptors->append(new ctkDicomSoapObjectDescriptor("ObjectDescriptor",*it));
-        }
-        this->insert(odescriptors);
-
-        QtSoapArray * series = new QtSoapArray( QtSoapQName("Series"),QtSoapType::Other,
-                          s.series.size());
-
-        for (QList<ctkDicomAppHosting::Series>::ConstIterator it = s.series.constBegin();
-                it < s.series.constEnd(); it++){
-            series->append(new ctkDicomSoapSeries("Series",*it));
-        }
-        this->insert(series);
-    };
-
-    static ctkDicomAppHosting::Study getStudy(const QtSoapType& type){
-         ctkDicomAppHosting::Study s;
-
-         s.studyUID = type["StudyUID"].value().toString();
-         QList<ctkDicomAppHosting::ObjectDescriptor> list;
-         const QtSoapArray& array = static_cast<const QtSoapArray&> (type["ObjectDescriptors"]);
-         for (int i = 0; i < array.count() ; i++ ){
-             const ctkDicomAppHosting::ObjectDescriptor od =
-                     ctkDicomSoapObjectDescriptor::getObjectDescriptor(array.at(i));
-             list.append(od);
-         }
-         s.objectDescriptors = list;
-         QList<ctkDicomAppHosting::Series> listSeries;
-         const QtSoapArray& array2 = static_cast<const QtSoapArray&> (type["Series"]);
-         for (int i = 0; i < array2.count() ; i++ ){
-             const ctkDicomAppHosting::Series series =
-                     ctkDicomSoapSeries::getSeries(array2.at(i));
-             listSeries.append(series);
-         }
-         s.series = listSeries;
-
-         return s;
-     };
+class ctkDicomSoapStudy : public QtSoapStruct
+{
+
+public:
+
+  ctkDicomSoapStudy ( const QString & name,
+                      const ctkDicomAppHosting::Study& s ):
+     QtSoapStruct ( QtSoapQName(name) )
+  {
+    this->insert(new QtSoapSimpleType(QtSoapQName("StudyUID"),
+                                      s.studyUID) );
+    QtSoapArray * odescriptors = new QtSoapArray( QtSoapQName("ObjectDescriptors"),QtSoapType::Other,
+                                                  s.objectDescriptors.size());
+
+    for (QList<ctkDicomAppHosting::ObjectDescriptor>::ConstIterator it = s.objectDescriptors.constBegin();
+    it < s.objectDescriptors.constEnd(); it++){
+      odescriptors->append(new ctkDicomSoapObjectDescriptor("ObjectDescriptor",*it));
+    }
+    this->insert(odescriptors);
+
+    QtSoapArray * series = new QtSoapArray( QtSoapQName("Series"),QtSoapType::Other,
+                                            s.series.size());
+
+    for (QList<ctkDicomAppHosting::Series>::ConstIterator it = s.series.constBegin();
+    it < s.series.constEnd(); it++){
+      series->append(new ctkDicomSoapSeries("Series",*it));
+    }
+    this->insert(series);
+  }
+
+  static ctkDicomAppHosting::Study getStudy(const QtSoapType& type)
+  {
+    ctkDicomAppHosting::Study s;
+
+    s.studyUID = type["StudyUID"].value().toString();
+    QList<ctkDicomAppHosting::ObjectDescriptor> list;
+    const QtSoapArray& array = static_cast<const QtSoapArray&> (type["ObjectDescriptors"]);
+    for (int i = 0; i < array.count() ; i++ ){
+      const ctkDicomAppHosting::ObjectDescriptor od =
+          ctkDicomSoapObjectDescriptor::getObjectDescriptor(array.at(i));
+      list.append(od);
+    }
+    s.objectDescriptors = list;
+    QList<ctkDicomAppHosting::Series> listSeries;
+    const QtSoapArray& array2 = static_cast<const QtSoapArray&> (type["Series"]);
+    for (int i = 0; i < array2.count() ; i++ ){
+      const ctkDicomAppHosting::Series series =
+          ctkDicomSoapSeries::getSeries(array2.at(i));
+      listSeries.append(series);
+    }
+    s.series = listSeries;
+
+    return s;
+  }
 };
 };
 
 
-class ctkDicomSoapPatient : public QtSoapStruct{
-    public:
-        ctkDicomSoapPatient ( const QString & name,
-            const ctkDicomAppHosting::Patient& p ):
-        QtSoapStruct ( QtSoapQName(name) ){
-            this->insert(new QtSoapSimpleType(QtSoapQName("Name"),
-                    p.name) );
-            this->insert(new QtSoapSimpleType(QtSoapQName("ID"),
-                    p.id) );
-            this->insert(new QtSoapSimpleType(QtSoapQName("AssigningAuthority"),
-                    p.assigningAuthority) );
-            this->insert(new QtSoapSimpleType(QtSoapQName("Sex"),
-                    p.sex) );
-            this->insert(new QtSoapSimpleType(QtSoapQName("BirthDate"),
-                    p.birthDate) );
-            QtSoapArray * odescriptors = new QtSoapArray( QtSoapQName("ObjectDescriptors"),QtSoapType::Other,
-                          p.objectDescriptors.size());
-
-            for (QList<ctkDicomAppHosting::ObjectDescriptor>::ConstIterator it = p.objectDescriptors.constBegin();
-                it < p.objectDescriptors.constEnd(); it++){
-                odescriptors->append(new ctkDicomSoapObjectDescriptor("ObjectDescriptor",*it));
-            }
-            this->insert(odescriptors);
-
-            QtSoapArray * study = new QtSoapArray( QtSoapQName("Studies"),QtSoapType::Other,
-                              p.studies.size());
-
-            for (QList<ctkDicomAppHosting::Study>::ConstIterator it = p.studies.constBegin();
-                it < p.studies.constEnd(); it++){
-                study->append(new ctkDicomSoapStudy("Study",*it));
-            }
-            this->insert(study);
-        };
-
-        static ctkDicomAppHosting::Patient getPatient(const QtSoapType& type){
-             ctkDicomAppHosting::Patient p;
-
-             p.name = type["Name"].value().toString();
-             p.id = type["ID"].value().toString();
-             p.assigningAuthority = type["AssigningAuthority"].value().toString();
-             p.sex = type["Sex"].value().toString();
-             p.birthDate = type["Birthdate"].value().toString();
-
-             QList<ctkDicomAppHosting::ObjectDescriptor> list;
-             const QtSoapArray& array = static_cast<const QtSoapArray&> (type["ObjectDescriptors"]);
-             for (int i = 0; i < array.count() ; i++ ){
-                 const ctkDicomAppHosting::ObjectDescriptor od =
-                         ctkDicomSoapObjectDescriptor::getObjectDescriptor(array.at(i));
-                 list.append(od);
-             }
-
-             p.objectDescriptors = list;
-             QList<ctkDicomAppHosting::Study> listPatient;
-             const QtSoapArray& array2 = static_cast<const QtSoapArray&> (type["Studies"]);
-             for (int i = 0; i < array2.count() ; i++ ){
-                 const ctkDicomAppHosting::Study study =
-                         ctkDicomSoapStudy::getStudy(array2.at(i));
-                 listPatient.append(study);
-             }
-
-             p.studies = listPatient;
-             return p;
-        };
+class ctkDicomSoapPatient : public QtSoapStruct
+{
+
+public:
+
+  ctkDicomSoapPatient ( const QString & name,
+                        const ctkDicomAppHosting::Patient& p ):
+      QtSoapStruct ( QtSoapQName(name) )
+  {
+    this->insert(new QtSoapSimpleType(QtSoapQName("Name"),
+                                      p.name) );
+    this->insert(new QtSoapSimpleType(QtSoapQName("ID"),
+                                      p.id) );
+    this->insert(new QtSoapSimpleType(QtSoapQName("AssigningAuthority"),
+                                      p.assigningAuthority) );
+    this->insert(new QtSoapSimpleType(QtSoapQName("Sex"),
+                                      p.sex) );
+    this->insert(new QtSoapSimpleType(QtSoapQName("BirthDate"),
+                                      p.birthDate) );
+    QtSoapArray * odescriptors = new QtSoapArray( QtSoapQName("ObjectDescriptors"),QtSoapType::Other,
+                                                  p.objectDescriptors.size());
+
+    for (QList<ctkDicomAppHosting::ObjectDescriptor>::ConstIterator it = p.objectDescriptors.constBegin();
+    it < p.objectDescriptors.constEnd(); it++){
+      odescriptors->append(new ctkDicomSoapObjectDescriptor("ObjectDescriptor",*it));
+    }
+    this->insert(odescriptors);
+
+    QtSoapArray * study = new QtSoapArray( QtSoapQName("Studies"),QtSoapType::Other,
+                                           p.studies.size());
+
+    for (QList<ctkDicomAppHosting::Study>::ConstIterator it = p.studies.constBegin();
+    it < p.studies.constEnd(); it++){
+      study->append(new ctkDicomSoapStudy("Study",*it));
+    }
+    this->insert(study);
+  }
+
+  static ctkDicomAppHosting::Patient getPatient(const QtSoapType& type)
+  {
+    ctkDicomAppHosting::Patient p;
+
+    p.name = type["Name"].value().toString();
+    p.id = type["ID"].value().toString();
+    p.assigningAuthority = type["AssigningAuthority"].value().toString();
+    p.sex = type["Sex"].value().toString();
+    p.birthDate = type["Birthdate"].value().toString();
+
+    QList<ctkDicomAppHosting::ObjectDescriptor> list;
+    const QtSoapArray& array = static_cast<const QtSoapArray&> (type["ObjectDescriptors"]);
+    for (int i = 0; i < array.count() ; i++ ){
+      const ctkDicomAppHosting::ObjectDescriptor od =
+          ctkDicomSoapObjectDescriptor::getObjectDescriptor(array.at(i));
+      list.append(od);
+    }
+
+    p.objectDescriptors = list;
+    QList<ctkDicomAppHosting::Study> listPatient;
+    const QtSoapArray& array2 = static_cast<const QtSoapArray&> (type["Studies"]);
+    for (int i = 0; i < array2.count() ; i++ ){
+      const ctkDicomAppHosting::Study study =
+          ctkDicomSoapStudy::getStudy(array2.at(i));
+      listPatient.append(study);
+    }
+
+    p.studies = listPatient;
+    return p;
+  }
 };
 };
 
 
 
 
-class ctkDicomSoapAvailableData :public QtSoapStruct {
+class ctkDicomSoapAvailableData :public QtSoapStruct
+{
+
 public:
 public:
-    ctkDicomSoapAvailableData ( const QString & name,
-            const ctkDicomAppHosting::AvailableData& ad ):
-       QtSoapStruct ( QtSoapQName(name) ){
-        QtSoapArray * odescriptors = new QtSoapArray( QtSoapQName("ObjectDescriptors"),QtSoapType::Other,
-                      ad.objectDescriptors.size());
-
-        for (QList<ctkDicomAppHosting::ObjectDescriptor>::ConstIterator it = ad.objectDescriptors.constBegin();
-            it < ad.objectDescriptors.constEnd(); it++){
-            odescriptors->append(new ctkDicomSoapObjectDescriptor("ObjectDescriptor",*it));
-        }
-        this->insert(odescriptors);
-
-        QtSoapArray * patient = new QtSoapArray( QtSoapQName("Patient"),QtSoapType::Other,
-                          ad.patients.size());
-
-        for (QList<ctkDicomAppHosting::Patient>::ConstIterator it = ad.patients.constBegin();
-            it < ad.patients.constEnd(); it++){
-            patient->append(new ctkDicomSoapPatient("Patient",*it));
-        }
-        this->insert(patient);
-    };
-   static ctkDicomAppHosting::AvailableData getAvailableData (const QtSoapType& type){
-        ctkDicomAppHosting::AvailableData ad;
-
-        QList<ctkDicomAppHosting::ObjectDescriptor> list;
-        const QtSoapArray& array = static_cast<const QtSoapArray&> (type["ObjectDescriptors"]);
-        for (int i = 0; i < array.count() ; i++ ){
-            const ctkDicomAppHosting::ObjectDescriptor od =
-                    ctkDicomSoapObjectDescriptor::getObjectDescriptor(array.at(i));
-            list.append(od);
-        }
-        ad.objectDescriptors = list;
-        QList<ctkDicomAppHosting::Patient> listPatients;
-        const QtSoapArray& array2 = static_cast<const QtSoapArray&> (type["Patients"]);
-        for (int i = 0; i < array2.count() ; i++ ){
-            const ctkDicomAppHosting::Patient patient =
-                    ctkDicomSoapPatient::getPatient(array2.at(i));
-            listPatients.append(patient);
-        }
-        ad.patients = listPatients;
-        return ad;
-   };
+
+  ctkDicomSoapAvailableData ( const QString & name,
+                              const ctkDicomAppHosting::AvailableData& ad ):
+      QtSoapStruct ( QtSoapQName(name) )
+  {
+    QtSoapArray * odescriptors = new QtSoapArray( QtSoapQName("ObjectDescriptors"),QtSoapType::Other,
+                                                  ad.objectDescriptors.size());
+
+    for (QList<ctkDicomAppHosting::ObjectDescriptor>::ConstIterator it = ad.objectDescriptors.constBegin();
+    it < ad.objectDescriptors.constEnd(); it++){
+      odescriptors->append(new ctkDicomSoapObjectDescriptor("ObjectDescriptor",*it));
+    }
+    this->insert(odescriptors);
+
+    QtSoapArray * patient = new QtSoapArray( QtSoapQName("Patient"),QtSoapType::Other,
+                                             ad.patients.size());
+
+    for (QList<ctkDicomAppHosting::Patient>::ConstIterator it = ad.patients.constBegin();
+    it < ad.patients.constEnd(); it++){
+      patient->append(new ctkDicomSoapPatient("Patient",*it));
+    }
+    this->insert(patient);
+  }
+
+  static ctkDicomAppHosting::AvailableData getAvailableData (const QtSoapType& type)
+  {
+    ctkDicomAppHosting::AvailableData ad;
+
+    QList<ctkDicomAppHosting::ObjectDescriptor> list;
+    const QtSoapArray& array = static_cast<const QtSoapArray&> (type["ObjectDescriptors"]);
+    for (int i = 0; i < array.count() ; i++ ){
+      const ctkDicomAppHosting::ObjectDescriptor od =
+          ctkDicomSoapObjectDescriptor::getObjectDescriptor(array.at(i));
+      list.append(od);
+    }
+    ad.objectDescriptors = list;
+    QList<ctkDicomAppHosting::Patient> listPatients;
+    const QtSoapArray& array2 = static_cast<const QtSoapArray&> (type["Patients"]);
+    for (int i = 0; i < array2.count() ; i++ ){
+      const ctkDicomAppHosting::Patient patient =
+          ctkDicomSoapPatient::getPatient(array2.at(i));
+      listPatients.append(patient);
+    }
+    ad.patients = listPatients;
+    return ad;
+  }
 };
 };
 
 
-class ctkDicomSoapObjectLocator : public QtSoapStruct{
+class ctkDicomSoapObjectLocator : public QtSoapStruct
+{
+
 public:
 public:
-    ctkDicomSoapObjectLocator ( const QString & name,
-        const ctkDicomAppHosting::ObjectLocator& ol ):
-    QtSoapStruct ( QtSoapQName(name) ){
-        this->insert(new QtSoapSimpleType(QtSoapQName("Locator"),
-                ol.locator) );
-        this->insert(new QtSoapSimpleType(
-                QtSoapQName("Source"),
-                ol.source) );
-        this->insert(new QtSoapSimpleType(
-                QtSoapQName("TransfertSyntax"),
-                ol.transferSyntax) );
-        this->insert(new QtSoapSimpleType(
-                QtSoapQName("Length"),
-                ol.length) );
-        this->insert(new QtSoapSimpleType(
-                QtSoapQName("Offset"),
-                ol.offset) );
-        this->insert(new QtSoapSimpleType(
-                QtSoapQName("URI"),
-                ol.URI) );
-    };
-
-    static ctkDicomAppHosting::ObjectLocator getObjectLocator(const QtSoapType& type){
-         ctkDicomAppHosting::ObjectLocator ol;
-
-         ol.locator = QUuid(type["Locator"].value().toString());
-         ol.source = QUuid(type["Source"].value().toString());
-         ol.transferSyntax =
-             type["TransferSyntax"].value().toString();
-         ol.length =
-             type["Length"].value().toInt();
-         ol.offset =
-             type["Offset"].value().toInt();
-         ol.URI =
-             type["URI"].value().toString();
-         return ol;
-     };
+
+  ctkDicomSoapObjectLocator ( const QString & name,
+                              const ctkDicomAppHosting::ObjectLocator& ol ):
+      QtSoapStruct ( QtSoapQName(name) )
+  {
+    this->insert(new QtSoapSimpleType(QtSoapQName("Locator"),
+                                      ol.locator) );
+    this->insert(new QtSoapSimpleType(
+        QtSoapQName("Source"),
+        ol.source) );
+    this->insert(new QtSoapSimpleType(
+        QtSoapQName("TransfertSyntax"),
+        ol.transferSyntax) );
+    this->insert(new QtSoapSimpleType(
+        QtSoapQName("Length"),
+        ol.length) );
+    this->insert(new QtSoapSimpleType(
+        QtSoapQName("Offset"),
+        ol.offset) );
+    this->insert(new QtSoapSimpleType(
+        QtSoapQName("URI"),
+        ol.URI) );
+  }
+
+  static ctkDicomAppHosting::ObjectLocator getObjectLocator(const QtSoapType& type)
+  {
+    ctkDicomAppHosting::ObjectLocator ol;
+
+    ol.locator = QUuid(type["Locator"].value().toString());
+    ol.source = QUuid(type["Source"].value().toString());
+    ol.transferSyntax =
+        type["TransferSyntax"].value().toString();
+    ol.length =
+        type["Length"].value().toInt();
+    ol.offset =
+        type["Offset"].value().toInt();
+    ol.URI =
+        type["URI"].value().toString();
+    return ol;
+  }
 };
 };
 
 
 
 
-class ctkDicomSoapArrayOfObjectLocators : public QtSoapArray{
-    public:
-    ctkDicomSoapArrayOfObjectLocators ( const QString & name, const QList<ctkDicomAppHosting::ObjectLocator> &array):
-            QtSoapArray ( QtSoapQName(name),QtSoapType::String,
-                          array.size()){
-
-        for (QList<ctkDicomAppHosting::ObjectLocator>::ConstIterator it = array.constBegin();
-                it < array.constEnd(); it++){
-                    this->append(new ctkDicomSoapObjectLocator("objectLocator",(*it)));
-        }
-    };
-
-    static QList<ctkDicomAppHosting::ObjectLocator>* getArray(const QtSoapArray& array){
-        QList<ctkDicomAppHosting::ObjectLocator> * list = new QList<ctkDicomAppHosting::ObjectLocator>();
-
-        for (int i = 0; i < array.count() ; i++ ){
-            const ctkDicomAppHosting::ObjectLocator ol =
-                    ctkDicomSoapObjectLocator::getObjectLocator(array.at(i));
-            list->append(ol);
-        }
-        return list;
-    };
+class ctkDicomSoapArrayOfObjectLocators : public QtSoapArray
+{
+
+public:
+
+  ctkDicomSoapArrayOfObjectLocators ( const QString & name, const QList<ctkDicomAppHosting::ObjectLocator> &array):
+      QtSoapArray ( QtSoapQName(name),QtSoapType::String,
+                    array.size())
+  {
+    for (QList<ctkDicomAppHosting::ObjectLocator>::ConstIterator it = array.constBegin();
+         it < array.constEnd(); it++)
+    {
+      this->append(new ctkDicomSoapObjectLocator("objectLocator",(*it)));
+    }
+  }
+
+  static QList<ctkDicomAppHosting::ObjectLocator>* getArray(const QtSoapArray& array)
+  {
+    QList<ctkDicomAppHosting::ObjectLocator> * list = new QList<ctkDicomAppHosting::ObjectLocator>();
+
+    for (int i = 0; i < array.count() ; i++ )
+    {
+      const ctkDicomAppHosting::ObjectLocator ol =
+          ctkDicomSoapObjectLocator::getObjectLocator(array.at(i));
+      list->append(ol);
+    }
+    return list;
+  }
 
 
 };
 };
 
 

+ 25 - 24
Plugins/org.commontk.dah.core/ctkDicomExchangeService.cpp

@@ -26,43 +26,44 @@
 #include "ctkDicomAppHostingTypesHelper.h"
 #include "ctkDicomAppHostingTypesHelper.h"
 
 
 ctkDicomExchangeService::ctkDicomExchangeService(ushort port, QString path)
 ctkDicomExchangeService::ctkDicomExchangeService(ushort port, QString path)
- : d(new ctkDicomServicePrivate(port, path))
+  : d(new ctkDicomServicePrivate(port, path))
 {
 {
 
 
 }
 }
+
 ctkDicomExchangeService::~ctkDicomExchangeService()
 ctkDicomExchangeService::~ctkDicomExchangeService()
 {
 {
-    delete d;
-    d = NULL;
+  delete d;
+  d = NULL;
 }
 }
 
 
 bool ctkDicomExchangeService::notifyDataAvailable(
 bool ctkDicomExchangeService::notifyDataAvailable(
-        ctkDicomAppHosting::AvailableData data, bool lastData){
-    //Q_D(ctkDicomService);
-    QList<QtSoapType*> list;
-    list << new ctkDicomSoapAvailableData("data", data);
-    list << new ctkDicomSoapBool("lastData", lastData);
-    const QtSoapType & result = d->askHost("notifyDataAvailable",list);
-    return ctkDicomSoapBool::getBool(result);
+    ctkDicomAppHosting::AvailableData data, bool lastData)
+{
+  //Q_D(ctkDicomService);
+  QList<QtSoapType*> list;
+  list << new ctkDicomSoapAvailableData("data", data);
+  list << new ctkDicomSoapBool("lastData", lastData);
+  const QtSoapType & result = d->askHost("notifyDataAvailable",list);
+  return ctkDicomSoapBool::getBool(result);
 }
 }
 
 
-
-
 QList<ctkDicomAppHosting::ObjectLocator>* ctkDicomExchangeService::getData(
 QList<ctkDicomAppHosting::ObjectLocator>* ctkDicomExchangeService::getData(
-        QList<QUuid> objectUUIDs,
-        QList<QString> acceptableTransferSyntaxUIDs, bool includeBulkData){
-
-    //Q_D(ctkDicomService);
-    QList<QtSoapType*> list;
-
-    list << new ctkDicomSoapArrayOfUUIDS("objectUUIDS",objectUUIDs);
-    list << new ctkDicomSoapArrayOfStringType("UID","acceptableTransferSyntaxUIDs", acceptableTransferSyntaxUIDs);
-    list << new ctkDicomSoapBool("includeBulkData", includeBulkData);
-    const QtSoapType & result = d->askHost("getData",list);
-    return ctkDicomSoapArrayOfObjectLocators::getArray(static_cast<const QtSoapArray &>(result));
+    QList<QUuid> objectUUIDs,
+    QList<QString> acceptableTransferSyntaxUIDs, bool includeBulkData)
+{
+  //Q_D(ctkDicomService);
+  QList<QtSoapType*> list;
+
+  list << new ctkDicomSoapArrayOfUUIDS("objectUUIDS",objectUUIDs);
+  list << new ctkDicomSoapArrayOfStringType("UID","acceptableTransferSyntaxUIDs", acceptableTransferSyntaxUIDs);
+  list << new ctkDicomSoapBool("includeBulkData", includeBulkData);
+  const QtSoapType & result = d->askHost("getData",list);
+  return ctkDicomSoapArrayOfObjectLocators::getArray(static_cast<const QtSoapArray &>(result));
 }
 }
 
 
-void ctkDicomExchangeService::releaseData(QList<QUuid> objectUUIDs){
+void ctkDicomExchangeService::releaseData(QList<QUuid> objectUUIDs)
+{
   Q_UNUSED(objectUUIDs)
   Q_UNUSED(objectUUIDs)
 }
 }
 
 

+ 1 - 0
Plugins/org.commontk.dah.core/ctkDicomExchangeService.h

@@ -45,4 +45,5 @@ public:
 protected:
 protected:
   ctkDicomServicePrivate * d;
   ctkDicomServicePrivate * d;
 };
 };
+
 #endif // CTKDICOMEXCHANGESERVICE_H
 #endif // CTKDICOMEXCHANGESERVICE_H

+ 10 - 9
Plugins/org.commontk.dah.core/ctkDicomServicePrivate.cpp

@@ -44,10 +44,11 @@ void ctkDicomServicePrivate::responseReady()
 }
 }
 
 
 const QtSoapType & ctkDicomServicePrivate::askHost(const QString& methodName,
 const QtSoapType & ctkDicomServicePrivate::askHost(const QString& methodName,
-                                                   QtSoapType* soapType ){
-    QList<QtSoapType*> list;
-    list.append(soapType);
-    return askHost(methodName,list);
+                                                   QtSoapType* soapType )
+{
+  QList<QtSoapType*> list;
+  list.append(soapType);
+  return askHost(methodName,list);
 }
 }
 
 
 const QtSoapType & ctkDicomServicePrivate::askHost(const QString& methodName,
 const QtSoapType & ctkDicomServicePrivate::askHost(const QString& methodName,
@@ -64,10 +65,10 @@ const QtSoapType & ctkDicomServicePrivate::askHost(const QString& methodName,
   request.setMethod(QtSoapQName(methodName,"http://wg23.dicom.nema.org/"));
   request.setMethod(QtSoapQName(methodName,"http://wg23.dicom.nema.org/"));
   if( !soapTypes.isEmpty())
   if( !soapTypes.isEmpty())
   {
   {
-      for (QList<QtSoapType*>::ConstIterator it = soapTypes.begin();
-            it < soapTypes.constEnd(); it++){
-        request.addMethodArgument(*it);
-        qDebug() << "  Argument type added " << (*it)->typeName() << ". Argument name is " << (*it)->name().name();;
+    for (QList<QtSoapType*>::ConstIterator it = soapTypes.begin();
+    it < soapTypes.constEnd(); it++){
+      request.addMethodArgument(*it);
+      qDebug() << "  Argument type added " << (*it)->typeName() << ". Argument name is " << (*it)->name().name();;
     }
     }
   }
   }
   qDebug() << request.toXmlString();
   qDebug() << request.toXmlString();
@@ -92,7 +93,7 @@ const QtSoapType & ctkDicomServicePrivate::askHost(const QString& methodName,
     qDebug() << response.faultString().toString().toLatin1().constData() << endl;
     qDebug() << response.faultString().toString().toLatin1().constData() << endl;
     qDebug() << response.toXmlString();
     qDebug() << response.toXmlString();
     return response.returnValue();
     return response.returnValue();
-//    throw std::runtime_error("ctkDicomServicePrivate: server error (response.IsFault())");
+    //    throw std::runtime_error("ctkDicomServicePrivate: server error (response.IsFault())");
   }
   }
 
 
   qDebug() << "Response: " << response.toXmlString();
   qDebug() << "Response: " << response.toXmlString();

+ 16 - 16
Plugins/org.commontk.dah.core/ctkSoapMessageProcessorList.cpp

@@ -23,24 +23,24 @@
 
 
 void ctkSoapMessageProcessorList::push_back( ctkSoapMessageProcessor* processor )
 void ctkSoapMessageProcessorList::push_back( ctkSoapMessageProcessor* processor )
 {
 {
-	processors.push_back( processor );
+  processors.push_back( processor );
 }
 }
 
 
 bool ctkSoapMessageProcessorList::process(
 bool ctkSoapMessageProcessorList::process(
-	const QtSoapMessage& message,
-	QtSoapMessage* reply ) const
+    const QtSoapMessage& message,
+    QtSoapMessage* reply ) const
 {
 {
-  for( std::list<ctkSoapMessageProcessor*>::const_iterator it = processors.begin(); 
-    it != processors.end(); it++)
-	{
-		if( (*it)->process( message, reply ) )
-		{
-			return true;
-		}
-	}
-	// if still here, no processor could process the message
-	reply->setFaultCode( QtSoapMessage::Server );
-    reply->setFaultString( "No processor found to process message." );
-	return false;
+  for(std::list<ctkSoapMessageProcessor*>::const_iterator it = processors.begin();
+      it != processors.end(); it++)
+  {
+    if( (*it)->process( message, reply ) )
+    {
+      return true;
+    }
+  }
+  // if still here, no processor could process the message
+  reply->setFaultCode( QtSoapMessage::Server );
+  reply->setFaultString( "No processor found to process message." );
+  return false;
 }
 }
-		
+

+ 5 - 6
Plugins/org.commontk.dah.core/ctkSoapMessageProcessorList.h

@@ -32,15 +32,14 @@ class org_commontk_dah_core_EXPORT ctkSoapMessageProcessorList : public ctkSoapM
 
 
 public:
 public:
 
 
-	void push_back( ctkSoapMessageProcessor* processor );
+  void push_back( ctkSoapMessageProcessor* processor );
+
+  bool process(const QtSoapMessage& message,
+               QtSoapMessage* reply) const;
 
 
-	bool process(
-		const QtSoapMessage& message,
-		QtSoapMessage* reply) const;
-		
 private:
 private:
 
 
-	std::list<ctkSoapMessageProcessor*> processors;
+  std::list<ctkSoapMessageProcessor*> processors;
 
 
 };
 };
 
 

+ 2 - 2
Plugins/org.commontk.dah.exampleapp/CMakeLists.txt

@@ -3,14 +3,14 @@ PROJECT(org_commontk_dah_exampleapp)
 SET(PLUGIN_export_directive "org_commontk_example_dicomapp_EXPORT")
 SET(PLUGIN_export_directive "org_commontk_example_dicomapp_EXPORT")
 
 
 SET(PLUGIN_SRCS
 SET(PLUGIN_SRCS
-  ctkExampleDicomAppPlugin.cpp
   ctkExampleDicomAppLogic.cpp
   ctkExampleDicomAppLogic.cpp
+  ctkExampleDicomAppPlugin.cpp
 )
 )
 
 
 # Files which should be processed by Qts moc
 # Files which should be processed by Qts moc
 SET(PLUGIN_MOC_SRCS
 SET(PLUGIN_MOC_SRCS
-  ctkExampleDicomAppPlugin_p.h
   ctkExampleDicomAppLogic_p.h
   ctkExampleDicomAppLogic_p.h
+  ctkExampleDicomAppPlugin_p.h
 )
 )
 
 
 # Qt Designer files which should be processed by Qts uic
 # Qt Designer files which should be processed by Qts uic

+ 2 - 2
Plugins/org.commontk.dah.examplehost/CMakeLists.txt

@@ -3,15 +3,15 @@ PROJECT(org_commontk_dah_examplehost)
 SET(PLUGIN_export_directive "org_commontk_dah_examplehost_EXPORT")
 SET(PLUGIN_export_directive "org_commontk_dah_examplehost_EXPORT")
 
 
 SET(PLUGIN_SRCS
 SET(PLUGIN_SRCS
-  ctkExampleDicomHostPlugin.cpp
   ctkExampleDicomHost.cpp
   ctkExampleDicomHost.cpp
+  ctkExampleDicomHostPlugin.cpp
   ctkHostedAppPlaceholderWidget.cpp
   ctkHostedAppPlaceholderWidget.cpp
 )
 )
 
 
 # Files which should be processed by Qts moc
 # Files which should be processed by Qts moc
 SET(PLUGIN_MOC_SRCS
 SET(PLUGIN_MOC_SRCS
-  ctkExampleDicomHostPlugin_p.h
   ctkExampleDicomHost.h
   ctkExampleDicomHost.h
+  ctkExampleDicomHostPlugin_p.h
   ctkHostedAppPlaceholderWidget.h
   ctkHostedAppPlaceholderWidget.h
 )
 )
 
 

+ 57 - 33
Plugins/org.commontk.dah.examplehost/ctkExampleDicomHost.cpp

@@ -1,3 +1,24 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) 2010 German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  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
+
+  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 "ctkExampleDicomHost.h"
 #include "ctkExampleDicomHost.h"
 #include "ctkDicomAppHostingTypesHelper.h"
 #include "ctkDicomAppHostingTypesHelper.h"
 
 
@@ -15,44 +36,47 @@ ctkExampleDicomHost::ctkExampleDicomHost(ctkHostedAppPlaceholderWidget* placehol
   connect(&this->appProcess,SIGNAL(readyReadStandardOutput()),SLOT(forwardConsoleOutput()));
   connect(&this->appProcess,SIGNAL(readyReadStandardOutput()),SLOT(forwardConsoleOutput()));
 }
 }
 
 
-void ctkExampleDicomHost::StartApplication(QString AppPath){
-
-    QStringList l;
-    l.append("--hostURL");
-    l.append(QString("http://localhost:") + QString::number(this->getHostPort()) + "/HostInterface" );
-    l.append("--applicationURL");
-    l.append(QString("http://localhost:") + QString::number(this->getAppPort()) + "/ApplicationInterface" );
-    //by default, the ctkExampleHostedApp uses the org.commontk.dah.exampleapp plugin
-    //l.append("dicomapp"); // the app plugin to use - has to be changed later
-    //if (!QProcess::startDetached (
-    //{
-    //    qCritical() << "application failed to start!";
-    //}
-    //qDebug() << "starting application: " << AppPath << " " << l;
-    qDebug() << "starting application: " << AppPath << " " << l;
-    this->appProcess.setProcessChannelMode(QProcess::MergedChannels);
-    this->appProcess.start(AppPath,l);
+void ctkExampleDicomHost::StartApplication(QString AppPath)
+{
+  QStringList l;
+  l.append("--hostURL");
+  l.append(QString("http://localhost:") + QString::number(this->getHostPort()) + "/HostInterface" );
+  l.append("--applicationURL");
+  l.append(QString("http://localhost:") + QString::number(this->getAppPort()) + "/ApplicationInterface" );
+  //by default, the ctkExampleHostedApp uses the org.commontk.dah.exampleapp plugin
+  //l.append("dicomapp"); // the app plugin to use - has to be changed later
+  //if (!QProcess::startDetached (
+  //{
+  //    qCritical() << "application failed to start!";
+  //}
+  //qDebug() << "starting application: " << AppPath << " " << l;
+  qDebug() << "starting application: " << AppPath << " " << l;
+  this->appProcess.setProcessChannelMode(QProcess::MergedChannels);
+  this->appProcess.start(AppPath,l);
 }
 }
 
 
-QRect ctkExampleDicomHost::getAvailableScreen(const QRect& preferredScreen){
-    qDebug()<< "Application asked for this area:"<< preferredScreen;
+QRect ctkExampleDicomHost::getAvailableScreen(const QRect& preferredScreen)
+{
+  qDebug()<< "Application asked for this area:"<< preferredScreen;
 
 
-    QRect rect (this->placeholderWidget->getAbsolutePosition());
+  QRect rect (this->placeholderWidget->getAbsolutePosition());
 
 
-    emit giveAvailableScreen(rect);
-    return rect;
+  emit giveAvailableScreen(rect);
+  return rect;
 }
 }
 
 
 
 
-void ctkExampleDicomHost::notifyStateChanged(ctkDicomAppHosting::State state){
-    qDebug()<< "new state received:"<< static_cast<int>(state);
-    qDebug()<< "new state received:"<< ctkDicomSoapState::toStringValue(state);
-    emit stateChangedReceived(state);
+void ctkExampleDicomHost::notifyStateChanged(ctkDicomAppHosting::State state)
+{
+  qDebug()<< "new state received:"<< static_cast<int>(state);
+  qDebug()<< "new state received:"<< ctkDicomSoapState::toStringValue(state);
+  emit stateChangedReceived(state);
 }
 }
 
 
-void ctkExampleDicomHost::notifyStatus(const ctkDicomAppHosting::Status& status){
-    qDebug()<< "new status received:"<<status.codeMeaning;
-    emit statusReceived(status);;
+void ctkExampleDicomHost::notifyStatus(const ctkDicomAppHosting::Status& status)
+{
+  qDebug()<< "new status received:"<<status.codeMeaning;
+  emit statusReceived(status);;
 }
 }
 
 
 ctkExampleDicomHost::~ctkExampleDicomHost()
 ctkExampleDicomHost::~ctkExampleDicomHost()
@@ -81,9 +105,9 @@ bool ctkExampleDicomHost::notifyDataAvailable(ctkDicomAppHosting::AvailableData
 }
 }
 
 
 QList<ctkDicomAppHosting::ObjectLocator>* ctkExampleDicomHost::getData(
 QList<ctkDicomAppHosting::ObjectLocator>* ctkExampleDicomHost::getData(
-  QList<QUuid> objectUUIDs, 
-  QList<QString> acceptableTransferSyntaxUIDs, 
-  bool includeBulkData)
+    QList<QUuid> objectUUIDs,
+    QList<QString> acceptableTransferSyntaxUIDs,
+    bool includeBulkData)
 {
 {
   Q_UNUSED(objectUUIDs)
   Q_UNUSED(objectUUIDs)
   Q_UNUSED(acceptableTransferSyntaxUIDs)
   Q_UNUSED(acceptableTransferSyntaxUIDs)
@@ -93,4 +117,4 @@ QList<ctkDicomAppHosting::ObjectLocator>* ctkExampleDicomHost::getData(
 void ctkExampleDicomHost::releaseData(QList<QUuid> objectUUIDs)
 void ctkExampleDicomHost::releaseData(QList<QUuid> objectUUIDs)
 {
 {
   Q_UNUSED(objectUUIDs)
   Q_UNUSED(objectUUIDs)
-}
+  }

+ 53 - 25
Plugins/org.commontk.dah.examplehost/ctkExampleDicomHost.h

@@ -1,3 +1,24 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) 2010 German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  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
+
+  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 CTKEXAMPLEDICOMHOST_H
 #ifndef CTKEXAMPLEDICOMHOST_H
 #define CTKEXAMPLEDICOMHOST_H
 #define CTKEXAMPLEDICOMHOST_H
 
 
@@ -9,39 +30,46 @@
 #include <QUrl>
 #include <QUrl>
 #include <QProcess>
 #include <QProcess>
 
 
-class org_commontk_dah_examplehost_EXPORT ctkExampleDicomHost : public ctkDicomAbstractHost{
-    Q_OBJECT
+class org_commontk_dah_examplehost_EXPORT ctkExampleDicomHost : public ctkDicomAbstractHost
+{
+  Q_OBJECT
+
 public:
 public:
-    ctkExampleDicomHost(ctkHostedAppPlaceholderWidget* placeholderWidget, int hostPort = 8080, int appPort = 8081);
-
-    virtual void StartApplication(QString AppPath);
-    virtual QString generateUID() { return ""; }
-    virtual QRect getAvailableScreen(const QRect& preferredScreen);
-    virtual QString getOutputLocation(const QStringList& /*preferredProtocols*/) { return ""; }
-    virtual void notifyStateChanged(ctkDicomAppHosting::State state);
-    virtual void notifyStatus(const ctkDicomAppHosting::Status& status);
-    // exchange methods
-    virtual bool notifyDataAvailable(ctkDicomAppHosting::AvailableData data, bool lastData);
-    virtual QList<ctkDicomAppHosting::ObjectLocator>* getData(
+
+  ctkExampleDicomHost(ctkHostedAppPlaceholderWidget* placeholderWidget, int hostPort = 8080, int appPort = 8081);
+
+  virtual void StartApplication(QString AppPath);
+  virtual QString generateUID() { return ""; }
+  virtual QRect getAvailableScreen(const QRect& preferredScreen);
+  virtual QString getOutputLocation(const QStringList& /*preferredProtocols*/) { return ""; }
+  virtual void notifyStateChanged(ctkDicomAppHosting::State state);
+  virtual void notifyStatus(const ctkDicomAppHosting::Status& status);
+  // exchange methods
+  virtual bool notifyDataAvailable(ctkDicomAppHosting::AvailableData data, bool lastData);
+  virtual QList<ctkDicomAppHosting::ObjectLocator>* getData(
       QList<QUuid> objectUUIDs, 
       QList<QUuid> objectUUIDs, 
       QList<QString> acceptableTransferSyntaxUIDs, 
       QList<QString> acceptableTransferSyntaxUIDs, 
       bool includeBulkData);
       bool includeBulkData);
-    virtual void releaseData(QList<QUuid> objectUUIDs);
-    
-    const QProcess& getAppProcess() const { return appProcess; }
-    ~ctkExampleDicomHost();
+  virtual void releaseData(QList<QUuid> objectUUIDs);
+
+  const QProcess& getAppProcess() const { return appProcess; }
+  ~ctkExampleDicomHost();
 
 
 signals:
 signals:
-    void stateChangedReceived(ctkDicomAppHosting::State state);
-    void statusReceived(const ctkDicomAppHosting::Status& status);
-    void giveAvailableScreen(QRect rect);
+
+  void stateChangedReceived(ctkDicomAppHosting::State state);
+  void statusReceived(const ctkDicomAppHosting::Status& status);
+  void giveAvailableScreen(QRect rect);
 
 
 protected:
 protected:
-    QProcess appProcess;
-    ctkHostedAppPlaceholderWidget* placeholderWidget;
-    ctkDicomAppHosting::State applicationState;
-  protected slots:
-    void forwardConsoleOutput();
+
+  QProcess appProcess;
+  ctkHostedAppPlaceholderWidget* placeholderWidget;
+  ctkDicomAppHosting::State applicationState;
+
+protected slots:
+
+  void forwardConsoleOutput();
 };
 };
 
 
 #endif // CTKEXAMPLEDICOMHOST_H
 #endif // CTKEXAMPLEDICOMHOST_H

+ 21 - 0
Plugins/org.commontk.dah.examplehost/ctkHostedAppPlaceholderWidget.cpp

@@ -1,3 +1,24 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) 2010 German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  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
+
+  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 "ctkHostedAppPlaceholderWidget.h"
 #include "ctkHostedAppPlaceholderWidget.h"
 
 
 ctkHostedAppPlaceholderWidget::ctkHostedAppPlaceholderWidget(QWidget *parent) :
 ctkHostedAppPlaceholderWidget::ctkHostedAppPlaceholderWidget(QWidget *parent) :

+ 39 - 13
Plugins/org.commontk.dah.examplehost/ctkHostedAppPlaceholderWidget.h

@@ -1,3 +1,24 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) 2010 German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  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
+
+  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 CTKHOSTEDAPPPLACEHOLDERWIDGET_H
 #ifndef CTKHOSTEDAPPPLACEHOLDERWIDGET_H
 #define CTKHOSTEDAPPPLACEHOLDERWIDGET_H
 #define CTKHOSTEDAPPPLACEHOLDERWIDGET_H
 
 
@@ -8,25 +29,30 @@
 class org_commontk_dah_examplehost_EXPORT ctkHostedAppPlaceholderWidget : public QFrame
 class org_commontk_dah_examplehost_EXPORT ctkHostedAppPlaceholderWidget : public QFrame
 {
 {
   Q_OBJECT
   Q_OBJECT
+
 public:
 public:
-    explicit ctkHostedAppPlaceholderWidget(QWidget *parent = 0);
-    QRect getAbsolutePosition()
+
+  explicit ctkHostedAppPlaceholderWidget(QWidget *parent = 0);
+  QRect getAbsolutePosition()
+  {
+    QWidget* current = this;
+    int x = 0;
+    int y = 0;
+    do
     {
     {
-      QWidget* current = this;
-      int x = 0;
-      int y = 0;
-      do
-      {
-        x = x + current->x();
-        y = y + current->y();
-        current = dynamic_cast<QWidget*>(current->parent());
-      } while (current);
-      return QRect(x,y,width(),height());
-    }
+      x = x + current->x();
+      y = y + current->y();
+      current = dynamic_cast<QWidget*>(current->parent());
+    } while (current);
+    return QRect(x,y,width(),height());
+  }
 
 
 signals:
 signals:
+
   void resized();
   void resized();
+
 protected:
 protected:
+
   void resizeEvent(QResizeEvent* /* event */) { emit resized(); }
   void resizeEvent(QResizeEvent* /* event */) { emit resized(); }
 };
 };
 
 

+ 4 - 4
Plugins/org.commontk.dah.host/CMakeLists.txt

@@ -3,18 +3,18 @@ PROJECT(org_commontk_dah_host)
 SET(PLUGIN_export_directive "org_commontk_dah_host_EXPORT")
 SET(PLUGIN_export_directive "org_commontk_dah_host_EXPORT")
 
 
 SET(PLUGIN_SRCS
 SET(PLUGIN_SRCS
+  ctkDicomAbstractHost.cpp
+  ctkDicomAppService.cpp  
+  ctkDicomHostPlugin.cpp  
   ctkDicomHostServer.cpp
   ctkDicomHostServer.cpp
   ctkDicomHostServerPrivate.cpp
   ctkDicomHostServerPrivate.cpp
-  ctkDicomHostPlugin.cpp
-  ctkDicomAbstractHost.cpp
-  ctkDicomAppService.cpp
   ctkHostSoapMessageProcessor.cpp
   ctkHostSoapMessageProcessor.cpp
 )
 )
 
 
 # Files which should be processed by Qts moc
 # Files which should be processed by Qts moc
 SET(PLUGIN_MOC_SRCS
 SET(PLUGIN_MOC_SRCS
-  ctkDicomHostServerPrivate.h
   ctkDicomHostPlugin_p.h
   ctkDicomHostPlugin_p.h
+  ctkDicomHostServerPrivate.h
 )
 )
 
 
 # Qt Designer files which should be processed by Qts uic
 # Qt Designer files which should be processed by Qts uic

+ 24 - 1
Plugins/org.commontk.dah.host/ctkDicomAbstractHost.cpp

@@ -1,10 +1,32 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) 2010 German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  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
+
+  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 "ctkDicomAbstractHost.h"
 #include "ctkDicomAbstractHost.h"
 #include "ctkDicomHostServer.h"
 #include "ctkDicomHostServer.h"
 #include "ctkDicomAppService.h"
 #include "ctkDicomAppService.h"
 
 
 class ctkDicomAbstractHostPrivate
 class ctkDicomAbstractHostPrivate
 {
 {
-  public:
+public:
+
   ctkDicomAbstractHostPrivate(ctkDicomAbstractHost* hostInterface, int hostPort, int appPort) : hostPort(hostPort), appPort(appPort)
   ctkDicomAbstractHostPrivate(ctkDicomAbstractHost* hostInterface, int hostPort, int appPort) : hostPort(hostPort), appPort(appPort)
   {
   {
     // start server
     // start server
@@ -20,6 +42,7 @@ class ctkDicomAbstractHostPrivate
     server = new ctkDicomHostServer(hostInterface,hostPort);
     server = new ctkDicomHostServer(hostInterface,hostPort);
     appService = new ctkDicomAppService(appPort, "/ApplicationInterface");
     appService = new ctkDicomAppService(appPort, "/ApplicationInterface");
   }
   }
+
   ~ctkDicomAbstractHostPrivate()
   ~ctkDicomAbstractHostPrivate()
   {
   {
     delete server;
     delete server;

+ 36 - 11
Plugins/org.commontk.dah.host/ctkDicomAbstractHost.h

@@ -1,3 +1,24 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) 2010 German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  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
+
+  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 CTKDICOMABSTRACTHOST_H
 #ifndef CTKDICOMABSTRACTHOST_H
 #define CTKDICOMABSTRACTHOST_H
 #define CTKDICOMABSTRACTHOST_H
 
 
@@ -20,19 +41,23 @@ class ctkDicomAbstractHostPrivate;
   */
   */
 class org_commontk_dah_host_EXPORT ctkDicomAbstractHost : public ctkDicomHostInterface
 class org_commontk_dah_host_EXPORT ctkDicomAbstractHost : public ctkDicomHostInterface
 {
 {
+
 public:
 public:
-    /**
-      * Start the soap sever on the specified port or choose port automatically.
-      */
-    ctkDicomAbstractHost(int hostPort = 0, int appPort = 0);
-    int getHostPort() const;
-    int getAppPort() const;
-    ~ctkDicomAbstractHost();
-
-    ctkDicomAppInterface* getDicomAppService() const;
+
+  /**
+    * Start the soap sever on the specified port or choose port automatically.
+    */
+  ctkDicomAbstractHost(int hostPort = 0, int appPort = 0);
+  int getHostPort() const;
+  int getAppPort() const;
+  ~ctkDicomAbstractHost();
+
+  ctkDicomAppInterface* getDicomAppService() const;
+
 private:
 private:
-    Q_DECLARE_PRIVATE(ctkDicomAbstractHost)
-    const QScopedPointer<ctkDicomAbstractHostPrivate> d_ptr;
+
+  Q_DECLARE_PRIVATE(ctkDicomAbstractHost)
+  const QScopedPointer<ctkDicomAbstractHostPrivate> d_ptr;
 
 
 };
 };
 
 

+ 0 - 1
Plugins/org.commontk.dah.host/ctkDicomAppService.cpp

@@ -34,7 +34,6 @@ ctkDicomAppService::~ctkDicomAppService()
 {
 {
 }
 }
 
 
-
 ctkDicomAppHosting::State ctkDicomAppService::getState()
 ctkDicomAppHosting::State ctkDicomAppService::getState()
 {
 {
   //Q_D(ctkDicomService);
   //Q_D(ctkDicomService);

+ 4 - 5
Plugins/org.commontk.dah.host/ctkDicomHostServer.h

@@ -23,24 +23,23 @@
 #ifndef CTKDICOMHOSTSERVER_H
 #ifndef CTKDICOMHOSTSERVER_H
 #define CTKDICOMHOSTSERVER_H
 #define CTKDICOMHOSTSERVER_H
 
 
-class ctkDicomHostInterface;
-
 #include <QScopedPointer>
 #include <QScopedPointer>
 
 
+class ctkDicomHostInterface;
 class ctkDicomHostServerPrivate;
 class ctkDicomHostServerPrivate;
 
 
 class ctkDicomHostServer
 class ctkDicomHostServer
 {
 {
 
 
 public:
 public:
+
   ctkDicomHostServer(ctkDicomHostInterface* hostInterface, int port);
   ctkDicomHostServer(ctkDicomHostInterface* hostInterface, int port);
   ~ctkDicomHostServer();
   ~ctkDicomHostServer();
+
 private:
 private:
-  Q_DECLARE_PRIVATE(ctkDicomHostServer)
 
 
+  Q_DECLARE_PRIVATE(ctkDicomHostServer)
   const QScopedPointer<ctkDicomHostServerPrivate> d_ptr;
   const QScopedPointer<ctkDicomHostServerPrivate> d_ptr;
-
-
 };
 };
 
 
 #endif // CTKDICOMHOSTSERVER_H
 #endif // CTKDICOMHOSTSERVER_H