[vlmc-devel] commit: Renderer: Save the effects to the project file. ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Fri Jul 30 00:38:27 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Jul 29 23:47:42 2010 +0200| [876a7b7e925676e368e8429d6a2538eb69455aa0] | committer: Hugo Beauzée-Luyssen
Renderer: Save the effects to the project file.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=876a7b7e925676e368e8429d6a2538eb69455aa0
---
src/EffectsEngine/EffectsEngine.cpp | 20 ++++++++++++++++++++
src/EffectsEngine/EffectsEngine.h | 4 +++-
src/Gui/timeline/Timeline.h | 1 +
src/Project/ProjectManager.cpp | 3 +++
src/Renderer/WorkflowRenderer.cpp | 11 +++++++++++
src/Renderer/WorkflowRenderer.h | 2 ++
src/Workflow/VideoClipWorkflow.cpp | 16 +---------------
7 files changed, 41 insertions(+), 16 deletions(-)
diff --git a/src/EffectsEngine/EffectsEngine.cpp b/src/EffectsEngine/EffectsEngine.cpp
index d159683..5fd69c2 100644
--- a/src/EffectsEngine/EffectsEngine.cpp
+++ b/src/EffectsEngine/EffectsEngine.cpp
@@ -159,3 +159,23 @@ EffectsEngine::applyEffects( const EffectList &effects, Workflow::Frame* frame,
}
}
}
+
+void
+EffectsEngine::saveEffects( const EffectList &effects, QXmlStreamWriter &project )
+{
+ if ( effects.size() <= 0 )
+ return ;
+ EffectsEngine::EffectList::const_iterator it = effects.begin();
+ EffectsEngine::EffectList::const_iterator ite = effects.end();
+ project.writeStartElement( "effects" );
+ while ( it != ite )
+ {
+ project.writeStartElement( "effect" );
+ project.writeAttribute( "name", (*it)->effect->effect()->name() );
+ project.writeAttribute( "start", QString::number( (*it)->start ) );
+ project.writeAttribute( "end", QString::number( (*it)->end ) );
+ project.writeEndElement();
+ ++it;
+ }
+ project.writeEndElement();
+}
diff --git a/src/EffectsEngine/EffectsEngine.h b/src/EffectsEngine/EffectsEngine.h
index 839a55f..70adbdb 100644
--- a/src/EffectsEngine/EffectsEngine.h
+++ b/src/EffectsEngine/EffectsEngine.h
@@ -53,8 +53,10 @@ class EffectsEngine : public QObject, public Singleton<EffectsEngine>
bool loadEffect( const QString& fileName );
void browseDirectory( const QString& path );
- static void applyEffects( const EffectList& effects,
+ static void applyEffects( const EffectList &effects,
Workflow::Frame *frame, qint64 currentFrame );
+ static void saveEffects( const EffectList &effects, QXmlStreamWriter &project );
+
private:
EffectsEngine();
~EffectsEngine();
diff --git a/src/Gui/timeline/Timeline.h b/src/Gui/timeline/Timeline.h
index 76b4049..200b334 100644
--- a/src/Gui/timeline/Timeline.h
+++ b/src/Gui/timeline/Timeline.h
@@ -54,6 +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; }
void save( QXmlStreamWriter& project ) const;
void load( const QDomElement &root );
diff --git a/src/Project/ProjectManager.cpp b/src/Project/ProjectManager.cpp
index 0b215f7..13e75c3 100644
--- a/src/Project/ProjectManager.cpp
+++ b/src/Project/ProjectManager.cpp
@@ -27,6 +27,8 @@
#include "project/GuiProjectManager.h"
#include "ProjectManager.h"
#include "SettingsManager.h"
+#include "Timeline.h"
+#include "WorkflowRenderer.h"
#include "Workspace.h"
#include <QDir>
@@ -163,6 +165,7 @@ void ProjectManager::__saveProject( const QString &fileName )
Library::getInstance()->saveProject( project );
MainWorkflow::getInstance()->saveProject( project );
+ Timeline::getInstance()->renderer()->saveProject( project );
SettingsManager::getInstance()->save( project );
saveTimeline( project );
diff --git a/src/Renderer/WorkflowRenderer.cpp b/src/Renderer/WorkflowRenderer.cpp
index ce1f045..00142a0 100644
--- a/src/Renderer/WorkflowRenderer.cpp
+++ b/src/Renderer/WorkflowRenderer.cpp
@@ -393,6 +393,17 @@ WorkflowRenderer::appendEffect( Effect *effect, qint64 start, qint64 end )
m_effects.push_back( new EffectsEngine::EffectHelper( effectInstance, start, end ) );
}
+void
+WorkflowRenderer::saveProject( QXmlStreamWriter &project ) const
+{
+ project.writeStartElement( "renderer" );
+ {
+ QReadLocker lock( m_effectsLock );
+ EffectsEngine::getInstance()->saveEffects( m_effects, project );
+ }
+ project.writeEndElement();
+}
+
/////////////////////////////////////////////////////////////////////
/////SLOTS :
/////////////////////////////////////////////////////////////////////
diff --git a/src/Renderer/WorkflowRenderer.h b/src/Renderer/WorkflowRenderer.h
index f1f30c0..85e84ed 100644
--- a/src/Renderer/WorkflowRenderer.h
+++ b/src/Renderer/WorkflowRenderer.h
@@ -133,6 +133,8 @@ class WorkflowRenderer : public GenericRenderer
void appendEffect( Effect* effect, qint64 start = 0, qint64 end = -1 );
+ void saveProject( QXmlStreamWriter &project ) const;
+
private:
/**
* \brief This is a subpart of the togglePlayPause( bool ) method
diff --git a/src/Workflow/VideoClipWorkflow.cpp b/src/Workflow/VideoClipWorkflow.cpp
index fb5056e..98b5c44 100644
--- a/src/Workflow/VideoClipWorkflow.cpp
+++ b/src/Workflow/VideoClipWorkflow.cpp
@@ -228,21 +228,7 @@ void
VideoClipWorkflow::saveEffects( QXmlStreamWriter &project ) const
{
QReadLocker lock( m_effectsLock );
- if ( m_effects.size() <= 0 )
- return ;
- EffectsEngine::EffectList::const_iterator it = m_effects.begin();
- EffectsEngine::EffectList::const_iterator ite = m_effects.end();
- project.writeStartElement( "effects" );
- while ( it != ite )
- {
- project.writeStartElement( "effect" );
- project.writeAttribute( "name", (*it)->effect->effect()->name() );
- project.writeAttribute( "start", QString::number( (*it)->start ) );
- project.writeAttribute( "end", QString::number( (*it)->end ) );
- project.writeEndElement();
- ++it;
- }
- project.writeEndElement();
+ EffectsEngine::getInstance()->saveEffects( m_effects, project );
}
void
More information about the Vlmc-devel
mailing list