Commit e77d9061 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use KeyToString

parent 1e81cdfb
...@@ -83,17 +83,11 @@ static VLCSimplePrefs *_o_sharedInstance = nil; ...@@ -83,17 +83,11 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
if( val & KEY_MODIFIER_COMMAND ) if( val & KEY_MODIFIER_COMMAND )
[o_temp_str appendString: [NSString stringWithUTF8String: "\xE2\x8C\x98"]]; [o_temp_str appendString: [NSString stringWithUTF8String: "\xE2\x8C\x98"]];
unsigned int i_keys = sizeof(vlc_keys)/sizeof(key_descriptor_t); const char *base = KeyToString( val & ~KEY_MODIFIER );
for( unsigned int i = 0; i< i_keys; i++ ) if( base )
{ [o_temp_str appendString: [NSString stringWithUTF8String: base]];
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 else
o_temp_str = @"Unset"; o_temp_str = @"Unset";
}
}
return o_temp_str; return o_temp_str;
} }
......
...@@ -181,6 +181,8 @@ int qtWheelEventToVLCKey( QWheelEvent *e ) ...@@ -181,6 +181,8 @@ int qtWheelEventToVLCKey( QWheelEvent *e )
QString VLCKeyToString( int val ) QString VLCKeyToString( int val )
{ {
const char *base = KeyToString (val & ~KEY_MODIFIER);
QString r = ""; QString r = "";
if( val & KEY_MODIFIER_CTRL ) if( val & KEY_MODIFIER_CTRL )
r+= "Ctrl+"; r+= "Ctrl+";
...@@ -189,14 +191,6 @@ QString VLCKeyToString( int val ) ...@@ -189,14 +191,6 @@ QString VLCKeyToString( int val )
if( val & KEY_MODIFIER_SHIFT ) if( val & KEY_MODIFIER_SHIFT )
r+= "Shift+"; r+= "Shift+";
unsigned int i_keys = sizeof(vlc_keys)/sizeof(key_descriptor_t); return r + (base ? base : "Unset");
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;
} }
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