]> git.sesse.net Git - vlc/commitdiff
Qt: allow clearing of global keys
authorJean-Baptiste Kempf <jb@videolan.org>
Wed, 31 Mar 2010 14:45:48 +0000 (16:45 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 31 Mar 2010 14:48:46 +0000 (16:48 +0200)
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

modules/gui/qt4/components/preferences_widgets.cpp
modules/gui/qt4/components/preferences_widgets.hpp

index fa697f3f5413ad5d541c014a1946b15977f6f666..8d4dbf68fa6463bec3bda4603a3a8e9d92cd2029 100644 (file)
@@ -1191,12 +1191,13 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this,
     table->headerItem()->setText( 1, qtr( "Hotkey" ) );
     table->headerItem()->setText( 2, qtr( "Global" ) );
     table->setAlternatingRowColors( true );
+    table->setSelectionBehavior( QAbstractItemView::SelectItems );
 
     shortcutValue = new KeyShortcutEdit;
     shortcutValue->setReadOnly(true);
 
     QPushButton *clearButton = new QPushButton( qtr( "Clear" ) );
-    QPushButton *setButton = new QPushButton( qtr( "Set" ) );
+    QPushButton *setButton = new QPushButton( qtr( "Apply" ) );
     setButton->setDefault( true );
     finish();
 
@@ -1284,6 +1285,8 @@ void KeySelectorControl::finish()
 
     CONNECT( table, itemDoubleClicked( QTreeWidgetItem *, int ),
              this, selectKey( QTreeWidgetItem *, int ) );
+    CONNECT( table, itemClicked( QTreeWidgetItem *, int ),
+             this, select( QTreeWidgetItem *, int) );
     CONNECT( table, itemSelectionChanged(),
              this, select1Key() );
 
@@ -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 */
 void KeySelectorControl::select1Key()
 {
index 4ef0c35274b260c3a819af63a89377e30c4c6238..fea298ed12b5ae33582353cfbd7cec874749702e 100644 (file)
@@ -452,7 +452,7 @@ public:
     void setGlobal( bool _value ) { b_global = _value; }
     bool getGlobal()  const { return b_global; }
 public slots:
-    virtual void clear(void) { value = 0; QLineEdit::clear(); b_global = false;}
+    virtual void clear(void) { value = 0; QLineEdit::clear(); }
 private:
     int value;
     bool b_global;
@@ -483,6 +483,7 @@ private:
 private slots:
     void setTheKey();
     void selectKey( QTreeWidgetItem * = NULL, int column = 1 );
+    void select( QTreeWidgetItem * = NULL, int column = 1 );
     void select1Key();
     void filter( const QString & );
 };