Explorar o código

merged with upstream

Benoit Bleuze %!s(int64=14) %!d(string=hai) anos
pai
achega
a403bf13a8

+ 29 - 5
Applications/ctkExampleHost/ctkHostAppExampleWidget.cpp

@@ -74,6 +74,7 @@ void ctkHostAppExampleWidget::runButtonClicked()
 void ctkHostAppExampleWidget::stopButtonClicked()
 {
   qDebug() << "stop button clicked";
+  host->getDicomAppService ()->setState (ctkDicomAppHosting::SUSPENDED);
 }
 
 void ctkHostAppExampleWidget::loadButtonClicked()
@@ -140,10 +141,24 @@ void ctkHostAppExampleWidget::placeholderResized()
 void ctkHostAppExampleWidget::appStateChanged(ctkDicomAppHosting::State state)
 {
   ui->statusLabel->setText(ctkDicomSoapState::toStringValue(state));
-  if (state == ctkDicomAppHosting::INPROGRESS)
+
+  bool reply;
+  ctkDicomAppHosting::ObjectDescriptor ourObjectDescriptor;
+  QList<ctkDicomAppHosting::Study> studies;
+  ctkDicomAppHosting::AvailableData data;
+  ctkDicomAppHosting::Patient patient;
+
+  //TODO put the state changed routine back in notifyStateChanged for the state machine part.
+  switch (state)
   {
-    ctkDicomAppHosting::AvailableData data;
-    ctkDicomAppHosting::Patient patient;
+  case ctkDicomAppHosting::IDLE:
+    //if (host->appInprogress)
+    //{
+      host->getDicomAppService()->setState (ctkDicomAppHosting::EXIT);
+    //}
+    break;
+  case ctkDicomAppHosting::INPROGRESS:
+
     patient.name = "John Doe";
     patient.id = "0000";
     patient.assigningAuthority = "authority";
@@ -151,7 +166,8 @@ void ctkHostAppExampleWidget::appStateChanged(ctkDicomAppHosting::State state)
     patient.birthDate = "today";
     patient.objectDescriptors = QList<ctkDicomAppHosting::ObjectDescriptor>();
 
-    ctkDicomAppHosting::ObjectDescriptor ourObjectDescriptor;
+    patient.studies = studies;
+
     ourObjectDescriptor.descriptorUUID = QUuid("{11111111-1111-1111-1111-111111111111}");
     ourObjectDescriptor.mimeType = "text/plain";
     ourObjectDescriptor.classUID = "lovelyClass";
@@ -163,7 +179,15 @@ void ctkHostAppExampleWidget::appStateChanged(ctkDicomAppHosting::State state)
     data.patients = QList<ctkDicomAppHosting::Patient>();
     data.patients.append (patient);
 
-    bool reply = host->getDicomAppService()->notifyDataAvailable (data,true);
+    reply = host->getDicomAppService()->notifyDataAvailable (data,true);
     qDebug() << "  notifyDataAvailable(1111) returned: " << reply;
+    break;
+  case ctkDicomAppHosting::COMPLETED:
+  case ctkDicomAppHosting::SUSPENDED:
+  case ctkDicomAppHosting::CANCELED:
+  case ctkDicomAppHosting::EXIT:
+  default:
+    //do nothing
+    break;
   }
 }

+ 1 - 0
Plugins/org.commontk.dah.core/ctkExchangeSoapMessageProcessor.cpp

@@ -63,6 +63,7 @@ void ctkExchangeSoapMessageProcessor::processNotifyDataAvailable(
 {
   // extract arguments from input message
   const QtSoapType& inputType = message.method()[0];//"availableData"];
+  const QtSoapType& inputType = message.method()[0];
   if(inputType.isValid()==false)
   {
     qCritical() << "  NotifyDataAvailable: availableData not valid. " << inputType.errorString();

+ 3 - 2
Plugins/org.commontk.dah.examplehost/ctkExampleDicomHost.h

@@ -47,8 +47,8 @@ public:
   // exchange methods
   virtual bool notifyDataAvailable(ctkDicomAppHosting::AvailableData data, bool lastData);
   virtual QList<ctkDicomAppHosting::ObjectLocator> getData(
-      QList<QUuid> objectUUIDs, 
-      QList<QString> acceptableTransferSyntaxUIDs, 
+      QList<QUuid> objectUUIDs,
+      QList<QString> acceptableTransferSyntaxUIDs,
       bool includeBulkData);
   virtual void releaseData(QList<QUuid> objectUUIDs);
 
@@ -67,6 +67,7 @@ protected:
   ctkHostedAppPlaceholderWidget* placeholderWidget;
   ctkDicomAppHosting::State applicationState;
 
+
 protected slots:
 
   void forwardConsoleOutput();