ctkExampleDicomHost.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #ifndef CTKEXAMPLEDICOMHOST_H
  16. #define CTKEXAMPLEDICOMHOST_H
  17. // Qt includes
  18. #include <QUrl>
  19. #include <QProcess>
  20. // CTK includes
  21. #include <ctkDicomAbstractHost.h>
  22. #include <ctkHostedAppPlaceholderWidget.h>
  23. #include <org_commontk_dah_examplehost_Export.h>
  24. class org_commontk_dah_examplehost_EXPORT ctkExampleDicomHost : public ctkDicomAbstractHost
  25. {
  26. Q_OBJECT
  27. public:
  28. ctkExampleDicomHost(ctkHostedAppPlaceholderWidget* placeholderWidget, int hostPort = 8080, int appPort = 8081);
  29. virtual ~ctkExampleDicomHost();
  30. ctkDicomAppHosting::State getApplicationState() const;
  31. virtual void StartApplication(QString AppPath);
  32. virtual QString generateUID() { return ""; }
  33. virtual QRect getAvailableScreen(const QRect& preferredScreen);
  34. virtual QString getOutputLocation(const QStringList& /*preferredProtocols*/) { return ""; }
  35. virtual void notifyStatus(const ctkDicomAppHosting::Status& status);
  36. // exchange methods
  37. virtual bool notifyDataAvailable(const ctkDicomAppHosting::AvailableData& data, bool lastData);
  38. virtual void releaseData(const QList<QUuid>& objectUUIDs);
  39. const QProcess& getAppProcess() const { return this->AppProcess; }
  40. void exitApplication();
  41. QByteArray processReadAll(){return this->AppProcess.readAllStandardOutput ();}
  42. public Q_SLOTS:
  43. void onAppReady();
  44. void onReleaseAvailableResources();
  45. void onStartProgress();
  46. void onResumed();
  47. void onCompleted();
  48. void onSuspended();
  49. void onCanceled();
  50. void onExited();
  51. Q_SIGNALS:
  52. void giveAvailableScreen(QRect rect);
  53. protected:
  54. QProcess AppProcess;
  55. ctkHostedAppPlaceholderWidget* PlaceholderWidget;
  56. private:
  57. bool exitingApplication;
  58. };
  59. #endif // CTKEXAMPLEDICOMHOST_H