Commit 26765068 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

MediaLibrary: Filter now handle multiple media views.

parent eb9b7604
......@@ -28,6 +28,7 @@
#include "MediaCellView.h"
#include "MediaListView.h"
#include "StackViewController.h"
#include "ViewController.h"
#include <QtDebug>
......@@ -47,6 +48,8 @@ MediaLibrary::MediaLibrary(QWidget *parent) : QWidget(parent),
this, SLOT( filterUpdated( const QString& ) ) );
connect( m_ui->clearButton, SIGNAL( clicked() ),
this, SLOT( clearFilter() ) );
connect( nav, SIGNAL( viewChanged( ViewController* ) ),
this, SLOT( viewChanged( ViewController* ) ) );
}
void
......@@ -77,6 +80,18 @@ MediaLibrary::currentFilter()
return &filterByName;
}
void
MediaLibrary::viewChanged( ViewController *view )
{
MediaListView *mlv = qobject_cast<MediaListView*>( view );
if ( mlv == NULL )
return ;
m_mediaListView = mlv;
//Force an update as the media has changed
filterUpdated( m_ui->filterInput->text() );
}
bool
MediaLibrary::filterByName( const Clip *clip, const QString &filter )
{
......
......@@ -28,6 +28,7 @@
#include "ui_MediaLibrary.h"
class Clip;
class MediaListView;
class ViewController;
class MediaLibrary : public QWidget
{
......@@ -57,6 +58,12 @@ class MediaLibrary : public QWidget
private slots:
void filterUpdated( const QString &filter );
void clearFilter();
/**
* \brief Used to update the filters when the view is changed.
*
* A view is changed when the user goes through the clips hierarchy.
*/
void viewChanged( ViewController* view );
signals:
void importRequired();
......
......@@ -64,6 +64,7 @@ void StackViewController::pushViewController( ViewController* viewController,
m_layout->insertWidget( 1, m_current->view() );
if ( m_current->view()->isHidden() )
m_current->view()->show();
emit viewChanged( viewController );
}
void
......@@ -82,6 +83,7 @@ StackViewController::restorePrevious()
m_nav->previousButton()->setText( "< " +
m_controllerStack->value( m_controllerStack->size() - 1 )->title() );
}
emit viewChanged( m_current );
}
void
......@@ -108,7 +110,7 @@ StackViewController::popViewController( bool animated )
delete m_current;
}
void
void
StackViewController::previous()
{
popViewController();
......
......@@ -58,6 +58,9 @@ private:
public slots:
void previous();
void viewDestroyed();
signals:
void viewChanged( ViewController* );
};
#endif // STACKVIEWCONTROLLER_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