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);
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; }
77 
78  QByteArray processReadAll(){return this->AppProcess.readAllStandardOutput ();}
79 
80  void exitApplicationBlocking(int timeout = 2000);
81 
82 public Q_SLOTS:
83  void onAppReady();
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);
103 
104 protected:
105 
106  QProcess AppProcess;
108 private:
109  bool exitingApplication;
110 };
111 
112 #endif // CTKEXAMPLEDICOMHOST_H
Provides a basic implementation for an application host.
ctkDicomAppHosting::State getApplicationState() const
virtual QString getOutputLocation(const QStringList &preferredProtocols)
const QProcess & getAppProcess() const
virtual void StartApplication(QString AppPath)
void onBlockingExiting(QProcess::ProcessState)
ctkHostedAppPlaceholderWidget * PlaceholderWidget
void exitApplicationBlocking(int timeout=2000)
ctkExampleDicomHost(ctkHostedAppPlaceholderWidget *placeholderWidget, int hostPort=8080, int appPort=8081)
virtual QRect getAvailableScreen(const QRect &preferredScreen)
virtual ~ctkExampleDicomHost()
virtual void notifyStatus(const ctkDicomAppHosting::Status &status)
void onReleaseAvailableResources()
QEventLoop BlockingLoopForExiting
void giveAvailableScreen(QRect rect)
virtual QString generateUID()