Commit a823e39f authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: added an option to enable Growl notifcations more easily and fixed hotkey saving

parent d15f96b0
...@@ -98,6 +98,7 @@ ...@@ -98,6 +98,7 @@
IBOutlet id o_intf_view; IBOutlet id o_intf_view;
IBOutlet id o_intf_update_ckb; IBOutlet id o_intf_update_ckb;
IBOutlet id o_intf_last_update_lbl; IBOutlet id o_intf_last_update_lbl;
IBOutlet id o_intf_enableGrowl_ckb;
IBOutlet id o_osd_encoding_pop; IBOutlet id o_osd_encoding_pop;
IBOutlet id o_osd_encoding_txt; IBOutlet id o_osd_encoding_txt;
...@@ -156,6 +157,7 @@ ...@@ -156,6 +157,7 @@
NSOpenPanel *o_selectFolderPanel; NSOpenPanel *o_selectFolderPanel;
NSArray *o_hotkeyDescriptions; NSArray *o_hotkeyDescriptions;
NSArray *o_hotkeysNonUseableKeys; NSArray *o_hotkeysNonUseableKeys;
NSArray *o_hotkeyNames;
NSMutableArray *o_hotkeySettings; NSMutableArray *o_hotkeySettings;
NSNumber *o_keyInTransition; NSNumber *o_keyInTransition;
......
...@@ -273,6 +273,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des ...@@ -273,6 +273,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
[o_intf_mediakeys_bg_ckb setTitle: _NS("...when VLC is in background")]; [o_intf_mediakeys_bg_ckb setTitle: _NS("...when VLC is in background")];
[o_intf_update_ckb setTitle: _NS("Automatically check for updates")]; [o_intf_update_ckb setTitle: _NS("Automatically check for updates")];
[o_intf_last_update_lbl setStringValue: @""]; [o_intf_last_update_lbl setStringValue: @""];
[o_intf_enableGrowl_ckb setStringValue: _NS("Enable Growl notifications (on playlist item change)")];
/* Subtitles and OSD */ /* Subtitles and OSD */
[o_osd_encoding_txt setStringValue: _NS("Default Encoding")]; [o_osd_encoding_txt setStringValue: _NS("Default Encoding")];
...@@ -466,6 +467,13 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na ...@@ -466,6 +467,13 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
[o_intf_last_update_lbl setStringValue: [NSString stringWithFormat: _NS("Last check on: %@"), [[[SUUpdater sharedUpdater] lastUpdateCheckDate] descriptionWithLocale: [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]]]]; [o_intf_last_update_lbl setStringValue: [NSString stringWithFormat: _NS("Last check on: %@"), [[[SUUpdater sharedUpdater] lastUpdateCheckDate] descriptionWithLocale: [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]]]];
else else
[o_intf_last_update_lbl setStringValue: _NS("No check was performed yet.")]; [o_intf_last_update_lbl setStringValue: _NS("No check was performed yet.")];
psz_tmp = config_GetPsz( p_intf, "control" );
if (psz_tmp) {
[o_intf_enableGrowl_ckb setState: (NSInteger)strstr( psz_tmp, "growl")];
free( psz_tmp );
}
else
[o_intf_enableGrowl_ckb setState: NSOffState];
/****************** /******************
* audio settings * * audio settings *
...@@ -648,6 +656,7 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na ...@@ -648,6 +656,7 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
[o_hotkeySettings release]; [o_hotkeySettings release];
o_hotkeySettings = [[NSMutableArray alloc] init]; o_hotkeySettings = [[NSMutableArray alloc] init];
NSMutableArray *o_tempArray_desc = [[NSMutableArray alloc] init]; NSMutableArray *o_tempArray_desc = [[NSMutableArray alloc] init];
NSMutableArray *o_tempArray_names = [[NSMutableArray alloc] init];
module_t *p_main = module_get_main(); module_t *p_main = module_get_main();
assert( p_main ); assert( p_main );
...@@ -665,6 +674,7 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na ...@@ -665,6 +674,7 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
&& !EMPTY_STR( p_item->psz_text ) ) && !EMPTY_STR( p_item->psz_text ) )
{ {
[o_tempArray_desc addObject: _NS( p_item->psz_text )]; [o_tempArray_desc addObject: _NS( p_item->psz_text )];
[o_tempArray_names addObject: [NSString stringWithUTF8String:p_item->psz_name]];
[o_hotkeySettings addObject: [NSNumber numberWithInt:p_item->value.i]]; [o_hotkeySettings addObject: [NSNumber numberWithInt:p_item->value.i]];
} }
} }
...@@ -673,7 +683,10 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na ...@@ -673,7 +683,10 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
[o_hotkeyDescriptions release]; [o_hotkeyDescriptions release];
o_hotkeyDescriptions = [[NSArray alloc] initWithArray: o_tempArray_desc copyItems: YES]; o_hotkeyDescriptions = [[NSArray alloc] initWithArray: o_tempArray_desc copyItems: YES];
[o_hotkeyNames release];
o_hotkeyNames = [[NSArray alloc] initWithArray: o_tempArray_names copyItems: YES];
[o_tempArray_desc release]; [o_tempArray_desc release];
[o_tempArray_names release];
[o_hotkeys_listbox reloadData]; [o_hotkeys_listbox reloadData];
} }
...@@ -803,6 +816,29 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch ...@@ -803,6 +816,29 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
config_PutInt( p_intf, "macosx-appleremote", [o_intf_appleremote_ckb state] ); config_PutInt( p_intf, "macosx-appleremote", [o_intf_appleremote_ckb state] );
config_PutInt( p_intf, "macosx-mediakeys", [o_intf_mediakeys_ckb state] ); config_PutInt( p_intf, "macosx-mediakeys", [o_intf_mediakeys_ckb state] );
config_PutInt( p_intf, "macosx-mediakeys-background", [o_intf_mediakeys_bg_ckb state] ); config_PutInt( p_intf, "macosx-mediakeys-background", [o_intf_mediakeys_bg_ckb state] );
if( [o_intf_enableGrowl_ckb state] == NSOnState )
{
psz_tmp = config_GetPsz( p_intf, "control" );
if(! psz_tmp)
config_PutPsz( p_intf, "control", "growl" );
else if( (NSInteger)strstr( psz_tmp, "control" ) == NO )
{
psz_tmp = (char *)[[NSString stringWithFormat: @"%s:growl", psz_tmp] UTF8String];
config_PutPsz( p_intf, "control", psz_tmp );
free( psz_tmp );
}
}
else
{
psz_tmp = config_GetPsz( p_intf, "control" );
if( psz_tmp )
{
psz_tmp = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@":growl"]] UTF8String];
psz_tmp = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"growl:"]] UTF8String];
psz_tmp = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"growl"]] UTF8String];
config_PutPsz( p_intf, "control", psz_tmp );
}
}
/* activate stuff without restart */ /* activate stuff without restart */
if( [o_intf_appleremote_ckb state] == YES ) if( [o_intf_appleremote_ckb state] == YES )
...@@ -849,7 +885,6 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch ...@@ -849,7 +885,6 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
config_PutPsz( p_intf, "audio-filter", "volnorm" ); config_PutPsz( p_intf, "audio-filter", "volnorm" );
else if( (NSInteger)strstr( psz_tmp, "normvol" ) == NO ) else if( (NSInteger)strstr( psz_tmp, "normvol" ) == NO )
{ {
/* work-around a GCC 4.0.1 bug */
psz_tmp = (char *)[[NSString stringWithFormat: @"%s:volnorm", psz_tmp] UTF8String]; psz_tmp = (char *)[[NSString stringWithFormat: @"%s:volnorm", psz_tmp] UTF8String];
config_PutPsz( p_intf, "audio-filter", psz_tmp ); config_PutPsz( p_intf, "audio-filter", psz_tmp );
free( psz_tmp ); free( psz_tmp );
...@@ -860,11 +895,10 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch ...@@ -860,11 +895,10 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
psz_tmp = config_GetPsz( p_intf, "audio-filter" ); psz_tmp = config_GetPsz( p_intf, "audio-filter" );
if( psz_tmp ) if( psz_tmp )
{ {
char *psz_tmp2 = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@":volnorm"]] UTF8String]; psz_tmp = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@":volnorm"]] UTF8String];
psz_tmp2 = (char *)[[[NSString stringWithUTF8String: psz_tmp2] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"volnorm:"]] UTF8String]; psz_tmp = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"volnorm:"]] UTF8String];
psz_tmp2 = (char *)[[[NSString stringWithUTF8String: psz_tmp2] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"volnorm"]] UTF8String]; psz_tmp = (char *)[[[NSString stringWithUTF8String: psz_tmp] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"volnorm"]] UTF8String];
config_PutPsz( p_intf, "audio-filter", psz_tmp ); config_PutPsz( p_intf, "audio-filter", psz_tmp );
free( psz_tmp );
} }
} }
config_PutFloat( p_intf, "norm-max-level", [o_audio_norm_fld floatValue] ); config_PutFloat( p_intf, "norm-max-level", [o_audio_norm_fld floatValue] );
...@@ -1045,13 +1079,8 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch ...@@ -1045,13 +1079,8 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
********************/ ********************/
if( b_hotkeyChanged ) if( b_hotkeyChanged )
{ {
const struct hotkey *p_hotkeys = p_intf->p_libvlc->p_hotkeys; for (size_t i = 0; i < [o_hotkeySettings count]; i++)
i = 1; config_PutInt( p_intf, [[o_hotkeyNames objectAtIndex: i] UTF8String], [[o_hotkeySettings objectAtIndex: i] intValue] );
while( i < [o_hotkeySettings count] )
{
config_PutInt( p_intf, p_hotkeys[i].psz_action, [[o_hotkeySettings objectAtIndex: i-1] intValue] );
i++;
}
i = config_SaveConfigFile( p_intf, "main" ); i = config_SaveConfigFile( p_intf, "main" );
......
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