[vlmc-devel] Workflow: Save/Load linked clips

Yikai Lu git at videolan.org
Sat Jul 23 17:12:23 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sat Jul 23 23:15:39 2016 +0900| [30d7197c610e4d446d9232758a4799b460d71cfb] | committer: Yikai Lu

Workflow: Save/Load linked clips

> https://code.videolan.org/videolan/vlmc/commit/30d7197c610e4d446d9232758a4799b460d71cfb
---

 src/Workflow/TrackWorkflow.cpp | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/Workflow/TrackWorkflow.cpp b/src/Workflow/TrackWorkflow.cpp
index a1d52cb..d8d4a1c 100644
--- a/src/Workflow/TrackWorkflow.cpp
+++ b/src/Workflow/TrackWorkflow.cpp
@@ -215,17 +215,12 @@ TrackWorkflow::toVariant() const
     for ( auto it = m_clips.begin(); it != m_clips.end(); ++it )
     {
         auto    clip = it.value();
-        QVariantHash h;
-        h.insert( "parent", clip->parent()->uuid().toString() );
-        h.insert( "begin", clip->begin() );
-        h.insert( "end", clip->end() );
-        h.insert( "formats", (int)clip->formats() );
-        h.insert( "filters", EffectHelper::toVariant( clip->input() ) );
+        auto    h = clip->toVariant().toHash();
         h.insert( "startFrame", it.key() );
         l << h;
     }
     QVariantHash h{ { "clips", l }, { "filters", EffectHelper::toVariant( m_multitrack ) } };
-    return QVariant( h );
+    return h;
 }
 
 void
@@ -239,7 +234,15 @@ TrackWorkflow::loadFromVariant( const QVariant &variant )
                           m["end"].toULongLong()
                          );
         c->setFormats( (Clip::Formats)m["formats"].toInt() );
+        c->setUuid( m["uuid"].toString() );
+
+        auto isLinked = m["linked"].toBool();
+        c->setLinked( isLinked );
+        if ( isLinked == true )
+            c->setLinkedClipUuid( m["linkedClip"].toString() );
+
         EffectHelper::loadFromVariant( m["filters"], c->input() );
+
         addClip( c, m["startFrame"].toLongLong() );
         emit Core::instance()->workflow()->clipAdded( c->uuid().toString() );
     }



More information about the Vlmc-devel mailing list