Commit f287c7b9 authored by Geoffroy Lacarriere's avatar Geoffroy Lacarriere

Bugfix: junk signal

Selection media cell in Library
parent fed11d2b
......@@ -26,6 +26,7 @@ MediaLibraryWidget::MediaLibraryWidget( QWidget* parent ) : QWidget( parent )
{
m_nav = new StackViewController( this );
MediaListViewController* list = new MediaListViewController( m_nav );
connect( list, SIGNAL( mediaSelected( Media* ) ), this, SLOT( mediaSelection( Media* ) ) );
m_nav->pushViewController( list );
}
......@@ -39,3 +40,13 @@ const ViewController* MediaLibraryWidget::getCurrentViewController()
{
return m_nav->getCurrentViewController();
}
void MediaLibraryWidget::mediaSelection( Media* media )
{
emit mediaSelected( media );
}
void MediaLibraryWidget::clipSelection( Clip* clip )
{
emit clipSelected( clip );
}
......@@ -27,6 +27,8 @@
#include "StackViewController.h"
#include "MediaListViewController.h"
#include "Media.h"
#include "Clip.h"
class MediaLibraryWidget : public QWidget
{
......@@ -40,6 +42,13 @@ public:
private:
StackViewController* m_nav;
private slots:
void mediaSelection( Media* media );
void clipSelection( Clip* clip );
signals:
void mediaSelected( Media* media );
void clipSelected( Clip* clip );
};
#endif // MEDIALIBRARYWIDGET_H
......@@ -6,22 +6,36 @@ MediaListViewController::MediaListViewController( StackViewController* nav ) :
ListViewController( nav ), m_nav( nav )
{
connect(Library::getInstance(), SIGNAL( newMediaLoaded( Media* ) ), this, SLOT( newMediaLoaded( Media* ) ) );
m_cells = new QHash<QUuid, QWidget*>();
}
MediaListViewController::~MediaListViewController()
{
delete m_cells;
}
void MediaListViewController::newMediaLoaded( Media* media )
{
MediaCellView* cell = new MediaCellView( media->getUuid() );
connect( cell, SIGNAL ( cellSelected( QUuid ) ),
this, SLOT ( cellSelected( QUuid ) ) );
connect( cell, SIGNAL ( cellSelected( QUuid ) ), this, SLOT ( cellSelection( QUuid ) ) );
cell->setThumbnail( media->getSnapshot() );
cell->setTitle( media->getFileName() );
addCell(cell);
m_cells->insert( media->getUuid(), cell );
}
void MediaListViewController::cellSelection( const QUuid& uuid )
{
if ( m_currentUuid == uuid )
return;
if ( !m_currentUuid.isNull() )
m_cells->value( m_currentUuid )->setPalette( m_cells->value( uuid )->palette() );
QPalette p = m_cells->value( uuid )->palette();
p.setColor( QPalette::Window, QColor( Qt::darkBlue ) );
m_cells->value( uuid )->setPalette( p );
m_currentUuid = uuid;
emit mediaSelected( Library::getInstance()->getMedia( uuid) );
}
......@@ -17,9 +17,13 @@ public:
private:
StackViewController* m_nav;
QUuid m_currentUuid;
QHash<QUuid, QWidget*>* m_cells;
public slots:
void newMediaLoaded( Media* );
void cellSelection( const QUuid& uuid );
signals:
void mediaSelected( Media* media );
};
#endif // MEDIALISTVIEWCONTROLLER_H
......@@ -119,15 +119,8 @@ void MainWindow::setupLibrary()
Library* library = Library::getInstance();
//GUI part :
LibraryWidget* libraryWidget = new LibraryWidget( this );
MediaLibraryWidget* mediaLibraryWidget = new MediaLibraryWidget( this );
DockWidgetManager::instance()->addDockedWidget( libraryWidget,
tr( "Old Media Library" ),
Qt::AllDockWidgetAreas,
QDockWidget::AllDockWidgetFeatures,
Qt::LeftDockWidgetArea );
DockWidgetManager::instance()->addDockedWidget( mediaLibraryWidget,
tr( "Media Library" ),
Qt::AllDockWidgetAreas,
......@@ -135,38 +128,11 @@ void MainWindow::setupLibrary()
Qt::LeftDockWidgetArea );
//Connecting GUI and Frontend :
connect( libraryWidget,
SIGNAL( newMediaLoadingAsked(const QString& ) ),
library,
SLOT( newMediaLoadingAsked( const QString& ) ) );
connect( library,
SIGNAL( newClipLoaded( Clip* ) ),
libraryWidget,
SLOT( newClipLoaded( Clip* ) ) );
connect( libraryWidget,
SIGNAL( removingMediaAsked( const QUuid& ) ),
library,
SLOT( removingMediaAsked( const QUuid& ) ) );
connect( library,
SIGNAL( mediaRemoved( const QUuid& ) ),
libraryWidget,
SLOT( mediaRemoved( const QUuid& ) ), Qt::DirectConnection );
connect( libraryWidget->getVideoListWidget(), SIGNAL( selectedClipChanged( Clip* ) ),
m_clipPreview->getGenericRenderer(), SLOT( setClip( Clip* ) ) );
connect( mediaLibraryWidget->getCurrentViewController(),
SIGNAL( selectedClipChanged( Clip* ) ),
m_clipPreview->getGenericRenderer(),
SLOT( setClip( Clip* ) ) );
connect( mediaLibraryWidget, SIGNAL( mediaSelected( Media* ) ),
m_clipPreview->getGenericRenderer(), SLOT( setMedia( Media* ) ) );
connect( Library::getInstance(), SIGNAL( mediaRemoved( const QUuid& ) ),
m_clipPreview->getGenericRenderer(), SLOT( mediaUnloaded( QUuid ) ) );
connect( libraryWidget->getVideoListWidget(), SIGNAL( itemDoubleClicked( QListWidgetItem* ) ),
this, SLOT( mediaListItemDoubleClicked( QListWidgetItem* ) ) );
}
void MainWindow::on_actionSave_triggered()
......
......@@ -87,6 +87,13 @@ void Library::newMediaLoadingAsked( const QString& filePath, const QStrin
void Library::addMedia( Media* media )
{
QUuid id;
foreach( id, m_medias.keys() )
if ( m_medias.value( id )->getFileInfo()->filePath() == media->getFileInfo()->filePath() )
{
delete media;
return;
}
m_medias[media->getUuid()] = media;
metaDataComputed( media );
}
......
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