You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

106 lines
3.6 KiB

/*****************************************************************************
* VLCMainVideoViewControlsBar.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2023 VLC authors and VideoLAN
*
* Authors: Claudio Cambra <developer@claudiocambra.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "VLCMainVideoViewControlsBar.h"
#import "extensions/NSString+Helpers.h"
#import "library/VLCLibraryDataTypes.h"
#import "main/VLCMain.h"
#import "menus/VLCMainMenu.h"
#import "panels/VLCBookmarksWindowController.h"
#import "playlist/VLCPlaylistController.h"
#import "playlist/VLCPlayerController.h"
#import "views/VLCWrappableTextField.h"
@interface VLCMainVideoViewControlsBar ()
{
VLCPlaylistController *_playlistController;
VLCPlayerController *_playerController;
}
@end
@implementation VLCMainVideoViewControlsBar
- (void)awakeFromNib
{
[super awakeFromNib];
_bookmarksButton.toolTip = _NS("Bookmarks");
_bookmarksButton.accessibilityLabel = _bookmarksButton.toolTip;
_subtitlesButton.toolTip = _NS("Subtitle settings");
_subtitlesButton.accessibilityLabel = _subtitlesButton.toolTip;
_audioButton.toolTip = _NS("Audio settings");
_audioButton.accessibilityLabel = _audioButton.toolTip;
_playlistController = VLCMain.sharedInstance.playlistController;
_playerController = _playlistController.playerController;
NSNotificationCenter * const notificationCenter = NSNotificationCenter.defaultCenter;
[notificationCenter addObserver:self
selector:@selector(updateDetailLabel:)
name:VLCPlayerCurrentMediaItemChanged
object:nil];
}
- (void)updateDetailLabel:(NSNotification *)notification
{
VLCMediaLibraryMediaItem * const mediaItem = [VLCMediaLibraryMediaItem mediaItemForURL:_playerController.URLOfCurrentMediaItem];
if (!mediaItem) {
return;
}
_detailLabel.hidden = [mediaItem.detailString isEqualToString:@""] ||
[mediaItem.detailString isEqualToString:mediaItem.durationString];
_detailLabel.stringValue = mediaItem.detailString;
}
- (IBAction)openBookmarks:(id)sender
{
[VLCMain.sharedInstance.bookmarks toggleWindow:sender];
}
- (IBAction)openSubtitlesMenu:(id)sender
{
NSMenu * const menu = VLCMain.sharedInstance.mainMenu.subtitlesMenu;
[menu popUpMenuPositioningItem:nil
atLocation:_subtitlesButton.frame.origin
inView:((NSView *)sender).superview];
}
- (IBAction)openAudioMenu:(id)sender
{
NSMenu * const menu = VLCMain.sharedInstance.mainMenu.audioMenu;
[menu popUpMenuPositioningItem:nil
atLocation:_audioButton.frame.origin
inView:((NSView *)sender).superview];
}
@end