[vlmc-devel] commit: MediaLibrary: Filter now handle multiple media views. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Fri May 14 18:51:25 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu May 13 21:13:37 2010 +0200| [267650681b6443bd59b186a29184481f5f01a5ff] | committer: Hugo Beauzée-Luyssen 

MediaLibrary: Filter now handle multiple media views.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=267650681b6443bd59b186a29184481f5f01a5ff
---

 src/Gui/library/MediaLibrary.cpp        |   15 +++++++++++++++
 src/Gui/library/MediaLibrary.h          |    7 +++++++
 src/Gui/library/StackViewController.cpp |    4 +++-
 src/Gui/library/StackViewController.h   |    3 +++
 4 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/src/Gui/library/MediaLibrary.cpp b/src/Gui/library/MediaLibrary.cpp
index 73f1073..c75f6eb 100644
--- a/src/Gui/library/MediaLibrary.cpp
+++ b/src/Gui/library/MediaLibrary.cpp
@@ -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 )
 {
diff --git a/src/Gui/library/MediaLibrary.h b/src/Gui/library/MediaLibrary.h
index 5c08a7e..b6b9449 100644
--- a/src/Gui/library/MediaLibrary.h
+++ b/src/Gui/library/MediaLibrary.h
@@ -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();
diff --git a/src/Gui/library/StackViewController.cpp b/src/Gui/library/StackViewController.cpp
index 717d58a..1ed44cd 100644
--- a/src/Gui/library/StackViewController.cpp
+++ b/src/Gui/library/StackViewController.cpp
@@ -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();
diff --git a/src/Gui/library/StackViewController.h b/src/Gui/library/StackViewController.h
index c48743a..3d6eb6f 100644
--- a/src/Gui/library/StackViewController.h
+++ b/src/Gui/library/StackViewController.h
@@ -58,6 +58,9 @@ private:
 public slots:
     void                        previous();
     void                        viewDestroyed();
+
+signals:
+    void                        viewChanged( ViewController* );
 };
 
 #endif // STACKVIEWCONTROLLER_H



More information about the Vlmc-devel mailing list