Commit 69d1076c authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Refactored pause/unpause

parent 748ddacd
......@@ -120,4 +120,16 @@ class PauseAction : public WorkflowAction
}
};
class UnpauseAction : public WorkflowAction
{
public:
UnpauseAction( MainWorkflow* mainWorkflow ) : WorkflowAction( mainWorkflow )
{
}
void execute()
{
m_mainWorkflow->unpause();
}
};
#endif // STACKEDACTION_H
......@@ -155,30 +155,12 @@ void WorkflowRenderer::previousFrame()
m_mainWorkflow->previousFrame();
}
void WorkflowRenderer::pauseMainWorkflow()
{
if ( m_paused == true )
return ;
QMutexLocker lock( m_condMutex );
m_mainWorkflow->pause();
m_waitCond->wait( m_condMutex );
}
void WorkflowRenderer::unpauseMainWorkflow()
{
if ( m_paused == false )
return ;
m_mainWorkflow->unpause();
}
void WorkflowRenderer::mainWorkflowPaused()
{
m_paused = true;
{
QMutexLocker lock( m_condMutex );
}
m_waitCond->wakeAll();
emit paused();
}
......@@ -203,10 +185,9 @@ void WorkflowRenderer::internalPlayPause( bool forcePause )
{
if ( m_paused == true && forcePause == false )
{
if ( m_paused == true )
{
unpauseMainWorkflow();
}
StackedAction* act = new UnpauseAction( m_mainWorkflow );
QMutexLocker lock( m_actionsMutex );
m_actions.addAction( act );
}
else
{
......@@ -357,23 +338,17 @@ void WorkflowRenderer::__frameChanged( qint64 frame, MainWorkflow::FrameC
emit frameChanged( frame, reason );
}
void WorkflowRenderer::__videoPaused()
{
pauseMainWorkflow();
}
void WorkflowRenderer::__videoPlaying()
{
if ( m_paused == true )
unpauseMainWorkflow();
else
{
m_paused = false;
emit playing();
}
emit playing();
}
void WorkflowRenderer::__videoStopped()
{
emit endReached();
}
void WorkflowRenderer::__videoPaused()
{
emit paused();
}
......@@ -60,8 +60,6 @@ class WorkflowRenderer : public GenericRenderer
static void unlock( void* datas );
private:
void internalPlayPause( bool forcePause );
void pauseMainWorkflow();
void unpauseMainWorkflow();
virtual void startPreview();
void checkActions();
......
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