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

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 @@ ...@@ -27,6 +27,8 @@
*/ */
#include <QtDebug> #include <QtDebug>
#include <QMessageBox>
#include "Library.h" #include "Library.h"
#include "MetaDataManager.h" #include "MetaDataManager.h"
...@@ -128,6 +130,11 @@ void Library::loadMedia( const QString& path, const QUuid& uuid ) ...@@ -128,6 +130,11 @@ void Library::loadMedia( const QString& path, const QUuid& uuid )
return ; 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 ); Media* media = new Media( path, uuid );
connect( media, SIGNAL( metaDataComputed( Media* ) ), this, SLOT( metaDataComputed( Media* ) ) ); connect( media, SIGNAL( metaDataComputed( Media* ) ), this, SLOT( metaDataComputed( Media* ) ) );
MetaDataManager::getInstance()->computeMediaMetadata( media ); MetaDataManager::getInstance()->computeMediaMetadata( media );
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "MainWorkflow.h" #include "MainWorkflow.h"
#include "TrackWorkflow.h" #include "TrackWorkflow.h"
#include "TrackHandler.h" #include "TrackHandler.h"
#include "Library.h"
//JUST FOR THE DEFINES ! //JUST FOR THE DEFINES !
//TODO: //TODO:
...@@ -350,8 +351,11 @@ void MainWorkflow::loadProject( const QDomElement& project ) ...@@ -350,8 +351,11 @@ void MainWorkflow::loadProject( const QDomElement& project )
clipProperty = clipProperty.nextSibling().toElement(); clipProperty = clipProperty.nextSibling().toElement();
} }
Clip* c = new Clip( parent, begin, end ); if ( Library::getInstance()->getMedia( parent ) != NULL )
addClip( c, trackId, startPos, trackType ); {
Clip* c = new Clip( parent, begin, end );
addClip( c, trackId, startPos, trackType );
}
clip = clip.nextSibling().toElement(); clip = clip.nextSibling().toElement();
} }
...@@ -371,7 +375,6 @@ void MainWorkflow::saveProject( QDomDocument& doc, QDomElement& rootNode ...@@ -371,7 +375,6 @@ void MainWorkflow::saveProject( QDomDocument& doc, QDomElement& rootNode
void MainWorkflow::clear() void MainWorkflow::clear()
{ {
qDebug() << "main workflow cleared";
for ( unsigned int i = 0; i < MainWorkflow::NbTrackType; ++i ) for ( unsigned int i = 0; i < MainWorkflow::NbTrackType; ++i )
m_tracks[i]->clear(); m_tracks[i]->clear();
emit cleared(); emit cleared();
......
Supports Markdown
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