Commit b3a50081 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Fix minor bugs

parent 5bd86267
......@@ -105,11 +105,6 @@ ImportController::ImportController(QWidget *parent) :
m_mediaListController, SLOT( clipAdded( Clip* ) ) ); //StackViewController
connect( m_stackNav, SIGNAL( previousButtonPushed() ),
this, SLOT( restoreContext() ) );
connect( Library::getInstance(), SIGNAL( progressDialogMax( int ) ),
this, SLOT( progressDialogMax( int ) ) );
connect( Library::getInstance(), SIGNAL( progressDialogValue( int ) ),
this, SLOT( progressDialogValue( int ) ) );
}
ImportController::~ImportController()
......@@ -239,6 +234,13 @@ ImportController::forwardButtonClicked()
{
QModelIndex index = m_ui->treeView->selectionModel()->currentIndex();
QString filePath = m_filesModel->fileInfo( index ).filePath();
foreach ( Media* media, m_temporaryMedias.values() )
if ( media->getFileInfo()->filePath() == filePath )
return ;
if ( Library::getInstance()->mediaAlreadyLoaded( filePath ) == true )
return ;
Media* media = new Media( filePath );
connect( media, SIGNAL( metaDataComputed( Media* ) ),
this, SLOT( updateMediaRequested( Media* ) ) );
......@@ -287,6 +289,7 @@ ImportController::accept()
collapseAllButCurrentPath();
foreach ( Media* media, m_temporaryMedias.values() )
Library::getInstance()->addMedia( media );
m_temporaryMedias.clear();
done( Accepted );
}
......@@ -316,8 +319,9 @@ ImportController::collapseAllButCurrentPath()
void
ImportController::mediaDeletion( const QUuid& uuid )
{
Library::getInstance()->deleteMedia( uuid );
m_mediaListController->removeMedia( uuid );
if ( m_temporaryMedias.contains( uuid ) == true )
delete m_temporaryMedias.take( uuid );
if ( uuid == m_currentUuid )
{
......
......@@ -108,8 +108,7 @@ Library::addMedia( const QFileInfo& fileInfo, const QString& uuid )
foreach( Media* it, m_medias.values() )
{
if ( it->getFileInfo()->filePath() ==
media->getFileInfo()->filePath() )
if ( it->getFileInfo()->filePath() == media->getFileInfo()->filePath() )
{
delete media;
return;
......
......@@ -113,17 +113,18 @@ public:
*/
void addMedia( Media *media );
/**
* \brief Check if a file has already been loaded into library.
* \param fileInfo The file infos
* \return true if the file is already loaded, false otherwhise
*/
bool mediaAlreadyLoaded( const QFileInfo& fileInfo );
private:
/**
* \brief Library Object Constructor
*/
Library();
/**
* \brief Tells the media has already been loaded into library or not
* \param fileInfo The files info of the media file
* \return true if the media is already loaded, false otherwhise
*/
bool mediaAlreadyLoaded( const QFileInfo& fileInfo );
/**
* \brief This method is used to load a media directly from it's
* path, with a specified UUID.
......
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