Sfoglia il codice sorgente

Factored out controls for hosted apps

Ivo Wolf 13 anni fa
parent
commit
75548aefb9

+ 12 - 105
Applications/ctkExampleHost/ctkHostAppExampleWidget.cpp

@@ -23,12 +23,14 @@
 #include <QDebug>
 #include <QFileDialog>
 #include <QProcess>
+#include <QtGui/QVBoxLayout>
 
 // CTK includes
 #include "ctkHostAppExampleWidget.h"
 #include "ui_ctkHostAppExampleWidget.h"
 #include "ctkExampleDicomHost.h"
 #include "ctkDicomAppService.h"
+#include <ctkExampleHostControlWidget.h>
 #include <ctkDicomAppHostingTypesHelper.h>
 
 //----------------------------------------------------------------------------
@@ -39,14 +41,13 @@ ctkHostAppExampleWidget::ctkHostAppExampleWidget(QWidget *parent) :
   qDebug() << "setup ui";
   ui->setupUi(this);
   ui->crashLabel->setVisible(false);
-  ui->messageOutput->setVisible(true);
   this->Host = new ctkExampleDicomHost(ui->placeholderFrame);
+  this->HostControls = new ctkExampleHostControlWidget(Host, ui->placeHolderForControls);
+  this->HostControls->setObjectName(QString::fromUtf8("exampleHostControls"));
+  ui->verticalLayout->addWidget(HostControls);
 
   connect(&this->Host->getAppProcess(),SIGNAL(error(QProcess::ProcessError)),SLOT(appProcessError(QProcess::ProcessError)));
-  connect(&this->Host->getAppProcess(),SIGNAL(stateChanged(QProcess::ProcessState)),SLOT(appProcessStateChanged(QProcess::ProcessState)));
   connect(ui->placeholderFrame,SIGNAL(resized()),SLOT(placeholderResized()));
-  connect(this->Host,SIGNAL(stateChangedReceived(ctkDicomAppHosting::State)),SLOT(appStateChanged(ctkDicomAppHosting::State)));
-
 }
 
 //----------------------------------------------------------------------------
@@ -59,36 +60,6 @@ ctkHostAppExampleWidget::~ctkHostAppExampleWidget()
 }
 
 //----------------------------------------------------------------------------
-void ctkHostAppExampleWidget::startButtonClicked()
-{
-  qDebug() << "start button clicked";
-  if (this->Host)
-    {
-    this->Host->StartApplication(this->AppFileName);
-    //forward output to textedit
-    connect(&this->Host->getAppProcess(),SIGNAL(readyReadStandardOutput()),this,SLOT(outputMessage()));
-    }
-}
-
-//----------------------------------------------------------------------------
-void ctkHostAppExampleWidget::runButtonClicked()
-{
-  qDebug() << "run button clicked";
-  if (this->Host)
-    {
-    bool reply = this->Host->getDicomAppService()->setState(ctkDicomAppHosting::INPROGRESS);
-    qDebug() << "  setState(INPROGRESS) returned: " << reply;
-    }
-}
-
-//----------------------------------------------------------------------------
-void ctkHostAppExampleWidget::stopButtonClicked()
-{
-  qDebug() << "stop button clicked";
-  this->Host->exitApplication();
-}
-
-//----------------------------------------------------------------------------
 void ctkHostAppExampleWidget::loadButtonClicked()
 {
   qDebug() << "load button clicked";
@@ -98,55 +69,7 @@ void ctkHostAppExampleWidget::loadButtonClicked()
 //----------------------------------------------------------------------------
 void ctkHostAppExampleWidget::setAppFileName(QString name)
 {
-  this->AppFileName = name;
-  if (QFile(this->AppFileName).permissions() & QFile::ExeUser )
-    {
-    this->ui->applicationPathLabel->setText(this->AppFileName);
-    }
-  else
-    {
-    this->ui->applicationPathLabel->setText(
-        QString("<font color='red'>Not executable:</font>").append(this->AppFileName));
-    }
-}
-
-//----------------------------------------------------------------------------
-void ctkHostAppExampleWidget::appProcessError(QProcess::ProcessError error)
-{
-  if (error == QProcess::Crashed)
-    {
-    qDebug() << "crash detected";
-    ui->crashLabel->setVisible(true);
-    }
-}
-
-//----------------------------------------------------------------------------
-void ctkHostAppExampleWidget::appProcessStateChanged(QProcess::ProcessState state)
-{
-  QString labelText;
-  switch (state)
-    {
-    case QProcess::Running:
-      ui->processStateLabel->setText("Running");
-      break;
-    case QProcess::NotRunning:
-      if (this->Host->getAppProcess().exitStatus() == QProcess::CrashExit )
-      {
-        labelText = "crashed";
-      }
-      else
-      {
-        labelText = "Not Running, last exit code ";
-        labelText.append(QString::number(this->Host->getAppProcess().exitCode()));
-      }
-      ui->processStateLabel->setText(labelText);
-      break;
-    case QProcess::Starting:
-      ui->processStateLabel->setText("Starting");
-      break;
-    default:
-      ;
-    }
+  HostControls->setAppFileName(name);
 }
 
 //----------------------------------------------------------------------------
@@ -156,28 +79,12 @@ void ctkHostAppExampleWidget::placeholderResized()
   //ui->placeholderFrame->printPosition();
 }
 
-
-
-void ctkHostAppExampleWidget::appStateChanged(ctkDicomAppHosting::State state)
-{
-  ui->statusLabel->setText(ctkDicomSoapState::toStringValue(state));
-}
-
-
-//----------------------------------------------------------------------------
-void ctkHostAppExampleWidget::outputMessage ()
-{
-  ui->messageOutput->append (this->Host->processReadAll ());
-}
-
 //----------------------------------------------------------------------------
-void ctkHostAppExampleWidget::suspendButtonClicked()
-{
-  this->Host->getDicomAppService()->setState(ctkDicomAppHosting::SUSPENDED);
-}
-
-void ctkHostAppExampleWidget::cancelButtonClicked()
+void ctkHostAppExampleWidget::appProcessError(QProcess::ProcessError error)
 {
-  this->Host->getDicomAppService()->setState(ctkDicomAppHosting::CANCELED);
+  if (error == QProcess::Crashed)
+    {
+    qDebug() << "crash detected";
+    ui->crashLabel->setVisible(true);
+    }
 }
-

+ 5 - 9
Applications/ctkExampleHost/ctkHostAppExampleWidget.h

@@ -28,6 +28,7 @@
 #include <ctkDicomAppHostingTypes.h>
 
 class ctkExampleDicomHost;
+class ctkExampleHostControlWidget;
 
 namespace Ui {
   class ctkHostAppExampleWidget;
@@ -47,20 +48,15 @@ public:
 public slots:
 
   void loadButtonClicked();
-  void startButtonClicked();
-  void runButtonClicked();
-  void stopButtonClicked();
-  void suspendButtonClicked();
-  void cancelButtonClicked();
-  void appProcessError(QProcess::ProcessError error);
-  void appProcessStateChanged(QProcess::ProcessState state);
-  void appStateChanged(ctkDicomAppHosting::State state);
 
   void placeholderResized();
-  void outputMessage();
+
+  void appProcessError(QProcess::ProcessError error);
+
 protected:
 
   ctkExampleDicomHost* Host;
+  ctkExampleHostControlWidget* HostControls;
   QString AppFileName;
 
 private:

+ 12 - 276
Applications/ctkExampleHost/ctkHostAppExampleWidget.ui

@@ -26,195 +26,16 @@
        </property>
       </widget>
      </item>
-     <item>
-      <widget class="QLabel" name="label_2">
-       <property name="text">
-        <string>Application Path:</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QLabel" name="applicationPathLabel">
-       <property name="text">
-        <string>None</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_3">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
     </layout>
    </item>
    <item row="1" column="0">
-    <layout class="QHBoxLayout" name="horizontalLayout_2">
-     <item>
-      <widget class="QPushButton" name="startButton">
-       <property name="text">
-        <string>Start</string>
-       </property>
-      </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>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QLabel" name="label">
-       <property name="text">
-        <string>Plugin Status:</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QLabel" name="statusLabel">
-       <property name="font">
-        <font>
-         <weight>75</weight>
-         <bold>true</bold>
-        </font>
-       </property>
-       <property name="text">
-        <string>-</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QLabel" name="label_3">
-       <property name="text">
-        <string>Process Status:</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QLabel" name="processStateLabel">
-       <property name="font">
-        <font>
-         <weight>75</weight>
-         <bold>true</bold>
-        </font>
-       </property>
-       <property name="text">
-        <string>Not running</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>107</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-    </layout>
-   </item>
-   <item row="2" column="0">
-    <layout class="QHBoxLayout" name="horizontalLayout_5">
-     <item>
-      <widget class="QPushButton" name="SuspendButton">
-       <property name="text">
-        <string>Suspend</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QPushButton" name="CancelButton">
-       <property name="text">
-        <string>Cancel</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_6">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-    </layout>
-   </item>
-   <item row="3" column="0">
     <widget class="Line" name="line">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
     </widget>
    </item>
-   <item row="4" column="0">
-    <layout class="QHBoxLayout" name="horizontalLayout">
-     <item>
-      <widget class="QCheckBox" name="checkBox">
-       <property name="text">
-        <string>Show Messages</string>
-       </property>
-       <property name="checked">
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_2">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>107</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-    </layout>
-   </item>
-   <item row="5" column="0">
-    <widget class="QTextEdit" name="messageOutput">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="font">
-      <font>
-       <weight>75</weight>
-       <bold>true</bold>
-      </font>
-     </property>
-    </widget>
-   </item>
-   <item row="6" column="0">
+   <item row="3" column="0">
     <widget class="ctkHostedAppPlaceholderWidget" name="placeholderFrame">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@@ -277,6 +98,17 @@
      </layout>
     </widget>
    </item>
+   <item row="2" column="0">
+    <widget class="QWidget" name="placeHolderForControls" native="true">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>1</verstretch>
+      </sizepolicy>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout"/>
+    </widget>
+   </item>
   </layout>
  </widget>
  <customwidgets>
@@ -290,38 +122,6 @@
  <resources/>
  <connections>
   <connection>
-   <sender>startButton</sender>
-   <signal>clicked()</signal>
-   <receiver>ctkHostAppExampleWidget</receiver>
-   <slot>startButtonClicked()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>64</x>
-     <y>63</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>269</x>
-     <y>26</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>stopButton</sender>
-   <signal>clicked()</signal>
-   <receiver>ctkHostAppExampleWidget</receiver>
-   <slot>stopButtonClicked()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>246</x>
-     <y>63</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>238</x>
-     <y>52</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
    <sender>loadButton</sender>
    <signal>clicked()</signal>
    <receiver>ctkHostAppExampleWidget</receiver>
@@ -337,70 +137,6 @@
     </hint>
    </hints>
   </connection>
-  <connection>
-   <sender>checkBox</sender>
-   <signal>clicked(bool)</signal>
-   <receiver>messageOutput</receiver>
-   <slot>setVisible(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>38</x>
-     <y>98</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>151</x>
-     <y>184</y>
-    </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>
-  <connection>
-   <sender>SuspendButton</sender>
-   <signal>clicked()</signal>
-   <receiver>ctkHostAppExampleWidget</receiver>
-   <slot>suspendButtonClicked()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>47</x>
-     <y>83</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>291</x>
-     <y>296</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>CancelButton</sender>
-   <signal>clicked()</signal>
-   <receiver>ctkHostAppExampleWidget</receiver>
-   <slot>cancelButtonClicked()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>132</x>
-     <y>83</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>291</x>
-     <y>296</y>
-    </hint>
-   </hints>
-  </connection>
  </connections>
  <slots>
   <slot>startButtonClicked()</slot>

+ 3 - 0
Plugins/org.commontk.dah.examplehost/CMakeLists.txt

@@ -7,6 +7,7 @@ SET(PLUGIN_SRCS
   ctkExampleDicomHostPlugin.cpp
   ctkExampleDicomHostPlugin_p.h
   ctkHostedAppPlaceholderWidget.cpp
+  ctkExampleHostControlWidget.cpp
 )
 
 # Files which should be processed by Qts moc
@@ -14,10 +15,12 @@ SET(PLUGIN_MOC_SRCS
   ctkExampleDicomHost.h
   ctkExampleDicomHostPlugin_p.h
   ctkHostedAppPlaceholderWidget.h
+  ctkExampleHostControlWidget.h
 )
 
 # Qt Designer files which should be processed by Qts uic
 SET(PLUGIN_UI_FORMS
+  ctkExampleHostControlWidget.ui
 )
 
 # QRC Files which should be compiled into the plugin

+ 169 - 0
Plugins/org.commontk.dah.examplehost/ctkExampleHostControlWidget.cpp

@@ -0,0 +1,169 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=============================================================================*/
+
+// Qt includes
+#include <QDebug>
+#include <QFileDialog>
+#include <QProcess>
+
+// CTK includes
+#include "ctkExampleHostControlWidget.h"
+#include "ui_ctkExampleHostControlWidget.h"
+#include "ctkExampleDicomHost.h"
+#include "ctkDicomAppService.h"
+#include <ctkDicomAppHostingTypesHelper.h>
+
+//----------------------------------------------------------------------------
+ctkExampleHostControlWidget::ctkExampleHostControlWidget(ctkExampleDicomHost * host, QWidget *parent) :
+    Host(host),
+    QWidget(parent),
+    ui(new Ui::ctkExampleHostControlWidget)
+{
+  qDebug() << "setup ui";
+  ui->setupUi(this);
+//  ui->crashLabel->setVisible(false);
+  ui->messageOutput->setVisible(true);
+  if(Host==NULL)
+    qDebug() << "no host provided when creating ctkExampleHostControlWidget.";
+  else
+  {
+    connect(&this->Host->getAppProcess(),SIGNAL(error(QProcess::ProcessError)),SLOT(appProcessError(QProcess::ProcessError)));
+    connect(&this->Host->getAppProcess(),SIGNAL(stateChanged(QProcess::ProcessState)),SLOT(appProcessStateChanged(QProcess::ProcessState)));
+    connect(this->Host,SIGNAL(stateChangedReceived(ctkDicomAppHosting::State)),SLOT(appStateChanged(ctkDicomAppHosting::State)));
+  }
+}
+
+//----------------------------------------------------------------------------
+ctkExampleHostControlWidget::~ctkExampleHostControlWidget()
+{
+  delete this->ui;
+  this->ui = 0;
+}
+
+//----------------------------------------------------------------------------
+void ctkExampleHostControlWidget::startButtonClicked()
+{
+  qDebug() << "start button clicked";
+  if (this->Host)
+    {
+    this->Host->StartApplication(this->AppFileName);
+    //forward output to textedit
+    connect(&this->Host->getAppProcess(),SIGNAL(readyReadStandardOutput()),this,SLOT(outputMessage()));
+    }
+}
+
+//----------------------------------------------------------------------------
+void ctkExampleHostControlWidget::runButtonClicked()
+{
+  qDebug() << "run button clicked";
+  if (this->Host)
+    {
+    bool reply = this->Host->getDicomAppService()->setState(ctkDicomAppHosting::INPROGRESS);
+    qDebug() << "  setState(INPROGRESS) returned: " << reply;
+    }
+}
+
+//----------------------------------------------------------------------------
+void ctkExampleHostControlWidget::stopButtonClicked()
+{
+  qDebug() << "stop button clicked";
+  this->Host->exitApplication();
+}
+
+
+//----------------------------------------------------------------------------
+void ctkExampleHostControlWidget::setAppFileName(QString name)
+{
+  this->AppFileName = name;
+  if (QFile(this->AppFileName).permissions() & QFile::ExeUser )
+    {
+    this->ui->applicationPathLabel->setText(this->AppFileName);
+    }
+  else
+    {
+    this->ui->applicationPathLabel->setText(
+        QString("<font color='red'>Not executable:</font>").append(this->AppFileName));
+    }
+}
+
+//----------------------------------------------------------------------------
+void ctkExampleHostControlWidget::appProcessError(QProcess::ProcessError error)
+{
+  if (error == QProcess::Crashed)
+    {
+    qDebug() << "crash detected";
+//    ui->crashLabel->setVisible(true);
+    }
+}
+
+//----------------------------------------------------------------------------
+void ctkExampleHostControlWidget::appProcessStateChanged(QProcess::ProcessState state)
+{
+  QString labelText;
+  switch (state)
+    {
+    case QProcess::Running:
+      ui->processStateLabel->setText("Running");
+      break;
+    case QProcess::NotRunning:
+      if (this->Host->getAppProcess().exitStatus() == QProcess::CrashExit )
+      {
+        labelText = "crashed";
+      }
+      else
+      {
+        labelText = "Not Running, last exit code ";
+        labelText.append(QString::number(this->Host->getAppProcess().exitCode()));
+      }
+      ui->processStateLabel->setText(labelText);
+      break;
+    case QProcess::Starting:
+      ui->processStateLabel->setText("Starting");
+      break;
+    default:
+      ;
+    }
+}
+
+
+void ctkExampleHostControlWidget::appStateChanged(ctkDicomAppHosting::State state)
+{
+  ui->statusLabel->setText(ctkDicomSoapState::toStringValue(state));
+}
+
+
+//----------------------------------------------------------------------------
+void ctkExampleHostControlWidget::outputMessage ()
+{
+  ui->messageOutput->append (this->Host->processReadAll ());
+}
+
+//----------------------------------------------------------------------------
+void ctkExampleHostControlWidget::suspendButtonClicked()
+{
+  this->Host->getDicomAppService()->setState(ctkDicomAppHosting::SUSPENDED);
+}
+
+void ctkExampleHostControlWidget::cancelButtonClicked()
+{
+  this->Host->getDicomAppService()->setState(ctkDicomAppHosting::CANCELED);
+}
+

+ 71 - 0
Plugins/org.commontk.dah.examplehost/ctkExampleHostControlWidget.h

@@ -0,0 +1,71 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=============================================================================*/
+
+#ifndef ctkExampleHostControlWidget_H
+#define ctkExampleHostControlWidget_H
+
+#include <QWidget>
+#include <QProcess>
+
+#include <ctkDicomAppHostingTypes.h>
+
+#include <org_commontk_dah_examplehost_Export.h>
+
+class ctkExampleDicomHost;
+
+namespace Ui {
+  class ctkExampleHostControlWidget;
+}
+
+class org_commontk_dah_examplehost_EXPORT ctkExampleHostControlWidget : public QWidget
+{
+  Q_OBJECT
+
+public:
+
+  explicit ctkExampleHostControlWidget(ctkExampleDicomHost * host, QWidget *parent = 0);
+  void setAppFileName(QString name);
+
+  virtual ~ctkExampleHostControlWidget();
+
+public slots:
+  void startButtonClicked();
+  void runButtonClicked();
+  void stopButtonClicked();
+  void suspendButtonClicked();
+  void cancelButtonClicked();
+  void appProcessError(QProcess::ProcessError error);
+  void appProcessStateChanged(QProcess::ProcessState state);
+  void appStateChanged(ctkDicomAppHosting::State state);
+
+  void outputMessage();
+protected:
+
+  ctkExampleDicomHost* Host;
+  QString AppFileName;
+
+private:
+
+  Ui::ctkExampleHostControlWidget *ui;
+
+};
+
+#endif // CTKHOSTWIDGET_H

+ 332 - 0
Plugins/org.commontk.dah.examplehost/ctkExampleHostControlWidget.ui

@@ -0,0 +1,332 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ctkExampleHostControlWidget</class>
+ <widget class="QWidget" name="ctkExampleHostControlWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>583</width>
+    <height>343</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0">
+    <layout class="QHBoxLayout" name="horizontalLayout_3">
+     <item>
+      <widget class="QLabel" name="label_2">
+       <property name="text">
+        <string>Application Path:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="applicationPathLabel">
+       <property name="text">
+        <string>None</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer_3">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item row="1" column="0">
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <widget class="QPushButton" name="startButton">
+       <property name="text">
+        <string>Start</string>
+       </property>
+      </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>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="label">
+       <property name="text">
+        <string>Plugin Status:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="statusLabel">
+       <property name="font">
+        <font>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
+       </property>
+       <property name="text">
+        <string>-</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="label_3">
+       <property name="text">
+        <string>Process Status:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="processStateLabel">
+       <property name="font">
+        <font>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
+       </property>
+       <property name="text">
+        <string>Not running</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>107</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item row="2" column="0">
+    <layout class="QHBoxLayout" name="horizontalLayout_5">
+     <item>
+      <widget class="QPushButton" name="SuspendButton">
+       <property name="text">
+        <string>Suspend</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="CancelButton">
+       <property name="text">
+        <string>Cancel</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer_6">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item row="3" column="0">
+    <widget class="Line" name="line">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="0">
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QCheckBox" name="checkBox">
+       <property name="text">
+        <string>Show Messages</string>
+       </property>
+       <property name="checked">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer_2">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>107</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item row="5" column="0">
+    <widget class="QTextEdit" name="messageOutput">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="font">
+      <font>
+       <weight>75</weight>
+       <bold>true</bold>
+      </font>
+     </property>
+    </widget>
+   </item>
+   <item row="6" column="0">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>0</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>startButton</sender>
+   <signal>clicked()</signal>
+   <receiver>ctkExampleHostControlWidget</receiver>
+   <slot>startButtonClicked()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>64</x>
+     <y>63</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>269</x>
+     <y>26</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>stopButton</sender>
+   <signal>clicked()</signal>
+   <receiver>ctkExampleHostControlWidget</receiver>
+   <slot>stopButtonClicked()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>246</x>
+     <y>63</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>238</x>
+     <y>52</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>checkBox</sender>
+   <signal>clicked(bool)</signal>
+   <receiver>messageOutput</receiver>
+   <slot>setVisible(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>38</x>
+     <y>98</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>151</x>
+     <y>184</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>runButton</sender>
+   <signal>clicked()</signal>
+   <receiver>ctkExampleHostControlWidget</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>
+  <connection>
+   <sender>SuspendButton</sender>
+   <signal>clicked()</signal>
+   <receiver>ctkExampleHostControlWidget</receiver>
+   <slot>suspendButtonClicked()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>47</x>
+     <y>83</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>291</x>
+     <y>296</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>CancelButton</sender>
+   <signal>clicked()</signal>
+   <receiver>ctkExampleHostControlWidget</receiver>
+   <slot>cancelButtonClicked()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>132</x>
+     <y>83</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>291</x>
+     <y>296</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+ <slots>
+  <slot>startButtonClicked()</slot>
+  <slot>stopButtonClicked()</slot>
+  <slot>loadButtonClicked()</slot>
+  <slot>runButtonClicked()</slot>
+  <slot>suspendButtonClicked()</slot>
+  <slot>cancelButtonClicked()</slot>
+ </slots>
+</ui>