Commit b220e881 authored by Christophe Courtaut's avatar Christophe Courtaut
Browse files

Fixed media removal in Library

parent 9664ddaa
......@@ -26,8 +26,10 @@ MediaLibraryWidget::MediaLibraryWidget( QWidget* parent ) : QWidget( parent )
{
m_nav = new StackViewController( this );
MediaListViewController* list = new MediaListViewController( m_nav );
Library* library = Library::getInstance();
connect( list, SIGNAL( mediaSelected( Media* ) ), this, SLOT( mediaSelection( Media* ) ) );
connect( list, SIGNAL( mediaDeleted( const QUuid& ) ), library, SLOT( removingMediaAsked( const QUuid& ) ) );
connect( library, SIGNAL( mediaRemoved( QUuid ) ), list, SLOT( mediaRemoved( const QUuid& ) ) );
m_nav->pushViewController( list );
}
......
......@@ -19,6 +19,7 @@ void MediaListViewController::newMediaLoaded( Media* media )
MediaCellView* cell = new MediaCellView( media->getUuid() );
connect( cell, SIGNAL ( cellSelected( QUuid ) ), this, SLOT ( cellSelection( QUuid ) ) );
connect( cell, SIGNAL ( cellDeleted( QUuid ) ), this, SLOT( mediaDeletion( QUuid ) ) );
cell->setThumbnail( media->getSnapshot() );
cell->setTitle( media->getFileName() );
......@@ -37,5 +38,17 @@ void MediaListViewController::cellSelection( const QUuid& uuid )
p.setColor( QPalette::Window, QColor( Qt::darkBlue ) );
m_cells->value( uuid )->setPalette( p );
m_currentUuid = uuid;
emit mediaSelected( Library::getInstance()->getMedia( uuid) );
emit mediaSelected( Library::getInstance()->getMedia( uuid ) );
}
void MediaListViewController::mediaDeletion( const QUuid& uuid )
{
emit mediaDeleted( uuid );
}
void MediaListViewController::mediaRemoved( const QUuid& uuid )
{
removeCell( m_cells->value( uuid ) );
m_cells->remove( uuid );
m_currentUuid = QUuid();
}
......@@ -23,7 +23,11 @@ private:
public slots:
void newMediaLoaded( Media* );
void cellSelection( const QUuid& uuid );
void mediaDeletion( const QUuid& uuid );
void mediaRemoved( const QUuid& uuid );
signals:
void mediaSelected( Media* media );
void mediaDeleted( const QUuid& uuid );
};
#endif // MEDIALISTVIEWCONTROLLER_H
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