Commit db94319c authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Media/Workspace: Rework the things a bit.

parent b4737891
......@@ -27,9 +27,11 @@
*/
#include "Media.h"
#include "Clip.h"
#include "MetaDataManager.h"
#include "VLCMedia.h"
#include "Clip.h"
#include "Workspace.h"
#include <QtDebug>
#include <QUrl>
......@@ -270,12 +272,6 @@ Media::isInWorkspace() const
return m_inWorkspace;
}
void
Media::setInWorkspace(bool inWorkspace )
{
m_inWorkspace = inWorkspace;
}
void
Media::setFilePath( const QString &filePath )
{
......@@ -286,4 +282,8 @@ Media::setFilePath( const QString &filePath )
m_mrl = "file:///" + QUrl::toPercentEncoding( filePath, "/" );
else
m_mrl = "fake:///" + QUrl::toPercentEncoding( filePath, "/" );
delete m_vlcMedia;
m_vlcMedia = new LibVLCpp::Media( m_mrl );
if ( Workspace::isInProjectDir( filePath ) == true )
m_inWorkspace = true;
}
......@@ -75,6 +75,11 @@ public:
File,
Stream
};
static const QString VideoExtensions;
static const QString AudioExtensions;
static const QString ImageExtensions;
static const QString streamPrefix;
Media( const QString& filePath );
virtual ~Media();
......@@ -93,6 +98,11 @@ public:
const QFileInfo *fileInfo() const;
const QString &mrl() const;
const QString &fileName() const;
/**
* \brief Set this media's path.
*
* \param path The media path. This should be an absolute path.
*/
void setFilePath( const QString& path );
/**
......@@ -128,11 +138,8 @@ public:
int nbVideoTracks() const;
FileType fileType() const;
static const QString VideoExtensions;
static const QString AudioExtensions;
static const QString ImageExtensions;
InputType inputType() const;
static const QString streamPrefix;
void emitMetaDataComputed();
void emitAudioSpectrumComuted();
......@@ -148,7 +155,6 @@ public:
void save( QXmlStreamWriter& project );
bool isInWorkspace() const;
void setInWorkspace( bool inWorkspace );
private:
void setFileType();
......
......@@ -26,6 +26,7 @@
#include "Library.h"
#include "Media.h"
#include "Project/WorkspaceWorker.h"
#include "SettingsManager.h"
#include <QtDebug>
......@@ -67,5 +68,12 @@ void
Workspace::copyTerminated( Media *media, QString dest )
{
media->setFilePath( dest );
media->setInWorkspace( true );
}
bool
Workspace::isInProjectDir( const QString &filePath )
{
const QString projectDir = VLMC_PROJECT_GET_STRING( "general/ProjectDir" );
return ( filePath.startsWith( projectDir ) );
}
......@@ -36,6 +36,7 @@ class Workspace : public QObject, public Singleton<Workspace>
public:
static const QString workspacePrefix;
static bool isInProjectDir( const QString& filePath );
private:
Workspace();
~Workspace(){}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment