[vlmc-devel] MediaLibraryView: Implement filtering

Yikai Lu git at videolan.org
Sat Jun 24 12:49:42 CEST 2017


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Wed Jun 21 21:18:23 2017 +0900| [ffcabc0cc3fb09b15fcc0c27d5964cc724a1616a] | committer: Yikai Lu

MediaLibraryView: Implement filtering

> https://code.videolan.org/videolan/vlmc/commit/ffcabc0cc3fb09b15fcc0c27d5964cc724a1616a
---

 src/Gui/library/ui/MediaItem.qml        | 7 +++++++
 src/Gui/library/ui/MediaLibraryView.qml | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/src/Gui/library/ui/MediaItem.qml b/src/Gui/library/ui/MediaItem.qml
index 1af7c15e..bb4d12d7 100644
--- a/src/Gui/library/ui/MediaItem.qml
+++ b/src/Gui/library/ui/MediaItem.qml
@@ -6,11 +6,18 @@ Rectangle {
     color: GridView.isCurrentItem ? "black" : "#333333"
     border.color: "#222222"
     border.width: 1
+    visible: searchText.length > 0 ? containsString( searchText ) : true
+    enabled: visible
     property string thumbnailPath
     property string title
     property int duration
     property int mediaId
 
+    function containsString( str )
+    {
+        return title.toLowerCase().indexOf( str.toLowerCase() ) !== -1;
+    }
+
     Image {
         id: thumbnail
         anchors.left: mediaItem.left
diff --git a/src/Gui/library/ui/MediaLibraryView.qml b/src/Gui/library/ui/MediaLibraryView.qml
index af80e8b9..955a8b0d 100644
--- a/src/Gui/library/ui/MediaLibraryView.qml
+++ b/src/Gui/library/ui/MediaLibraryView.qml
@@ -5,6 +5,8 @@ Rectangle {
     anchors.fill: parent
     color: "#999999"
 
+    property alias searchText: searchTextInput.text
+
     ScrollView {
         id: sView
         height: parent.height
@@ -41,6 +43,7 @@ Rectangle {
                         }
 
                         TextInput {
+                            id: searchTextInput
                             color: "#DDDDDD"
                             width: parent.width
                             anchors.centerIn: parent



More information about the Vlmc-devel mailing list