Commit 60046966 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

WorkflowRenderer: Load effects from the project file.

Removed forgotten debug.
parent f41201e0
......@@ -54,7 +54,7 @@ public:
TracksRuler* tracksRuler() { return m_tracksRuler; }
/// Return a pointer to the Timeline instance (singleton).
static Timeline* getInstance() { return m_instance; }
const WorkflowRenderer *renderer() const { return m_renderer; }
WorkflowRenderer *renderer() { return m_renderer; }
void save( QXmlStreamWriter& project ) const;
void load( const QDomElement &root );
......
......@@ -150,6 +150,7 @@ ProjectManager::loadProject( const QString& fileName )
//Load settings first, as it contains some informations about the workspace.
SettingsManager::getInstance()->load( root );
SettingsManager::getInstance()->setValue( "general/Workspace", fInfo.absolutePath(), SettingsManager::Project );
Timeline::getInstance()->renderer()->loadProject( root );
Library::getInstance()->loadProject( root );
}
......
......@@ -20,12 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <QtDebug>
#include <QThread>
#include <QWaitCondition>
//Allow PRId64 to be defined:
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include "WorkflowRenderer.h"
#include "Clip.h"
#include "EffectInstance.h"
......@@ -34,10 +32,15 @@
#include "SettingsManager.h"
#include "VLCMedia.h"
#include "VLCMediaPlayer.h"
#include "WorkflowRenderer.h"
#include "Workflow/Types.h"
#include "timeline/Timeline.h"
#include <QDomElement>
#include <QtDebug>
#include <QThread>
#include <QWaitCondition>
#include <inttypes.h>
WorkflowRenderer::WorkflowRenderer() :
m_mainWorkflow( MainWorkflow::getInstance() ),
m_media( NULL ),
......@@ -391,7 +394,6 @@ void
WorkflowRenderer::appendEffect( Effect *effect, qint64 start, qint64 end )
{
EffectInstance *effectInstance = effect->createInstance();
qDebug() << "width:" << m_width << m_height;
QWriteLocker lock( m_effectsLock );
m_effects.push_back( new EffectsEngine::EffectHelper( effectInstance, start, end ) );
}
......@@ -407,6 +409,33 @@ WorkflowRenderer::saveProject( QXmlStreamWriter &project ) const
project.writeEndElement();
}
void
WorkflowRenderer::loadProject( const QDomElement &project )
{
QDomElement renderer = project.firstChildElement( "renderer" );
if ( renderer.isNull() == true )
return ;
QDomElement effects = renderer.firstChildElement( "effects" );
if ( effects.isNull() == true )
return ;
QDomElement effect = effects.firstChildElement( "effect" );
while ( effect.isNull() == false )
{
if ( effect.hasAttribute( "name" ) == true &&
effect.hasAttribute( "start" ) == true &&
effect.hasAttribute( "end" ) == true )
{
Effect *e = EffectsEngine::getInstance()->effect( effect.attribute( "name" ) );
if ( e != NULL )
appendEffect( e, effect.attribute( "start" ).toLongLong(),
effect.attribute( "end" ).toLongLong() );
else
qCritical() << "Renderer: Can't load effect" << effect.attribute( "name" );
}
effect = effect.nextSibling().toElement();
}
}
/////////////////////////////////////////////////////////////////////
/////SLOTS :
/////////////////////////////////////////////////////////////////////
......
......@@ -134,7 +134,7 @@ class WorkflowRenderer : public GenericRenderer
void appendEffect( Effect* effect, qint64 start = 0, qint64 end = -1 );
void saveProject( QXmlStreamWriter &project ) const;
void loadProject( const QDomElement& project );
private:
/**
* \brief This is a subpart of the togglePlayPause( bool ) method
......
......@@ -361,7 +361,7 @@ MainWorkflow::loadProject( const QDomElement &root )
if ( e != NULL )
addEffect( e, trackId, uuid, type );
else
qCritical() << "Can't load effect" << effect.attribute( "name" );
qCritical() << "Workflow: Can't load effect" << effect.attribute( "name" );
}
effect = effect.nextSibling().toElement();
}
......
......@@ -212,7 +212,6 @@ VideoClipWorkflow::flushComputedBuffers()
bool
VideoClipWorkflow::appendEffect( Effect *effect, qint64 start, qint64 end )
{
qDebug() << "Adding effect:" << effect;
if ( effect->type() != Effect::Filter )
{
qWarning() << "VideoClipWorkflow does not handle non filter effects.";
......
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