[vlc-commits] [Git][videolan/vlc][master] 8 commits: macosx: Store button images as private references in VLCControlsBarCommon
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Tue Feb 27 11:36:25 UTC 2024
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
a7adc7ec by Claudio Cambra at 2024-02-27T10:04:07+00:00
macosx: Store button images as private references in VLCControlsBarCommon
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
cdb141f6 by Claudio Cambra at 2024-02-27T10:04:07+00:00
macosx: Stop redundantly overwriting control bar icons in VLCMainWindowControlsBar subclass
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
daadfbf3 by Claudio Cambra at 2024-02-27T10:04:07+00:00
macosx: Use system icons if possible for the control bar
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
a2e572a5 by Claudio Cambra at 2024-02-27T10:04:07+00:00
macosx: Use system icons if possible for the VLCMainWindowControlsBar
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
216fbcf2 by Claudio Cambra at 2024-02-27T10:04:07+00:00
macosx: Replace shuffle icon on playlist library window sidebar with system icon if possible, tint content instead of replacing icon
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
bfa5ba3a by Claudio Cambra at 2024-02-27T10:04:07+00:00
macosx: Replace repeat icons on playlist library window sidebar with system icon if possible, tint content
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
504f65fe by Claudio Cambra at 2024-02-27T10:04:07+00:00
macosx: Remove now unused images for repeat and shuffle in main window controls bar
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
50066908 by Claudio Cambra at 2024-02-27T10:04:07+00:00
macosx: Fix display of current item title and detail string in controls bars
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
3 changed files:
- modules/gui/macosx/library/VLCLibraryWindow.m
- modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.m
- modules/gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.m
Changes:
=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -337,10 +337,14 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
- (void)shuffleStateUpdated:(NSNotification *)aNotification
{
- if (_playlistController.playbackOrder == VLC_PLAYLIST_PLAYBACK_ORDER_NORMAL) {
- self.shufflePlaylistButton.image = [NSImage imageNamed:@"shuffleOff"];
+ if (@available(macOS 11.0, *)) {
+ self.shufflePlaylistButton.image = [NSImage imageWithSystemSymbolName:@"shuffle"
+ accessibilityDescription:@"Shuffle"];
+ self.shufflePlaylistButton.contentTintColor = _playlistController.playbackOrder == VLC_PLAYLIST_PLAYBACK_ORDER_NORMAL ?
+ nil : [NSColor VLCAccentColor];
} else {
- self.shufflePlaylistButton.image = [[NSImage imageNamed:@"shuffleOn"] imageTintedWithColor:NSColor.VLCAccentColor];
+ self.shufflePlaylistButton.image = _playlistController.playbackOrder == VLC_PLAYLIST_PLAYBACK_ORDER_NORMAL ?
+ [NSImage imageNamed:@"shuffleOff"] : [[NSImage imageNamed:@"shuffleOn"] imageTintedWithColor:NSColor.VLCAccentColor];
}
}
@@ -364,17 +368,37 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
- (void)repeatStateUpdated:(NSNotification *)aNotification
{
enum vlc_playlist_playback_repeat currentRepeatState = _playlistController.playbackRepeat;
- switch (currentRepeatState) {
- case VLC_PLAYLIST_PLAYBACK_REPEAT_ALL:
- self.repeatPlaylistButton.image = [[NSImage imageNamed:@"repeatAll"] imageTintedWithColor:NSColor.VLCAccentColor];
- break;
- case VLC_PLAYLIST_PLAYBACK_REPEAT_CURRENT:
- self.repeatPlaylistButton.image = [[NSImage imageNamed:@"repeatOne"] imageTintedWithColor:NSColor.VLCAccentColor];
- break;
- default:
- self.repeatPlaylistButton.image = [NSImage imageNamed:@"repeatOff"];
- break;
+ if (@available(macOS 11.0, *)) {
+ switch (currentRepeatState) {
+ case VLC_PLAYLIST_PLAYBACK_REPEAT_CURRENT:
+ self.repeatPlaylistButton.image = [NSImage imageWithSystemSymbolName:@"repeat.1"
+ accessibilityDescription:@"Repeat current"];
+ self.repeatPlaylistButton.contentTintColor = [NSColor VLCAccentColor];
+ break;
+ case VLC_PLAYLIST_PLAYBACK_REPEAT_ALL:
+ self.repeatPlaylistButton.image = [NSImage imageWithSystemSymbolName:@"repeat"
+ accessibilityDescription:@"Repeat"];
+ self.repeatPlaylistButton.contentTintColor = [NSColor VLCAccentColor];
+ break;
+ default:
+ self.repeatPlaylistButton.image = [NSImage imageWithSystemSymbolName:@"repeat"
+ accessibilityDescription:@"Repeat"];
+ self.repeatPlaylistButton.contentTintColor = nil;
+ break;
+ }
+ } else {
+ switch (currentRepeatState) {
+ case VLC_PLAYLIST_PLAYBACK_REPEAT_ALL:
+ self.repeatPlaylistButton.image = [[NSImage imageNamed:@"repeatAll"] imageTintedWithColor:NSColor.VLCAccentColor];
+ break;
+ case VLC_PLAYLIST_PLAYBACK_REPEAT_CURRENT:
+ self.repeatPlaylistButton.image = [[NSImage imageNamed:@"repeatOne"] imageTintedWithColor:NSColor.VLCAccentColor];
+ break;
+ default:
+ self.repeatPlaylistButton.image = [NSImage imageNamed:@"repeatOff"];
+ break;
+ }
}
}
=====================================
modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.m
=====================================
@@ -52,6 +52,11 @@
NSImage *_pressedPauseImage;
NSImage *_playImage;
NSImage *_pressedPlayImage;
+ NSImage *_backwardImage;
+ NSImage *_forwardImage;
+ NSImage *_fullscreenImage;
+ NSImage *_mutedVolumeImage;
+ NSImage *_unmutedVolumeImage;
NSTimeInterval last_fwd_event;
NSTimeInterval last_bwd_event;
@@ -94,7 +99,7 @@
name:VLCPlayerStateChanged
object:nil];
[notificationCenter addObserver:self
- selector:@selector(updateCurrentItemDisplayControls:)
+ selector:@selector(updatePlaybackControls:)
name:VLCPlayerCurrentMediaItemChanged
object:nil];
[notificationCenter addObserver:self
@@ -124,17 +129,44 @@
[self.fullscreenButton setToolTip: _NS("Enter fullscreen")];
self.fullscreenButton.accessibilityLabel = self.fullscreenButton.toolTip;
- [self.backwardButton setImage: imageFromRes(@"VLCBackwardTemplate")];
- [self.backwardButton setAlternateImage: imageFromRes(@"VLCBackwardTemplate")];
- _playImage = imageFromRes(@"VLCPlayTemplate");
- _pressedPlayImage = imageFromRes(@"VLCPlayTemplate");
- _pauseImage = imageFromRes(@"VLCPauseTemplate");
- _pressedPauseImage = imageFromRes(@"VLCPauseTemplate");
- [self.forwardButton setImage: imageFromRes(@"VLCForwardTemplate")];
- [self.forwardButton setAlternateImage: imageFromRes(@"VLCForwardTemplate")];
-
- [self.fullscreenButton setImage: imageFromRes(@"VLCFullscreenOffTemplate")];
- [self.fullscreenButton setAlternateImage: imageFromRes(@"VLCFullscreenOffTemplate")];
+ if (@available(macOS 11.0, *)) {
+ _playImage = [NSImage imageWithSystemSymbolName:@"play.circle.fill"
+ accessibilityDescription:_NS("Play")];
+ _pressedPlayImage = [NSImage imageWithSystemSymbolName:@"play.circle.fill"
+ accessibilityDescription:_NS("Play")];
+ _pauseImage = [NSImage imageWithSystemSymbolName:@"pause.circle.fill"
+ accessibilityDescription:_NS("Pause")];
+ _pressedPauseImage = [NSImage imageWithSystemSymbolName:@"pause.circle.fill"
+ accessibilityDescription:_NS("Pause")];
+ _backwardImage = [NSImage imageWithSystemSymbolName:@"backward.fill"
+ accessibilityDescription:_NS("Previous")];
+ _forwardImage = [NSImage imageWithSystemSymbolName:@"forward.fill"
+ accessibilityDescription:_NS("Next")];
+ _fullscreenImage = [NSImage imageWithSystemSymbolName:@"arrow.up.backward.and.arrow.down.forward"
+ accessibilityDescription:_NS("Fullscreen")];
+ _mutedVolumeImage = [NSImage imageWithSystemSymbolName:@"speaker.slash.fill"
+ accessibilityDescription:_NS("Muted")];
+ _unmutedVolumeImage = [NSImage imageWithSystemSymbolName:@"speaker.wave.3.fill"
+ accessibilityDescription:_NS("Unmuted")];
+ } else {
+ _playImage = imageFromRes(@"VLCPlayTemplate");
+ _pressedPlayImage = imageFromRes(@"VLCPlayTemplate");
+ _pauseImage = imageFromRes(@"VLCPauseTemplate");
+ _pressedPauseImage = imageFromRes(@"VLCPauseTemplate");
+ _backwardImage = imageFromRes(@"VLCBackwardTemplate");
+ _forwardImage = imageFromRes(@"VLCForwardTemplate");
+ _fullscreenImage = imageFromRes(@"VLCFullscreenOffTemplate");
+ _mutedVolumeImage = imageFromRes(@"VLCVolumeOffTemplate");
+ _unmutedVolumeImage = imageFromRes(@"VLCVolumeOnTemplate");
+ }
+
+ [self.backwardButton setImage: _backwardImage];
+ [self.backwardButton setAlternateImage: _backwardImage];
+ [self.forwardButton setImage: _forwardImage];
+ [self.forwardButton setAlternateImage: _forwardImage];
+
+ [self.fullscreenButton setImage: _fullscreenImage];
+ [self.fullscreenButton setAlternateImage: _fullscreenImage];
[self.playButton setImage: _playImage];
[self.playButton setAlternateImage: _pressedPlayImage];
@@ -399,7 +431,7 @@
- (void)updateMuteVolumeButtonImage
{
_muteVolumeButton.image = _playerController.mute ?
- imageFromRes(@"VLCVolumeOffTemplate") : imageFromRes(@"VLCVolumeOnTemplate");
+ _mutedVolumeImage : _unmutedVolumeImage;
}
- (void)playerStateUpdated:(NSNotification *)aNotification
@@ -420,6 +452,7 @@
[self.forwardButton setEnabled: (b_seekable || _playlistController.hasNextPlaylistItem || b_chapters)];
[self.backwardButton setEnabled: (b_seekable || _playlistController.hasPreviousPlaylistItem || b_chapters)];
+ [self updateCurrentItemDisplayControls:aNotification];
}
- (void)updateCurrentItemDisplayControls:(NSNotification *)aNotification
=====================================
modules/gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.m
=====================================
@@ -51,6 +51,8 @@
@interface VLCMainWindowControlsBar()
{
+ NSImage *_alwaysMuteImage;
+
VLCPlaylistController *_playlistController;
VLCPlayerController *_playerController;
}
@@ -80,18 +82,23 @@
[self.volumeUpButton setToolTip: _NS("Full Volume")];
self.volumeUpButton.accessibilityLabel = self.volumeUpButton.toolTip;
- [self.stopButton setImage: imageFromRes(@"stop")];
- [self.stopButton setAlternateImage: imageFromRes(@"stop-pressed")];
+ if (@available(macOS 11.0, *)) {
+ _alwaysMuteImage = [NSImage imageWithSystemSymbolName:@"speaker.minus.fill"
+ accessibilityDescription:_NS("Mute")];
- [self.volumeUpButton setImage: imageFromRes(@"VLCVolumeOnTemplate")];
+ [self.stopButton setImage: [NSImage imageWithSystemSymbolName:@"stop.fill"
+ accessibilityDescription:_NS("Stop")]];
+ [self.volumeUpButton setImage: [NSImage imageWithSystemSymbolName:@"speaker.plus.fill"
+ accessibilityDescription:_NS("Volume up")]];
+ } else {
+ _alwaysMuteImage = [NSImage imageNamed:@"VLCVolumeOffTemplate"];
- [self.fullscreenButton setImage: imageFromRes(@"VLCFullscreenOffTemplate")];
- [self.fullscreenButton setAlternateImage: imageFromRes(@"VLCFullscreenOffTemplate")];
+ [self.stopButton setImage: imageFromRes(@"stop")];
+ [self.stopButton setAlternateImage: imageFromRes(@"stop-pressed")];
+ [self.volumeUpButton setImage: imageFromRes(@"VLCVolumeOnTemplate")];
+ }
- [self.prevButton setImage: imageFromRes(@"previous-6btns")];
- [self.prevButton setAlternateImage: imageFromRes(@"previous-6btns-pressed")];
- [self.nextButton setImage: imageFromRes(@"next-6btns")];
- [self.nextButton setAlternateImage: imageFromRes(@"next-6btns-pressed")];
+ [self updateMuteVolumeButtonImage];
[self playbackStateChanged:nil];
[self.stopButton setHidden:YES];
@@ -172,7 +179,7 @@
- (void)updateMuteVolumeButtonImage
{
- self.muteVolumeButton.image = imageFromRes(@"VLCVolumeOffTemplate");
+ self.muteVolumeButton.image = _alwaysMuteImage;
}
- (void)playbackStateChanged:(NSNotification *)aNotification
@@ -197,6 +204,7 @@
[self.prevButton setEnabled: (b_seekable || _playlistController.hasPreviousPlaylistItem || b_chapters)];
[self.nextButton setEnabled: (b_seekable || _playlistController.hasNextPlaylistItem || b_chapters)];
+ [self updateCurrentItemDisplayControls:aNotification];
}
@end
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7f19145d9335546c5af0ad6ccf8c2227ecb9f093...5006690850c77c703a5e2dd471de8020135bdd74
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7f19145d9335546c5af0ad6ccf8c2227ecb9f093...5006690850c77c703a5e2dd471de8020135bdd74
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list