[vlc-commits] [Git][videolan/vlc][master] 5 commits: macosx: Register nib for VLCLibraryTableCellView in video library table views

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Mon Sep 25 07:55:37 UTC 2023



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


Commits:
9fddce82 by Claudio Cambra at 2023-09-25T07:39:30+00:00
macosx: Register nib for VLCLibraryTableCellView in video library table views

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
09bb1d9b by Claudio Cambra at 2023-09-25T07:39:30+00:00
macosx: Register nib for VLCLibraryTableCellView in VLCMediaSourceBaseDataSource

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
c37d0365 by Claudio Cambra at 2023-09-25T07:39:30+00:00
macosx: Remove fallback for unregistered table view cell type in VLCMediaSourceDataSource

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
72af50e8 by Claudio Cambra at 2023-09-25T07:39:30+00:00
macosx: Replace magic strings for VLCLibraryTableCellView name with direct string from class name

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
eb6a3577 by Claudio Cambra at 2023-09-25T07:39:30+00:00
macosx: Replace media source magic table cell view identifier string with standard identifier string for table cell views

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


6 changed files:

- modules/gui/macosx/library/VLCLibraryTableCellView.h
- modules/gui/macosx/library/VLCLibraryTableCellView.m
- modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.m
- modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.m
- modules/gui/macosx/library/video-library/VLCLibraryVideoTableViewDelegate.m
- modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryTableCellView.h
=====================================
@@ -31,6 +31,8 @@ NS_ASSUME_NONNULL_BEGIN
 @protocol VLCMediaLibraryItemProtocol;
 @class VLCInputItem;
 
+extern NSString * const VLCLibraryTableCellViewIdentifier;
+
 @interface VLCLibraryTableCellView : NSTableCellView<VLCLibraryTableCellViewProtocol>
 
 + (instancetype)fromNibWithOwner:(id)owner;


=====================================
modules/gui/macosx/library/VLCLibraryTableCellView.m
=====================================
@@ -41,11 +41,13 @@
 #import "views/VLCImageView.h"
 #import "views/VLCTrackingView.h"
 
+NSString * const VLCLibraryTableCellViewIdentifier = @"VLCLibraryTableCellViewIdentifier";
+
 @implementation VLCLibraryTableCellView
 
 + (instancetype)fromNibWithOwner:(id)owner
 {
-    return (VLCLibraryTableCellView*)[NSView fromNibNamed:@"VLCLibraryTableCellView"
+    return (VLCLibraryTableCellView*)[NSView fromNibNamed:NSStringFromClass(VLCLibraryTableCellView.class)
                                                 withClass:[VLCLibraryTableCellView class]
                                                 withOwner:owner];
 }


=====================================
modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.m
=====================================
@@ -44,9 +44,6 @@
 
 #import "views/VLCImageView.h"
 
-
-NSString *VLCMediaSourceTableViewCellIdentifier = @"VLCMediaSourceTableViewCellIdentifier";
-
 @interface VLCMediaSourceBaseDataSource () <NSCollectionViewDataSource, NSCollectionViewDelegate, NSTableViewDelegate, NSTableViewDataSource>
 {
     NSArray<VLCMediaSource *> *_mediaSources;
@@ -110,7 +107,10 @@ NSString *VLCMediaSourceTableViewCellIdentifier = @"VLCMediaSourceTableViewCellI
 
     self.tableView.dataSource = self;
     self.tableView.delegate = self;
-    
+
+    NSNib * const tableCellViewNib = [[NSNib alloc] initWithNibNamed:NSStringFromClass(VLCLibraryTableCellView.class) bundle:nil];
+    [self.tableView registerNib:tableCellViewNib forIdentifier:VLCLibraryTableCellViewIdentifier];
+
     [self reloadViews];
 }
 
@@ -355,13 +355,7 @@ referenceSizeForHeaderInSection:(NSInteger)section
 
 - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
 {
-    VLCLibraryTableCellView *cellView = [tableView makeViewWithIdentifier:VLCMediaSourceTableViewCellIdentifier owner:self];
-
-    if (cellView == nil) {
-        cellView = [VLCLibraryTableCellView fromNibWithOwner:self];
-        cellView.identifier = VLCMediaSourceTableViewCellIdentifier;
-    }
-
+    VLCLibraryTableCellView * const cellView = [tableView makeViewWithIdentifier:VLCLibraryTableCellViewIdentifier owner:self];
     cellView.primaryTitleTextField.hidden = YES;
     cellView.secondaryTitleTextField.hidden = YES;
     cellView.singlePrimaryTitleTextField.hidden = NO;


=====================================
modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.m
=====================================
@@ -131,13 +131,7 @@
 
 - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
 {
-    VLCLibraryTableCellView *cellView = [tableView makeViewWithIdentifier:@"VLCMediaSourceTableViewCellIdentifier" owner:self];
-
-    if (cellView == nil) {
-        cellView = [VLCLibraryTableCellView fromNibWithOwner:self];
-        cellView.identifier = @"VLCMediaSourceTableViewCellIdentifier";
-    }
-
+    VLCLibraryTableCellView * const cellView = [tableView makeViewWithIdentifier:VLCLibraryTableCellViewIdentifier owner:self];
     cellView.representedInputItem = [self mediaSourceInputItemAtRow:row];
     return cellView;
 }


=====================================
modules/gui/macosx/library/video-library/VLCLibraryVideoTableViewDelegate.m
=====================================
@@ -54,12 +54,7 @@
         return [super tableView:tableView viewForTableColumn:tableColumn row:row];
     }
 
-    VLCLibraryTableCellView *cellView = [tableView makeViewWithIdentifier:self.cellViewIdentifier owner:self];
-
-    if (!cellView) {
-        cellView = [VLCLibraryTableCellView fromNibWithOwner:self];
-        cellView.identifier = @"VLCVideoLibraryTableViewCellIdentifier";
-    }
+    VLCLibraryTableCellView * const cellView = [tableView makeViewWithIdentifier:self.cellViewIdentifier owner:self];
 
     if ([vlcDataSource isKindOfClass:[VLCLibraryVideoTableViewDataSource class]]) {
         VLCLibraryVideoTableViewDataSource * const videoTableViewDataSource = (VLCLibraryVideoTableViewDataSource *)vlcDataSource;


=====================================
modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m
=====================================
@@ -26,6 +26,7 @@
 
 #import "library/VLCLibraryController.h"
 #import "library/VLCLibraryModel.h"
+#import "library/VLCLibraryTableCellView.h"
 #import "library/VLCLibraryTwoPaneSplitViewDelegate.h"
 #import "library/VLCLibraryUIUnits.h"
 #import "library/VLCLibraryWindow.h"
@@ -107,6 +108,10 @@
     _libraryVideoTableViewDataSource.libraryModel = VLCMain.sharedInstance.libraryController.libraryModel;
     _libraryVideoTableViewDataSource.groupsTableView = _videoLibraryGroupsTableView;
     _libraryVideoTableViewDataSource.groupSelectionTableView = _videoLibraryGroupSelectionTableView;
+
+    NSNib * const tableCellViewNib = [[NSNib alloc] initWithNibNamed:NSStringFromClass(VLCLibraryTableCellView.class) bundle:nil];
+    [_videoLibraryGroupsTableView registerNib:tableCellViewNib forIdentifier:@"VLCVideoLibraryTableViewCellIdentifier"];
+    [_videoLibraryGroupSelectionTableView registerNib:tableCellViewNib forIdentifier:@"VLCVideoLibraryTableViewCellIdentifier"];
 }
 
 - (void)setupTableViews



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/117561315447fa25425bc09f9168e9692cb9a561...eb6a357774254e889afc1e6da903a5c00efe7925

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/117561315447fa25425bc09f9168e9692cb9a561...eb6a357774254e889afc1e6da903a5c00efe7925
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