Commit 1fcf654f authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Library/Import: Media import is now functionnal again.

parent 6baffde4
......@@ -285,6 +285,8 @@ ImportController::accept()
m_mediaListController->cleanAll();
m_preview->stop();
collapseAllButCurrentPath();
foreach ( Media* media, m_temporaryMedias.values() )
Library::getInstance()->addMedia( media );
done( Accepted );
}
......
......@@ -27,8 +27,8 @@
MediaListViewController::MediaListViewController( StackViewController* nav ) :
ListViewController( nav ), m_nav( nav ), m_clipsListView( 0 )
{
connect( Library::getInstance(), SIGNAL( newMediaImported( QUuid ) ),
this, SLOT( newMediaLoaded( QUuid ) ) );
connect( Library::getInstance(), SIGNAL( newMediaLoaded( Media* ) ),
this, SLOT( newMediaLoaded( Media* ) ) );
m_cells = new QHash<QUuid, QWidget*>();
connect( m_nav, SIGNAL( previousButtonPushed() ), this, SLOT( restoreContext() ) );
}
......@@ -38,12 +38,8 @@ MediaListViewController::~MediaListViewController()
delete m_cells;
}
void MediaListViewController::newMediaLoaded( const QUuid& uuid )
void MediaListViewController::newMediaLoaded( Media* media )
{
Media* media = Library::getInstance()->media( uuid );
if ( media == NULL )
return;
MediaCellView* cell = new MediaCellView( media->getUuid() );
connect( cell, SIGNAL ( cellSelected( QUuid ) ),
......
......@@ -26,7 +26,7 @@ private:
public slots:
//void newMediaLoaded( Media* );
void newMediaLoaded( const QUuid& uuid );
void newMediaLoaded( Media* media );
void cellSelection( const QUuid& uuid );
void mediaRemoved( const QUuid& uuid );
void updateCell( Media* media );
......
......@@ -216,42 +216,6 @@ Library::mediaAlreadyLoaded( const QFileInfo& fileInfo )
return false;
}
void
Library::loadFile( const QFileInfo& fileInfo, int loadingMedias )
{
if ( !fileInfo.isDir() )
{
if ( loadingMedias == 1 )
{
emit progressDialogMax( 1 );
emit progressDialogValue( 0 );
m_loadingMedias = 1;
m_nbLoadedMedias = 0;
}
if ( !mediaAlreadyLoaded( fileInfo ) )
addMedia( fileInfo );
else
{
emit progressDialogMax( m_loadingMedias-- );
emit progressDialogValue( ++m_nbLoadedMedias );
}
}
else
{
QDir dir = QDir( fileInfo.filePath() );
QFileInfoList list = dir.entryInfoList( m_filters );
QFileInfo file;
m_loadingMedias = list.count();
m_nbLoadedMedias = 0;
emit progressDialogMax( m_loadingMedias );
emit progressDialogValue( 0 );
foreach( file, list )
loadFile( file, m_loadingMedias );
}
}
void
Library::loadProject( const QDomElement& medias )
{
......@@ -412,3 +376,10 @@ Library::removeClip( const QUuid& mediaId, const QUuid& clipId )
if ( med->clips()->contains( clipId ) )
med->removeClip( clipId );
}
void
Library::addMedia( Media *media )
{
m_medias[media->getUuid()] = media;
emit newMediaLoaded( media );
}
......@@ -85,7 +85,7 @@ public:
*/
QHash<QUuid, Media*>* medias() { return &m_medias; }
/**
* \brief Add the media with already computed metadatas to the library
* \brief Add a file to the media library
* \param fileInfo the file info of the media
* \sa addClip( Clip* clip )
* \sa media( const QUuid& uuid)
......@@ -101,16 +101,17 @@ public:
* \sa clip( const QUuid& uuid )
*/
void addClip( Clip* clip );
/**
* \brief Load a media or all the medias of a directory
* \param fileInfo the path of the media(s)
*/
void loadFile( const QFileInfo& fileInfo, int loadingMedias = 1 );
/**
* \brief
* \param
*/
void setFilter( const QStringList& filter ) { m_filters = filter; }
/**
* \brief Add an already preparsed media.
*
* \param media The media to add to the library
*/
void addMedia( Media *media );
private:
/**
......@@ -206,15 +207,10 @@ private slots:
signals:
/**
* \brief This signal should be emitted to begin metadata computing
* \param media The media you want to compute the metadata
* \brief This signal should be emitted to tell a new media have been imported
* \param media The newly imported media
*/
void metadataRequired( Media* media );
/**
* \brief This signal should be emiteted to tell a new media have been imported
* \param uuid The newly imported media
*/
void newMediaImported( const QUuid& );
void newMediaLoaded( Media* );
/**
* \brief This signal should be emiteted when a media has been removed
* \param uuid The removed media uuid
......@@ -228,17 +224,6 @@ signals:
* \brief
*/
void updateMediaRequested( const QUuid& uuid );
/**
* \brief
*/
void progressDialogMax( int max );
/**
* \brief
*/
void progressDialogValue( int value );
/**
* \brief
*/
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