Commit 0113c88d authored by Benjamin Long's avatar Benjamin Long

Add Player back widget to give feedback to users.

The player back widget allow users to :
* load severals scripts
* play all the scripts
* stop/pause/play step by step one script
* give feedbacks to the users

All players are now QObject so that it's possible to retrieve the
associated class name using the metaobject. This required to provide
feedback associated with the newly introduced event type "comment".
(See pqCommentEventPlayer)
parent 9ad9ac3c
......@@ -83,11 +83,21 @@ SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${MOC_INCLUDE_DIRS}")
QT4_WRAP_CPP(MOC_BUILT_SOURCES
pq3DViewEventTranslator.h
pq3DViewEventPlayer.h
pqAbstractActivateEventPlayer.h
pqAbstractButtonEventTranslator.h
pqAbstractBooleanEventPlayer.h
pqAbstractDoubleEventPlayer.h
pqAbstractIntEventPlayer.h
pqAbstractItemViewEventPlayer.h
pqAbstractItemViewEventTranslator.h
pqAbstractMiscellaneousEventPlayer.h
pqAbstractSliderEventTranslator.h
pqAbstractStringEventPlayer.h
pqBasicWidgetEventTranslator.h
pqBasicWidgetEventPlayer.h
pqComboBoxEventTranslator.h
pqCommentEventPlayer.h
pqDoubleSpinBoxEventTranslator.h
pqEventDispatcher.h
pqEventObserver.h
......@@ -98,9 +108,11 @@ QT4_WRAP_CPP(MOC_BUILT_SOURCES
pqMenuEventTranslator.h
pqNativeFileDialogEventPlayer.h
pqNativeFileDialogEventTranslator.h
pqPlayBackEventsDialog.h
pqRecordEventsDialog.h
pqSpinBoxEventTranslator.h
pqStdoutEventObserver.h
pqTabBarEventPlayer.h
pqTabBarEventTranslator.h
pqTestUtility.h
pqThreadedEventSource.h
......@@ -108,15 +120,21 @@ QT4_WRAP_CPP(MOC_BUILT_SOURCES
pqTreeViewEventPlayer.h
pqTreeViewEventTranslator.h
pqWidgetEventTranslator.h
pqWidgetEventPlayer.h
${PYTHON_MOCS}
)
SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "${include_dirs_tmp}")
QT4_WRAP_UI(UI_BUILT_SOURCES
pqPlayBackEventsDialog.ui
pqRecordEventsDialog.ui
)
QT4_ADD_RESOURCES(QRC_BUILT_SOURCES
Resources/QtTesting.qrc
)
SET(QtTesting_SOURCES
pq3DViewEventPlayer.cxx
pq3DViewEventTranslator.cxx
......@@ -133,6 +151,7 @@ SET(QtTesting_SOURCES
pqBasicWidgetEventPlayer.cxx
pqBasicWidgetEventTranslator.cxx
pqComboBoxEventTranslator.cxx
pqCommentEventPlayer.cxx
pqDoubleSpinBoxEventTranslator.cxx
pqEventDispatcher.cxx
pqEventObserver.cxx
......@@ -143,6 +162,7 @@ SET(QtTesting_SOURCES
pqNativeFileDialogEventPlayer.cxx
pqNativeFileDialogEventTranslator.cxx
pqObjectNaming.cxx
pqPlayBackEventsDialog.cxx
pqRecordEventsDialog.cxx
pqSpinBoxEventTranslator.cxx
pqStdoutEventObserver.cxx
......@@ -172,6 +192,7 @@ SET(QtTesting_DEVEL_HEADERS
pqBasicWidgetEventPlayer.h
pqBasicWidgetEventTranslator.h
pqComboBoxEventTranslator.h
pqCommentEventPlayer.h
pqDoubleSpinBoxEventTranslator.h
pqEventDispatcher.h
pqEventObserver.h
......@@ -183,6 +204,7 @@ SET(QtTesting_DEVEL_HEADERS
pqNativeFileDialogEventPlayer.h
pqNativeFileDialogEventTranslator.h
pqObjectNaming.h
pqPlayBackEventsDialog.h
pqRecordEventsDialog.h
pqSpinBoxEventTranslator.h
pqStdoutEventObserver.h
......@@ -203,6 +225,7 @@ ADD_LIBRARY(QtTesting
${QtTesting_SOURCES}
${MOC_BUILT_SOURCES}
${UI_BUILT_SOURCES}
${QRC_BUILT_SOURCES}
${PYTHON_SRCS}
)
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="159.60748"
height="159.60748"
id="svg2046"
sodipodi:version="0.32"
inkscape:version="0.44"
version="1.0"
sodipodi:docbase="C:\Documents and Settings\Molumen\Desktop"
sodipodi:docname="round_error_warning_icon.svg">
<defs
id="defs2048">
<linearGradient
inkscape:collect="always"
id="linearGradient5190">
<stop
style="stop-color:#ffffff;stop-opacity:1"
offset="0"
id="stop5192" />
<stop
style="stop-color:#ff0000;stop-opacity:1"
offset="1"
id="stop5194" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5190"
id="linearGradient2109"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.312273,0,0,0.320491,127.55,434.3769)"
x1="264.582"
y1="296.37491"
x2="380.6846"
y2="553.74487" />
<linearGradient
inkscape:collect="always"
id="linearGradient5197">
<stop
style="stop-color:#ffffff;stop-opacity:1"
offset="0"
id="stop5199" />
<stop
style="stop-color:#ff0000;stop-opacity:1"
offset="1"
id="stop5201" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5197"
id="linearGradient2107"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-0.301633,8.082223e-2,-8.294933e-2,-0.30957,402.8575,730.1118)"
x1="249.48328"
y1="262.87494"
x2="272.02597"
y2="427.54285" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="10000"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
inkscape:cx="85.853793"
inkscape:cy="82.99359"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:window-width="853"
inkscape:window-height="569"
inkscape:window-x="606"
inkscape:window-y="124" />
<metadata
id="metadata2051">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>round error warning button</dc:title>
<dc:creator>
<cc:Agent>
<dc:title>Lumen Design Studio</dc:title>
</cc:Agent>
</dc:creator>
<dc:contributor>
<cc:Agent>
<dc:title>Lumen Design Studio</dc:title>
</cc:Agent>
</dc:contributor>
<dc:description>error warning icon</dc:description>
<dc:subject>
<rdf:Bag>
<rdf:li>error</rdf:li>
<rdf:li>icon</rdf:li>
<rdf:li>button</rdf:li>
<rdf:li>red</rdf:li>
<rdf:li>stop</rdf:li>
<rdf:li>no</rdf:li>
<rdf:li>warning</rdf:li>
<rdf:li>negative</rdf:li>
<rdf:li>delete</rdf:li>
<rdf:li>cancel</rdf:li>
</rdf:Bag>
</dc:subject>
<cc:license
rdf:resource="http://web.resource.org/cc/PublicDomain" />
</cc:Work>
<cc:License
rdf:about="http://web.resource.org/cc/PublicDomain">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-311.6248,-429.7013)">
<g
id="g2100"
transform="matrix(0.9,0,0,0.9,170.4421,-31.11303)">
<path
sodipodi:type="arc"
style="fill:red;fill-opacity:1;fill-rule:evenodd;stroke:#cb0000;stroke-width:20.127882;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path2174"
sodipodi:cx="384.28571"
sodipodi:cy="559.50507"
sodipodi:rx="250"
sodipodi:ry="250"
d="M 634.28571 559.50507 A 250 250 0 1 1 134.28571,559.50507 A 250 250 0 1 1 634.28571 559.50507 z"
transform="matrix(0.306862,0,0,0.306862,127.6178,428.9959)" />
<path
style="fill:url(#linearGradient2107);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="M 264.19015,668.93136 C 283.23679,663.82784 298.36338,651.27316 307.41885,635.10742 C 322.12654,600.28933 267.25204,681.80733 221.92757,666.99805 C 235.1036,671.83026 249.74086,672.80304 264.19015,668.93136 z "
id="path2540"
sodipodi:nodetypes="cccc" />
<path
sodipodi:nodetypes="ccccc"
id="path2197"
d="M 245.65747,529.36222 C 206.22043,529.36222 174.21527,562.20957 174.21527,602.68438 C 174.21527,608.15829 174.82272,613.48618 175.93277,618.61875 C 215.13788,543.15095 257.37836,590.65582 311.83982,575.07214 C 301.20439,548.27438 275.57549,529.36222 245.65747,529.36222 z "
style="fill:url(#linearGradient2109);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
sodipodi:nodetypes="ccccccccccccc"
id="text2705"
d="M 267.42338,640.03739 L 245.74431,618.35831 L 223.86132,640.24129 L 205.98576,622.36573 L 227.86874,600.48275 L 206.18966,578.80367 L 223.58945,561.40388 L 245.26853,583.08296 L 267.21948,561.13201 L 285.09504,579.00757 L 263.14409,600.95853 L 284.82317,622.6376 L 267.42338,640.03739"
style="font-size:660.22442627px;font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;line-height:100%;writing-mode:lr-tb;text-anchor:start;opacity:0.73529412;fill:white;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Arial" />
<path
id="text2713"
d="M 267.29788,637.00578 L 245.71038,615.41828 L 223.95289,637.17577 L 209.05128,622.27415 L 230.80877,600.51667 L 209.22127,578.92917 L 223.72626,564.42418 L 245.31376,586.01168 L 267.1279,564.19754 L 282.02951,579.09915 L 260.21537,600.91329 L 281.80287,622.50079 L 267.29788,637.00578"
style="font-size:550.38305664px;font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:white;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Arial" />
</g>
</g>
</svg>
<RCC>
<qresource prefix="/">
<file>Icons/frameForward.png</file>
<file>Icons/pause.png</file>
<file>Icons/repeat.png</file>
<file>Icons/timePlay.png</file>
<file>Icons/stop.png</file>
<file>Icons/clear.svg</file>
<file>Icons/info.png</file>
</qresource>
</RCC>
<RCC>
<qresource prefix="/">
<file>Icons/frameForward.png</file>
<file>Icons/pause.png</file>
<file>Icons/repeat.png</file>
<file>Icons/timePlay.png</file>
<file>Icons/stop.png</file>
</qresource>
</RCC>
......@@ -44,6 +44,8 @@ It is not registered by default, and user can register with their own 3d view ty
class QTTESTING_EXPORT pq3DViewEventPlayer :
public pqWidgetEventPlayer
{
Q_OBJECT
public:
pq3DViewEventPlayer(const QByteArray& classname, QObject* p = 0);
......
......@@ -46,6 +46,8 @@ Concrete implementation of pqWidgetEventPlayer that handles playback of "activat
class QTTESTING_EXPORT pqAbstractActivateEventPlayer :
public pqWidgetEventPlayer
{
Q_OBJECT
public:
pqAbstractActivateEventPlayer(QObject* p = 0);
......
......@@ -43,6 +43,8 @@ Concrete implementation of pqWidgetEventPlayer that translates high-level ParaVi
class QTTESTING_EXPORT pqAbstractBooleanEventPlayer :
public pqWidgetEventPlayer
{
Q_OBJECT
public:
pqAbstractBooleanEventPlayer(QObject* p=0);
......
......@@ -44,6 +44,8 @@ Concrete implementation of pqWidgetEventPlayer that translates high-level ParaVi
class QTTESTING_EXPORT pqAbstractDoubleEventPlayer :
public pqWidgetEventPlayer
{
Q_OBJECT
public:
pqAbstractDoubleEventPlayer(QObject* p=0);
......
......@@ -44,6 +44,8 @@ Concrete implementation of pqWidgetEventPlayer that translates high-level ParaVi
class pqAbstractIntEventPlayer :
public pqWidgetEventPlayer
{
Q_OBJECT
public:
pqAbstractIntEventPlayer(QObject* p=0);
......
......@@ -44,6 +44,8 @@ Concrete implementation of pqWidgetEventPlayer that translates high-level ParaVi
class pqAbstractItemViewEventPlayer :
public pqWidgetEventPlayer
{
Q_OBJECT
public:
pqAbstractItemViewEventPlayer(QObject* p=0);
......
......@@ -42,6 +42,8 @@ Concrete implementation of pqWidgetEventPlayer that translates high-level ParaVi
class pqAbstractMiscellaneousEventPlayer :
public pqWidgetEventPlayer
{
Q_OBJECT
public:
pqAbstractMiscellaneousEventPlayer(QObject* p=0);
......
......@@ -44,6 +44,8 @@ Concrete implementation of pqWidgetEventPlayer that translates high-level ParaVi
class pqAbstractStringEventPlayer :
public pqWidgetEventPlayer
{
Q_OBJECT
public:
pqAbstractStringEventPlayer(QObject* p=0);
......
......@@ -43,6 +43,8 @@ Concrete implementation of pqWidgetEventPlayer that handles playback of "activat
class pqBasicWidgetEventPlayer :
public pqWidgetEventPlayer
{
Q_OBJECT
public:
pqBasicWidgetEventPlayer(QObject* p=0);
......
/*=========================================================================
Program: ParaView
Module: pqNativeFileDialogEventPlayer.h
Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include "pqCommentEventPlayer.h"
// ----------------------------------------------------------------------------
pqCommentEventPlayer::pqCommentEventPlayer(QObject* parent)
: pqWidgetEventPlayer(parent)
{
this->CommentEnabled = false;
}
// ----------------------------------------------------------------------------
pqCommentEventPlayer::~pqCommentEventPlayer()
{
}
// ----------------------------------------------------------------------------
void pqCommentEventPlayer::setCommentEnabled(bool value)
{
this->CommentEnabled = value;
}
// ----------------------------------------------------------------------------
bool pqCommentEventPlayer::isCommentEnabled() const
{
return this->CommentEnabled;
}
// ----------------------------------------------------------------------------
bool pqCommentEventPlayer::playEvent(QObject* Object,
const QString &Command,
const QString &Arguments,
bool &Error)
{
if (Command != "comment")
{
return false;
}
if (!this->CommentEnabled)
{
// We don't want to emit the comment but, we need to return true, to avoid
// an error.
return true;
}
emit this->comment(Arguments);
return true;
}
/*=========================================================================
Program: ParaView
Module: pqNativeFileDialogEventPlayer.h
Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#ifndef __pqCommentEventPlayer_h
#define __pqCommentEventPlayer_h
// QtTesting includes
#include "pqWidgetEventPlayer.h"
/// This class is a comment class.
/// Do no action on Object.
/// Emit comment wrote in the xml, which can be catch by someone else.
class pqCommentEventPlayer : public pqWidgetEventPlayer
{
Q_OBJECT
public:
pqCommentEventPlayer(QObject* p =0);
~pqCommentEventPlayer();
bool playEvent(QObject* Object, const QString &Command, const QString &Arguments, bool &Error);
void setCommentEnabled(bool value);
bool isCommentEnabled() const;
signals:
void comment(const QString&);
private:
pqCommentEventPlayer(const pqCommentEventPlayer&); // Not implemented
pqCommentEventPlayer& operator=(const pqCommentEventPlayer&); // Not implemented
bool CommentEnabled;
};
#endif // __pqCommentEventPlayer_h
......@@ -75,8 +75,15 @@ pqEventDispatcher::pqEventDispatcher(QObject* parentObject) :
{
this->ActiveSource = NULL;
this->ActivePlayer = NULL;
this->PlayBackStatus = false;
this->PlayingBlockingEvent = false;
this->PlayBackStatus = true;
this->PlayBackFinished = false;
this->PlayBackPaused = false;
this->PlayBackOneStep = false;
this->PlayBackStoped = false;
this->TimeStep = 1;
#ifdef __APPLE__
this->BlockTimer.setInterval(1000);
......@@ -139,6 +146,51 @@ void pqEventDispatcher::awake()
// }
}
//-----------------------------------------------------------------------------
void pqEventDispatcher::setTimeStep(int value)
{
this->TimeStep = value;
}
//-----------------------------------------------------------------------------
void pqEventDispatcher::pause()
{
this->PlayBackPaused = true;
emit this->paused();
}
//-----------------------------------------------------------------------------
void pqEventDispatcher::restart()
{
this->PlayBackPaused = false;
emit this->restarted();
}
//-----------------------------------------------------------------------------
void pqEventDispatcher::stop()
{
this->PlayBackPaused = false;
this->PlayBackFinished = true;
}
//-----------------------------------------------------------------------------
bool pqEventDispatcher::isPaused() const
{
return this->PlayBackPaused;
}
//-----------------------------------------------------------------------------
bool pqEventDispatcher::status() const
{
return this->PlayBackStatus;
}
//-----------------------------------------------------------------------------
void pqEventDispatcher::oneStep()
{
this->PlayBackOneStep = true;
}
//-----------------------------------------------------------------------------
bool pqEventDispatcher::playEvents(pqEventSource& source, pqEventPlayer& player)
{
......@@ -148,8 +200,6 @@ bool pqEventDispatcher::playEvents(pqEventSource& source, pqEventPlayer& player)
return false;
}
emit this->started();
this->ActiveSource = &source;
this->ActivePlayer = &player;
......@@ -160,7 +210,6 @@ bool pqEventDispatcher::playEvents(pqEventSource& source, pqEventPlayer& player)
QObject::connect(QAbstractEventDispatcher::instance(), SIGNAL(awake()),
this, SLOT(awake()));
// This is how the playback logic works:
// * In here, we continuously keep on playing one event after another until
// we are done processing all the events.
......@@ -176,7 +225,23 @@ bool pqEventDispatcher::playEvents(pqEventSource& source, pqEventPlayer& player)
this->PlayBackFinished = false;
while (!this->PlayBackFinished)
{
this->playEvent();
qDebug() << "while Loop";
if(!this->PlayBackPaused)
{
this->playEvent();
}
else
{
if (this->PlayBackOneStep)
{
this->PlayBackOneStep = false;
this->playEvent();
}
else
{
this->processEventsAndWait(100);
}
}
}
this->ActiveSource = NULL;
this->ActivePlayer = NULL;
......@@ -186,14 +251,19 @@ bool pqEventDispatcher::playEvents(pqEventSource& source, pqEventPlayer& player)
QObject::disconnect(QAbstractEventDispatcher::instance(), SIGNAL(awake()),
this, SLOT(awake()));
emit this->stopped();
qDebug() << "About to Stop Dispatcher";
return this->PlayBackStatus;
}
//-----------------------------------------------------------------------------
void pqEventDispatcher::playEventOnBlocking()
{
// if(this->PlayingBlockingEvent)
// {
// qDebug() << "Event blocking already playing ....";
// return;
// }
if (pqEventDispatcher::DeferMenuTimeouts)
{
this->BlockTimer.start();
......@@ -208,6 +278,7 @@ void pqEventDispatcher::playEventOnBlocking()
// {
// this->BlockTimer.start();
// }
this->PlayingBlockingEvent = false;
}
//-----------------------------------------------------------------------------
......@@ -283,12 +354,14 @@ void pqEventDispatcher::playEvent(int indent)
<< QString().fill(' ', 4*indent).toStdString().c_str()
<< local_counter << ": Done" << endl;
}
if (error)
{
this->PlayBackStatus = false;
this->PlayBackFinished = true;
return;
}
}
//-----------------------------------------------------------------------------
......@@ -298,7 +371,7 @@ void pqEventDispatcher::processEventsAndWait(int ms)
pqEventDispatcher::DeferMenuTimeouts = true;
if (ms > 0)
{
ms = (ms < 100) ? 100 : ms;
// ms = (ms < 100) ? 100 : ms;
QApplication::processEvents();
QEventLoop loop;
QTimer::singleShot(ms, &loop, SLOT(quit()));
......
......@@ -99,12 +99,18 @@ public:
/// event dispatch.
static void registerTimer(QTimer* timer);
/// Return if the Dispatcher is not playing events
bool isPaused() const;
/// Return Dispatcher's status
bool status() const;
signals:
/// signal when playback starts
void started();
/// signal when playback stops
void stopped();
/// signal when playback starts
void restarted();
/// signal when playback pauses
void paused();
protected slots:
/// Plays a single event. this->PlayBackFinished and this->PlayBackStatus are
......@@ -118,10 +124,24 @@ protected slots:
/// Called when the mainThread wakes up.
void awake();
public slots:
/// Change the TimeStep
void setTimeStep(int value);
/// Method to be able to stop/pause/play the current playback script
void pause();
void restart();
void stop();
void oneStep();
protected:
bool PlayingBlockingEvent;
bool PlayBackFinished;
bool PlayBackPaused;
bool PlayBackStatus;
bool PlayBackOneStep;
bool PlayBackStoped;
static bool DeferMenuTimeouts;
int TimeStep;
pqEventSource* ActiveSource;
pqEventPlayer* ActivePlayer;
......
......@@ -40,6 +40,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqAbstractMiscellaneousEventPlayer.h"