CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkExampleDicomHost.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  Library: CTK
4 
5  Copyright (c) German Cancer Research Center,
6  Division of Medical and Biological Informatics
7 
8  Licensed under the Apache License, Version 2.0 (the "License");
9  you may not use this file except in compliance with the License.
10  You may obtain a copy of the License at
11 
12  http://www.apache.org/licenses/LICENSE-2.0
13 
14  Unless required by applicable law or agreed to in writing, software
15  distributed under the License is distributed on an "AS IS" BASIS,
16  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  See the License for the specific language governing permissions and
18  limitations under the License.
19 
20 =============================================================================*/
21 
22 #ifndef CTKEXAMPLEDICOMHOST_H
23 #define CTKEXAMPLEDICOMHOST_H
24 
25 // Qt includes
26 #include <QUrl>
27 #include <QProcess>
28 
29 // CTK includes
30 #include <ctkDicomAbstractHost.h>
32 
33 #include <org_commontk_dah_examplehost_Export.h>
34 
35 
36 class org_commontk_dah_examplehost_EXPORT ctkExampleDicomHost : public ctkDicomAbstractHost
37 {
38  Q_OBJECT
39 
40 public:
41 
42  ctkExampleDicomHost(ctkHostedAppPlaceholderWidget* placeholderWidget, int hostPort = 8080, int appPort = 8081);
43  virtual ~ctkExampleDicomHost();
44 
45  virtual void StartApplication(QString AppPath);
46 
51  virtual QString generateUID();
52 
58  virtual QRect getAvailableScreen(const QRect& preferredScreen);
59 
65  virtual QString getOutputLocation(const QStringList& preferredProtocols);
66 
71  virtual void notifyStatus(const ctkDicomAppHosting::Status& status);
72 
74 
75  const QProcess& getAppProcess() const { return this->AppProcess; }
76  void exitApplication();
77 
78  QByteArray processReadAll(){return this->AppProcess.readAllStandardOutput ();}
79 
80  void exitApplicationBlocking(int timeout = 2000);
81 
82 public Q_SLOTS:
83  void onAppReady();
84  void onReleaseAvailableResources();
85  void onStartProgress();
86  void onResumed();
87  void onCompleted();
88  void onSuspended();
89  void onCanceled();
90  void onExited();
91 
92 Q_SIGNALS:
93 
94 
95  void giveAvailableScreen(QRect rect);
96 
97 protected:
99 
100 protected slots:
101  void onBlockingExiting(QProcess::ProcessState);
102  void onBlockingExiting();
103 
104 protected:
105 
106  QProcess AppProcess;
108 private:
109  bool exitingApplication;
110 };
111 
112 #endif // CTKEXAMPLEDICOMHOST_H
ctkDicomAbstractHost.h
ctkDicomAppHosting::State
State
Definition: ctkDicomAppHostingTypes.h:45
ctkExampleDicomHost::processReadAll
QByteArray processReadAll()
Definition: ctkExampleDicomHost.h:78
ctkDicomHostInterface::getAvailableScreen
virtual QRect getAvailableScreen(const QRect &preferredScreen)=0
ctkHostedAppPlaceholderWidget.h
ctkExampleDicomHost::getAppProcess
const QProcess & getAppProcess() const
Definition: ctkExampleDicomHost.h:75
ctkExampleDicomHost::BlockingLoopForExiting
QEventLoop BlockingLoopForExiting
Definition: ctkExampleDicomHost.h:98
ctkDicomAbstractHost
Provides a basic implementation for an application host.
Definition: ctkDicomAbstractHost.h:49
ctkHostedAppPlaceholderWidget
Definition: ctkHostedAppPlaceholderWidget.h:31
ctkDicomAppHosting::Status
Definition: ctkDicomAppHostingTypes.h:63
ctkDicomHostInterface::getOutputLocation
virtual QString getOutputLocation(const QStringList &preferredProtocols)=0
ctkDicomHostInterface::notifyStatus
virtual void notifyStatus(const ctkDicomAppHosting::Status &status)=0
ctkExampleDicomHost::AppProcess
QProcess AppProcess
Definition: ctkExampleDicomHost.h:106
ctkExampleDicomHost::PlaceholderWidget
ctkHostedAppPlaceholderWidget * PlaceholderWidget
Definition: ctkExampleDicomHost.h:107
ctkExampleDicomHost
Definition: ctkExampleDicomHost.h:36
ctkDicomHostInterface::generateUID
virtual QString generateUID()=0
ctkDicomAbstractHost::getApplicationState
ctkDicomAppHosting::State getApplicationState() const
Gets the internal representation of the application state. Does not call the client....