Commit 34bd55c7 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Adding error check when loading a project.

The restored file doesn't always exist... (for instance, you didn't remount your third hard drive :D)
parent 413504f1
......@@ -27,6 +27,8 @@
*/
#include <QtDebug>
#include <QMessageBox>
#include "Library.h"
#include "MetaDataManager.h"
......@@ -128,6 +130,11 @@ void Library::loadMedia( const QString& path, const QUuid& uuid )
return ;
}
}
if ( QFile::exists( path ) == false )
{
QMessageBox::warning( NULL, tr( "Import error" ), tr( "Can't open file :" ) + path );
return ;
}
Media* media = new Media( path, uuid );
connect( media, SIGNAL( metaDataComputed( Media* ) ), this, SLOT( metaDataComputed( Media* ) ) );
MetaDataManager::getInstance()->computeMediaMetadata( media );
......
......@@ -26,6 +26,7 @@
#include "MainWorkflow.h"
#include "TrackWorkflow.h"
#include "TrackHandler.h"
#include "Library.h"
//JUST FOR THE DEFINES !
//TODO:
......@@ -350,8 +351,11 @@ void MainWorkflow::loadProject( const QDomElement& project )
clipProperty = clipProperty.nextSibling().toElement();
}
Clip* c = new Clip( parent, begin, end );
addClip( c, trackId, startPos, trackType );
if ( Library::getInstance()->getMedia( parent ) != NULL )
{
Clip* c = new Clip( parent, begin, end );
addClip( c, trackId, startPos, trackType );
}
clip = clip.nextSibling().toElement();
}
......@@ -371,7 +375,6 @@ void MainWorkflow::saveProject( QDomDocument& doc, QDomElement& rootNode
void MainWorkflow::clear()
{
qDebug() << "main workflow cleared";
for ( unsigned int i = 0; i < MainWorkflow::NbTrackType; ++i )
m_tracks[i]->clear();
emit cleared();
......
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