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

Qt: allow clearing of global keys

Original patch from Anik Varshney anik d0t varshney -- gmail d0t com,
that had issues applying (whitespace and git am...)
Fixes from me too.
Close #3045
parent a6d95142
...@@ -1191,12 +1191,13 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this, ...@@ -1191,12 +1191,13 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this,
table->headerItem()->setText( 1, qtr( "Hotkey" ) ); table->headerItem()->setText( 1, qtr( "Hotkey" ) );
table->headerItem()->setText( 2, qtr( "Global" ) ); table->headerItem()->setText( 2, qtr( "Global" ) );
table->setAlternatingRowColors( true ); table->setAlternatingRowColors( true );
table->setSelectionBehavior( QAbstractItemView::SelectItems );
shortcutValue = new KeyShortcutEdit; shortcutValue = new KeyShortcutEdit;
shortcutValue->setReadOnly(true); shortcutValue->setReadOnly(true);
QPushButton *clearButton = new QPushButton( qtr( "Clear" ) ); QPushButton *clearButton = new QPushButton( qtr( "Clear" ) );
QPushButton *setButton = new QPushButton( qtr( "Set" ) ); QPushButton *setButton = new QPushButton( qtr( "Apply" ) );
setButton->setDefault( true ); setButton->setDefault( true );
finish(); finish();
...@@ -1284,6 +1285,8 @@ void KeySelectorControl::finish() ...@@ -1284,6 +1285,8 @@ void KeySelectorControl::finish()
CONNECT( table, itemDoubleClicked( QTreeWidgetItem *, int ), CONNECT( table, itemDoubleClicked( QTreeWidgetItem *, int ),
this, selectKey( QTreeWidgetItem *, int ) ); this, selectKey( QTreeWidgetItem *, int ) );
CONNECT( table, itemClicked( QTreeWidgetItem *, int ),
this, select( QTreeWidgetItem *, int) );
CONNECT( table, itemSelectionChanged(), CONNECT( table, itemSelectionChanged(),
this, select1Key() ); this, select1Key() );
...@@ -1301,6 +1304,11 @@ void KeySelectorControl::filter( const QString &qs_search ) ...@@ -1301,6 +1304,11 @@ void KeySelectorControl::filter( const QString &qs_search )
} }
} }
void KeySelectorControl::select( QTreeWidgetItem *keyItem, int column )
{
shortcutValue->setGlobal( column == 2 );
}
/* 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()
{ {
......
...@@ -452,7 +452,7 @@ public: ...@@ -452,7 +452,7 @@ public:
void setGlobal( bool _value ) { b_global = _value; } void setGlobal( bool _value ) { b_global = _value; }
bool getGlobal() const { return b_global; } bool getGlobal() const { return b_global; }
public slots: public slots:
virtual void clear(void) { value = 0; QLineEdit::clear(); b_global = false;} virtual void clear(void) { value = 0; QLineEdit::clear(); }
private: private:
int value; int value;
bool b_global; bool b_global;
...@@ -483,6 +483,7 @@ private: ...@@ -483,6 +483,7 @@ private:
private slots: private slots:
void setTheKey(); void setTheKey();
void selectKey( QTreeWidgetItem * = NULL, int column = 1 ); void selectKey( QTreeWidgetItem * = NULL, int column = 1 );
void select( QTreeWidgetItem * = NULL, int column = 1 );
void select1Key(); void select1Key();
void filter( const QString & ); void filter( const QString & );
}; };
......
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