[vlc-devel] commit: Use KeyToString ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu Mar 27 21:58:43 CET 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Thu Mar 27 22:59:05 2008 +0200| [e77d9061a5f92aff02ca206cda9cf03507bd2b4e]

Use KeyToString

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

 modules/gui/macosx/simple_prefs.m      |   16 +++++-----------
 modules/gui/qt4/util/customwidgets.cpp |   12 +++---------
 2 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/modules/gui/macosx/simple_prefs.m b/modules/gui/macosx/simple_prefs.m
index e8185ea..5fd56bb 100644
--- a/modules/gui/macosx/simple_prefs.m
+++ b/modules/gui/macosx/simple_prefs.m
@@ -83,17 +83,11 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
     if( val & KEY_MODIFIER_COMMAND )
         [o_temp_str appendString: [NSString stringWithUTF8String: "\xE2\x8C\x98"]];
 
-    unsigned int i_keys = sizeof(vlc_keys)/sizeof(key_descriptor_t);
-    for( unsigned int i = 0; i< i_keys; i++ )
-    {
-        if( vlc_keys[i].i_key_code == (val& ~KEY_MODIFIER) )
-        {
-            if( vlc_keys[i].psz_key_string )
-                [o_temp_str appendString: [NSString stringWithUTF8String: vlc_keys[i].psz_key_string]];
-            else
-                o_temp_str = @"Unset";
-        }
-    }
+    const char *base = KeyToString( val & ~KEY_MODIFIER );
+    if( base )
+        [o_temp_str appendString: [NSString stringWithUTF8String: base]];
+    else
+        o_temp_str = @"Unset";
     return o_temp_str;
 }
 
diff --git a/modules/gui/qt4/util/customwidgets.cpp b/modules/gui/qt4/util/customwidgets.cpp
index a7251cd..4de1129 100644
--- a/modules/gui/qt4/util/customwidgets.cpp
+++ b/modules/gui/qt4/util/customwidgets.cpp
@@ -181,6 +181,8 @@ int qtWheelEventToVLCKey( QWheelEvent *e )
 
 QString VLCKeyToString( int val )
 {
+    const char *base = KeyToString (val & ~KEY_MODIFIER);
+
     QString r = "";
     if( val & KEY_MODIFIER_CTRL )
         r+= "Ctrl+";
@@ -189,14 +191,6 @@ QString VLCKeyToString( int val )
     if( val & KEY_MODIFIER_SHIFT )
         r+= "Shift+";
 
-    unsigned int i_keys = sizeof(vlc_keys)/sizeof(key_descriptor_t);
-    for( unsigned int i = 0; i< i_keys; i++ )
-    {
-        if( vlc_keys[i].i_key_code == (val& ~KEY_MODIFIER) )
-        {
-            r+= vlc_keys[i].psz_key_string;
-        }
-    }
-    return r;
+    return r + (base ? base : "Unset");
 }
 




More information about the vlc-devel mailing list