瀏覽代碼

QtTesting: Cleanup QtTesting app

Make it a bit more user friendly
Issue #249
Julien Finet 12 年之前
父節點
當前提交
e81cd87342

+ 17 - 13
Applications/ctkQtTesting/ctkQtTestingMainWindow.cpp

@@ -39,8 +39,8 @@ ctkQtTestingMainWindow::ctkQtTestingMainWindow()
 {
   this->Ui.setupUi(this);
 
-  QObject::connect(Ui.RecordButton, SIGNAL(clicked(bool)), this, SLOT(record()));
-  QObject::connect(Ui.PlayBackButton, SIGNAL(clicked(bool)), this, SLOT(play()));
+  QObject::connect(Ui.RecordButton, SIGNAL(toggled(bool)), this, SLOT(record(bool)));
+  QObject::connect(Ui.PlayBackButton, SIGNAL(clicked()), this, SLOT(play()));
 
   this->TestUtility = new ctkQtTestingUtility(this);
   this->TestUtility->addEventObserver("xml", new ctkXMLEventObserver(this->TestUtility));
@@ -50,7 +50,6 @@ ctkQtTestingMainWindow::ctkQtTestingMainWindow()
   Ui.renderView->setBackgroundColor2(QColor(Qt::darkBlue));
   Ui.renderView->setGradientBackground(true);
   Ui.renderView->setCornerAnnotationText("ctk Qt test");
-  Ui.renderView->show();
 
   // Create a cube.
   vtkSmartPointer<vtkCubeSource> cubeSource =
@@ -74,10 +73,6 @@ ctkQtTestingMainWindow::ctkQtTestingMainWindow()
 //  boxWidget->PlaceWidget();
 //  boxWidget->On();
 
-  // Render and interact
-//  Ui.renderView->renderWindow()->Render();
-//  Ui.renderView->interactor()->Start();
-
   Ui.renderView->resetCamera();
 }
 
@@ -91,14 +86,22 @@ ctkQtTestingMainWindow::~ctkQtTestingMainWindow()
 }
 
 //-----------------------------------------------------------------------------
-void ctkQtTestingMainWindow::record()
+void ctkQtTestingMainWindow::record(bool start)
 {
-  qDebug() << "Start Record";
-  QString filename = QFileDialog::getSaveFileName (this, "Test File Name",
-    QString(), "XML Files (*.xml)");
-  if (!filename.isEmpty())
+  if (start)
+    {
+    QString filename = QFileDialog::getSaveFileName (this, "Test File Name",
+                                                     QString(), "XML Files (*.xml)");
+    if (!filename.isEmpty())
+      {
+      qDebug() << "Start recording";
+      this->TestUtility->recordTests(filename);
+      }
+    }
+  else
     {
-    this->TestUtility->recordTests(filename);
+    qDebug() << "Stop recording";
+    this->TestUtility->stopRecords(1);
     }
 }
 
@@ -112,4 +115,5 @@ void ctkQtTestingMainWindow::play()
     {
     this->TestUtility->playTests(filename);
     }
+  qDebug() << "End Playback";
 }

+ 1 - 1
Applications/ctkQtTesting/ctkQtTestingMainWindow.h

@@ -14,7 +14,7 @@ public:
   ctkQtTestingMainWindow();
   ~ctkQtTestingMainWindow();
 protected slots:
-  void record();
+  void record(bool start);
   void play();
 
 private:

+ 4 - 4
Applications/ctkQtTesting/ctkQtTestingMainWindow.ui

@@ -28,9 +28,6 @@
         <property name="enabled">
          <bool>true</bool>
         </property>
-        <property name="mouseTracking">
-         <bool>false</bool>
-        </property>
         <property name="backgroundColor">
          <color>
           <red>51</red>
@@ -105,7 +102,10 @@
       <item>
        <widget class="QPushButton" name="RecordButton">
         <property name="text">
-         <string>Start Record</string>
+         <string>Record</string>
+        </property>
+        <property name="checkable">
+         <bool>true</bool>
         </property>
        </widget>
       </item>