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

Move QVariant -> Media conversion from MediaContainer to Media

Also, just convert from within the method, instead of silently adding
the media to the container
parent 43b31c9f
......@@ -72,7 +72,10 @@ void
Library::postLoad()
{
for ( const auto& var : m_settings->value( "medias" )->get().toList() )
createMediaFromVariant( var );
{
auto m = Media::fromVariant( var );
addMedia( m );
}
for ( const auto& var : m_settings->value( "clips" )->get().toList() )
createClipFromVariant( var, nullptr );
......
......@@ -193,13 +193,6 @@ MediaContainer::count() const
return m_clips.size();
}
Media*
MediaContainer::createMediaFromVariant( const QVariant& var )
{
Media* m = addMedia( QFileInfo( var.toString() ) );
return m;
}
Clip*
MediaContainer::createClipFromVariant( const QVariant &var, Clip* parent )
{
......
......@@ -121,7 +121,6 @@ protected:
Clip* m_parent;
Media* createMediaFromVariant( const QVariant& var );
Clip* createClipFromVariant( const QVariant& var, Clip* parent );
public slots:
......
......@@ -32,6 +32,7 @@
#endif
#include <QUrl>
#include <QVariant>
#include "Media.h"
......@@ -123,6 +124,11 @@ Media::input() const
return m_input.get();
}
Media* Media::fromVariant( const QVariant& v )
{
return new Media( QFileInfo( v.toString() ).absoluteFilePath() );
}
void
Media::setFilePath( const QString &filePath )
{
......
......@@ -101,6 +101,8 @@ public:
Backend::IInput* input();
const Backend::IInput* input() const;
static Media* fromVariant( const QVariant& v );
#ifdef HAVE_GUI
// This has to be called from the GUI thread.
QPixmap& snapshot();
......
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