Commit cd56737f authored by Yuval Tze's avatar Yuval Tze Committed by François Cartegnie

Qt: Preferences tree filter, UI

add SearchLineEdit above the advanced tree that filters the tree items.
parent 9b80d194
......@@ -32,6 +32,7 @@
#include "components/complete_preferences.hpp"
#include "components/simple_preferences.hpp"
#include "util/searchlineedit.hpp"
#include <QHBoxLayout>
#include <QGroupBox>
......@@ -54,7 +55,7 @@ PrefsDialog::PrefsDialog( QWidget *parent, intf_thread_t *_p_intf )
/* Create Panels */
tree_panel = new QWidget;
tree_panel_l = new QHBoxLayout;
tree_panel_l = new QVBoxLayout;
tree_panel->setLayout( tree_panel_l );
main_panel = new QWidget;
main_panel_l = new QHBoxLayout;
......@@ -75,6 +76,7 @@ PrefsDialog::PrefsDialog( QWidget *parent, intf_thread_t *_p_intf )
/* Tree and panel initialisations */
advanced_tree = NULL;
tree_filter = NULL;
simple_tree = NULL;
current_simple_panel = NULL;
advanced_panel = NULL;
......@@ -138,6 +140,19 @@ void PrefsDialog::setAdvanced()
if( simple_tree )
if( simple_tree->isVisible() ) simple_tree->hide();
if ( !tree_filter )
{
tree_filter = new SearchLineEdit( tree_panel );
tree_filter->setMinimumHeight( 26 );
CONNECT( tree_filter, textChanged( const QString & ),
this, advancedTreeFilterChanged( const QString & ) );
tree_panel_l->addWidget( tree_filter );
}
tree_filter->show();
/* If don't have already and advanced TREE, then create it */
if( !advanced_tree )
{
......@@ -179,6 +194,9 @@ void PrefsDialog::setSmall()
if( advanced_tree )
if( advanced_tree->isVisible() ) advanced_tree->hide();
if( tree_filter )
if( tree_filter->isVisible() ) tree_filter->hide();
/* If no simple_tree, create one, connect it */
if( !simple_tree )
{
......@@ -328,3 +346,8 @@ void PrefsDialog::reset()
accept();
}
}
void PrefsDialog::advancedTreeFilterChanged( const QString & text )
{
advanced_tree->filter( text );
}
......@@ -40,6 +40,7 @@ class QRadioButton;
class QWidget;
class QCheckBox;
class QLabel;
class SearchLineEdit;
class PrefsDialog : public QVLCDialog
{
......@@ -63,10 +64,11 @@ private:
SPrefsPanel *simple_panels[SPrefsMax];
QWidget *tree_panel;
QHBoxLayout *tree_panel_l;
QVBoxLayout *tree_panel_l;
SPrefsCatList *simple_tree;
PrefsTree *advanced_tree;
SearchLineEdit *tree_filter;
QGroupBox *types;
QRadioButton *small,*all;
......@@ -79,6 +81,7 @@ private slots:
void changeAdvPanel( QTreeWidgetItem * );
void changeSimplePanel( int );
void advancedTreeFilterChanged( const QString & );
void save();
void cancel();
......
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