[vlc-devel] commit: Qt, prefs, global hotkeys configuration, step 1. ( Jean-Baptiste Kempf )

git version control git at videolan.org
Tue Feb 24 11:18:43 CET 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Feb 23 22:15:44 2009 +0100| [b7923c3eaff47badd6272b126d267ea14fa13320] | committer: Jean-Baptiste Kempf 

Qt, prefs, global hotkeys configuration, step 1.

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

 modules/gui/qt4/components/preferences_widgets.cpp |   22 +++++++++++++++++--
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp
index 036ecc9..6c49762 100644
--- a/modules/gui/qt4/components/preferences_widgets.cpp
+++ b/modules/gui/qt4/components/preferences_widgets.cpp
@@ -1143,9 +1143,11 @@ KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this,
     QLineEdit *actionSearch = new QLineEdit;*/
 
     table = new QTreeWidget;
-    table->setColumnCount(2);
+    table->setColumnCount(3);
     table->headerItem()->setText( 0, qtr( "Action" ) );
     table->headerItem()->setText( 1, qtr( "Shortcut" ) );
+    table->headerItem()->setText( 2, qtr( "Global" ) );
+    table->setAlternatingRowColors( true );
 
     shortcutValue = new KeyShortcutEdit;
     shortcutValue->setReadOnly(true);
@@ -1177,8 +1179,6 @@ void KeySelectorControl::finish()
         label->setToolTip( formatTooltip( qtr( p_item->psz_longtext ) ) );
 
     /* Fill the table */
-    table->setColumnCount( 2 );
-    table->setAlternatingRowColors( true );
 
     /* Get the main Module */
     module_t *p_main = module_get_main();
@@ -1197,6 +1197,7 @@ void KeySelectorControl::finish()
         /* If we are a key option not empty */
         if( p_item->i_type & CONFIG_ITEM && p_item->psz_name
             && strstr( p_item->psz_name , "key-" )
+            && !strstr( p_item->psz_name , "global-key" )
             && !EMPTY_STR( p_item->psz_text ) )
         {
             /*
@@ -1213,6 +1214,21 @@ void KeySelectorControl::finish()
             treeItem->setText( 1, VLCKeyToString( p_item->value.i ) );
             treeItem->setData( 1, Qt::UserRole, QVariant( p_item->value.i ) );
             table->addTopLevelItem( treeItem );
+            continue;
+        }
+
+        if( p_item->i_type & CONFIG_ITEM && p_item->psz_name
+                && strstr( p_item->psz_name , "global-key" )
+                && !EMPTY_STR( p_item->psz_text ) )
+        {
+            QList<QTreeWidgetItem *> list =
+                table->findItems( qtr( p_item->psz_text ), Qt::MatchExactly );
+            if( list.count() > 1 )
+            {
+                list[0]->setText( 2, VLCKeyToString( p_item->value.i ) );
+                list[0]->setData( 2, Qt::UserRole,
+                                  QVariant( p_item->value.i ) );
+            }
         }
     }
     module_config_free (p_config);




More information about the vlc-devel mailing list