[vlc-devel] commit: Qt: activate the searching for the Hotkeys Preferences. ( Jean-Baptiste Kempf )

git version control git at videolan.org
Sun May 3 00:28:01 CEST 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun May  3 00:27:47 2009 +0200| [9ec1eec76ced27977a3a9c6b2e35ae1860c92629] | committer: Jean-Baptiste Kempf 

Qt: activate the searching for the Hotkeys Preferences.

Close #2530

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9ec1eec76ced27977a3a9c6b2e35ae1860c92629
---

 modules/gui/qt4/components/preferences_widgets.cpp |   21 +++++++++++++++----
 modules/gui/qt4/components/preferences_widgets.hpp |    3 ++
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp
index d1e255d..ec56611 100644
--- a/modules/gui/qt4/components/preferences_widgets.cpp
+++ b/modules/gui/qt4/components/preferences_widgets.cpp
@@ -1138,9 +1138,8 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this,
     label = new QLabel(
             qtr( "Select an action to change the associated hotkey") );
 
-    /* Deactivated for now
     QLabel *searchLabel = new QLabel( qtr( "Search" ) );
-    QLineEdit *actionSearch = new QLineEdit;*/
+    actionSearch = new SearchLineEdit( keyContainer );
 
     table = new QTreeWidget;
     table->setColumnCount(3);
@@ -1158,9 +1157,8 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this,
     finish();
 
     gLayout->addWidget( label, 0, 0, 1, 4 );
-  /* deactivated for now
     gLayout->addWidget( searchLabel, 1, 0, 1, 2 );
-    gLayout->addWidget( actionSearch, 1, 2, 1, 2 ); */
+    gLayout->addWidget( actionSearch, 1, 2, 1, 2 );
     gLayout->addWidget( table, 2, 0, 1, 4 );
     gLayout->addWidget( clearButton, 3, 0, 1, 1 );
     gLayout->addWidget( shortcutValue, 3, 1, 1, 2 );
@@ -1171,6 +1169,8 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this,
     CONNECT( clearButton, clicked(), shortcutValue, clear() );
     CONNECT( clearButton, clicked(), this, setTheKey() );
     BUTTONACT( setButton, setTheKey() );
+    CONNECT( actionSearch, textChanged( const QString& ),
+             this, filter( const QString& ) );
 }
 
 void KeySelectorControl::finish()
@@ -1244,6 +1244,17 @@ void KeySelectorControl::finish()
     CONNECT( shortcutValue, pressed(), this, selectKey() );
 }
 
+void KeySelectorControl::filter( const QString &qs_search )
+{
+    QList<QTreeWidgetItem *> resultList =
+            table->findItems( qs_search, Qt::MatchContains, 0 );
+    for( int i = 0; i < table->topLevelItemCount(); i++ )
+    {
+        table->topLevelItem( i )->setHidden(
+                !resultList.contains( table->topLevelItem( i ) ) );
+    }
+}
+
 /* Show the key selected from the table in the keySelector */
 void KeySelectorControl::select1Key()
 {
@@ -1354,7 +1365,7 @@ void KeyInputDialog::checkForConflicts( int i_vlckey )
         /* Avoid 0 or -1 that are the "Unset" states */
     {
         warning->setText( qtr("Warning: the key is already assigned to \"") +
-          conflictList[0]->text( 0 ) + "\"" );
+                          conflictList[0]->text( 0 ) + "\"" );
         warning->show();
         buttonBox->show();
 
diff --git a/modules/gui/qt4/components/preferences_widgets.hpp b/modules/gui/qt4/components/preferences_widgets.hpp
index 99aea1c..9baadb8 100644
--- a/modules/gui/qt4/components/preferences_widgets.hpp
+++ b/modules/gui/qt4/components/preferences_widgets.hpp
@@ -434,6 +434,7 @@ signals:
     void pressed();
 };
 
+class SearchLineEdit;
 class KeySelectorControl : public ConfigControl
 {
     Q_OBJECT;
@@ -451,10 +452,12 @@ private:
     QTreeWidget *table;
     KeyShortcutEdit *shortcutValue;
     QList<module_config_t *> values;
+    SearchLineEdit *actionSearch;
 private slots:
     void setTheKey();
     void selectKey( QTreeWidgetItem * = NULL );
     void select1Key();
+    void filter( const QString & );
 };
 
 class KeyInputDialog : public QDialog




More information about the vlc-devel mailing list