]> git.sesse.net Git - vlc/commitdiff
Qt: apply search on latest Inserted Item
authorJean-Baptiste Kempf <jb@videolan.org>
Thu, 17 Nov 2011 00:30:32 +0000 (01:30 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 17 Nov 2011 00:44:41 +0000 (01:44 +0100)
Closes #4998

modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.hpp

index 0297b643063ca669cc49633b189c7fdcd2284eba..8b3e089282067204a80179e44f8f7362e6a5e6cc 100644 (file)
@@ -74,6 +74,7 @@ PLModel::PLModel( playlist_t *_p_playlist,  /* THEPL */
     sortingMenu       = NULL;
 
     rootItem          = NULL; /* PLItem rootItem, will be set in rebuild( ) */
+    latestSearch      = QString();
 
     /* Icons initialization */
 #define ADD_ICON(type, x) icons[ITEM_TYPE_##type] = QIcon( x )
@@ -653,6 +654,8 @@ void PLModel::processItemAppend( int i_item, int i_parent )
 
     if( newItem->inputItem() == THEMIM->currentInputItem() )
         emit currentIndexChanged( index( newItem, 0 ) );
+
+    search( latestSearch, index( rootItem, 0), false /*FIXME*/ );
 }
 
 void PLModel::rebuild( playlist_item_t *p_root )
@@ -855,6 +858,8 @@ void PLModel::sort( const int i_root_id, const int column, Qt::SortOrder order )
 
 void PLModel::search( const QString& search_text, const QModelIndex & idx, bool b_recursive )
 {
+    latestSearch = search_text;
+
     /** \todo Fire the search with a small delay ? */
     PL_LOCK;
     {
index 4caab5d0601a0722a00e581ce351a6fd3e3c18fc..6c66c7e9e35228aa5223ad0fd9bc718d7a93a095 100644 (file)
@@ -174,6 +174,9 @@ private:
     /* Zoom factor for font-size */
     int i_zoom;
 
+    /* */
+    QString latestSearch;
+
 private slots:
     void popupPlay();
     void popupDel();