[vlmc-devel] MainWorkflow: Add createClip and deleteClip functions

Yikai Lu git at videolan.org
Wed Jun 1 18:15:09 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Tue May 10 17:32:25 2016 +0900| [79103d945b2f4ed95276c9138b0ff2708dcc3f6a] | committer: Hugo Beauzée-Luyssen

MainWorkflow: Add createClip and deleteClip functions

This is used to create/delete subclips which are only used in a timeline.

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> https://code.videolan.org/videolan/vlmc/commit/79103d945b2f4ed95276c9138b0ff2708dcc3f6a
---

 src/Workflow/MainWorkflow.cpp | 20 ++++++++++++++++++++
 src/Workflow/MainWorkflow.h   | 13 +++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index c0407fe..6a9c08b 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -342,6 +342,26 @@ MainWorkflow::trackCount() const
     return m_trackCount;
 }
 
+Clip*
+MainWorkflow::createClip( const QUuid& uuid )
+{
+    Clip* clip = Core::instance()->library()->clip( uuid );
+    if ( clip == nullptr )
+    {
+        vlmcCritical() << "Couldn't find an acceptable parent to be added.";
+        return nullptr;
+    }
+    auto newClip = new Clip( clip );
+    m_mediaContainer->addClip( newClip );
+    return newClip;
+}
+
+void
+MainWorkflow::deleteClip( const QUuid& uuid )
+{
+    m_mediaContainer->deleteClip( uuid );
+}
+
 void
 MainWorkflow::preSave()
 {
diff --git a/src/Workflow/MainWorkflow.h b/src/Workflow/MainWorkflow.h
index fce06ab..0d5d76a 100644
--- a/src/Workflow/MainWorkflow.h
+++ b/src/Workflow/MainWorkflow.h
@@ -257,6 +257,19 @@ class   MainWorkflow : public QObject
          */
         quint32                 trackCount() const;
 
+        /**
+         * \brief       Create a clip from a parent clip's uuid.
+         *
+         * The clip will be added to this MediaContainer, not to the Library.
+         * The parent clip should be in the Library.
+         */
+        Clip*                   createClip( const QUuid& uuid );
+
+        /**
+         * \brief       Delete a clip.
+         */
+        void                    deleteClip( const QUuid& uuid );
+
     private:
         /**
          *  \brief  Compute the length of the workflow.



More information about the Vlmc-devel mailing list