Commit 91751dbd authored by David's avatar David

macosx: Move input-related handlers to InputManager, simplify

parent 0eaddd99
......@@ -21,6 +21,7 @@
#import "InputManager.h"
#import "CoreInteraction.h"
#import "CompatibilityFixes.h"
#import "ExtensionsManager.h"
#import "intf.h"
......@@ -28,6 +29,7 @@
#import "MainWindow.h"
#import "playlist.h"
#import "playlistinfo.h"
#import "TrackSynchronization.h"
#import "iTunes.h"
#import "Spotify.h"
......@@ -60,14 +62,14 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
[[[VLCMain sharedInstance] mainMenu] performSelectorOnMainThread:@selector(updatePlaybackRate) withObject: nil waitUntilDone:NO];
break;
case INPUT_EVENT_POSITION:
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updatePlaybackPosition) withObject: nil waitUntilDone:NO];
[[[VLCMain sharedInstance] mainWindow] performSelectorOnMainThread:@selector(updateTimeSlider) withObject: nil waitUntilDone:NO];
break;
case INPUT_EVENT_TITLE:
case INPUT_EVENT_CHAPTER:
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO];
[inputManager performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO];
break;
case INPUT_EVENT_CACHE:
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainWindow) withObject: nil waitUntilDone: NO];
[inputManager performSelectorOnMainThread:@selector(updateMainWindow) withObject:nil waitUntilDone:NO];
break;
case INPUT_EVENT_STATISTICS:
dispatch_async(dispatch_get_main_queue(), ^{
......@@ -84,17 +86,19 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
break;
case INPUT_EVENT_ITEM_META:
case INPUT_EVENT_ITEM_INFO:
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO];
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
[inputManager performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO];
[inputManager performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
[inputManager performSelectorOnMainThread:@selector(updateMetaAndInfo) withObject: nil waitUntilDone:NO];
break;
case INPUT_EVENT_BOOKMARK:
break;
case INPUT_EVENT_RECORD:
[[VLCMain sharedInstance] updateRecordState: var_GetBool(p_this, "record")];
dispatch_async(dispatch_get_main_queue(), ^{
[[[VLCMain sharedInstance] mainMenu] updateRecordState: var_InheritBool(p_this, "record")];
});
break;
case INPUT_EVENT_PROGRAM:
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO];
[inputManager performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO];
break;
case INPUT_EVENT_ITEM_EPG:
break;
......@@ -102,17 +106,17 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
break;
case INPUT_EVENT_ITEM_NAME:
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
[inputManager performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
break;
case INPUT_EVENT_AUDIO_DELAY:
case INPUT_EVENT_SUBTITLE_DELAY:
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateDelays) withObject:nil waitUntilDone:NO];
[inputManager performSelectorOnMainThread:@selector(updateDelays) withObject:nil waitUntilDone:NO];
break;
case INPUT_EVENT_DEAD:
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updatePlaybackPosition) withObject:nil waitUntilDone:NO];
[inputManager performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
[[[VLCMain sharedInstance] mainWindow] performSelectorOnMainThread:@selector(updateTimeSlider) withObject:nil waitUntilDone:NO];
break;
default:
......@@ -198,9 +202,9 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
[self updateMetaAndInfo];
[[o_main mainWindow] updateWindow];
[o_main updateDelays];
[o_main updateMainMenu];
[self updateMainWindow];
[self updateDelays];
[self updateMainMenu];
/*
* Due to constraints within NSAttributedString's main loop runtime handling
......@@ -334,7 +338,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
}
}
[[VLCMain sharedInstance] updateMainWindow];
[self updateMainWindow];
[self sendDistributedNotificationWithUpdatedPlaybackStatus];
}
......@@ -383,6 +387,28 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
[[o_main info] updatePanelWithItem:p_input_item];
}
- (void)updateMainWindow
{
[[o_main mainWindow] updateWindow];
}
- (void)updateName
{
[[o_main mainWindow] updateName];
}
- (void)updateDelays
{
[[VLCTrackSynchronization sharedInstance] updateValues];
}
- (void)updateMainMenu
{
[[o_main mainMenu] setupMenus];
[[o_main mainMenu] updatePlaybackRate];
[[VLCCoreInteraction sharedInstance] resetAtoB];
}
- (void)sendDistributedNotificationWithUpdatedPlaybackStatus
{
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"VLCPlayerStateDidChange"
......
......@@ -688,6 +688,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_fspanel updatePositionAndTime];
[[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(updateTimeSlider)];
[[VLCCoreInteraction sharedInstance] updateAtoB];
}
- (void)updateName
......
......@@ -212,8 +212,8 @@
if (b_nonembedded) {
// events might be posted before window is created, so call them again
[[VLCMain sharedInstance] updateName];
[[VLCMain sharedInstance] updateMainWindow]; // update controls bar
[[[VLCMain sharedInstance] mainWindow] updateName];
[[[VLCMain sharedInstance] mainWindow] updateWindow]; // update controls bar
}
// TODO: find a cleaner way for "start in fullscreen"
......
......@@ -642,7 +642,7 @@
var_Set(p_input, "position", pos);
vlc_object_release(p_input);
}
[[VLCMain sharedInstance] updatePlaybackPosition];
[[[VLCMain sharedInstance] mainWindow] updateTimeSlider];
}
- (IBAction)fsVolumeSliderUpdate:(id)sender
......
......@@ -146,14 +146,8 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
- (void)plItemUpdated;
- (void)playbackModeUpdated;
- (void)updateVolume;
- (void)updatePlaybackPosition;
- (void)updateName;
- (void)updateRecordState: (BOOL)b_value;
- (void)updateMainMenu;
- (void)updateMainWindow;
- (void)showMainWindow;
- (void)showFullscreenController;
- (void)updateDelays;
- (void)updateTogglePlaylistState;
......
......@@ -1225,18 +1225,6 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_info updateMetadata];
}
- (void)updateMainMenu
{
[o_mainmenu setupMenus];
[o_mainmenu updatePlaybackRate];
[[VLCCoreInteraction sharedInstance] resetAtoB];
}
- (void)updateMainWindow
{
[o_mainwindow updateWindow];
}
- (void)showMainWindow
{
[o_mainwindow performSelectorOnMainThread:@selector(makeKeyAndOrderFront:) withObject:nil waitUntilDone:NO];
......@@ -1249,32 +1237,11 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_mainwindow performSelectorOnMainThread:@selector(showFullscreenController) withObject:nil waitUntilDone:NO];
}
- (void)updateDelays
{
[[VLCTrackSynchronization sharedInstance] performSelectorOnMainThread: @selector(updateValues) withObject: nil waitUntilDone:NO];
}
- (void)updateName
{
[o_mainwindow updateName];
}
- (void)updatePlaybackPosition
{
[o_mainwindow updateTimeSlider];
[[VLCCoreInteraction sharedInstance] updateAtoB];
}
- (void)updateVolume
{
[o_mainwindow updateVolumeSlider];
}
- (void)updateRecordState: (BOOL)b_value
{
[o_mainmenu updateRecordState:b_value];
}
- (void)playbackModeUpdated
{
playlist_t * p_playlist = pl_Get(VLCIntf);
......
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