[vlc-commits] [Git][videolan/vlc][master] 2 commits: macosx: Remove duplicate internal properties

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Jul 18 14:04:57 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
0345a757 by Claudio Cambra at 2025-07-18T13:11:17+00:00
macosx: Remove duplicate internal properties

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

- - - - -
dac07369 by Claudio Cambra at 2025-07-18T13:11:17+00:00
macosx: Create own table view and collection view in favorites view controller rather than taking over video library UI components

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

- - - - -


2 changed files:

- modules/gui/macosx/library/favorites-library/VLCLibraryFavoritesViewController.h
- modules/gui/macosx/library/favorites-library/VLCLibraryFavoritesViewController.m


Changes:

=====================================
modules/gui/macosx/library/favorites-library/VLCLibraryFavoritesViewController.h
=====================================
@@ -34,14 +34,13 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface VLCLibraryFavoritesViewController : VLCLibraryAbstractMediaLibrarySegmentViewController<VLCLibraryItemPresentingCapable>
 
- at property (readonly, weak) NSView *favoritesLibraryView;
- at property (readonly, weak) NSSplitView *favoritesLibrarySplitView;
- at property (readonly, weak) NSScrollView *favoritesLibraryCollectionViewScrollView;
- at property (readonly, weak) VLCLibraryCollectionView *favoritesLibraryCollectionView;
- at property (readonly, weak) NSScrollView *favoritesLibraryGroupSelectionTableViewScrollView;
- at property (readonly, weak) NSTableView *favoritesLibraryGroupSelectionTableView;
- at property (readonly, weak) NSScrollView *favoritesLibraryGroupsTableViewScrollView;
- at property (readonly, weak) NSTableView *favoritesLibraryGroupsTableView;
+ at property (readonly, strong) NSSplitView *favoritesLibrarySplitView;
+ at property (readonly, strong) NSScrollView *favoritesLibraryCollectionViewScrollView;
+ at property (readonly, strong) VLCLibraryCollectionView *favoritesLibraryCollectionView;
+ at property (readonly, strong) NSScrollView *favoritesLibraryGroupSelectionTableViewScrollView;
+ at property (readonly, strong) NSTableView *favoritesLibraryGroupSelectionTableView;
+ at property (readonly, strong) NSScrollView *favoritesLibraryGroupsTableViewScrollView;
+ at property (readonly, strong) NSTableView *favoritesLibraryGroupsTableView;
 
 @property (readwrite, strong) VLCLibraryFavoritesDataSource *libraryFavoritesDataSource;
 


=====================================
modules/gui/macosx/library/favorites-library/VLCLibraryFavoritesViewController.m
=====================================
@@ -52,15 +52,6 @@
     id<VLCMediaLibraryItemProtocol> _awaitingPresentingLibraryItem;
 }
 
- at property (readwrite, weak) NSView *favoritesLibraryView;
- at property (readwrite, weak) NSSplitView *favoritesLibrarySplitView;
- at property (readwrite, weak) NSScrollView *favoritesLibraryCollectionViewScrollView;
- at property (readwrite, weak) VLCLibraryCollectionView *favoritesLibraryCollectionView;
- at property (readwrite, weak) NSScrollView *favoritesLibraryGroupSelectionTableViewScrollView;
- at property (readwrite, weak) NSTableView *favoritesLibraryGroupSelectionTableView;
- at property (readwrite, weak) NSScrollView *favoritesLibraryGroupsTableViewScrollView;
- at property (readwrite, weak) NSTableView *favoritesLibraryGroupsTableView;
-
 @end
 
 @implementation VLCLibraryFavoritesViewController
@@ -73,7 +64,7 @@
         _favoritesLibraryTableViewDelegate = [[VLCLibraryMasterDetailViewTableViewDelegate alloc] init];
         _splitViewDelegate = [[VLCLibraryTwoPaneSplitViewDelegate alloc] init];
         
-        [self setupPropertiesFromLibraryWindow:libraryWindow];
+        [self setupProperties];
         [self setupTableViews];
         [self setupCollectionView];
         [self setupFavoritesDataSource];
@@ -90,17 +81,15 @@
     [self updatePresentedFavoritesView];
 }
 
-- (void)setupPropertiesFromLibraryWindow:(VLCLibraryWindow *)libraryWindow
+- (void)setupProperties
 {
-    NSParameterAssert(libraryWindow);
-    _favoritesLibraryView = libraryWindow.videoLibraryView;
-    _favoritesLibrarySplitView = libraryWindow.videoLibrarySplitView;
-    _favoritesLibraryCollectionViewScrollView = libraryWindow.videoLibraryCollectionViewScrollView;
-    _favoritesLibraryCollectionView = libraryWindow.videoLibraryCollectionView;
-    _favoritesLibraryGroupSelectionTableViewScrollView = libraryWindow.videoLibraryGroupSelectionTableViewScrollView;
-    _favoritesLibraryGroupSelectionTableView = libraryWindow.videoLibraryGroupSelectionTableView;
-    _favoritesLibraryGroupsTableViewScrollView = libraryWindow.videoLibraryGroupsTableViewScrollView;
-    _favoritesLibraryGroupsTableView = libraryWindow.videoLibraryGroupsTableView;
+    _favoritesLibrarySplitView = [[NSSplitView alloc] init];
+    _favoritesLibraryCollectionViewScrollView = [[NSScrollView alloc] init];
+    _favoritesLibraryCollectionView = [[VLCLibraryCollectionView alloc] init];
+    _favoritesLibraryGroupSelectionTableViewScrollView = [[NSScrollView alloc] init];
+    _favoritesLibraryGroupSelectionTableView = [[NSTableView alloc] init];
+    _favoritesLibraryGroupsTableViewScrollView = [[NSScrollView alloc] init];
+    _favoritesLibraryGroupsTableView = [[NSTableView alloc] init];
 }
 
 - (void)setupTableViews
@@ -108,6 +97,12 @@
     self.favoritesLibrarySplitView.delegate = _splitViewDelegate;
     [_splitViewDelegate resetDefaultSplitForSplitView:self.favoritesLibrarySplitView];
 
+    NSTableColumn * const groupsColumn = [[NSTableColumn alloc] initWithIdentifier:@"groups"];
+    NSTableColumn * const selectedGroupColumn = [[NSTableColumn alloc] initWithIdentifier:@"selectedGroup"];
+    
+    [self.favoritesLibraryGroupsTableView addTableColumn:groupsColumn];
+    [self.favoritesLibraryGroupSelectionTableView addTableColumn:selectedGroupColumn];
+
     NSNib * const tableCellViewNib =
         [[NSNib alloc] initWithNibNamed:NSStringFromClass(VLCLibraryTableCellView.class)
                                  bundle:nil];
@@ -115,10 +110,26 @@
                                         forIdentifier:@"VLCLibraryTableViewCellIdentifier"];
     [self.favoritesLibraryGroupSelectionTableView registerNib:tableCellViewNib 
                                                 forIdentifier:@"VLCLibraryTableViewCellIdentifier"];
+    
+    self.favoritesLibraryGroupsTableView.headerView = nil;
+    self.favoritesLibraryGroupSelectionTableView.headerView = nil;
+    
+    self.favoritesLibraryGroupsTableView.rowHeight = VLCLibraryUIUnits.mediumTableViewRowHeight;
+    self.favoritesLibraryGroupSelectionTableView.rowHeight = VLCLibraryUIUnits.mediumTableViewRowHeight;
 }
 
 - (void)setupCollectionView
 {
+    self.favoritesLibraryCollectionViewScrollView.translatesAutoresizingMaskIntoConstraints = NO;
+    self.favoritesLibraryCollectionView.translatesAutoresizingMaskIntoConstraints = NO;
+
+    self.favoritesLibraryCollectionViewScrollView.hasHorizontalScroller = NO;
+    self.favoritesLibraryCollectionViewScrollView.borderType = NSNoBorder;
+    self.favoritesLibraryCollectionViewScrollView.automaticallyAdjustsContentInsets = NO;
+    self.favoritesLibraryCollectionViewScrollView.contentInsets = VLCLibraryUIUnits.libraryViewScrollViewContentInsets;
+    self.favoritesLibraryCollectionViewScrollView.scrollerInsets = VLCLibraryUIUnits.libraryViewScrollViewScrollerInsets;
+    self.favoritesLibraryCollectionViewScrollView.documentView = self.favoritesLibraryCollectionView;
+
     _collectionViewLayout = [[VLCLibraryCollectionViewFlowLayout alloc] init];
     
     const CGFloat collectionItemSpacing = VLCLibraryUIUnits.collectionViewItemSpacing;
@@ -134,6 +145,10 @@
     _collectionViewDelegate = [[VLCLibraryCollectionViewDelegate alloc] init];
     collectionView.delegate = _collectionViewDelegate;
     
+    collectionView.selectable = YES;
+    collectionView.allowsEmptySelection = YES;
+    collectionView.allowsMultipleSelection = YES;
+    
     [collectionView registerClass:VLCLibraryCollectionViewItem.class
             forItemWithIdentifier:VLCLibraryCellIdentifier];
     
@@ -158,26 +173,47 @@
     self.libraryFavoritesDataSource.collectionView = self.favoritesLibraryCollectionView;
     self.libraryFavoritesDataSource.masterTableView = self.favoritesLibraryGroupsTableView;
     self.libraryFavoritesDataSource.detailTableView = self.favoritesLibraryGroupSelectionTableView;
+    
+    self.favoritesLibraryCollectionView.dataSource = self.libraryFavoritesDataSource;
+    
+    self.favoritesLibraryGroupsTableView.dataSource = self.libraryFavoritesDataSource;
+    self.favoritesLibraryGroupsTableView.target = self.libraryFavoritesDataSource;
+    self.favoritesLibraryGroupsTableView.delegate = _favoritesLibraryTableViewDelegate;
+
+    self.favoritesLibraryGroupSelectionTableView.dataSource = self.libraryFavoritesDataSource;
+    self.favoritesLibraryGroupSelectionTableView.target = self.libraryFavoritesDataSource;
+    self.favoritesLibraryGroupSelectionTableView.delegate = _favoritesLibraryTableViewDelegate;
 }
 
 - (void)setupFavoritesLibraryViews
 {
-    _favoritesLibraryGroupsTableView.rowHeight = VLCLibraryUIUnits.mediumTableViewRowHeight;
-    _favoritesLibraryGroupSelectionTableView.rowHeight = VLCLibraryUIUnits.mediumTableViewRowHeight;
+    self.favoritesLibraryGroupsTableViewScrollView.translatesAutoresizingMaskIntoConstraints = NO;
+    self.favoritesLibraryGroupSelectionTableViewScrollView.translatesAutoresizingMaskIntoConstraints = NO;
+    self.favoritesLibrarySplitView.translatesAutoresizingMaskIntoConstraints = NO;
 
     const NSEdgeInsets defaultInsets = VLCLibraryUIUnits.libraryViewScrollViewContentInsets;
     const NSEdgeInsets scrollerInsets = VLCLibraryUIUnits.libraryViewScrollViewScrollerInsets;
 
-    _favoritesLibraryCollectionViewScrollView.automaticallyAdjustsContentInsets = NO;
-    _favoritesLibraryCollectionViewScrollView.contentInsets = defaultInsets;
-    _favoritesLibraryCollectionViewScrollView.scrollerInsets = scrollerInsets;
+    self.favoritesLibraryGroupsTableViewScrollView.hasHorizontalScroller = NO;
+    self.favoritesLibraryGroupsTableViewScrollView.borderType = NSNoBorder;
+    self.favoritesLibraryGroupsTableViewScrollView.automaticallyAdjustsContentInsets = NO;
+    self.favoritesLibraryGroupsTableViewScrollView.contentInsets = defaultInsets;
+    self.favoritesLibraryGroupsTableViewScrollView.scrollerInsets = scrollerInsets;
+
+    self.favoritesLibraryGroupSelectionTableViewScrollView.hasHorizontalScroller = NO;
+    self.favoritesLibraryGroupSelectionTableViewScrollView.borderType = NSNoBorder;
+    self.favoritesLibraryGroupSelectionTableViewScrollView.automaticallyAdjustsContentInsets = NO;
+    self.favoritesLibraryGroupSelectionTableViewScrollView.contentInsets = defaultInsets;
+    self.favoritesLibraryGroupSelectionTableViewScrollView.scrollerInsets = scrollerInsets;
+
+    self.favoritesLibraryGroupsTableViewScrollView.documentView = self.favoritesLibraryGroupsTableView;
+    self.favoritesLibraryGroupSelectionTableViewScrollView.documentView = self.favoritesLibraryGroupSelectionTableView;
 
-    _favoritesLibraryGroupsTableViewScrollView.automaticallyAdjustsContentInsets = NO;
-    _favoritesLibraryGroupsTableViewScrollView.contentInsets = defaultInsets;
-    _favoritesLibraryGroupsTableViewScrollView.scrollerInsets = scrollerInsets;
-    _favoritesLibraryGroupSelectionTableViewScrollView.automaticallyAdjustsContentInsets = NO;
-    _favoritesLibraryGroupSelectionTableViewScrollView.contentInsets = defaultInsets;
-    _favoritesLibraryGroupSelectionTableViewScrollView.scrollerInsets = scrollerInsets;
+    self.favoritesLibrarySplitView.vertical = YES;
+    self.favoritesLibrarySplitView.dividerStyle = NSSplitViewDividerStyleThin;
+    self.favoritesLibrarySplitView.delegate = _splitViewDelegate;
+    [self.favoritesLibrarySplitView addArrangedSubview:self.favoritesLibraryGroupsTableViewScrollView];
+    [self.favoritesLibrarySplitView addArrangedSubview:self.favoritesLibraryGroupSelectionTableViewScrollView];
 }
 
 - (void)setupFavoritesPlaceholderView
@@ -241,16 +277,6 @@
 
 - (void)updatePresentedFavoritesView
 {
-    self.favoritesLibraryCollectionView.dataSource = self.libraryFavoritesDataSource;
-    
-    self.favoritesLibraryGroupsTableView.dataSource = self.libraryFavoritesDataSource;
-    self.favoritesLibraryGroupsTableView.target = self.libraryFavoritesDataSource;
-    self.favoritesLibraryGroupsTableView.delegate = _favoritesLibraryTableViewDelegate;
-
-    self.favoritesLibraryGroupSelectionTableView.dataSource = self.libraryFavoritesDataSource;
-    self.favoritesLibraryGroupSelectionTableView.target = self.libraryFavoritesDataSource;
-    self.favoritesLibraryGroupSelectionTableView.delegate = _favoritesLibraryTableViewDelegate;
-    
     [self.libraryFavoritesDataSource reloadData];
     
     if ([self hasFavoriteItems]) {
@@ -275,8 +301,7 @@
 
 - (void)presentFavoritesCollectionView
 {
-    [self.libraryWindow displayLibraryView:self.favoritesLibraryView];
-    self.favoritesLibraryCollectionViewScrollView.hidden = NO;
+    [self.libraryWindow displayLibraryView:self.favoritesLibraryCollectionViewScrollView];
 }
 
 - (void)presentPlaceholderFavoritesView
@@ -288,13 +313,10 @@
 
 - (void)presentFavoritesLibraryView:(VLCLibraryViewModeSegment)viewModeSegment
 {
-    [self.libraryWindow displayLibraryView:self.favoritesLibraryView];
     if (viewModeSegment == VLCLibraryGridViewModeSegment) {
-        self.favoritesLibrarySplitView.hidden = YES;
-        self.favoritesLibraryCollectionViewScrollView.hidden = NO;
+        [self.libraryWindow displayLibraryView:self.favoritesLibraryCollectionViewScrollView];
     } else if (viewModeSegment == VLCLibraryListViewModeSegment) {
-        self.favoritesLibrarySplitView.hidden = NO;
-        self.favoritesLibraryCollectionViewScrollView.hidden = YES;
+        [self.libraryWindow displayLibraryView:self.favoritesLibrarySplitView];
     } else {
         NSAssert(false, @"View mode must be grid or list mode");
     }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bb9df9f18cfdbcc3a1ea4933221d0a3b4c4ed7c8...dac0736929af1beeddf5a1db7f6675a03007355c

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