Bladeren bron

CHG: keep track of the state of the hosted application process and display it in GUI

Marco Nolden 15 jaren geleden
bovenliggende
commit
5b6bfcd1e2

+ 12 - 0
Applications/ctkExampleHost/ctkHostAppExampleWidget.cpp

@@ -15,6 +15,7 @@ ctkHostAppExampleWidget::ctkHostAppExampleWidget(QWidget *parent) :
     ui->crashLabel->setVisible(false);
     ui->messageOutput->setVisible(false);
     this->host = new ctkDicomExampleHost();
+
     connect(&this->host->getAppProcess(),SIGNAL(error(QProcess::ProcessError)),SLOT(appProcessError(QProcess::ProcessError)));
     connect(&this->host->getAppProcess(),SIGNAL(stateChanged(QProcess::ProcessState)),SLOT(appProcessStateChanged(QProcess::ProcessState)));
   }
@@ -52,6 +53,17 @@ void ctkHostAppExampleWidget::loadButtonClicked()
       this->ui->applicationPathLabel->setText(QString("<font color='red'>Not executable:</font>").append(this->appFileName));
     }
 }
+
+
+
+
+
+
+
+
+
+
+
 void ctkHostAppExampleWidget::appProcessError(QProcess::ProcessError error)
 {
   if (error == QProcess::Crashed)

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

@@ -13,6 +13,11 @@ void ctkDicomExampleHost::StartApplication(QString AppPath, const QUrl& App_URL)
     l.append(QString("localhost:") + this->getPort() );
     l.append("--applicationURL");
     l.append(App_URL.toString());
+    if (!QProcess::startDetached (
+            AppPath,l))
+    {
+        qCritical() << "application failed to start!";
+    }
 
     this->appProcess.setProcessChannelMode(QProcess::ForwardedChannels);
     this->appProcess.start(AppPath,l);