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) ...@@ -48,6 +48,7 @@ pqEventRecorder::pqEventRecorder(QObject *parent)
this->ActiveTranslator = 0; this->ActiveTranslator = 0;
this->File = 0; this->File = 0;
this->ContinuousFlush = false; this->ContinuousFlush = false;
this->RecordInteractionTimings = false;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
...@@ -86,6 +87,22 @@ bool pqEventRecorder::continuousFlush() const ...@@ -86,6 +87,22 @@ bool pqEventRecorder::continuousFlush() const
return this->ContinuousFlush; 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) void pqEventRecorder::check(bool value)
{ {
...@@ -120,6 +137,7 @@ pqEventObserver* pqEventRecorder::observer() const ...@@ -120,6 +137,7 @@ pqEventObserver* pqEventRecorder::observer() const
void pqEventRecorder::setTranslator(pqEventTranslator* translator) void pqEventRecorder::setTranslator(pqEventTranslator* translator)
{ {
this->ActiveTranslator = translator; this->ActiveTranslator = translator;
this->ActiveTranslator->recordInteractionTimings(this->RecordInteractionTimings);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
......
...@@ -64,6 +64,7 @@ public: ...@@ -64,6 +64,7 @@ public:
~pqEventRecorder(); ~pqEventRecorder();
bool continuousFlush() const; bool continuousFlush() const;
bool recordInteractionTimings() const;
void setFile(QIODevice* file); void setFile(QIODevice* file);
QIODevice* file() const; QIODevice* file() const;
...@@ -109,14 +110,26 @@ public slots: ...@@ -109,14 +110,26 @@ public slots:
// this recorder // this recorder
// If true, events are written on file as soon // If true, events are written on file as soon
// as they are recorded. // as they are recorded.
// False by default
void setContinuousFlush(bool value); 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: protected:
pqEventObserver* ActiveObserver; pqEventObserver* ActiveObserver;
pqEventTranslator* ActiveTranslator; pqEventTranslator* ActiveTranslator;
QIODevice* File; QIODevice* File;
bool ContinuousFlush; bool ContinuousFlush;
bool RecordInteractionTimings;
QTextStream Stream; QTextStream Stream;
}; };
......
...@@ -52,12 +52,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -52,12 +52,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqTableViewEventTranslator.h" #include "pqTableViewEventTranslator.h"
#include "pqTreeViewEventTranslator.h" #include "pqTreeViewEventTranslator.h"
#include <QApplication>
#include <QCoreApplication> #include <QCoreApplication>
#include <QtDebug> #include <QElapsedTimer>
#include <QSet> #include <QSet>
#include <QVector> #include <QtDebug>
#include <QApplication>
#include <QToolBar> #include <QToolBar>
#include <QVector>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// pqEventTranslator::pqImplementation // pqEventTranslator::pqImplementation
...@@ -72,6 +73,8 @@ struct pqEventTranslator::pqImplementation ...@@ -72,6 +73,8 @@ struct pqEventTranslator::pqImplementation
// Create overlay and hide it // Create overlay and hide it
this->CheckOverlay = new pqCheckEventOverlay(NULL); this->CheckOverlay = new pqCheckEventOverlay(NULL);
this->hideOverlay(); this->hideOverlay();
this->RecordInteractionTimings = false;
} }
~pqImplementation() ~pqImplementation()
...@@ -117,6 +120,12 @@ struct pqEventTranslator::pqImplementation ...@@ -117,6 +120,12 @@ struct pqEventTranslator::pqImplementation
// Pointer to the overlayed widget // Pointer to the overlayed widget
QPointer<QWidget> CheckOverlayWidgetOn; 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, ...@@ -609,6 +618,22 @@ void pqEventTranslator::onRecordEvent(QObject* Object,
return; 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 // Record the event
emit recordEvent(name, Command, Arguments, eventType); emit recordEvent(name, Command, Arguments, eventType);
} }
...@@ -643,6 +668,16 @@ bool pqEventTranslator::isRecording() ...@@ -643,6 +668,16 @@ bool pqEventTranslator::isRecording()
return this->Implementation->Recording; 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) void pqEventTranslator::setOverlayGeometry(const QRect& geometry, bool specific)
{ {
......
...@@ -103,6 +103,8 @@ public: ...@@ -103,6 +103,8 @@ public:
void record(bool value); void record(bool value);
bool isRecording(); bool isRecording();
/// Set the record interaction timings flag
void recordInteractionTimings(bool value);
signals: signals:
/// This signal will be emitted every time a translator generates a /// This signal will be emitted every time a translator generates a
/// high-level ParaView event. Observers should connect to this signal /// high-level ParaView event. Observers should connect to this signal
......
...@@ -112,6 +112,11 @@ pqRecordEventsDialog::pqRecordEventsDialog(pqEventRecorder* recorder, ...@@ -112,6 +112,11 @@ pqRecordEventsDialog::pqRecordEventsDialog(pqEventRecorder* recorder,
this->Implementation->Recorder, this->Implementation->Recorder,
SLOT(setContinuousFlush(bool))); SLOT(setContinuousFlush(bool)));
QObject::connect(this->Implementation->Ui.recordInteractionTimings,
SIGNAL(toggled(bool)),
this->Implementation->Recorder,
SLOT(setRecordInteractionTimings(bool)));
QObject::connect(this->Implementation->Recorder, QObject::connect(this->Implementation->Recorder,
SIGNAL(started()), SIGNAL(started()),
this, this,
......
...@@ -242,14 +242,37 @@ ...@@ -242,14 +242,37 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="continuousFlush"> <layout class="QHBoxLayout">
<property name="text"> <property name="spacing">
<string>Continuous Flush</string> <number>6</number>
</property> </property>
<property name="toolTip"> <property name="sizeConstraint">
<string>Write events to file as soon as they are recorded</string> <enum>QLayout::SetMinimumSize</enum>
</property> </property>
</widget> <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>
<item> <item>
<layout class="QHBoxLayout"> <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