[vlc-commits] commit: Qt: allow clearing of global keys (Jean-Baptiste Kempf )

git at videolan.org git at videolan.org
Wed Mar 31 16:48:44 CEST 2010


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Mar 31 16:45:48 2010 +0200| [a2c859a5e74882e46a2ce702262e6d69194e4e68] | committer: 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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a2c859a5e74882e46a2ce702262e6d69194e4e68
---

 modules/gui/qt4/components/preferences_widgets.cpp |   10 +++++++++-
 modules/gui/qt4/components/preferences_widgets.hpp |    3 ++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp
index fa697f3..8d4dbf6 100644
--- a/modules/gui/qt4/components/preferences_widgets.cpp
+++ b/modules/gui/qt4/components/preferences_widgets.cpp
@@ -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()
 {
diff --git a/modules/gui/qt4/components/preferences_widgets.hpp b/modules/gui/qt4/components/preferences_widgets.hpp
index 4ef0c35..fea298e 100644
--- a/modules/gui/qt4/components/preferences_widgets.hpp
+++ b/modules/gui/qt4/components/preferences_widgets.hpp
@@ -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 & );
 };



More information about the vlc-commits mailing list