浏览代码

ENH: added run button to ask app to switch to INPROGRESS state

ivowolf 15 年之前
父节点
当前提交
8e40500247

+ 11 - 0
Applications/ctkExampleHost/ctkHostAppExampleWidget.cpp

@@ -1,6 +1,7 @@
 #include "ctkHostAppExampleWidget.h"
 #include "ui_ctkHostAppExampleWidget.h"
 #include "ctkDicomExampleHost.h"
+#include "ctkDicomAppService.h"
 
 #include <QDebug>
 #include <QFileDialog>
@@ -36,6 +37,16 @@ void ctkHostAppExampleWidget::startButtonClicked()
     }
 }
 
+void ctkHostAppExampleWidget::runButtonClicked()
+{
+    qDebug() << "run button clicked";
+    if (host)
+    {
+      bool reply = host->getDicomAppService()->setState(ctkDicomWG23::INPROGRESS);
+      qDebug() << "  setState(INPROGRESS) returned: " << reply;
+    }
+}
+
 void ctkHostAppExampleWidget::stopButtonClicked()
 {
     qDebug() << "stop button clicked";

+ 2 - 1
Applications/ctkExampleHost/ctkHostAppExampleWidget.h

@@ -19,9 +19,10 @@ public:
     explicit ctkHostAppExampleWidget(QWidget *parent = 0);
     ~ctkHostAppExampleWidget();
 public slots:
+    void loadButtonClicked();
     void startButtonClicked();
+    void runButtonClicked();
     void stopButtonClicked();
-    void loadButtonClicked();
     void appProcessError(QProcess::ProcessError error);
     void appProcessStateChanged(QProcess::ProcessState state);
 

+ 32 - 8
Applications/ctkExampleHost/ctkHostAppExampleWidget.ui

@@ -65,6 +65,13 @@
       </widget>
      </item>
      <item>
+      <widget class="QPushButton" name="runButton">
+       <property name="text">
+        <string>Run</string>
+       </property>
+      </widget>
+     </item>
+     <item>
       <widget class="QPushButton" name="stopButton">
        <property name="text">
         <string>Stop</string>
@@ -258,8 +265,8 @@
    <slot>startButtonClicked()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>54</x>
-     <y>70</y>
+     <x>64</x>
+     <y>63</y>
     </hint>
     <hint type="destinationlabel">
      <x>269</x>
@@ -274,8 +281,8 @@
    <slot>stopButtonClicked()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>185</x>
-     <y>70</y>
+     <x>246</x>
+     <y>63</y>
     </hint>
     <hint type="destinationlabel">
      <x>238</x>
@@ -290,8 +297,8 @@
    <slot>loadButtonClicked()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>55</x>
-     <y>35</y>
+     <x>65</x>
+     <y>32</y>
     </hint>
     <hint type="destinationlabel">
      <x>87</x>
@@ -306,8 +313,8 @@
    <slot>setVisible(bool)</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>28</x>
-     <y>123</y>
+     <x>38</x>
+     <y>98</y>
     </hint>
     <hint type="destinationlabel">
      <x>151</x>
@@ -315,10 +322,27 @@
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>runButton</sender>
+   <signal>clicked()</signal>
+   <receiver>ctkHostAppExampleWidget</receiver>
+   <slot>runButtonClicked()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>122</x>
+     <y>53</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>4</x>
+     <y>538</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
  <slots>
   <slot>startButtonClicked()</slot>
   <slot>stopButtonClicked()</slot>
   <slot>loadButtonClicked()</slot>
+  <slot>runButtonClicked()</slot>
  </slots>
 </ui>