[vlmc-devel] commit: MediaLibrary: Adding filtering by tags. ( Hugo Beauzée-Luyssen )

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


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

MediaLibrary: Adding filtering by tags.

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

 src/Gui/library/MediaLibrary.cpp   |   16 +++++++++++++++-
 src/Gui/library/MediaLibrary.h     |    1 +
 src/Gui/library/ui/MediaLibrary.ui |    5 +++++
 3 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/src/Gui/library/MediaLibrary.cpp b/src/Gui/library/MediaLibrary.cpp
index c75f6eb..40ecaca 100644
--- a/src/Gui/library/MediaLibrary.cpp
+++ b/src/Gui/library/MediaLibrary.cpp
@@ -77,7 +77,15 @@ MediaLibrary::clearFilter()
 MediaLibrary::Filter
 MediaLibrary::currentFilter()
 {
-    return &filterByName;
+    switch ( m_ui->filterType->currentIndex() )
+    {
+    case 0:
+        return &filterByName;
+    case 1:
+        return &filterByTags;
+    default:
+        return &filterByName;
+    }
 }
 
 void
@@ -97,3 +105,9 @@ MediaLibrary::filterByName( const Clip *clip, const QString &filter )
 {
     return ( clip->getMedia()->fileName().contains( filter, Qt::CaseInsensitive ) );
 }
+
+bool
+MediaLibrary::filterByTags( const Clip *clip, const QString &filter )
+{
+    return ( clip->matchMetaTag( filter ) );
+}
diff --git a/src/Gui/library/MediaLibrary.h b/src/Gui/library/MediaLibrary.h
index b6b9449..ec33f1c 100644
--- a/src/Gui/library/MediaLibrary.h
+++ b/src/Gui/library/MediaLibrary.h
@@ -50,6 +50,7 @@ class MediaLibrary : public QWidget
 
     //Filters list :
         static bool         filterByName( const Clip *clip, const QString &filter );
+        static bool         filterByTags( const Clip *clip, const QString &filter );
 
     private:
         Ui::MediaLibrary    *m_ui;
diff --git a/src/Gui/library/ui/MediaLibrary.ui b/src/Gui/library/ui/MediaLibrary.ui
index 89aab70..53c4512 100644
--- a/src/Gui/library/ui/MediaLibrary.ui
+++ b/src/Gui/library/ui/MediaLibrary.ui
@@ -39,6 +39,11 @@
          <string>Name</string>
         </property>
        </item>
+       <item>
+        <property name="text">
+         <string>Tags</string>
+        </property>
+       </item>
       </widget>
      </item>
      <item row="1" column="1">



More information about the Vlmc-devel mailing list