Commit a866a7aa authored by Benjamin Long's avatar Benjamin Long

ENH : Added possibility to pause the record

parent 5b453ceb
......@@ -9,5 +9,6 @@
<file>Icons/plus.png</file>
<file>Icons/info.png</file>
<file>Icons/playback-stop.png</file>
<file>Icons/record.png</file>
</qresource>
</RCC>
......@@ -47,6 +47,7 @@ pqEventRecorder::pqEventRecorder(QObject *parent)
this->ActiveObserver = 0;
this->ActiveTranslator = 0;
this->Recording = false;
this->ContinuousFlush = false;
}
......@@ -117,6 +118,12 @@ pqEventTranslator* pqEventRecorder::translator() const
return this->ActiveTranslator;
}
// ----------------------------------------------------------------------------
bool pqEventRecorder::isRecording() const
{
return this->Recording;
}
// ----------------------------------------------------------------------------
void pqEventRecorder::recordEvents(pqEventTranslator* translator,
pqEventObserver* observer,
......@@ -160,6 +167,7 @@ void pqEventRecorder::start()
// Start the Translator
this->ActiveTranslator->start();
this->Recording = true;
emit this->started();
}
......@@ -181,11 +189,31 @@ void pqEventRecorder::stop(int value)
}
this->flush();
this->Recording = false;
emit this->stopped();
}
// ----------------------------------------------------------------------------
void pqEventRecorder::pause()
void pqEventRecorder::pause(bool value)
{
// To be implemented
if (!value)
{
QObject::disconnect(
this->ActiveTranslator,
SIGNAL(recordEvent(QString,QString,QString)),
this->ActiveObserver,
SLOT(onRecordEvent(QString,QString,QString)));
}
else
{
QObject::connect(
this->ActiveTranslator,
SIGNAL(recordEvent(QString,QString,QString)),
this->ActiveObserver,
SLOT(onRecordEvent(QString,QString,QString)),
Qt::UniqueConnection);
}
this->Recording = value;
emit this->paused(value);
}
......@@ -75,6 +75,8 @@ public:
void setTranslator(pqEventTranslator* translator);
pqEventTranslator* translator() const;
bool isRecording() const;
void recordEvents(pqEventTranslator* translator,
pqEventObserver* observer,
QIODevice* file,
......@@ -90,13 +92,14 @@ public slots:
void start();
void stop(int value);
void pause();
void pause(bool);
protected:
pqEventObserver* ActiveObserver;
pqEventTranslator* ActiveTranslator;
QIODevice* File;
bool Recording;
bool ContinuousFlush;
QTextStream Stream;
};
......
......@@ -91,9 +91,28 @@ pqRecordEventsDialog::pqRecordEventsDialog(pqEventRecorder* recorder,
QObject::connect(this->Implementation->TestUtility->eventTranslator(),
SIGNAL(recordEvent(QString,QString,QString)),
this, SLOT(onEventRecorded(QString,QString,QString)));
QObject::connect(this->Implementation->Ui.commentAddButton,
SIGNAL(clicked()),
this, SLOT(addComment()));
QObject::connect(this->Implementation->Ui.recordPauseButton,
SIGNAL(toggled(bool)),
this->Implementation->Recorder,
SLOT(pause(bool)));
QObject::connect(this->Implementation->Recorder,
SIGNAL(paused(bool)),
this,
SLOT(updateUi()));
QObject::connect(this->Implementation->Recorder,
SIGNAL(started()),
this,
SLOT(updateUi()));
QObject::connect(this->Implementation->Recorder,
SIGNAL(stopped()),
this,
SLOT(updateUi()));
}
// ----------------------------------------------------------------------------
......@@ -124,6 +143,11 @@ void pqRecordEventsDialog::onEventRecorded(const QString& widget,
const QString& command,
const QString& argument)
{
if (!this->Implementation->Recorder->isRecording())
{
return;
}
this->Implementation->Ui.eventWidgetEdit->setText(widget);
this->Implementation->Ui.eventCommandEdit->setText(command);
this->Implementation->Ui.eventArgumentEdit->setText(argument);
......@@ -146,3 +170,10 @@ void pqRecordEventsDialog::addComment()
}
this->Implementation->Ui.commentTextEdit->clear();
}
// ----------------------------------------------------------------------------
void pqRecordEventsDialog::updateUi()
{
this->Implementation->Ui.recordPauseButton->setChecked(
this->Implementation->Recorder->isRecording());
}
......@@ -59,6 +59,9 @@ private slots:
void addComment();
public slots:
void updateUi();
private:
pqRecordEventsDialog(const pqRecordEventsDialog&);
pqRecordEventsDialog& operator=(const pqRecordEventsDialog&);
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>393</width>
<height>233</height>
<height>256</height>
</rect>
</property>
<property name="windowTitle">
......@@ -185,6 +185,9 @@
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QCheckBox" name="blockingCheckBox">
<property name="toolTip">
<string>Add option block to you comment</string>
</property>
<property name="text">
<string>Blocking</string>
</property>
......@@ -285,6 +288,24 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="recordPauseButton">
<property name="toolTip">
<string>Start/Pause record</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="Resources/QtTesting.qrc">
<normaloff>:/Icons/record.png</normaloff>
<normalon>:/Icons/pause.png</normalon>:/Icons/record.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="stopButton">
<property name="sizePolicy">
......@@ -294,7 +315,7 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>Stop recorder</string>
<string>Stop record</string>
</property>
<property name="text">
<string>Stop Recording</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment