ctkDicomExampleHost.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include "ctkDicomExampleHost.h"
  2. #include <QProcess>
  3. #include <QtDebug>
  4. ctkDicomExampleHost::ctkDicomExampleHost(QWidget* placeholderWidget, int hostPort, int appPort) : placeholderWidget(placeholderWidget),ctkDicomAbstractHost(hostPort, appPort)
  5. {
  6. }
  7. void ctkDicomExampleHost::StartApplication(QString AppPath){
  8. QStringList l;
  9. l.append("--hostURL");
  10. l.append(QString("http://localhost:") + QString::number(this->getHostPort()) );
  11. l.append("--applicationURL");
  12. l.append(QString("http://localhost:") + QString::number(this->getAppPort()));
  13. l.append("dicomapp"); // the app plugin to use - has to be changed later
  14. if (!QProcess::startDetached (
  15. AppPath,l))
  16. {
  17. qCritical() << "application failed to start!";
  18. }
  19. qDebug() << "starting application: " << AppPath << " " << l;
  20. this->appProcess.start(AppPath,l);
  21. }
  22. QRect ctkDicomExampleHost::getAvailableScreen(const QRect& preferredScreen){
  23. qDebug()<< "set screen from preferredScreen:"<< preferredScreen;
  24. QRect rect (preferredScreen);
  25. emit giveAvailableScreen(rect);
  26. return rect;
  27. }
  28. void ctkDicomExampleHost::notifyStateChanged(ctkDicomWG23::State state){
  29. qDebug()<< "new state received:"<< static_cast<int>(state);
  30. emit stateChangedReceived(state);
  31. }
  32. void ctkDicomExampleHost::notifyStatus(const ctkDicomWG23::Status& status){
  33. qDebug()<< "new status received:"<<status.codeMeaning;
  34. emit statusReceived(status);;
  35. }
  36. ctkDicomExampleHost::~ctkDicomExampleHost()
  37. {
  38. this->appProcess.terminate();
  39. }