Commit 91724201 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

MainWorkflow: saving is functionnal again.

parent 234fa727
......@@ -230,7 +230,7 @@ void ProjectManager::__saveProject( const QString &fileName )
project.writeStartElement( "vlmc" );
Library::getInstance()->saveProject( project );
// MainWorkflow::getInstance()->saveProject( doc, rootNode );
MainWorkflow::getInstance()->saveProject( project );
// SettingsManager::getInstance()->save( doc, rootNode );
project.writeEndElement();
......
......@@ -34,6 +34,7 @@
#include "SettingsManager.h"
#include <QDomElement>
#include <QXmlStreamWriter>
LightVideoFrame *MainWorkflow::blackOutput = NULL;
......@@ -379,14 +380,14 @@ MainWorkflow::loadProject( const QDomElement &project )
}
void
MainWorkflow::saveProject( QDomDocument& doc, QDomElement& rootNode )
MainWorkflow::saveProject( QXmlStreamWriter& project ) const
{
QDomElement project = doc.createElement( "timeline" );
project.writeStartElement( "timeline" );
for ( unsigned int i = 0; i < MainWorkflow::NbTrackType; ++i )
{
m_tracks[i]->save( doc, project );
m_tracks[i]->save( project );
}
rootNode.appendChild( project );
project.writeEndElement();
}
void
......
......@@ -31,6 +31,7 @@ class QDomDocument;
class QDomElement;
class QMutex;
class QReadWriteLock;
class QXmlStreamWriter;
class Clip;
class EffectsEngine;
......@@ -412,12 +413,11 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
*/
void loadProject( const QDomElement& project );
/**
* \brief Save the project on a given node, for a given document.
* \brief Save the project on a XML stream.
*
* \param doc A reference to the document.
* \param rootNode A reference on the node that will contain the timeline.
* \param project The XML stream representing the project
*/
void saveProject( QDomDocument& doc, QDomElement& rootNode );
void saveProject( QXmlStreamWriter& project ) const;
/**
* \brief Clear the workflow.
*
......
......@@ -27,6 +27,7 @@
#include <QDomDocument>
#include <QDomElement>
#include <QXmlStreamWriter>
LightVideoFrame* TrackHandler::nullOutput = NULL;
......@@ -276,18 +277,17 @@ TrackHandler::getTrackCount() const
}
void
TrackHandler::save( QDomDocument& doc, QDomElement& timelineNode ) const
TrackHandler::save( QXmlStreamWriter& project ) const
{
for ( unsigned int i = 0; i < m_trackCount; ++i)
{
if ( m_tracks[i]->getLength() > 0 )
{
QDomElement trackNode = doc.createElement( "track" );
trackNode.setAttribute( "id", i );
m_tracks[i]->save( doc, trackNode );
timelineNode.appendChild( trackNode );
project.writeStartElement( "track" );
project.writeAttribute( "type", QString::number( (int)m_trackType ) );
project.writeAttribute( "id", QString::number( i ) );
m_tracks[i]->save( project );
project.writeEndElement();
}
}
}
......
......@@ -33,6 +33,8 @@
class EffectEngine;
class TrackWorkflow;
class QXmlStreamWriter;
class TrackHandler : public QObject
{
Q_OBJECT
......@@ -72,7 +74,7 @@ class TrackHandler : public QObject
bool endIsReached() const;
void save( QDomDocument& doc, QDomElement& timelineNode ) const;
void save( QXmlStreamWriter& project ) const;
/**
* \brief Will configure the track workflow so they render only one frame
......
......@@ -29,9 +29,11 @@
#include "AudioClipWorkflow.h"
#include "Clip.h"
#include "Media.h"
#include <QReadWriteLock>
#include <QDomDocument>
#include <QDomElement>
#include <QXmlStreamWriter>
TrackWorkflow::TrackWorkflow( unsigned int trackId, MainWorkflow::TrackType type ) :
m_trackId( trackId ),
......@@ -386,7 +388,7 @@ ClipWorkflow* TrackWorkflow::removeClipWorkflow( const QUuid& id )
return NULL;
}
void TrackWorkflow::save( QDomDocument& doc, QDomElement& trackNode ) const
void TrackWorkflow::save( QXmlStreamWriter& project ) const
{
QReadLocker lock( m_clipsLock );
......@@ -395,44 +397,12 @@ void TrackWorkflow::save( QDomDocument& doc, QDomElement& trackNode ) const
for ( ; it != end ; ++it )
{
QDomElement clipNode = doc.createElement( "clip" );
{
QDomElement parent = doc.createElement( "parent" );
QDomCharacterData text = doc.createTextNode( it.value()->getClip()->getMedia()->baseClip()->uuid().toString() );
parent.appendChild( text );
clipNode.appendChild( parent );
}
{
QDomElement startFrame = doc.createElement( "startFrame" );
QDomCharacterData text = doc.createTextNode( QString::number( it.key() ) );
startFrame.appendChild( text );
clipNode.appendChild( startFrame );
}
{
QDomElement begin = doc.createElement( "begin" );
QDomCharacterData text = doc.createTextNode( QString::number( it.value()->getClip()->begin() ) );
begin.appendChild( text );
clipNode.appendChild( begin );
}
{
QDomElement end = doc.createElement( "end" );
QDomCharacterData text = doc.createTextNode( QString::number( it.value()->getClip()->end() ) );
end.appendChild( text );
clipNode.appendChild( end );
}
{
QDomElement trackType = doc.createElement( "trackType" );
QDomCharacterData text = doc.createTextNode( QString::number( m_trackType ) );
trackType.appendChild( text );
clipNode.appendChild( trackType );
}
trackNode.appendChild( clipNode );
project.writeStartElement( "clip" );
project.writeAttribute( "uuid", it.value()->getClip()->getParent()->uuid().toString() );
project.writeAttribute( "startFrame", QString::number( it.key() ) );
project.writeAttribute( "begin", QString::number( it.value()->getClip()->begin() ) );
project.writeAttribute( "end", QString::number( it.value()->getClip()->end() ) );
project.writeEndElement();
}
}
......
......@@ -68,7 +68,7 @@ class TrackWorkflow : public QObject
//FIXME: this won't be reliable as soon as we change the fps from the configuration
static const unsigned int nbFrameBeforePreload = 60;
void save( QDomDocument& doc, QDomElement& trackNode ) const;
void save( QXmlStreamWriter& project ) const;
void clear();
void renderOneFrame();
......
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