1
mirror of https://code.videolan.org/videolan/vlc synced 2024-08-18 23:45:06 +02:00

macosx/main menu: remove dependency on core interaction singleton

This commit is contained in:
Felix Paul Kühne 2019-04-13 21:23:08 +02:00
parent 53fe076816
commit 8651d45b69
3 changed files with 30 additions and 6 deletions

View File

@ -23,7 +23,6 @@
#import "VLCMainMenu.h"
#import "main/VLCMain.h"
#import "coreinteraction/VLCCoreInteraction.h"
#import "coreinteraction/VLCVideoFilterHelper.h"
#import "extensions/NSScreen+VLCAdditions.h"
@ -804,8 +803,8 @@
- (void)lockVideosAspectRatio:(id)sender
{
// FIXME: re-write the following using VLCPlayerController
[[VLCCoreInteraction sharedInstance] setAspectRatioIsLocked: ![sender state]];
[sender setState: [[VLCCoreInteraction sharedInstance] aspectRatioIsLocked]];
[_playerController setAspectRatioIsLocked: ![sender state]];
[sender setState: [_playerController aspectRatioIsLocked]];
}
- (IBAction)quitAfterPlayback:(id)sender
@ -1166,8 +1165,18 @@
i_returnValue = [openPanel runModal];
if (i_returnValue == NSModalResponseOK)
[[VLCCoreInteraction sharedInstance] addSubtitlesToCurrentInput:[openPanel URLs]];
if (i_returnValue == NSModalResponseOK) {
NSArray *URLs = [openPanel URLs];
NSUInteger count = [URLs count];
for (int i = 0; i < count ; i++) {
NSURL *url = URLs[i];
[_playerController addAssociatedMediaToCurrentFromURL:url
ofCategory:SPU_ES
shallSelectTrack:YES
shallDisplayOSD:YES
shallVerifyExtension:NO];
}
}
}
- (void)switchSubtitleSize:(id)sender
@ -1559,7 +1568,7 @@
lmi_tmp2 = [menu addItemWithTitle: _NS("Lock Aspect Ratio") action: @selector(lockVideosAspectRatio:) keyEquivalent: @""];
[lmi_tmp2 setTarget: self];
[lmi_tmp2 setEnabled: YES];
[lmi_tmp2 setState: [[VLCCoreInteraction sharedInstance] aspectRatioIsLocked]];
[lmi_tmp2 setState: [_playerController aspectRatioIsLocked]];
[parent setEnabled: YES];
[menu addItem: [NSMenuItem separatorItem]];
}

View File

@ -803,6 +803,11 @@ extern NSString *VLCPlayerMuteChanged;
*/
- (void)setVideoFilterChain:(nullable NSString *)filterChain forType:(enum vlc_vout_filter_type)filterType;
/**
* defines whether the vout windows lock on the video's AR or can be resized arbitrarily
*/
@property (nonatomic, readwrite) BOOL aspectRatioIsLocked;
#pragma mark - audio output properties
/**

View File

@ -1623,6 +1623,16 @@ static const struct vlc_player_aout_cbs player_aout_callbacks = {
vlc_player_vout_SetFilter(_p_player, filterType, filterChain != nil ? [filterChain UTF8String] : NULL);
}
- (void)setAspectRatioIsLocked:(BOOL)b_value
{
config_PutInt("macosx-lock-aspect-ratio", b_value);
}
- (BOOL)aspectRatioIsLocked
{
return config_GetInt("macosx-lock-aspect-ratio");
}
#pragma mark - audio specific delegation
- (void)volumeChanged:(float)volume