[vlc-commits] [Git][videolan/vlc][master] macosx: add dedicated table cell for shows
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Fri Nov 6 10:11:23 UTC 2026
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
3ccde4ef by Serhii Bykov at 2026-11-06T10:31:15+01:00
macosx: add dedicated table cell for shows
- - - - -
7 changed files:
- modules/gui/macosx/Makefile.am
- modules/gui/macosx/UI/VLCLibraryTableCellView.xib
- modules/gui/macosx/library/VLCLibraryTableCellView.h
- modules/gui/macosx/library/VLCLibraryTableCellView.m
- + modules/gui/macosx/library/video-library/VLCLibraryShowsMasterTableViewDelegate.h
- + modules/gui/macosx/library/video-library/VLCLibraryShowsMasterTableViewDelegate.m
- modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m
Changes:
=====================================
modules/gui/macosx/Makefile.am
=====================================
@@ -300,6 +300,8 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/library/video-library/VLCLibraryMoviesDataSource.m \
gui/macosx/library/video-library/VLCLibraryShowEpisodeTableViewDelegate.h \
gui/macosx/library/video-library/VLCLibraryShowEpisodeTableViewDelegate.m \
+ gui/macosx/library/video-library/VLCLibraryShowsMasterTableViewDelegate.h \
+ gui/macosx/library/video-library/VLCLibraryShowsMasterTableViewDelegate.m \
gui/macosx/library/video-library/VLCLibraryShowsDataSource.h \
gui/macosx/library/video-library/VLCLibraryShowsDataSource.m \
gui/macosx/library/video-library/VLCLibraryVideoViewController.h \
=====================================
modules/gui/macosx/UI/VLCLibraryTableCellView.xib
=====================================
@@ -138,6 +138,7 @@
<connections>
<outlet property="playInstantlyButton" destination="NFZ-x0-t5c" id="suD-1u-UrY"/>
<outlet property="primaryTitleTextField" destination="xJW-ps-ycn" id="5Vl-3a-J2T"/>
+ <outlet property="representedImageAspectRatioConstraint" destination="4aB-rs-m22" id="QmB-dC-16R"/>
<outlet property="representedImageView" destination="Ydb-7n-5Cd" id="qBu-r5-jIY"/>
<outlet property="secondaryTitleTextField" destination="TPv-k2-6XS" id="rRg-vu-a7j"/>
<outlet property="singlePrimaryTitleTextField" destination="ohB-P0-nCv" id="gBJ-WZ-6pB"/>
=====================================
modules/gui/macosx/library/VLCLibraryTableCellView.h
=====================================
@@ -39,6 +39,11 @@ typedef NS_ENUM(NSUInteger, VLCLibraryTableCellDetailMode) {
VLCLibraryTableCellDetailModeDuration,
};
+typedef NS_ENUM(NSUInteger, VLCLibraryTableCellImageAspectRatio) {
+ VLCLibraryTableCellImageAspectRatioSquare,
+ VLCLibraryTableCellImageAspectRatioVideo,
+};
+
@interface VLCLibraryTableCellView : NSTableCellView<VLCLibraryTableCellViewProtocol>
@property (readwrite, weak) IBOutlet VLCTrackingView *trackingView;
@@ -49,6 +54,7 @@ typedef NS_ENUM(NSUInteger, VLCLibraryTableCellDetailMode) {
@property (readwrite, weak) IBOutlet NSButton *playInstantlyButton;
@property (readwrite, nonatomic) VLCLibraryTableCellDetailMode detailMode;
+ at property (readwrite, nonatomic) VLCLibraryTableCellImageAspectRatio representedImageAspectRatio;
@property (readwrite, strong, nonatomic) VLCLibraryRepresentedItem *representedItem;
@property (readwrite, strong, nonatomic) VLCInputItem *representedInputItem;
@property (readwrite, nonatomic) NSUInteger representedVideoLibrarySection;
=====================================
modules/gui/macosx/library/VLCLibraryTableCellView.m
=====================================
@@ -45,6 +45,12 @@
NSString * const VLCLibraryTableCellViewIdentifier = @"VLCLibraryTableCellViewIdentifier";
+ at interface VLCLibraryTableCellView ()
+
+ at property (readwrite, strong) IBOutlet NSLayoutConstraint *representedImageAspectRatioConstraint;
+
+ at end
+
@implementation VLCLibraryTableCellView
- (void)awakeFromNib
@@ -67,6 +73,7 @@ NSString * const VLCLibraryTableCellViewIdentifier = @"VLCLibraryTableCellViewId
{
[super prepareForReuse];
self.detailMode = VLCLibraryTableCellDetailModePrimaryDetail;
+ self.representedImageAspectRatio = VLCLibraryTableCellImageAspectRatioSquare;
self.representedImageView.image = nil;
self.primaryTitleTextField.hidden = YES;
self.secondaryTitleTextField.hidden = YES;
@@ -75,6 +82,40 @@ NSString * const VLCLibraryTableCellViewIdentifier = @"VLCLibraryTableCellViewId
self.playInstantlyButton.hidden = YES;
}
+- (void)setRepresentedImageAspectRatio:(VLCLibraryTableCellImageAspectRatio)representedImageAspectRatio
+{
+ if (_representedImageAspectRatio == representedImageAspectRatio) {
+ return;
+ }
+
+ _representedImageAspectRatio = representedImageAspectRatio;
+ if (self.representedImageAspectRatioConstraint == nil) {
+ return;
+ }
+
+ CGFloat multiplier = 1.;
+ switch (representedImageAspectRatio) {
+ case VLCLibraryTableCellImageAspectRatioSquare:
+ multiplier = 1.;
+ break;
+ case VLCLibraryTableCellImageAspectRatioVideo:
+ multiplier = 16. / 9.;
+ break;
+ }
+
+ NSLayoutConstraint * const previousConstraint = self.representedImageAspectRatioConstraint;
+ NSLayoutConstraint * const newConstraint =
+ [self.representedImageView.widthAnchor
+ constraintEqualToAnchor:self.representedImageView.heightAnchor
+ multiplier:multiplier];
+ newConstraint.priority = previousConstraint.priority;
+ newConstraint.identifier = previousConstraint.identifier;
+
+ previousConstraint.active = NO;
+ newConstraint.active = YES;
+ self.representedImageAspectRatioConstraint = newConstraint;
+}
+
- (void)setRepresentedItem:(VLCLibraryRepresentedItem *)representedItem
{
_representedItem = representedItem;
=====================================
modules/gui/macosx/library/video-library/VLCLibraryShowsMasterTableViewDelegate.h
=====================================
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * VLCLibraryShowsMasterTableViewDelegate.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2026 VLC authors and VideoLAN
+ *
+ * Authors: Serhii Bykov <esphynox at gmail.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 "library/video-library/VLCLibraryVideoTableViewDelegate.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+ at interface VLCLibraryShowsMasterTableViewDelegate : VLCLibraryVideoTableViewDelegate
+
+ at end
+
+
+NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/video-library/VLCLibraryShowsMasterTableViewDelegate.m
=====================================
@@ -0,0 +1,46 @@
+/*****************************************************************************
+ * VLCLibraryShowsMasterTableViewDelegate.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2026 VLC authors and VideoLAN
+ *
+ * Authors: Serhii Bykov <esphynox at gmail.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 "VLCLibraryShowsMasterTableViewDelegate.h"
+
+#import "library/VLCLibraryTableCellView.h"
+
+ at implementation VLCLibraryShowsMasterTableViewDelegate
+
+- (instancetype)init
+{
+ self = [super init];
+ if (self) {
+ self.cellViewIdentifier = @"VLCLibraryShowsMasterTableCellViewIdentifier";
+ }
+ return self;
+}
+
+- (void)configureCellView:(NSView<VLCLibraryTableCellViewProtocol> *)cellView
+{
+ [super configureCellView:cellView];
+
+ VLCLibraryTableCellView * const libraryCellView = (VLCLibraryTableCellView *)cellView;
+ libraryCellView.representedImageAspectRatio = VLCLibraryTableCellImageAspectRatioVideo;
+}
+
+ at end
=====================================
modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m
=====================================
@@ -47,6 +47,7 @@
#import "library/video-library/VLCLibraryMoviesDataSource.h"
#import "library/video-library/VLCLibraryShowEpisodeTableViewDelegate.h"
+#import "library/video-library/VLCLibraryShowsMasterTableViewDelegate.h"
#import "library/video-library/VLCLibraryShowsDataSource.h"
#import "library/video-library/VLCLibraryVideoDataSource.h"
#import "library/video-library/VLCLibraryVideoTableViewDelegate.h"
@@ -61,6 +62,7 @@
@interface VLCLibraryVideoViewController ()
{
VLCLibraryVideoTableViewDelegate *_videoLibraryTableViewDelegate;
+ VLCLibraryShowsMasterTableViewDelegate *_showsMasterTableViewDelegate;
VLCLibraryShowEpisodeTableViewDelegate *_showEpisodeTableViewDelegate;
VLCLibraryCollectionViewDelegate *_collectionViewDelegate;
VLCLibraryCollectionViewFlowLayout *_collectionViewLayout;
@@ -79,6 +81,7 @@
if(self) {
_videoLibraryTableViewDelegate = [[VLCLibraryVideoTableViewDelegate alloc] init];
+ _showsMasterTableViewDelegate = [[VLCLibraryShowsMasterTableViewDelegate alloc] init];
_showEpisodeTableViewDelegate = [[VLCLibraryShowEpisodeTableViewDelegate alloc] init];
[self setupPropertiesFromLibraryWindow:libraryWindow];
@@ -145,10 +148,15 @@
NSNib * const tableCellViewNib =
[[NSNib alloc] initWithNibNamed:@"VLCLibraryVideoTableCellView"
bundle:nil];
+ NSNib * const showTableCellViewNib =
+ [[NSNib alloc] initWithNibNamed:NSStringFromClass(VLCLibraryTableCellView.class)
+ bundle:nil];
[self.videoLibraryGroupSelectionTableView registerNib:tableCellViewNib
forIdentifier:@"VLCVideoLibraryTableViewCellIdentifier"];
[self.videoLibraryGroupsTableView registerNib:tableCellViewNib
forIdentifier:@"VLCVideoLibraryTableViewCellIdentifier"];
+ [self.videoLibraryGroupsTableView registerNib:showTableCellViewNib
+ forIdentifier:_showsMasterTableViewDelegate.cellViewIdentifier];
[self.videoLibraryGroupSelectionTableView registerNib:tableCellViewNib
forIdentifier:_showEpisodeTableViewDelegate.cellViewIdentifier];
@@ -343,7 +351,7 @@
self.videoLibraryGroupsTableView.dataSource = self.libraryShowsDataSource;
self.videoLibraryGroupsTableView.target = self.libraryShowsDataSource;
- self.videoLibraryGroupsTableView.delegate = _videoLibraryTableViewDelegate;
+ self.videoLibraryGroupsTableView.delegate = _showsMasterTableViewDelegate;
self.videoLibraryGroupSelectionTableView.dataSource = self.libraryShowsDataSource;
self.videoLibraryGroupSelectionTableView.target = self.libraryShowsDataSource;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/3ccde4ef6ec635483400caf305339a35d24b1c8e
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/3ccde4ef6ec635483400caf305339a35d24b1c8e
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list