[vlc-commits] [Git][videolan/vlc][master] 6 commits: macosx: Leverage two pane split view delegate in playlist view controller

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sun Sep 28 18:44:27 UTC 2025



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


Commits:
7b47f214 by Claudio Cambra at 2025-09-28T18:29:33+00:00
macosx: Leverage two pane split view delegate in playlist view controller

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

- - - - -
4a36d26c by Claudio Cambra at 2025-09-28T18:29:33+00:00
macosx: Leverage two pane split view delegate in groups view controller

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

- - - - -
e167f184 by Claudio Cambra at 2025-09-28T18:29:33+00:00
macosx: Apply split view reset on present time

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

- - - - -
0ae6a264 by Claudio Cambra at 2025-09-28T18:29:33+00:00
macosx: Ensure split view default split size is performed on main queue

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

- - - - -
0b45d889 by Claudio Cambra at 2025-09-28T18:29:33+00:00
macosx: Use more reasonable size for split view detail view

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

- - - - -
7bfc3aec by Claudio Cambra at 2025-09-28T18:29:33+00:00
macosx: Store and re-apply user set detail view width for all split views using VLCLibraryTwoPaneSplitViewDelegate

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

- - - - -


9 changed files:

- modules/gui/macosx/library/VLCLibraryTwoPaneSplitViewDelegate.m
- modules/gui/macosx/library/VLCLibraryUIUnits.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
- modules/gui/macosx/library/favorites-library/VLCLibraryFavoritesViewController.m
- modules/gui/macosx/library/groups-library/VLCLibraryGroupsViewController.h
- modules/gui/macosx/library/groups-library/VLCLibraryGroupsViewController.m
- modules/gui/macosx/library/playlist-library/VLCLibraryPlaylistViewController.h
- modules/gui/macosx/library/playlist-library/VLCLibraryPlaylistViewController.m
- modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryTwoPaneSplitViewDelegate.m
=====================================
@@ -27,12 +27,24 @@
 
 #import "main/VLCMain.h"
 
+NSString * const VLCLibrarySplitViewDetailViewWidthKey = @"VLCLibrarySplitViewDetailViewWidth";
+
 @implementation VLCLibraryTwoPaneSplitViewDelegate
 
 - (void)resetDefaultSplitForSplitView:(NSSplitView *)splitView
 {
-    [splitView setPosition:VLCLibraryUIUnits.librarySplitViewSelectionViewDefaultWidth
-          ofDividerAtIndex:0];
+    dispatch_async(dispatch_get_main_queue(), ^{
+        NSParameterAssert(splitView != nil);
+        NSParameterAssert(splitView.window != nil);
+        NSParameterAssert(splitView.subviews.count >= 2);
+        
+        NSUserDefaults * const defaults = NSUserDefaults.standardUserDefaults;
+        CGFloat width = [defaults floatForKey:VLCLibrarySplitViewDetailViewWidthKey];
+        if (width <= 0) {
+            width = VLCLibraryUIUnits.librarySplitViewSelectionViewDefaultWidth;
+        }
+        [splitView setPosition:width ofDividerAtIndex:0];
+    });
 }
 
 - (CGFloat)splitView:(NSSplitView *)splitView
@@ -48,4 +60,22 @@ constrainMaxCoordinate:(CGFloat)proposedMinimumPosition
     return libraryWindowWidth - VLCLibraryUIUnits.librarySplitViewMainViewMinimumWidth;
 }
 
+- (void)splitViewDidResizeSubviews:(NSNotification *)notification
+{
+    dispatch_async(dispatch_get_main_queue(), ^{
+        NSSplitView * const splitView = notification.object;
+        NSParameterAssert(splitView != nil);
+        NSParameterAssert(splitView.subviews.count >= 2);
+
+        NSUserDefaults * const defaults = NSUserDefaults.standardUserDefaults;
+        if ([defaults floatForKey:VLCLibrarySplitViewDetailViewWidthKey] <= 0) {
+            return;
+        }
+        
+        NSView * const detailView = splitView.arrangedSubviews[0];
+        const CGFloat detailViewWidth = detailView.frame.size.width;
+        [defaults setFloat:detailViewWidth forKey:VLCLibrarySplitViewDetailViewWidthKey];
+    });
+}
+
 @end


=====================================
modules/gui/macosx/library/VLCLibraryUIUnits.m
=====================================
@@ -244,7 +244,7 @@ NSString * const VLCLibraryCollectionViewItemAdjustmentKey = @"VLCLibraryCollect
 
 + (const CGFloat)librarySplitViewSelectionViewDefaultWidth
 {
-    return 180.;
+    return 280.;
 }
 
 + (const CGFloat)librarySplitViewMainViewMinimumWidth


=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
=====================================
@@ -181,7 +181,6 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
 - (void)setupAudioTableViews
 {
     _audioLibrarySplitView.delegate = _splitViewDelegate;
-    [_splitViewDelegate resetDefaultSplitForSplitView:self.audioLibrarySplitView];
 
     _audioCollectionSelectionTableView.dataSource = _audioDataSource;
     _audioCollectionSelectionTableView.delegate = _audioLibraryTableViewDelegate;
@@ -200,7 +199,6 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
 - (void)setupGridModeSplitView
 {
     _audioLibraryGridModeSplitView.delegate = _splitViewDelegate;
-    [_splitViewDelegate resetDefaultSplitForSplitView:self.audioLibraryGridModeSplitView];
 
     _audioLibraryGridModeSplitViewListTableView.dataSource = _audioDataSource;
     _audioLibraryGridModeSplitViewListTableView.delegate = _audioLibraryTableViewDelegate;
@@ -338,6 +336,7 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
         _audioCollectionViewScrollView.hidden = NO;
     } else {
         _audioLibraryGridModeSplitView.hidden = NO;
+        [_splitViewDelegate resetDefaultSplitForSplitView:self.audioLibraryGridModeSplitView];
     }
 }
 
@@ -347,6 +346,7 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
         _audioSongTableViewScrollView.hidden = NO;
     } else {
         _audioLibrarySplitView.hidden = NO;
+        [_splitViewDelegate resetDefaultSplitForSplitView:self.audioLibrarySplitView];
     }
 }
 


=====================================
modules/gui/macosx/library/favorites-library/VLCLibraryFavoritesViewController.m
=====================================
@@ -100,7 +100,6 @@
 - (void)setupTableViews
 {
     self.favoritesLibrarySplitView.delegate = _splitViewDelegate;
-    [_splitViewDelegate resetDefaultSplitForSplitView:self.favoritesLibrarySplitView];
 
     NSTableColumn * const groupsColumn = [[NSTableColumn alloc] initWithIdentifier:@"groups"];
     NSTableColumn * const selectedGroupColumn = [[NSTableColumn alloc] initWithIdentifier:@"selectedGroup"];
@@ -349,6 +348,7 @@
         [self.libraryWindow displayLibraryView:self.favoritesLibraryCollectionViewScrollView];
     } else if (viewModeSegment == VLCLibraryListViewModeSegment) {
         [self.libraryWindow displayLibraryView:self.favoritesLibrarySplitView];
+        [_splitViewDelegate resetDefaultSplitForSplitView:self.favoritesLibrarySplitView];
     } else {
         NSAssert(false, @"View mode must be grid or list mode");
     }


=====================================
modules/gui/macosx/library/groups-library/VLCLibraryGroupsViewController.h
=====================================
@@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
 @class VLCLibraryMasterDetailViewTableViewDelegate;
 @class VLCLibraryTableView;
 @class VLCLibraryWindow;
- at class VLCMediaLibraryGroup;
+ at class VLCLibraryTwoPaneSplitViewDelegate;
 
 @interface VLCLibraryGroupsViewController : VLCLibraryAbstractMediaLibrarySegmentViewController<NSSplitViewDelegate, VLCLibraryItemPresentingCapable>
 
@@ -47,6 +47,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (readonly) VLCLibraryCollectionViewDelegate *collectionViewDelegate;
 @property (readonly) VLCLibraryMasterDetailViewTableViewDelegate *tableViewDelegate;
+ at property (readonly) VLCLibraryTwoPaneSplitViewDelegate *splitViewDelegate;
+
 @property (readonly) VLCLibraryGroupsDataSource *dataSource;
 
 - (instancetype)initWithLibraryWindow:(VLCLibraryWindow *)libraryWindow;


=====================================
modules/gui/macosx/library/groups-library/VLCLibraryGroupsViewController.m
=====================================
@@ -35,6 +35,7 @@
 #import "library/VLCLibraryModel.h"
 #import "library/VLCLibraryTableCellView.h"
 #import "library/VLCLibraryTableView.h"
+#import "library/VLCLibraryTwoPaneSplitViewDelegate.h"
 #import "library/VLCLibraryUIUnits.h"
 #import "library/VLCLibraryWindow.h"
 #import "library/VLCLibraryWindowPersistentPreferences.h"
@@ -134,6 +135,7 @@
     _groupsTableViewScrollView = [[NSScrollView alloc] init];
     _selectedGroupTableViewScrollView = [[NSScrollView alloc] init];
     _tableViewDelegate = [[VLCLibraryMasterDetailViewTableViewDelegate alloc] init];
+    _splitViewDelegate = [[VLCLibraryTwoPaneSplitViewDelegate alloc] init];
     _groupsTableView = [[VLCLibraryTableView alloc] init];
     _selectedGroupTableView = [[VLCLibraryTableView alloc] init];
     _listViewSplitView = [[NSSplitView alloc] init];
@@ -164,7 +166,7 @@
 
     self.listViewSplitView.vertical = YES;
     self.listViewSplitView.dividerStyle = NSSplitViewDividerStyleThin;
-    self.listViewSplitView.delegate = self;
+    self.listViewSplitView.delegate = self.splitViewDelegate;
     [self.listViewSplitView addArrangedSubview:self.groupsTableViewScrollView];
     [self.listViewSplitView addArrangedSubview:self.selectedGroupTableViewScrollView];
 
@@ -246,6 +248,7 @@
             [self.libraryWindow displayLibraryView:self.collectionViewScrollView];
         } else {
             [self.libraryWindow displayLibraryView:self.listViewSplitView];
+            [self.splitViewDelegate resetDefaultSplitForSplitView:self.listViewSplitView];
         }
     } else if (self.dataSource.libraryModel.filterString.length > 0) {
         [self.libraryWindow displayNoResultsMessage];
@@ -273,17 +276,4 @@
     }
 }
 
-#pragma mark - NSSplitViewDelegate
-
-- (CGFloat)splitView:(NSSplitView *)splitView
-constrainMinCoordinate:(CGFloat)proposedMinimumPosition
-         ofSubviewAt:(NSInteger)dividerIndex
-{
-    if (dividerIndex == 0) {
-        return VLCLibraryUIUnits.librarySplitViewSelectionViewDefaultWidth;
-    } else {
-        return VLCLibraryUIUnits.librarySplitViewMainViewMinimumWidth;
-    }
-}
-
 @end


=====================================
modules/gui/macosx/library/playlist-library/VLCLibraryPlaylistViewController.h
=====================================
@@ -33,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
 @class VLCLibraryMasterDetailViewTableViewDelegate;
 @class VLCLibraryPlaylistDataSource;
 @class VLCLibraryTableView;
+ at class VLCLibraryTwoPaneSplitViewDelegate;
 @class VLCLibraryWindow;
 
 @interface VLCLibraryPlaylistViewController : VLCLibraryAbstractMediaLibrarySegmentViewController<NSSplitViewDelegate>
@@ -48,6 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (readonly) VLCLibraryPlaylistDataSource *dataSource;
 @property (readonly) VLCLibraryCollectionViewDelegate *collectionViewDelegate;
 @property (readonly) VLCLibraryMasterDetailViewTableViewDelegate *tableViewDelegate;
+ at property (readonly) VLCLibraryTwoPaneSplitViewDelegate *splitViewDelegate;
 
 - (instancetype)initWithLibraryWindow:(VLCLibraryWindow *)libraryWindow;
 


=====================================
modules/gui/macosx/library/playlist-library/VLCLibraryPlaylistViewController.m
=====================================
@@ -32,6 +32,7 @@
 #import "library/VLCLibraryModel.h"
 #import "library/VLCLibraryTableCellView.h"
 #import "library/VLCLibraryTableView.h"
+#import "library/VLCLibraryTwoPaneSplitViewDelegate.h"
 #import "library/VLCLibraryUIUnits.h"
 #import "library/VLCLibraryWindow.h"
 #import "library/VLCLibraryWindowPersistentPreferences.h"
@@ -61,6 +62,7 @@
 
     if (self) {
         _dataSource = [[VLCLibraryPlaylistDataSource alloc] init];
+        _splitViewDelegate = [[VLCLibraryTwoPaneSplitViewDelegate alloc] init];
 
         [self setupPlaylistCollectionView];
         [self setupPlaylistTableView];
@@ -159,7 +161,7 @@
 
     self.listViewSplitView.vertical = YES;
     self.listViewSplitView.dividerStyle = NSSplitViewDividerStyleThin;
-    self.listViewSplitView.delegate = self;
+    self.listViewSplitView.delegate = self.splitViewDelegate;
     [self.listViewSplitView addArrangedSubview:self.masterTableViewScrollView];
     [self.listViewSplitView addArrangedSubview:self.detailTableViewScrollView];
 
@@ -263,6 +265,7 @@
         viewToPresent = self.collectionViewScrollView;
     } else {
         viewToPresent = self.listViewSplitView;
+        [self.splitViewDelegate resetDefaultSplitForSplitView:self.listViewSplitView];
     }
     NSParameterAssert(viewToPresent != nil);
     [self.libraryWindow displayLibraryView:viewToPresent];
@@ -332,17 +335,4 @@
     [self.libraryWindow hideLoadingOverlay];
 }
 
-#pragma mark - NSSplitViewDelegate
-
-- (CGFloat)splitView:(NSSplitView *)splitView 
-constrainMinCoordinate:(CGFloat)proposedMinimumPosition
-         ofSubviewAt:(NSInteger)dividerIndex
-{
-    if (dividerIndex == 0) {
-        return VLCLibraryUIUnits.librarySplitViewSelectionViewDefaultWidth;
-    } else {
-        return VLCLibraryUIUnits.librarySplitViewMainViewMinimumWidth;
-    }
-}
-
 @end


=====================================
modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m
=====================================
@@ -137,7 +137,6 @@
 {
     // Split view with table views
     self.videoLibrarySplitView.delegate = _splitViewDelegate;
-    [_splitViewDelegate resetDefaultSplitForSplitView:self.videoLibrarySplitView];
 
     NSNib * const tableCellViewNib =
         [[NSNib alloc] initWithNibNamed:NSStringFromClass(VLCLibraryTableCellView.class)
@@ -391,6 +390,7 @@
     } else if (viewModeSegment == VLCLibraryListViewModeSegment) {
         self.videoLibrarySplitView.hidden = NO;
         self.videoLibraryCollectionViewScrollView.hidden = YES;
+        [_splitViewDelegate resetDefaultSplitForSplitView:self.videoLibrarySplitView];
     } else {
         NSAssert(false, @"View mode must be grid or list mode");
     }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0dd629e7890d74d9b1a557ea058e6a85d0b79b39...7bfc3aec715744ee809e47be3b0843fc58660582

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