[vlc-devel] commit: Qt: search implementation in the plugins list dialog for fast-seeing if a module is here or not . (Jean-Baptiste Kempf )
git version control
git at videolan.org
Sat Jan 3 16:59:09 CET 2009
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Jan 3 16:58:09 2009 +0100| [de2c8c118476dd42dcdc2eae7af9250655aa61e6] | committer: Jean-Baptiste Kempf
Qt: search implementation in the plugins list dialog for fast-seeing if a module is here or not.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=de2c8c118476dd42dcdc2eae7af9250655aa61e6
---
modules/gui/qt4/dialogs/plugins.cpp | 26 +++++++++++++++++++++++++-
modules/gui/qt4/dialogs/plugins.hpp | 4 ++++
2 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/modules/gui/qt4/dialogs/plugins.cpp b/modules/gui/qt4/dialogs/plugins.cpp
index 5e888ff..fc653f5 100644
--- a/modules/gui/qt4/dialogs/plugins.cpp
+++ b/modules/gui/qt4/dialogs/plugins.cpp
@@ -33,6 +33,8 @@
#include <QStringList>
#include <QHeaderView>
#include <QDialogButtonBox>
+#include <QLineEdit>
+#include <QLabel>
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->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;
QPushButton *okButton = new QPushButton( "ok", this );
box->addButton( okButton, QDialogButtonBox::AcceptRole );
- layout->addWidget( box, 1, 2 );
+ layout->addWidget( box, 2, 2 );
BUTTONACT( okButton, close() );
@@ -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()
{
writeSettings( "Plugins" );
diff --git a/modules/gui/qt4/dialogs/plugins.hpp b/modules/gui/qt4/dialogs/plugins.hpp
index b2232ea..cd0c107 100644
--- a/modules/gui/qt4/dialogs/plugins.hpp
+++ b/modules/gui/qt4/dialogs/plugins.hpp
@@ -27,6 +27,7 @@
#include "util/qvlcframe.hpp"
class QTreeWidget;
+class QLineEdit;
class PluginDialog : public QVLCFrame
{
@@ -38,6 +39,9 @@ private:
virtual ~PluginDialog();
QTreeWidget *treePlugins;
+ QLineEdit *edit;
+private slots:
+ void search( const QString );
};
#endif
More information about the vlc-devel
mailing list