浏览代码

ENH: dah adds app Services and CHG hostServicePrivate

Benoît Bleuzé 14 年之前
父节点
当前提交
db6c9117b9

+ 0 - 2
Plugins/org.commontk.dicom.wg23.app/CMakeLists.txt

@@ -13,14 +13,12 @@ SET(PLUGIN_SRCS
   ctkDicomWG23AppPlugin.cpp
   ctkDicomAbstractApp.cpp
   ctkDicomHostService.cpp
-  ctkDicomHostServicePrivate.cpp
 )
 
 # Files which should be processed by Qts moc
 SET(PLUGIN_MOC_SRCS
   ctkDicomAppServerPrivate.h
   ctkDicomWG23AppPlugin_p.h
-  ctkDicomHostServicePrivate.h
 )
 
 # Qt Designer files which should be processed by Qts uic

+ 6 - 6
Plugins/org.commontk.dicom.wg23.app/ctkDicomHostService.cpp

@@ -21,12 +21,12 @@
 
 #include "ctkDicomHostService.h"
 
-#include "ctkDicomHostServicePrivate.h"
+#include "ctkDicomServicePrivate.h"
 
 #include "ctkDicomWG23TypesHelper.h"
 
 ctkDicomHostService::ctkDicomHostService(int port)
-  : d_ptr(new ctkDicomHostServicePrivate(port))
+  : d_ptr(new ctkDicomServicePrivate(port))
 {
 
 }
@@ -36,7 +36,7 @@ ctkDicomHostService::~ctkDicomHostService()
 
 QString ctkDicomHostService::generateUID()
 {
-  Q_D(ctkDicomHostService);
+  Q_D(ctkDicomService);
 
   const QtSoapType& result = d->askHost("generateUID", NULL);
   QString resultUID = ctkDicomSoapUID::getUID(result);
@@ -53,7 +53,7 @@ QString ctkDicomHostService::getOutputLocation(const QStringList& preferredProto
 
 QRect ctkDicomHostService::getAvailableScreen(const QRect& preferredScreen)
 {
-  Q_D(ctkDicomHostService);
+  Q_D(ctkDicomService);
 
   QtSoapStruct* input = new ctkDicomSoapRectangle("preferredScreen", preferredScreen);
   const QtSoapType& result = d->askHost("getAvailableScreen", input);
@@ -64,14 +64,14 @@ QRect ctkDicomHostService::getAvailableScreen(const QRect& preferredScreen)
 
 void ctkDicomHostService::notifyStateChanged(ctkDicomWG23::State state)
 {
-  Q_D(ctkDicomHostService);
+  Q_D(ctkDicomService);
   QtSoapType* input = new ctkDicomSoapState("stateChanged", state);
   d->askHost("notifyStateChanged", input);
 }
 
 void ctkDicomHostService::notifyStatus(const ctkDicomWG23::Status& status)
 {
-  Q_D(ctkDicomHostService);
+  Q_D(ctkDicomService);
   QtSoapStruct* input = new ctkDicomSoapStatus("status", status);
   d->askHost("notifyStatus", input);
 }

+ 3 - 3
Plugins/org.commontk.dicom.wg23.app/ctkDicomHostService.h

@@ -27,7 +27,7 @@
 #include <QScopedPointer>
 #include <org_commontk_dicom_wg23_app_Export.h>
 
-class ctkDicomHostServicePrivate;
+class ctkDicomServicePrivate;
 
 class org_commontk_dicom_wg23_app_EXPORT ctkDicomHostService : public ctkDicomHostInterface
 {
@@ -43,9 +43,9 @@ public:
   void notifyStatus(const ctkDicomWG23::Status& status);
 
 private:
-  Q_DECLARE_PRIVATE(ctkDicomHostService)
+  Q_DECLARE_PRIVATE(ctkDicomService)
 
-  const QScopedPointer<ctkDicomHostServicePrivate> d_ptr;
+  const QScopedPointer<ctkDicomServicePrivate> d_ptr;
 };
 
 #endif // CTKDICOMHOSTSERVICE_H

+ 2 - 1
Plugins/org.commontk.dicom.wg23.core/CMakeLists.txt

@@ -19,6 +19,7 @@ SET(PLUGIN_SRCS
   ctkDicomWG23CorePlugin.cpp
   ctkSimpleSoapServer.cpp
   ctkSoapConnectionRunnable.cpp
+  ctkDicomServicePrivate.cpp
   ctkDicomWG23Types.h
   ctkDicomWG23TypesHelper.h
 )
@@ -29,7 +30,7 @@ SET(PLUGIN_MOC_SRCS
   ctkDicomAppInterface.h
   ctkDicomExchangeInterface.h
   ctkDicomHostInterface.h
-
+  ctkDicomServicePrivate.h
   ctkDicomWG23CorePlugin_p.h
   ctkSimpleSoapServer.h
   ctkSoapConnectionRunnable_p.h

+ 4 - 4
Plugins/org.commontk.dicom.wg23.app/ctkDicomHostServicePrivate.cpp

@@ -19,7 +19,7 @@
 
 =============================================================================*/
 
-#include "ctkDicomHostServicePrivate.h"
+#include "ctkDicomServicePrivate.h"
 #include "ctkDicomWG23TypesHelper.h"
 
 #include <QApplication>
@@ -28,19 +28,19 @@
 
 #include <stdexcept>
 
-ctkDicomHostServicePrivate::ctkDicomHostServicePrivate(int port)
+ctkDicomServicePrivate::ctkDicomServicePrivate(int port)
 {
   connect(&http, SIGNAL(responseReady()), this, SLOT(responseReady()));
 
   http.setHost("127.0.0.1", false, port);
 }
 
-void ctkDicomHostServicePrivate::responseReady()
+void ctkDicomServicePrivate::responseReady()
 {
   blockingLoop.exit();
 }
 
-QtSoapType ctkDicomHostServicePrivate::askHost(const QString& methodName, QtSoapType* soapType )
+QtSoapType ctkDicomServicePrivate::askHost(const QString& methodName, QtSoapType* soapType )
 {
   http.setAction(methodName);
 

+ 6 - 5
Plugins/org.commontk.dicom.wg23.app/ctkDicomHostServicePrivate.h

@@ -19,20 +19,21 @@
 
 =============================================================================*/
 
-#ifndef CTKDICOMHOSTSERVICEPRIVATE_H
-#define CTKDICOMHOSTSERVICEPRIVATE_H
+#ifndef CTKDICOMSERVICEPRIVATE_H
+#define CTKDICOMSERVICEPRIVATE_H
 
 #include <ctkDicomWG23Types.h>
 
 #include <QEventLoop>
 #include <QtSoapHttpTransport>
+#include <org_commontk_dicom_wg23_core_Export.h>
 
-class ctkDicomHostServicePrivate : public QObject
+class org_commontk_dicom_wg23_core_EXPORT ctkDicomServicePrivate : public QObject
 {
   Q_OBJECT
 
 public:
-  ctkDicomHostServicePrivate(int port);
+  ctkDicomServicePrivate(int port);
 
   QtSoapType askHost(const QString& methodName, QtSoapType* soapStruct);
     
@@ -46,4 +47,4 @@ private slots:
   void responseReady();
 };
 
-#endif // CTKDICOMHOSTSERVICEPRIVATE_H
+#endif // CTKDICOMSERVICEPRIVATE_H

+ 15 - 4
Plugins/org.commontk.dicom.wg23.core/ctkDicomWG23TypesHelper.h

@@ -26,6 +26,7 @@
 #include <QtSoapStruct>
 #include <QtSoapQName>
 #include <QRect>
+#include <ctkDicomWG23Types.h>
 
 class ctkDicomSoapRectangle :public QtSoapStruct {
     public: 
@@ -93,14 +94,24 @@ class ctkDicomSoapStatus : public QtSoapStruct{
 };
 
 class ctkDicomSoapUID : public QtSoapSimpleType{
-public:
-ctkDicomSoapUID ( const QString & name, const QString& uid ):
+    public:
+    ctkDicomSoapUID ( const QString & name, const QString& uid ):
    QtSoapSimpleType ( QtSoapQName(name), uid ){};
 
-static QString getUID(const QtSoapType& type){
-	return static_cast<QString> (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 ){};
+
+    static bool getBool(const QtSoapType& type){
+        return  type.value().toBool();
+    };
+
 };
 
 

+ 1 - 0
Plugins/org.commontk.dicom.wg23.host/CMakeLists.txt

@@ -7,6 +7,7 @@ SET(PLUGIN_SRCS
   ctkDicomHostServerPrivate.cpp
   ctkDicomWG23HostPlugin.cpp
   ctkDicomAbstractHost.cpp
+  ctkDicomAppService.cpp
 )
 
 # Files which should be processed by Qts moc

+ 60 - 0
Plugins/org.commontk.dicom.wg23.host/ctkDicomAppService.cpp

@@ -0,0 +1,60 @@
+/*=============================================================================
+
+  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 "ctkDicomAppService.h"
+
+#include "ctkDicomServicePrivate.h"
+
+#include "ctkDicomWG23TypesHelper.h"
+
+ctkDicomAppService::ctkDicomAppService(int port)
+  : d_ptr(new ctkDicomServicePrivate(port))
+{
+
+}
+ctkDicomAppService::~ctkDicomAppService()
+{
+}
+
+
+ctkDicomWG23::State ctkDicomAppService::getState()
+{
+  Q_D(ctkDicomService);
+
+  QtSoapType result = d->askHost("getState", NULL);
+  return ctkDicomSoapState::getState(result);
+}
+
+bool ctkDicomAppService::setState(ctkDicomWG23::State newState)
+{
+  Q_D(ctkDicomService);
+  QtSoapType* input = new ctkDicomSoapState("state", newState);
+  QtSoapType result = d->askHost("setState", input);
+  return ctkDicomSoapBool::getBool(result);
+}
+
+bool ctkDicomAppService::bringToFront(const QRect& requestedScreenArea)
+{
+    Q_D(ctkDicomService);
+    QtSoapType* input = new ctkDicomSoapRectangle("requestedScreenArea", requestedScreenArea);
+    QtSoapType result = d->askHost("bringToFront", input);
+    return ctkDicomSoapBool::getBool(result);
+}

+ 49 - 0
Plugins/org.commontk.dicom.wg23.host/ctkDicomAppService.h

@@ -0,0 +1,49 @@
+/*=============================================================================
+
+  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 CTKDICOMHOSTSERVICE_H
+#define CTKDICOMHOSTSERVICE_H
+
+#include <ctkDicomAppInterface.h>
+#include <QScopedPointer>
+#include <org_commontk_dicom_wg23_host_Export.h>
+
+class ctkDicomServicePrivate;
+
+class org_commontk_dicom_wg23_host_EXPORT ctkDicomAppService : public ctkDicomAppInterface
+{
+
+public:
+  ctkDicomAppService(int port);
+  ~ctkDicomAppService();
+
+  ctkDicomWG23::State getState();
+  bool setState(ctkDicomWG23::State newState);
+  bool bringToFront(const QRect& requestedScreenArea);
+
+private:
+  Q_DECLARE_PRIVATE(ctkDicomService)
+
+  const QScopedPointer<ctkDicomServicePrivate> d_ptr;
+};
+
+#endif // CTKDICOMHOSTSERVICE_H