Commit d874a21b authored by Mathieu Westphal's avatar Mathieu Westphal Committed by Kitware Robot

Merge topic 'AddingRecordInteractionTimingsFeature'

e936b75c Add feature to record interaction timings
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Joachim Pouderoux's avatarJoachim Pouderoux <joachim.pouderoux@kitware.com>
Acked-by: Julien Finet's avatarJulien Finet <julien.finet@kitware.com>
Merge-request: !2
parents 20ede6c4 e936b75c
......@@ -48,6 +48,7 @@ pqEventRecorder::pqEventRecorder(QObject *parent)
this->ActiveTranslator = 0;
this->File = 0;
this->ContinuousFlush = false;
this->RecordInteractionTimings = false;
}
// ----------------------------------------------------------------------------
......@@ -86,6 +87,22 @@ bool pqEventRecorder::continuousFlush() const
return this->ContinuousFlush;
}
// ----------------------------------------------------------------------------
void pqEventRecorder::setRecordInteractionTimings(bool value)
{
this->RecordInteractionTimings = value;
if (this->ActiveTranslator)
{
this->ActiveTranslator->recordInteractionTimings(value);
}
}
// ----------------------------------------------------------------------------
bool pqEventRecorder::recordInteractionTimings() const
{
return this->RecordInteractionTimings;
}
// ----------------------------------------------------------------------------
void pqEventRecorder::check(bool value)
{
......@@ -120,6 +137,7 @@ pqEventObserver* pqEventRecorder::observer() const
void pqEventRecorder::setTranslator(pqEventTranslator* translator)
{
this->ActiveTranslator = translator;
this->ActiveTranslator->recordInteractionTimings(this->RecordInteractionTimings);
}
// ----------------------------------------------------------------------------
......
......@@ -64,6 +64,7 @@ public:
~pqEventRecorder();
bool continuousFlush() const;
bool recordInteractionTimings() const;
void setFile(QIODevice* file);
QIODevice* file() const;
......@@ -109,14 +110,26 @@ public slots:
// this recorder
// If true, events are written on file as soon
// as they are recorded.
// False by default
void setContinuousFlush(bool value);
// Set the record interaction timings value
// and pass it to current active translator
// if any.
// When set to true user's pause between interaction events
// are recorded and thus will be reproduced during playback.
// When enabled, timing starts to be recorded only after the
// next recorded event.
// False by default
void setRecordInteractionTimings(bool value);
protected:
pqEventObserver* ActiveObserver;
pqEventTranslator* ActiveTranslator;
QIODevice* File;
bool ContinuousFlush;
bool RecordInteractionTimings;
QTextStream Stream;
};
......
......@@ -52,12 +52,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqTableViewEventTranslator.h"
#include "pqTreeViewEventTranslator.h"
#include <QApplication>
#include <QCoreApplication>
#include <QtDebug>
#include <QElapsedTimer>
#include <QSet>
#include <QVector>
#include <QApplication>
#include <QtDebug>
#include <QToolBar>
#include <QVector>
////////////////////////////////////////////////////////////////////////////////
// pqEventTranslator::pqImplementation
......@@ -72,6 +73,8 @@ struct pqEventTranslator::pqImplementation
// Create overlay and hide it
this->CheckOverlay = new pqCheckEventOverlay(NULL);
this->hideOverlay();
this->RecordInteractionTimings = false;
}
~pqImplementation()
......@@ -117,6 +120,12 @@ struct pqEventTranslator::pqImplementation
// Pointer to the overlayed widget
QPointer<QWidget> CheckOverlayWidgetOn;
// Record interaction timings flag
bool RecordInteractionTimings;
// Timer to track time between user interactions
QElapsedTimer InteractionsTimer;
};
////////////////////////////////////////////////////////////////////////////////
......@@ -609,6 +618,22 @@ void pqEventTranslator::onRecordEvent(QObject* Object,
return;
}
}
// Record user interaction time
if (this->Implementation->RecordInteractionTimings)
{
if (this->Implementation->InteractionsTimer.isValid())
{
emit recordEvent(name, "pause",
QString::number(this->Implementation->InteractionsTimer.restart()),
pqEventTypes::ACTION_EVENT);
}
else
{
this->Implementation->InteractionsTimer.start();
}
}
// Record the event
emit recordEvent(name, Command, Arguments, eventType);
}
......@@ -643,6 +668,16 @@ bool pqEventTranslator::isRecording()
return this->Implementation->Recording;
}
// ----------------------------------------------------------------------------
void pqEventTranslator::recordInteractionTimings(bool value)
{
if (value != this->Implementation->RecordInteractionTimings)
{
this->Implementation->RecordInteractionTimings = value;
this->Implementation->InteractionsTimer.invalidate();
}
}
// ----------------------------------------------------------------------------
void pqEventTranslator::setOverlayGeometry(const QRect& geometry, bool specific)
{
......
......@@ -103,6 +103,8 @@ public:
void record(bool value);
bool isRecording();
/// Set the record interaction timings flag
void recordInteractionTimings(bool value);
signals:
/// This signal will be emitted every time a translator generates a
/// high-level ParaView event. Observers should connect to this signal
......
......@@ -112,6 +112,11 @@ pqRecordEventsDialog::pqRecordEventsDialog(pqEventRecorder* recorder,
this->Implementation->Recorder,
SLOT(setContinuousFlush(bool)));
QObject::connect(this->Implementation->Ui.recordInteractionTimings,
SIGNAL(toggled(bool)),
this->Implementation->Recorder,
SLOT(setRecordInteractionTimings(bool)));
QObject::connect(this->Implementation->Recorder,
SIGNAL(started()),
this,
......
......@@ -242,14 +242,37 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="continuousFlush">
<property name="text">
<string>Continuous Flush</string>
</property>
<property name="toolTip">
<string>Write events to file as soon as they are recorded</string>
</property>
</widget>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="continuousFlush">
<property name="text">
<string>Continuous Flush</string>
</property>
<property name="toolTip">
<string>Write events to file as soon as they are recorded</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="recordInteractionTimings">
<property name="text">
<string>Record Interaction Timings</string>
</property>
<property name="toolTip">
<string>When activated, each pause between interactions will be recorded as a pause event, with the correct timing</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
......
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