[vlmc-devel] commit: Library: Handle the workspace when loading a project. ( Hugo Beauzée-Luyssen )

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


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

Library: Handle the workspace when loading a project.

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

 src/Library/Library.cpp |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/Library/Library.cpp b/src/Library/Library.cpp
index dd2eac1..430041b 100644
--- a/src/Library/Library.cpp
+++ b/src/Library/Library.cpp
@@ -31,6 +31,8 @@
 #include "Library.h"
 #include "Media.h"
 #include "MetaDataManager.h"
+#include "SettingsManager.h"
+#include "Workspace.h"
 
 #include <QtDebug>
 #include <QDomElement>
@@ -54,7 +56,14 @@ Library::loadProject( const QDomElement& doc )
         if ( media.hasAttribute( "mrl" ) == true )
         {
             QString mrl = media.attribute( "mrl" );
-            Media* m = addMedia( mrl );
+
+            //If in workspace: compute the path in workspace
+            if ( mrl.startsWith( Workspace::workspacePrefix ) == true )
+            {
+                QString     projectPath = VLMC_PROJECT_GET_STRING( "general/ProjectDir" );
+                mrl = projectPath + '/' + mrl.mid( Workspace::workspacePrefix.length() );
+            }
+            Media*  m = addMedia( mrl );
             connect( m, SIGNAL( metaDataComputed( const Media* ) ),
                      this, SLOT( mediaLoaded( const Media* ) ), Qt::QueuedConnection );
             m_medias[mrl] = m;



More information about the Vlmc-devel mailing list