Browse Source

ENH: dah runs an app from exampleHost

Benoît Bleuzé 14 years ago
parent
commit
a428a42ed6

+ 4 - 0
Plugins/org.commontk.dicom.examplehost/CMakeLists.txt

@@ -20,12 +20,16 @@ SET(PLUGIN_UI_FORMS
 SET(PLUGIN_resources
 )
 
+# Additional directories to include - Note that CTK_INCLUDE_LIBRARIES is already included
+SET(PLUGIN_include_directories
+)
 #Compute the plugin dependencies
 ctkMacroGetTargetLibraries(PLUGIN_target_libraries)
 
 ctkMacroBuildPlugin(
   NAME ${PROJECT_NAME}
   EXPORT_DIRECTIVE ${PLUGIN_export_directive}
+  INCLUDE_DIRECTORIES ${PLUGIN_include_directories}
   SRCS ${PLUGIN_SRCS}
   MOC_SRCS ${PLUGIN_MOC_SRCS}
   UI_FORMS ${PLUGIN_UI_FORMS}

+ 23 - 0
Plugins/org.commontk.dicom.examplehost/ctkDicomExampleHost.cpp

@@ -1,5 +1,28 @@
 #include "ctkDicomExampleHost.h"
+#include <QProcess>
+#include <QtDebug>
 
 ctkDicomExampleHost::ctkDicomExampleHost() : ctkDicomAbstractHost(8080)
 {
 }
+
+int ctkDicomExampleHost::StartApplication(QString AppPath, QString App_URL, int port){
+    QStringList l;
+    l.append("--hostURL");
+    l.append("localhost:"+this->getPort());
+    l.append("--applicationURL");
+    l.append(App_URL+":"+QString(port));
+    if (!QProcess::startDetached (
+            AppPath,l))
+    {
+        qCritical() << "application failed to start!";
+    }
+}
+
+void ctkDicomExampleHost::notifyStateChanged(ctkDicomWG23::State state){
+
+}
+
+void ctkDicomExampleHost::notifyStatus(const ctkDicomWG23::Status& status){
+
+}

+ 3 - 2
Plugins/org.commontk.dicom.examplehost/ctkDicomExampleHost.h

@@ -9,11 +9,12 @@ class org_commontk_dicom_examplehost_EXPORT ctkDicomExampleHost : public ctkDico
 public:
     ctkDicomExampleHost();
 
+    virtual int StartApplication(QString AppPath, QString App_URL, int port);
     virtual QString generateUID() { return ""; }
     virtual QRect getAvailableScreen(const QRect& preferredScreen) { return QRect(); }
     virtual QString getOutputLocation(const QStringList& preferredProtocols) { return ""; }
-    virtual void notifyStateChanged(ctkDicomWG23::State state) {}
-    virtual void notifyStatus(const ctkDicomWG23::Status& status) {}
+    virtual void notifyStateChanged(ctkDicomWG23::State state);
+    virtual void notifyStatus(const ctkDicomWG23::Status& status);
 
 };
 

+ 0 - 13
Plugins/org.commontk.dicom.wg23.host/ctkDicomHostServer.cpp

@@ -30,17 +30,4 @@ ctkDicomHostServer::ctkDicomHostServer(ctkDicomHostInterface* hostInterface, int
 }
 ctkDicomHostServer::~ctkDicomHostServer()
 {
-
-int ctkDicomHostServer::StartApplication(QString AppPath, QString App_URL, int port){
-    QStringList l;
-    l.append("--hostURL");
-    l.append("localhost:"+d_ptr->port);
-    l.append("--applicationURL");
-    l.append(App_URL+":"+QString(port));
-    if (!QProcess::startDetached (
-            AppPath,l))
-    {
-        qCritical()<<"application failed to start!";
-    }
-
 }