mirror of
https://code.videolan.org/videolan/vlc
synced 2024-08-18 23:45:06 +02:00
macosx/main menu: fix play state display
This commit is contained in:
parent
dcda3df5ce
commit
fc5d29fa80
@ -277,12 +277,9 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
|
||||
|
||||
if (state == PLAYING_S) {
|
||||
[self stopItunesPlayback];
|
||||
|
||||
[[o_main mainMenu] setPause];
|
||||
[[o_main mainWindow] setPause];
|
||||
} else {
|
||||
[[o_main mainMenu] setSubmenusEnabled: FALSE];
|
||||
[[o_main mainMenu] setPlay];
|
||||
[[o_main mainWindow] setPlay];
|
||||
|
||||
if (state == END_S || state == -1) {
|
||||
@ -302,7 +299,6 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
|
||||
}
|
||||
|
||||
[self updateMainWindow];
|
||||
[self sendDistributedNotificationWithUpdatedPlaybackStatus];
|
||||
}
|
||||
|
||||
// Called when playback has ended and likely no subsequent media will start playing
|
||||
@ -401,14 +397,6 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
|
||||
[[VLCCoreInteraction sharedInstance] resetAtoB];
|
||||
}
|
||||
|
||||
- (void)sendDistributedNotificationWithUpdatedPlaybackStatus
|
||||
{
|
||||
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"VLCPlayerStateDidChange"
|
||||
object:nil
|
||||
userInfo:nil
|
||||
deliverImmediately:YES];
|
||||
}
|
||||
|
||||
- (BOOL)hasInput
|
||||
{
|
||||
return p_current_input != NULL;
|
||||
|
@ -284,12 +284,6 @@
|
||||
- (IBAction)showMainWindow:(id)sender;
|
||||
- (IBAction)showPlaylist:(id)sender;
|
||||
|
||||
- (void)setPlay;
|
||||
- (void)setPause;
|
||||
- (void)setRepeatOne;
|
||||
- (void)setRepeatAll;
|
||||
- (void)setRepeatOff;
|
||||
- (void)setShuffle;
|
||||
@end
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -236,6 +236,18 @@
|
||||
selector:@selector(updateRecordState)
|
||||
name:VLCPlayerRecordingChanged
|
||||
object:nil];
|
||||
[notificationCenter addObserver:self
|
||||
selector:@selector(playbackStateChanged:)
|
||||
name:VLCPlayerStateChanged
|
||||
object:nil];
|
||||
[notificationCenter addObserver:self
|
||||
selector:@selector(playModeChanged:)
|
||||
name:VLCPlaybackRepeatChanged
|
||||
object:self];
|
||||
[notificationCenter addObserver:self
|
||||
selector:@selector(playOrderChanged:)
|
||||
name:VLCPlaybackOrderChanged
|
||||
object:self];
|
||||
|
||||
[self setupVarMenuItem:_add_intf target: (vlc_object_t *)p_intf
|
||||
var:"intf-add" selector: @selector(toggleVar:)];
|
||||
@ -1297,7 +1309,40 @@
|
||||
[[[VLCMain sharedInstance] currentMediaInfoPanel] toggleWindow:sender];
|
||||
}
|
||||
|
||||
#pragma mark - convinience stuff for other objects
|
||||
#pragma mark - playback state
|
||||
|
||||
- (void)playbackStateChanged:(NSNotification *)aNotification
|
||||
{
|
||||
enum vlc_player_state playerState = [_playlistController playerController].playerState;
|
||||
if (playerState == VLC_PLAYER_STATE_PLAYING) {
|
||||
[self setPause];
|
||||
} else {
|
||||
[self setPlay];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)playModeChanged:(NSNotification *)aNotification
|
||||
{
|
||||
enum vlc_playlist_playback_repeat repeatState = _playlistController.playbackRepeat;
|
||||
switch (repeatState) {
|
||||
case VLC_PLAYLIST_PLAYBACK_REPEAT_ALL:
|
||||
[self setRepeatAll];
|
||||
break;
|
||||
|
||||
case VLC_PLAYLIST_PLAYBACK_REPEAT_CURRENT:
|
||||
[self setRepeatOne];
|
||||
break;
|
||||
|
||||
default:
|
||||
[self setRepeatOff];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)playOrderChanged:(NSNotification *)aNotification
|
||||
{
|
||||
[_random setState:_playlistController.playbackOrder == VLC_PLAYLIST_PLAYBACK_ORDER_RANDOM];
|
||||
}
|
||||
|
||||
- (void)setPlay
|
||||
{
|
||||
@ -1331,11 +1376,6 @@
|
||||
[_loop setState: NSOffState];
|
||||
}
|
||||
|
||||
- (void)setShuffle
|
||||
{
|
||||
[_random setState:_playlistController.playbackOrder == VLC_PLAYLIST_PLAYBACK_ORDER_RANDOM];
|
||||
}
|
||||
|
||||
#pragma mark - Dynamic menu creation and validation
|
||||
|
||||
- (void)setupVarMenuItem:(NSMenuItem *)mi
|
||||
|
Loading…
Reference in New Issue
Block a user