Commit 35e26f34 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen
Browse files

emit a signal when the media library has been loaded

parent 69972249
......@@ -31,6 +31,7 @@
Library::Library()
{
m_nbMediasToLoad = -1;
}
Media* Library::getMedia( const QUuid& uuid )
......@@ -61,6 +62,12 @@ void Library::metaDataComputed( Media* media )
Clip* clip = new Clip( media );
m_clips[media->getUuid()] = clip;
emit newClipLoaded( clip );
if ( m_nbMediasToLoad >= 0 )
{
m_nbMediasToLoad.fetchAndAddAcquire( -1 );
if ( m_nbMediasToLoad <= 0 )
emit projectLoaded();
}
}
void Library::newMediaLoadingAsked( const QString& filePath, const QString& uuid )
......@@ -88,6 +95,7 @@ void Library::loadProject( const QDomElement& medias )
}
QDomElement elem = medias.firstChild().toElement();
m_nbMediasToLoad = 0;
while ( elem.isNull() == false )
{
QDomElement mediaProperty = elem.firstChild().toElement();
......@@ -105,6 +113,7 @@ void Library::loadProject( const QDomElement& medias )
qWarning() << "Unknown field" << tagName;
mediaProperty = mediaProperty.nextSibling().toElement();
}
m_nbMediasToLoad.fetchAndAddAcquire( 1 );
newMediaLoadingAsked( path, uuid );
elem = elem.nextSibling().toElement();
}
......
......@@ -62,6 +62,7 @@ private:
return NULL;
return *it;
}
QAtomicInt m_nbMediasToLoad;
public slots:
void newMediaLoadingAsked( const QString& filePath, const QString& uuid = QString() );
......@@ -77,6 +78,7 @@ signals:
void newClipLoaded( Clip* );
void newMediaLoaded( Media* );
void mediaRemoved( const QUuid& );
void projectLoaded();
friend class Singleton<Library>;
};
......
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