Commit de2c8c11 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: search implementation in the plugins list dialog for fast-seeing if a module is here or not.

parent 1664191a
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include <QStringList> #include <QStringList>
#include <QHeaderView> #include <QHeaderView>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QLineEdit>
#include <QLabel>
PluginDialog::PluginDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) PluginDialog::PluginDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
{ {
...@@ -66,10 +68,19 @@ PluginDialog::PluginDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) ...@@ -66,10 +68,19 @@ PluginDialog::PluginDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
treePlugins->setSortingEnabled( true ); treePlugins->setSortingEnabled( true );
treePlugins->sortByColumn( 1, Qt::AscendingOrder ); treePlugins->sortByColumn( 1, Qt::AscendingOrder );
QLabel *label = new QLabel( _("&Search:"), this );
edit = new QLineEdit;
label->setBuddy( edit );
layout->addWidget( label, 1, 0 );
layout->addWidget( edit, 1, 1, 1, -1 );
CONNECT( edit, textChanged( QString ),
this, search( QString ) );
QDialogButtonBox *box = new QDialogButtonBox; QDialogButtonBox *box = new QDialogButtonBox;
QPushButton *okButton = new QPushButton( "ok", this ); QPushButton *okButton = new QPushButton( "ok", this );
box->addButton( okButton, QDialogButtonBox::AcceptRole ); box->addButton( okButton, QDialogButtonBox::AcceptRole );
layout->addWidget( box, 1, 2 ); layout->addWidget( box, 2, 2 );
BUTTONACT( okButton, close() ); BUTTONACT( okButton, close() );
...@@ -94,6 +105,19 @@ inline void PluginDialog::FillTree() ...@@ -94,6 +105,19 @@ inline void PluginDialog::FillTree()
} }
} }
void PluginDialog::search( const QString qs )
{
QList<QTreeWidgetItem *> items = treePlugins->findItems( qs, Qt::MatchContains );
items += treePlugins->findItems( qs, Qt::MatchContains, 1 );
QTreeWidgetItem *item = NULL;
for( int i = 0; i < treePlugins->topLevelItemCount(); i++ )
{
item = treePlugins->topLevelItem( i );
item->setHidden( !items.contains( item ) );
}
}
PluginDialog::~PluginDialog() PluginDialog::~PluginDialog()
{ {
writeSettings( "Plugins" ); writeSettings( "Plugins" );
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "util/qvlcframe.hpp" #include "util/qvlcframe.hpp"
class QTreeWidget; class QTreeWidget;
class QLineEdit;
class PluginDialog : public QVLCFrame class PluginDialog : public QVLCFrame
{ {
...@@ -38,6 +39,9 @@ private: ...@@ -38,6 +39,9 @@ private:
virtual ~PluginDialog(); virtual ~PluginDialog();
QTreeWidget *treePlugins; QTreeWidget *treePlugins;
QLineEdit *edit;
private slots:
void search( const QString );
}; };
#endif #endif
......
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