[vlc-commits] [Git][videolan/vlc][master] macosx: show duration in episode table rows

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Fri Oct 16 22:33:41 UTC 2026



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
7e6b6e0c by Serhii Bykov at 2026-10-17T00:24:50+02:00
macosx: show duration in episode table rows

- - - - -


8 changed files:

- modules/gui/macosx/Makefile.am
- modules/gui/macosx/library/VLCLibraryTableCellView.h
- modules/gui/macosx/library/VLCLibraryTableCellView.m
- modules/gui/macosx/library/VLCLibraryTableViewDelegate.h
- modules/gui/macosx/library/VLCLibraryTableViewDelegate.m
- + modules/gui/macosx/library/video-library/VLCLibraryShowEpisodeTableViewDelegate.h
- + modules/gui/macosx/library/video-library/VLCLibraryShowEpisodeTableViewDelegate.m
- modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m


Changes:

=====================================
modules/gui/macosx/Makefile.am
=====================================
@@ -284,6 +284,8 @@ libmacosx_plugin_la_SOURCES = \
     gui/macosx/library/home-library/VLCLibraryHomeViewVideoGridContainerView.m \
 	gui/macosx/library/video-library/VLCLibraryMoviesDataSource.h \
 	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/VLCLibraryShowsDataSource.h \
 	gui/macosx/library/video-library/VLCLibraryShowsDataSource.m \
 	gui/macosx/library/video-library/VLCLibraryVideoViewController.h \


=====================================
modules/gui/macosx/library/VLCLibraryTableCellView.h
=====================================
@@ -34,6 +34,11 @@ NS_ASSUME_NONNULL_BEGIN
 
 extern NSString * const VLCLibraryTableCellViewIdentifier;
 
+typedef NS_ENUM(NSUInteger, VLCLibraryTableCellDetailMode) {
+    VLCLibraryTableCellDetailModePrimaryDetail,
+    VLCLibraryTableCellDetailModeDuration,
+};
+
 @interface VLCLibraryTableCellView : NSTableCellView<VLCLibraryTableCellViewProtocol>
 
 @property (readwrite, weak) IBOutlet VLCTrackingView *trackingView;
@@ -43,10 +48,13 @@ extern NSString * const VLCLibraryTableCellViewIdentifier;
 @property (readwrite, weak) IBOutlet VLCImageView *representedImageView;
 @property (readwrite, weak) IBOutlet NSButton *playInstantlyButton;
 
+ at property (readwrite, nonatomic) VLCLibraryTableCellDetailMode detailMode;
 @property (readwrite, strong, nonatomic) VLCLibraryRepresentedItem *representedItem;
 @property (readwrite, strong, nonatomic) VLCInputItem *representedInputItem;
 @property (readwrite, nonatomic) NSUInteger representedVideoLibrarySection;
 
+- (NSString *)primaryDetailStringForItem:(id<VLCMediaLibraryItemProtocol>)item;
+
 @end
 
 NS_ASSUME_NONNULL_END


=====================================
modules/gui/macosx/library/VLCLibraryTableCellView.m
=====================================
@@ -66,6 +66,7 @@ NSString * const VLCLibraryTableCellViewIdentifier = @"VLCLibraryTableCellViewId
 - (void)prepareForReuse
 {
     [super prepareForReuse];
+    self.detailMode = VLCLibraryTableCellDetailModePrimaryDetail;
     self.representedImageView.image = nil;
     self.primaryTitleTextField.hidden = YES;
     self.secondaryTitleTextField.hidden = YES;
@@ -94,11 +95,12 @@ NSString * const VLCLibraryTableCellViewIdentifier = @"VLCLibraryTableCellViewId
         weakSelf.representedImageView.image = thumbnail;
     }];
 
-    if(actualItem.primaryDetailString.length > 0) {
+    NSString * const primaryDetailString = [self primaryDetailStringForItem:actualItem];
+    if (primaryDetailString.length > 0) {
         self.primaryTitleTextField.hidden = NO;
         self.primaryTitleTextField.stringValue = actualItem.displayString;
         self.secondaryTitleTextField.hidden = NO;
-        self.secondaryTitleTextField.stringValue = actualItem.primaryDetailString;
+        self.secondaryTitleTextField.stringValue = primaryDetailString;
     } else {
         self.singlePrimaryTitleTextField.hidden = NO;
         self.singlePrimaryTitleTextField.stringValue = actualItem.displayString;
@@ -156,6 +158,16 @@ NSString * const VLCLibraryTableCellViewIdentifier = @"VLCLibraryTableCellViewId
     _representedVideoLibrarySection = section;
 }
 
+- (NSString *)primaryDetailStringForItem:(id<VLCMediaLibraryItemProtocol>)item
+{
+    switch (self.detailMode) {
+        case VLCLibraryTableCellDetailModePrimaryDetail:
+            return item.primaryDetailString;
+        case VLCLibraryTableCellDetailModeDuration:
+            return item.durationString;
+    }
+}
+
 - (void)playMediaItemInstantly:(id)sender
 {
     [self.representedItem play];


=====================================
modules/gui/macosx/library/VLCLibraryTableViewDelegate.h
=====================================
@@ -31,6 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (readwrite, assign) NSString *cellViewIdentifier;
 
 - (NSView<VLCLibraryTableCellViewProtocol> *)makeCellView;
+- (void)configureCellView:(NSView<VLCLibraryTableCellViewProtocol> *)cellView;
 
 @end
 


=====================================
modules/gui/macosx/library/VLCLibraryTableViewDelegate.m
=====================================
@@ -54,6 +54,11 @@
     return [VLCLibraryTableCellView fromNibWithOwner:self];
 }
 
+- (void)configureCellView:(NSView<VLCLibraryTableCellViewProtocol> *)cellView
+{
+    // no-op
+}
+
 - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
 {
     if (![tableView.dataSource conformsToProtocol:@protocol(VLCLibraryTableViewDataSource)]) {
@@ -70,6 +75,8 @@
         cellView.identifier = self.cellViewIdentifier;
     }
 
+    [self configureCellView:cellView];
+
     NSObject<VLCMediaLibraryItemProtocol> * const libraryItem = [vlcDataSource libraryItemAtRow:row forTableView:tableView];
     if (libraryItem != nil) {
         VLCLibraryRepresentedItem *representedItem = nil;


=====================================
modules/gui/macosx/library/video-library/VLCLibraryShowEpisodeTableViewDelegate.h
=====================================
@@ -0,0 +1,28 @@
+/*****************************************************************************
+ * VLCLibraryShowEpisodeTableViewDelegate.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2026 VLC authors and VideoLAN
+ *
+ * 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 "VLCLibraryVideoTableViewDelegate.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+ at interface VLCLibraryShowEpisodeTableViewDelegate : VLCLibraryVideoTableViewDelegate
+ at end
+
+NS_ASSUME_NONNULL_END


=====================================
modules/gui/macosx/library/video-library/VLCLibraryShowEpisodeTableViewDelegate.m
=====================================
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * VLCLibraryShowEpisodeTableViewDelegate.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2026 VLC authors and VideoLAN
+ *
+ * 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 "VLCLibraryShowEpisodeTableViewDelegate.h"
+
+#import "extensions/NSView+VLCAdditions.h"
+
+#import "library/VLCLibraryTableCellView.h"
+
+ at implementation VLCLibraryShowEpisodeTableViewDelegate
+
+- (instancetype)init
+{
+    self = [super init];
+    if (self) {
+        self.cellViewIdentifier = @"VLCLibraryShowEpisodeTableCellViewIdentifier";
+    }
+    return self;
+}
+
+- (NSView<VLCLibraryTableCellViewProtocol> *)makeCellView
+{
+    return [VLCLibraryTableCellView fromNibNamed:@"VLCLibraryVideoTableCellView"
+                                     withClass:VLCLibraryTableCellView.class
+                                     withOwner:self];
+}
+
+- (void)configureCellView:(NSView<VLCLibraryTableCellViewProtocol> *)cellView
+{
+    VLCLibraryTableCellView * const libraryCellView = (VLCLibraryTableCellView *)cellView;
+    libraryCellView.detailMode = VLCLibraryTableCellDetailModeDuration;
+}
+
+ at end


=====================================
modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m
=====================================
@@ -46,6 +46,7 @@
 #import "library/playlist-library/VLCLibraryPlaylistViewController.h"
 
 #import "library/video-library/VLCLibraryMoviesDataSource.h"
+#import "library/video-library/VLCLibraryShowEpisodeTableViewDelegate.h"
 #import "library/video-library/VLCLibraryShowsDataSource.h"
 #import "library/video-library/VLCLibraryVideoDataSource.h"
 #import "library/video-library/VLCLibraryVideoTableViewDelegate.h"
@@ -60,6 +61,7 @@
 @interface VLCLibraryVideoViewController ()
 {
     VLCLibraryVideoTableViewDelegate *_videoLibraryTableViewDelegate;
+    VLCLibraryShowEpisodeTableViewDelegate *_showEpisodeTableViewDelegate;
     VLCLibraryCollectionViewDelegate *_collectionViewDelegate;
     VLCLibraryCollectionViewFlowLayout *_collectionViewLayout;
 
@@ -77,6 +79,7 @@
 
     if(self) {
         _videoLibraryTableViewDelegate = [[VLCLibraryVideoTableViewDelegate alloc] init];
+        _showEpisodeTableViewDelegate = [[VLCLibraryShowEpisodeTableViewDelegate alloc] init];
 
         [self setupPropertiesFromLibraryWindow:libraryWindow];
         [self setupTableView];
@@ -147,6 +150,9 @@
     [self.videoLibraryGroupsTableView registerNib:tableCellViewNib
                                    forIdentifier:@"VLCVideoLibraryTableViewCellIdentifier"];
     
+    [self.videoLibraryGroupSelectionTableView registerNib:tableCellViewNib
+                                            forIdentifier:_showEpisodeTableViewDelegate.cellViewIdentifier];
+
     self.videoLibraryGroupSelectionTableView.floatsGroupRows = NO;
 }
 
@@ -341,7 +347,7 @@
 
     self.videoLibraryGroupSelectionTableView.dataSource = self.libraryShowsDataSource;
     self.videoLibraryGroupSelectionTableView.target = self.libraryShowsDataSource;
-    self.videoLibraryGroupSelectionTableView.delegate = _videoLibraryTableViewDelegate;
+    self.videoLibraryGroupSelectionTableView.delegate = _showEpisodeTableViewDelegate;
 
     // Shows uses the master/detail split view, not the single sectioned table.
     // The master and detail table views are wired in setupShowsDataSource.



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/7e6b6e0c51d58593c409e5c6add224266f549255

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/7e6b6e0c51d58593c409e5c6add224266f549255
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