Commit 89601853 authored by Felix Paul Kühne's avatar Felix Paul Kühne Committed by Jean-Baptiste Kempf

macosx: really fix the messages panel (fixes #5541) and added a 'live update'...

macosx: really fix the messages panel (fixes #5541) and added a 'live update' checkbox to turn off frequent updates since this is quite load intensive
(cherry picked from commit 4012f039)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent d860092a
...@@ -123,6 +123,8 @@ struct intf_sys_t ...@@ -123,6 +123,8 @@ struct intf_sys_t
BOOL b_msg_arr_changed; /* did the array change? */ BOOL b_msg_arr_changed; /* did the array change? */
IBOutlet NSButton * o_msgs_crashlog_btn; /* messages open crashlog */ IBOutlet NSButton * o_msgs_crashlog_btn; /* messages open crashlog */
IBOutlet NSButton * o_msgs_save_btn; /* save the log as rtf */ IBOutlet NSButton * o_msgs_save_btn; /* save the log as rtf */
IBOutlet NSButton * o_msgs_liveUpdate_ckb; /* always update the panel when visible */
BOOL b_msg_live_update;
/* CrashReporter panel */ /* CrashReporter panel */
IBOutlet NSButton * o_crashrep_dontSend_btn; IBOutlet NSButton * o_crashrep_dontSend_btn;
...@@ -199,6 +201,7 @@ struct intf_sys_t ...@@ -199,6 +201,7 @@ struct intf_sys_t
- (IBAction)openCrashLog:(id)sender; - (IBAction)openCrashLog:(id)sender;
- (IBAction)saveDebugLog:(id)sender; - (IBAction)saveDebugLog:(id)sender;
- (IBAction)showMessagesPanel:(id)sender; - (IBAction)showMessagesPanel:(id)sender;
- (IBAction)liveUpdateMessagesPanel:(id)sender;
- (void)processReceivedlibvlcMessage:(const msg_item_t *) item ofType: (int)type withStr: (char *)str; - (void)processReceivedlibvlcMessage:(const msg_item_t *) item ofType: (int)type withStr: (char *)str;
......
...@@ -534,6 +534,11 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -534,6 +534,11 @@ static VLCMain *_o_sharedMainInstance = nil;
object: @"VLCEyeTVSupport" object: @"VLCEyeTVSupport"
userInfo: NULL userInfo: NULL
deliverImmediately: YES]; deliverImmediately: YES];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"NO" forKey:@"LiveUpdateTheMessagesPanel"];
[defaults registerDefaults:appDefaults];
return _o_sharedMainInstance; return _o_sharedMainInstance;
} }
...@@ -606,6 +611,9 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -606,6 +611,9 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_remote setClickCountEnabledButtons: kRemoteButtonPlay]; [o_remote setClickCountEnabledButtons: kRemoteButtonPlay];
[o_remote setDelegate: _o_sharedMainInstance]; [o_remote setDelegate: _o_sharedMainInstance];
b_msg_live_update = [[NSUserDefaults standardUserDefaults] boolForKey:@"LiveUpdateTheMessagesPanel"];
[o_msgs_liveUpdate_ckb setState: b_msg_live_update];
/* yeah, we are done */ /* yeah, we are done */
b_nativeFullscreenMode = config_GetInt( p_intf, "macosx-nativefullscreenmode" ); b_nativeFullscreenMode = config_GetInt( p_intf, "macosx-nativefullscreenmode" );
nib_main_loaded = TRUE; nib_main_loaded = TRUE;
...@@ -652,6 +660,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -652,6 +660,7 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_msgs_panel setTitle: _NS("Messages")]; [o_msgs_panel setTitle: _NS("Messages")];
[o_msgs_crashlog_btn setTitle: _NS("Open CrashLog...")]; [o_msgs_crashlog_btn setTitle: _NS("Open CrashLog...")];
[o_msgs_save_btn setTitle: _NS("Save this Log...")]; [o_msgs_save_btn setTitle: _NS("Save this Log...")];
[o_msgs_liveUpdate_ckb setTitle: _NS("Live Update")];
/* crash reporter panel */ /* crash reporter panel */
[o_crashrep_send_btn setTitle: _NS("Send")]; [o_crashrep_send_btn setTitle: _NS("Send")];
...@@ -1837,6 +1846,17 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1837,6 +1846,17 @@ unsigned int CocoaKeyToVLC( unichar i_key )
#pragma mark - #pragma mark -
#pragma mark Errors, warnings and messages #pragma mark Errors, warnings and messages
- (IBAction)liveUpdateMessagesPanel:(id)sender
{
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"LiveUpdateTheMessagesPanel"])
[[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"LiveUpdateTheMessagesPanel"];
else
[[NSUserDefaults standardUserDefaults] setObject:@"YES" forKey:@"LiveUpdateTheMessagesPanel"];
b_msg_live_update = [[NSUserDefaults standardUserDefaults] boolForKey:@"LiveUpdateTheMessagesPanel"];
[o_msgs_liveUpdate_ckb setState: b_msg_live_update];
}
- (IBAction)showMessagesPanel:(id)sender - (IBAction)showMessagesPanel:(id)sender
{ {
[o_msgs_panel makeKeyAndOrderFront: sender]; [o_msgs_panel makeKeyAndOrderFront: sender];
...@@ -1850,7 +1870,7 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1850,7 +1870,7 @@ unsigned int CocoaKeyToVLC( unichar i_key )
- (void)updateMessageDisplay - (void)updateMessageDisplay
{ {
if( [o_msgs_panel isVisible] && b_msg_arr_changed ) if( [o_msgs_panel isVisible] && (b_msg_live_update || [o_msgs_panel isKeyWindow]) && b_msg_arr_changed )
{ {
id o_msg; id o_msg;
NSEnumerator * o_enum; NSEnumerator * o_enum;
...@@ -1901,7 +1921,7 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1901,7 +1921,7 @@ unsigned int CocoaKeyToVLC( unichar i_key )
b_msg_arr_changed = YES; b_msg_arr_changed = YES;
[o_msg_lock unlock]; [o_msg_lock unlock];
[self updateMessageDisplay]; [self performSelectorOnMainThread:@selector(updateMessageDisplay) withObject: nil waitUntilDone:NO];
} }
- (IBAction)saveDebugLog:(id)sender - (IBAction)saveDebugLog:(id)sender
......
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