Commit 9ec1eec7 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: activate the searching for the Hotkeys Preferences.

Close #2530
parent 62d7d384
...@@ -1138,9 +1138,8 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this, ...@@ -1138,9 +1138,8 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this,
label = new QLabel( label = new QLabel(
qtr( "Select an action to change the associated hotkey") ); qtr( "Select an action to change the associated hotkey") );
/* Deactivated for now
QLabel *searchLabel = new QLabel( qtr( "Search" ) ); QLabel *searchLabel = new QLabel( qtr( "Search" ) );
QLineEdit *actionSearch = new QLineEdit;*/ actionSearch = new SearchLineEdit( keyContainer );
table = new QTreeWidget; table = new QTreeWidget;
table->setColumnCount(3); table->setColumnCount(3);
...@@ -1158,9 +1157,8 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this, ...@@ -1158,9 +1157,8 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this,
finish(); finish();
gLayout->addWidget( label, 0, 0, 1, 4 ); gLayout->addWidget( label, 0, 0, 1, 4 );
/* deactivated for now
gLayout->addWidget( searchLabel, 1, 0, 1, 2 ); 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( table, 2, 0, 1, 4 );
gLayout->addWidget( clearButton, 3, 0, 1, 1 ); gLayout->addWidget( clearButton, 3, 0, 1, 1 );
gLayout->addWidget( shortcutValue, 3, 1, 1, 2 ); gLayout->addWidget( shortcutValue, 3, 1, 1, 2 );
...@@ -1171,6 +1169,8 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this, ...@@ -1171,6 +1169,8 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this,
CONNECT( clearButton, clicked(), shortcutValue, clear() ); CONNECT( clearButton, clicked(), shortcutValue, clear() );
CONNECT( clearButton, clicked(), this, setTheKey() ); CONNECT( clearButton, clicked(), this, setTheKey() );
BUTTONACT( setButton, setTheKey() ); BUTTONACT( setButton, setTheKey() );
CONNECT( actionSearch, textChanged( const QString& ),
this, filter( const QString& ) );
} }
void KeySelectorControl::finish() void KeySelectorControl::finish()
...@@ -1244,6 +1244,17 @@ void KeySelectorControl::finish() ...@@ -1244,6 +1244,17 @@ void KeySelectorControl::finish()
CONNECT( shortcutValue, pressed(), this, selectKey() ); 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 */ /* Show the key selected from the table in the keySelector */
void KeySelectorControl::select1Key() void KeySelectorControl::select1Key()
{ {
...@@ -1354,7 +1365,7 @@ void KeyInputDialog::checkForConflicts( int i_vlckey ) ...@@ -1354,7 +1365,7 @@ void KeyInputDialog::checkForConflicts( int i_vlckey )
/* Avoid 0 or -1 that are the "Unset" states */ /* Avoid 0 or -1 that are the "Unset" states */
{ {
warning->setText( qtr("Warning: the key is already assigned to \"") + warning->setText( qtr("Warning: the key is already assigned to \"") +
conflictList[0]->text( 0 ) + "\"" ); conflictList[0]->text( 0 ) + "\"" );
warning->show(); warning->show();
buttonBox->show(); buttonBox->show();
......
...@@ -434,6 +434,7 @@ signals: ...@@ -434,6 +434,7 @@ signals:
void pressed(); void pressed();
}; };
class SearchLineEdit;
class KeySelectorControl : public ConfigControl class KeySelectorControl : public ConfigControl
{ {
Q_OBJECT; Q_OBJECT;
...@@ -451,10 +452,12 @@ private: ...@@ -451,10 +452,12 @@ private:
QTreeWidget *table; QTreeWidget *table;
KeyShortcutEdit *shortcutValue; KeyShortcutEdit *shortcutValue;
QList<module_config_t *> values; QList<module_config_t *> values;
SearchLineEdit *actionSearch;
private slots: private slots:
void setTheKey(); void setTheKey();
void selectKey( QTreeWidgetItem * = NULL ); void selectKey( QTreeWidgetItem * = NULL );
void select1Key(); void select1Key();
void filter( const QString & );
}; };
class KeyInputDialog : public QDialog class KeyInputDialog : public QDialog
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment