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

macosx: fixed playlist/video toggling and some memory leaks

parent ae7db4e9
...@@ -327,7 +327,7 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -327,7 +327,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
[o_mi_minimize setTitle: _NS("Minimize Window")]; [o_mi_minimize setTitle: _NS("Minimize Window")];
[o_mi_close_window setTitle: _NS("Close Window")]; [o_mi_close_window setTitle: _NS("Close Window")];
[o_mi_player setTitle: _NS("Player...")]; [o_mi_player setTitle: _NS("Player...")];
[o_mi_controller setTitle: _NS("Controller...")]; [o_mi_controller setTitle: _NS("Main Window...")];
[o_mi_audioeffects setTitle: _NS("Audio Effects...")]; [o_mi_audioeffects setTitle: _NS("Audio Effects...")];
[o_mi_videoeffects setTitle: _NS("Video Filters...")]; [o_mi_videoeffects setTitle: _NS("Video Filters...")];
[o_mi_bookmarks setTitle: _NS("Bookmarks...")]; [o_mi_bookmarks setTitle: _NS("Bookmarks...")];
......
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
- (IBAction)fullscreen:(id)sender; - (IBAction)fullscreen:(id)sender;
- (id)videoView; - (id)videoView;
- (void)setVideoplayEnabled:(BOOL)b_value; - (void)setVideoplayEnabled;
- (void)updateTimeSlider; - (void)updateTimeSlider;
- (void)updateVolumeSlider; - (void)updateVolumeSlider;
- (void)updateWindow; - (void)updateWindow;
......
...@@ -304,8 +304,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -304,8 +304,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (IBAction)togglePlaylist:(id)sender - (IBAction)togglePlaylist:(id)sender
{ {
NSLog( @"b_videoplayen %i", b_video_playback_enabled ); if ([o_video_view isHidden] && [o_playlist_btn isEnabled]) {
if (b_video_playback_enabled && [o_video_view isHidden]) {
[o_video_view setHidden: NO]; [o_video_view setHidden: NO];
[o_playlist_table setHidden: YES]; [o_playlist_table setHidden: YES];
} }
...@@ -669,18 +668,9 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -669,18 +668,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
return o_video_view; return o_video_view;
} }
- (void)setVideoplayEnabled:(BOOL)b_value - (void)setVideoplayEnabled
{ {
NSLog( @"setVideoplayEnabled:%i", b_value ); [o_playlist_btn setEnabled: [[VLCMain sharedInstance] activeVideoPlayback]];
if (b_value) {
b_video_playback_enabled = YES;
[o_playlist_btn setEnabled: YES];
}
else
{
b_video_playback_enabled = NO;
[o_playlist_btn setEnabled: NO];
}
} }
@end @end
......
...@@ -93,7 +93,7 @@ struct intf_sys_t ...@@ -93,7 +93,7 @@ struct intf_sys_t
id o_wizard; /* VLCWizard */ id o_wizard; /* VLCWizard */
id o_embedded_list; /* VLCEmbeddedList*/ id o_embedded_list; /* VLCEmbeddedList*/
id o_coredialogs; /* VLCCoreDialogProvider */ id o_coredialogs; /* VLCCoreDialogProvider */
VLCInformation * o_info; /* VLCInformation */ id o_info; /* VLCInformation */
id o_eyetv; /* VLCEyeTVController */ id o_eyetv; /* VLCEyeTVController */
id o_bookmarks; /* VLCBookmarks */ id o_bookmarks; /* VLCBookmarks */
id o_coreinteraction; /* VLCCoreInteraction */ id o_coreinteraction; /* VLCCoreInteraction */
...@@ -105,6 +105,7 @@ struct intf_sys_t ...@@ -105,6 +105,7 @@ struct intf_sys_t
BOOL nib_info_loaded; /* information panel nibfile */ BOOL nib_info_loaded; /* information panel nibfile */
BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */ BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */
BOOL nib_bookmarks_loaded; /* Bookmarks nibfile */ BOOL nib_bookmarks_loaded; /* Bookmarks nibfile */
BOOL b_active_videoplayback;
IBOutlet id o_mainwindow; /* VLCMainWindow */ IBOutlet id o_mainwindow; /* VLCMainWindow */
...@@ -163,6 +164,8 @@ struct intf_sys_t ...@@ -163,6 +164,8 @@ struct intf_sys_t
- (id)coreDialogProvider; - (id)coreDialogProvider;
- (id)eyeTVController; - (id)eyeTVController;
- (id)appleRemoteController; - (id)appleRemoteController;
- (void)setActiveVideoPlayback:(BOOL)b_value;
- (BOOL)activeVideoPlayback;
- (void)applicationWillTerminate:(NSNotification *)notification; - (void)applicationWillTerminate:(NSNotification *)notification;
- (NSString *)localizedString:(const char *)psz; - (NSString *)localizedString:(const char *)psz;
- (char *)delocalizeString:(NSString *)psz; - (char *)delocalizeString:(NSString *)psz;
...@@ -186,8 +189,6 @@ struct intf_sys_t ...@@ -186,8 +189,6 @@ struct intf_sys_t
- (void)updateMessageDisplay; - (void)updateMessageDisplay;
- (IBAction)showController:(id)sender;
- (IBAction)crashReporterAction:(id)sender; - (IBAction)crashReporterAction:(id)sender;
- (IBAction)openCrashLog:(id)sender; - (IBAction)openCrashLog:(id)sender;
- (IBAction)saveDebugLog:(id)sender; - (IBAction)saveDebugLog:(id)sender;
...@@ -195,7 +196,6 @@ struct intf_sys_t ...@@ -195,7 +196,6 @@ struct intf_sys_t
- (void)processReceivedlibvlcMessage:(const msg_item_t *)item; - (void)processReceivedlibvlcMessage:(const msg_item_t *)item;
- (IBAction)togglePlaylist:(id)sender;
- (void)updateTogglePlaylistState; - (void)updateTogglePlaylistState;
- (void)windowDidBecomeKey:(NSNotification *)o_notification; - (void)windowDidBecomeKey:(NSNotification *)o_notification;
......
...@@ -145,8 +145,7 @@ int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg ) ...@@ -145,8 +145,7 @@ int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
[[VLCMainWindow sharedInstance] setVideoplayEnabled:YES]; [[VLCMain sharedInstance] setActiveVideoPlayback: YES];
[[VLCMainWindow sharedInstance] togglePlaylist:nil];
p_wnd->control = WindowControl; p_wnd->control = WindowControl;
p_wnd->sys = (vout_window_sys_t *)VLCIntf; p_wnd->sys = (vout_window_sys_t *)VLCIntf;
[o_pool release]; [o_pool release];
...@@ -170,7 +169,7 @@ static int WindowControl( vout_window_t *p_wnd, int i_query, va_list args ) ...@@ -170,7 +169,7 @@ static int WindowControl( vout_window_t *p_wnd, int i_query, va_list args )
void WindowClose( vout_window_t *p_wnd ) void WindowClose( vout_window_t *p_wnd )
{ {
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
[[VLCMainWindow sharedInstance] setVideoplayEnabled:NO]; [[VLCMain sharedInstance] setActiveVideoPlayback:NO];
NSLog( @"Window Close" ); NSLog( @"Window Close" );
// tell the interface to get rid of the video, TODO // tell the interface to get rid of the video, TODO
[o_pool release]; [o_pool release];
...@@ -234,6 +233,7 @@ static void MsgCallback( msg_cb_data_t *data, const msg_item_t *item ) ...@@ -234,6 +233,7 @@ static void MsgCallback( msg_cb_data_t *data, const msg_item_t *item )
static int InputEvent( vlc_object_t *p_this, const char *psz_var, static int InputEvent( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t new_val, void *param ) vlc_value_t oldval, vlc_value_t new_val, void *param )
{ {
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
switch (new_val.i_int) { switch (new_val.i_int) {
case INPUT_EVENT_STATE: case INPUT_EVENT_STATE:
[[VLCMain sharedInstance] playbackStatusUpdated]; [[VLCMain sharedInstance] playbackStatusUpdated];
...@@ -301,38 +301,47 @@ static int InputEvent( vlc_object_t *p_this, const char *psz_var, ...@@ -301,38 +301,47 @@ static int InputEvent( vlc_object_t *p_this, const char *psz_var,
break; break;
} }
[o_pool release];
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static int PLItemChanged( vlc_object_t *p_this, const char *psz_var, static int PLItemChanged( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t new_val, void *param ) vlc_value_t oldval, vlc_value_t new_val, void *param )
{ {
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(PlaylistItemChanged) withObject:nil waitUntilDone:NO]; [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(PlaylistItemChanged) withObject:nil waitUntilDone:NO];
[o_pool release];
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static int PlaylistUpdated( vlc_object_t *p_this, const char *psz_var, static int PlaylistUpdated( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t new_val, void *param ) vlc_value_t oldval, vlc_value_t new_val, void *param )
{ {
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(playlistUpdated) withObject:nil waitUntilDone:NO]; [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(playlistUpdated) withObject:nil waitUntilDone:NO];
[o_pool release];
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static int PlaybackModeUpdated( vlc_object_t *p_this, const char *psz_var, static int PlaybackModeUpdated( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t new_val, void *param ) vlc_value_t oldval, vlc_value_t new_val, void *param )
{ {
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
[[VLCMain sharedInstance] playbackModeUpdated]; [[VLCMain sharedInstance] playbackModeUpdated];
[o_pool release];
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static int VolumeUpdated( vlc_object_t *p_this, const char *psz_var, static int VolumeUpdated( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t new_val, void *param ) vlc_value_t oldval, vlc_value_t new_val, void *param )
{ {
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
[[VLCMain sharedInstance] updateVolume]; [[VLCMain sharedInstance] updateVolume];
[o_pool release];
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -1459,10 +1468,16 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1459,10 +1468,16 @@ unsigned int CocoaKeyToVLC( unichar i_key )
return o_remote; return o_remote;
} }
- (IBAction)showController:(id)sender - (void)setActiveVideoPlayback:(BOOL)b_value
{
b_active_videoplayback = b_value;
[o_mainwindow setVideoplayEnabled];
[o_mainwindow togglePlaylist:nil];
}
- (BOOL)activeVideoPlayback
{ {
//FIXME: why is this function here?! return b_active_videoplayback;
[o_mainwindow makeKeyAndOrderFront:sender];
} }
#pragma mark - #pragma mark -
...@@ -1755,11 +1770,6 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1755,11 +1770,6 @@ unsigned int CocoaKeyToVLC( unichar i_key )
#pragma mark - #pragma mark -
#pragma mark Playlist toggling #pragma mark Playlist toggling
- (IBAction)togglePlaylist:(id)sender
{
NSLog( @"needs to be re-implemented" );
}
- (void)updateTogglePlaylistState - (void)updateTogglePlaylistState
{ {
[[self playlist] outlineViewSelectionDidChange: NULL]; [[self playlist] outlineViewSelectionDidChange: NULL];
......
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