[vlmc-devel] commit: Clip: Fix parent mrl when using workspace. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Sun Jun 20 23:50:35 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Sun Jun 20 23:36:29 2010 +0200| [5e64c2a3deb5330d6dec382021517f8fe5d781dc] | committer: Hugo Beauzée-Luyssen 

Clip: Fix parent mrl when using workspace.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=5e64c2a3deb5330d6dec382021517f8fe5d781dc
---

 src/Library/MediaContainer.cpp |    6 ++++++
 src/Media/Clip.cpp             |    8 +++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/Library/MediaContainer.cpp b/src/Library/MediaContainer.cpp
index b90f1b9..08f10bc 100644
--- a/src/Library/MediaContainer.cpp
+++ b/src/Library/MediaContainer.cpp
@@ -29,6 +29,8 @@
 #include "MediaContainer.h"
 #include "Media.h"
 #include "MetaDataManager.h"
+#include "SettingsManager.h"
+#include "Workspace.h"
 
 #include <QtDebug>
 
@@ -203,6 +205,10 @@ MediaContainer::load( const QDomElement &clips, MediaContainer *parentMC )
         if ( clip.hasAttribute( "media" ) == true )
         {
             QString media = clip.attribute( "media" );
+
+            //Handle workspace stuff.
+            if ( media.startsWith( Workspace::workspacePrefix ) == true )
+                media = media.replace( Workspace::workspacePrefix, VLMC_PROJECT_GET_STRING( "general/ProjectDir" ) );
             if ( m_medias.contains( media ) == true )
             {
                 Media*  m = m_medias[media];
diff --git a/src/Media/Clip.cpp b/src/Media/Clip.cpp
index de81b22..db02339 100644
--- a/src/Media/Clip.cpp
+++ b/src/Media/Clip.cpp
@@ -29,6 +29,7 @@
 #include "Clip.h"
 #include "Library.h"
 #include "Media.h"
+#include "Workspace.h"
 
 const int   Clip::DefaultFPS = 30;
 
@@ -229,7 +230,12 @@ Clip::save( QXmlStreamWriter &project )
 {
     project.writeStartElement( "clip" );
     if ( isRootClip() == true )
-        project.writeAttribute( "media", m_media->fileInfo()->absoluteFilePath() );
+    {
+        if ( m_media->isInWorkspace() == true )
+            project.writeAttribute( "media", Workspace::pathInProjectDir( m_media ) );
+        else
+            project.writeAttribute( "media", m_media->fileInfo()->absoluteFilePath() );
+    }
     else
     {
         project.writeAttribute( "parent", m_parent->uuid() );



More information about the Vlmc-devel mailing list