[vlmc-devel] Don't use Workspace to save media
Yikai Lu
git at videolan.org
Wed Apr 6 14:39:49 CEST 2016
vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Mon Apr 4 20:17:22 2016 +0900| [c210e3372e69da930730d665cd6f172031d0f2c7] | committer: Hugo Beauzée-Luyssen
Don't use Workspace to save media
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> https://code.videolan.org/videolan/vlmc/commit/c210e3372e69da930730d665cd6f172031d0f2c7
---
src/Library/Library.cpp | 8 +++-----
src/Library/Library.h | 2 +-
src/Main/Core.cpp | 2 +-
src/Project/Workspace.cpp | 13 -------------
src/Project/Workspace.h | 2 --
5 files changed, 5 insertions(+), 22 deletions(-)
diff --git a/src/Library/Library.cpp b/src/Library/Library.cpp
index db5e2bf..b560d19 100644
--- a/src/Library/Library.cpp
+++ b/src/Library/Library.cpp
@@ -40,9 +40,8 @@
#include <QHash>
#include <QUuid>
-Library::Library( Workspace *workspace )
+Library::Library()
: m_cleanState( true )
- , m_workspace( workspace )
{
}
@@ -64,8 +63,7 @@ Library::load(const QDomDocument& doc )
{
QString mrl = media.attribute( "mrl" );
- mrl = m_workspace->toAbsolutePath( mrl );
- Media* m = addMedia( mrl );
+ Media* m = addMedia( QFileInfo( mrl ) );
if ( m == nullptr )
vlmcWarning() << "Failed to load media" << mrl << "when loading project.";
else
@@ -97,7 +95,7 @@ Library::save( QXmlStreamWriter& project )
Q_ASSERT( (*it)->isRootClip() == true );
const Media* m = (*it)->getMedia();
project.writeStartElement( "media" );
- project.writeAttribute( "mrl", m_workspace->toWorkspacePath( m ) );
+ project.writeAttribute( "mrl", m->fileInfo()->absoluteFilePath() );
project.writeEndElement();
++it;
}
diff --git a/src/Library/Library.h b/src/Library/Library.h
index 162305a..0373132 100644
--- a/src/Library/Library.h
+++ b/src/Library/Library.h
@@ -53,7 +53,7 @@ class Library : public MediaContainer, public ILoadSave
Q_DISABLE_COPY( Library );
public:
- Library(Workspace* workspace);
+ Library();
virtual ~Library(){}
virtual void addMedia( Media* media );
virtual Media *addMedia( const QFileInfo &fileInfo );
diff --git a/src/Main/Core.cpp b/src/Main/Core.cpp
index 62fc7c6..42b6681 100644
--- a/src/Main/Core.cpp
+++ b/src/Main/Core.cpp
@@ -52,7 +52,7 @@ Core::Core()
m_workflow = new MainWorkflow;
m_workflowRenderer = new WorkflowRenderer( Backend::getBackend(), m_workflow );
m_undoStack = new QUndoStack;
- m_library = new Library( m_workspace );
+ m_library = new Library;
m_currentProject = new Project( m_settings );
connect( m_undoStack, &QUndoStack::cleanChanged, m_currentProject, &Project::cleanChanged );
diff --git a/src/Project/Workspace.cpp b/src/Project/Workspace.cpp
index a82bd3b..4c4b056 100644
--- a/src/Project/Workspace.cpp
+++ b/src/Project/Workspace.cpp
@@ -173,16 +173,3 @@ Workspace::isInWorkspace(const Media *media)
{
return isInWorkspace( *(media->fileInfo() ) );
}
-
-QString
-Workspace::toAbsolutePath( const QString& path )
-{
- QString res = path;
- return res.replace( Workspace::workspacePrefix, m_workspaceDir );
-}
-
-QString
-Workspace::toWorkspacePath(const Media *media)
-{
- return media->fileInfo()->absoluteFilePath().replace( m_workspaceDir, Workspace::workspacePrefix );
-}
diff --git a/src/Project/Workspace.h b/src/Project/Workspace.h
index b824d0f..e149fe4 100644
--- a/src/Project/Workspace.h
+++ b/src/Project/Workspace.h
@@ -46,8 +46,6 @@ class Workspace : public QObject, public ErrorHandler
~Workspace();
bool isInWorkspace( const QString &path );
bool isInWorkspace( const Media *media );
- QString toAbsolutePath( const QString &path );
- QString toWorkspacePath( const Media* media );
bool copyToWorkspace( Media* media );
private:
More information about the Vlmc-devel
mailing list