[vlc-commits] [Git][videolan/vlc][master] 6 commits: macosx: Set a minimum number of items per dynamically sized collection view...
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Mon Apr 17 11:24:59 UTC 2023
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
0adf1783 by Claudio Cambra at 2023-04-17T11:01:13+00:00
macosx: Set a minimum number of items per dynamically sized collection view item row, preventing crash
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
ad22639a by Claudio Cambra at 2023-04-17T11:01:13+00:00
macosx: Add librarySplitViewMainViewMinimumWidth value in VLCLibraryUIUnits
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
03d15364 by Claudio Cambra at 2023-04-17T11:01:13+00:00
macosx: Add VLCLibraryTwoPaneSplitViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
4b4f854a by Claudio Cambra at 2023-04-17T11:01:13+00:00
macosx: Provide consistent implementation of two-pane view with large right-pane in VLCLibraryTwoPaneSplitViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
8f0d9496 by Claudio Cambra at 2023-04-17T11:01:13+00:00
macosx: Use two pane split view delegate in library audio views
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
373df52b by Claudio Cambra at 2023-04-17T11:01:13+00:00
macosx: Use two pane split view delegate in library video views
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
8 changed files:
- extras/package/macosx/VLC.xcodeproj/project.pbxproj
- modules/gui/macosx/Makefile.am
- + modules/gui/macosx/library/VLCLibraryTwoPaneSplitViewDelegate.h
- + modules/gui/macosx/library/VLCLibraryTwoPaneSplitViewDelegate.m
- modules/gui/macosx/library/VLCLibraryUIUnits.h
- modules/gui/macosx/library/VLCLibraryUIUnits.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
- modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m
Changes:
=====================================
extras/package/macosx/VLC.xcodeproj/project.pbxproj
=====================================
@@ -100,6 +100,7 @@
538A7EDA29A63EE40068AD4F /* VLCFullVideoViewWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 538A7ED929A63EE40068AD4F /* VLCFullVideoViewWindow.m */; };
53903D3A29576ED500D0B308 /* VLCLibraryAudioGroupDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 53903D3929576ED500D0B308 /* VLCLibraryAudioGroupDataSource.m */; };
539BA79F298C726200918C36 /* VLCAspectRatioRetainingVideoWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 539BA79E298C726200918C36 /* VLCAspectRatioRetainingVideoWindow.m */; };
+ 539F114B29E83A4200F13460 /* VLCLibraryTwoPaneSplitViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 539F114A29E83A4200F13460 /* VLCLibraryTwoPaneSplitViewDelegate.m */; };
53B447CA2939823E00857588 /* VLCLibrarySongsTableViewSongPlayingTableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B447C92939823E00857588 /* VLCLibrarySongsTableViewSongPlayingTableCellView.m */; };
53B447F6293BB47B00857588 /* VLCLibraryVideoCollectionViewContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B447EC293BB47A00857588 /* VLCLibraryVideoCollectionViewContainerView.m */; };
53B447F7293BB47B00857588 /* VLCLibraryVideoCollectionViewContainerViewDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B447ED293BB47A00857588 /* VLCLibraryVideoCollectionViewContainerViewDataSource.m */; };
@@ -307,6 +308,8 @@
53903D3929576ED500D0B308 /* VLCLibraryAudioGroupDataSource.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryAudioGroupDataSource.m; sourceTree = "<group>"; };
539BA79D298C726200918C36 /* VLCAspectRatioRetainingVideoWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCAspectRatioRetainingVideoWindow.h; sourceTree = "<group>"; };
539BA79E298C726200918C36 /* VLCAspectRatioRetainingVideoWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCAspectRatioRetainingVideoWindow.m; sourceTree = "<group>"; };
+ 539F114929E83A4200F13460 /* VLCLibraryTwoPaneSplitViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryTwoPaneSplitViewDelegate.h; sourceTree = "<group>"; };
+ 539F114A29E83A4200F13460 /* VLCLibraryTwoPaneSplitViewDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryTwoPaneSplitViewDelegate.m; sourceTree = "<group>"; };
53B447C82939823E00857588 /* VLCLibrarySongsTableViewSongPlayingTableCellView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibrarySongsTableViewSongPlayingTableCellView.h; sourceTree = "<group>"; };
53B447C92939823E00857588 /* VLCLibrarySongsTableViewSongPlayingTableCellView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibrarySongsTableViewSongPlayingTableCellView.m; sourceTree = "<group>"; };
53B447EC293BB47A00857588 /* VLCLibraryVideoCollectionViewContainerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryVideoCollectionViewContainerView.m; sourceTree = "<group>"; };
@@ -1208,6 +1211,8 @@
536283DE291146BC00640C15 /* VLCLibraryTableView.m */,
53ED473429CA4F3400795DB1 /* VLCLibraryTableViewDelegate.h */,
53ED473529CA4F3400795DB1 /* VLCLibraryTableViewDelegate.m */,
+ 539F114929E83A4200F13460 /* VLCLibraryTwoPaneSplitViewDelegate.h */,
+ 539F114A29E83A4200F13460 /* VLCLibraryTwoPaneSplitViewDelegate.m */,
7D713D302201AE350042BEB7 /* VLCLibraryWindow.h */,
7D713D312201AE350042BEB7 /* VLCLibraryWindow.m */,
5362550B293FD639005D64FA /* VLCLibraryWindowController.h */,
@@ -2031,6 +2036,7 @@
6BBB05DA1EEFEA29003A1019 /* VLCHUDOutlineView.m in Sources */,
7D445D842202524D00263D34 /* VLCPlaylistItem.m in Sources */,
1C3113CF1E508C6900D4DD76 /* prefs_widgets.m in Sources */,
+ 539F114B29E83A4200F13460 /* VLCLibraryTwoPaneSplitViewDelegate.m in Sources */,
7D0F63FF2201F63400FDB91F /* VLCPlaylistTableCellView.m in Sources */,
1C3113D11E508C6900D4DD76 /* prefs.m in Sources */,
1C3113D31E508C6900D4DD76 /* VLCResumeDialogController.m in Sources */,
=====================================
modules/gui/macosx/Makefile.am
=====================================
@@ -129,6 +129,8 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/library/VLCLibraryTableCellView.h \
gui/macosx/library/VLCLibraryTableCellView.m \
gui/macosx/library/VLCLibraryTableCellViewProtocol.h \
+ gui/macosx/library/VLCLibraryTwoPaneSplitViewDelegate.h \
+ gui/macosx/library/VLCLibraryTwoPaneSplitViewDelegate.m \
gui/macosx/library/VLCLibraryUIUnits.h \
gui/macosx/library/VLCLibraryUIUnits.m \
gui/macosx/library/VLCLibraryWindow.h \
=====================================
modules/gui/macosx/library/VLCLibraryTwoPaneSplitViewDelegate.h
=====================================
@@ -0,0 +1,31 @@
+/*****************************************************************************
+ * VLCLibraryTwoPaneSplitViewDelegate.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.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 "Cocoa/Cocoa.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+ at interface VLCLibraryTwoPaneSplitViewDelegate : NSObject<NSSplitViewDelegate>
+
+ at end
+
+NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/VLCLibraryTwoPaneSplitViewDelegate.m
=====================================
@@ -0,0 +1,49 @@
+/*****************************************************************************
+ * VLCLibraryTwoPaneSplitViewDelegate.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.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 "VLCLibraryTwoPaneSplitViewDelegate.h"
+
+#import "library/VLCLibraryUIUnits.h"
+#import "library/VLCLibraryWindow.h"
+
+#import "main/VLCMain.h"
+
+ at implementation VLCLibraryTwoPaneSplitViewDelegate
+
+- (CGFloat)splitView:(NSSplitView *)splitView
+constrainMaxCoordinate:(CGFloat)proposedMinimumPosition
+ ofSubviewAt:(NSInteger)dividerIndex
+{
+ if (dividerIndex != 0) {
+ return proposedMinimumPosition;
+ }
+
+ VLCLibraryWindow * const libraryWindow = VLCMain.sharedInstance.libraryWindow;
+ const CGFloat libraryWindowWidth = libraryWindow.frame.size.width;
+
+ NSNumber * const leftPaneIndex = [NSNumber numberWithLong:0];
+ NSNumber * const leftPaneMaxWidth = [NSNumber numberWithDouble:libraryWindowWidth - [VLCLibraryUIUnits librarySplitViewMainViewMinimumWidth]];
+
+ return leftPaneMaxWidth.floatValue;
+}
+
+ at end
=====================================
modules/gui/macosx/library/VLCLibraryUIUnits.h
=====================================
@@ -63,6 +63,8 @@ NS_ASSUME_NONNULL_BEGIN
+ (const CGFloat)controlsFadeAnimationDuration;
++ (const CGFloat)librarySplitViewMainViewMinimumWidth;
+
@end
NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/VLCLibraryUIUnits.m
=====================================
@@ -98,6 +98,7 @@
withItemsAspectRatio:(VLCLibraryCollectionViewItemAspectRatio)itemsAspectRatio
{
static uint numItemsInRow = 5;
+ static uint minItemsInRow = 2;
NSSize itemSize = [self itemSizeForCollectionView:collectionView
withLayout:collectionViewLayout
@@ -111,7 +112,7 @@
withItemsAspectRatio:itemsAspectRatio
withNumberOfItemsInRow:numItemsInRow];
}
- while (itemSize.width < [VLCLibraryUIUnits dynamicCollectionViewItemMinimumWidth]) {
+ while (itemSize.width < [VLCLibraryUIUnits dynamicCollectionViewItemMinimumWidth] && numItemsInRow > minItemsInRow) {
--numItemsInRow;
itemSize = [self itemSizeForCollectionView:collectionView
withLayout:collectionViewLayout
@@ -170,4 +171,9 @@
return 0.4f;
}
++ (const CGFloat)librarySplitViewMainViewMinimumWidth
+{
+ return 400.;
+}
+
@end
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
=====================================
@@ -29,6 +29,7 @@
#import "library/VLCLibraryController.h"
#import "library/VLCLibraryModel.h"
#import "library/VLCLibraryNavigationStack.h"
+#import "library/VLCLibraryTwoPaneSplitViewDelegate.h"
#import "library/VLCLibraryWindow.h"
#import "library/VLCLibraryWindowPersistentPreferences.h"
@@ -55,6 +56,7 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
VLCLibraryCollectionViewDelegate *_audioLibraryCollectionViewDelegate;
VLCLibraryAudioTableViewDelegate *_audioLibraryTableViewDelegate;
VLCLibraryAudioGroupTableViewDelegate *_audioGroupLibraryTableViewDelegate;
+ VLCLibraryTwoPaneSplitViewDelegate *_splitViewDelegate;
}
@end
@@ -73,6 +75,7 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
_audioLibraryCollectionViewDelegate = [[VLCLibraryCollectionViewDelegate alloc] init];
_audioLibraryTableViewDelegate = [[VLCLibraryAudioTableViewDelegate alloc] init];
_audioGroupLibraryTableViewDelegate = [[VLCLibraryAudioGroupTableViewDelegate alloc] init];
+ _splitViewDelegate = [[VLCLibraryTwoPaneSplitViewDelegate alloc] init];
[self setupAudioCollectionView];
[self setupGridModeSplitView];
@@ -161,6 +164,8 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
- (void)setupAudioTableViews
{
+ _audioLibrarySplitView.delegate = _splitViewDelegate;
+
_audioCollectionSelectionTableView.dataSource = _audioDataSource;
_audioCollectionSelectionTableView.delegate = _audioLibraryTableViewDelegate;
@@ -177,6 +182,8 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
- (void)setupGridModeSplitView
{
+ _audioLibraryGridModeSplitView.delegate = _splitViewDelegate;
+
_audioLibraryGridModeSplitViewListTableView.dataSource = _audioDataSource;
_audioLibraryGridModeSplitViewListTableView.delegate = _audioLibraryTableViewDelegate;
=====================================
modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m
=====================================
@@ -26,6 +26,7 @@
#import "library/VLCLibraryController.h"
#import "library/VLCLibraryModel.h"
+#import "library/VLCLibraryTwoPaneSplitViewDelegate.h"
#import "library/VLCLibraryUIUnits.h"
#import "library/VLCLibraryWindow.h"
#import "library/VLCLibraryWindowPersistentPreferences.h"
@@ -44,6 +45,7 @@
@interface VLCLibraryVideoViewController ()
{
VLCLibraryVideoTableViewDelegate *_videoLibraryTableViewDelegate;
+ VLCLibraryTwoPaneSplitViewDelegate *_splitViewDelegate;
}
@end
@@ -55,6 +57,7 @@
if(self) {
_videoLibraryTableViewDelegate = [[VLCLibraryVideoTableViewDelegate alloc] init];
+ _splitViewDelegate = [[VLCLibraryTwoPaneSplitViewDelegate alloc] init];
[self setupPropertiesFromLibraryWindow:libraryWindow];
[self setupTableViewDataSource];
@@ -99,6 +102,7 @@
- (void)setupTableViewDataSource
{
+ _videoLibrarySplitView.delegate = _splitViewDelegate;
_libraryVideoTableViewDataSource = [[VLCLibraryVideoTableViewDataSource alloc] init];
_libraryVideoTableViewDataSource.libraryModel = VLCMain.sharedInstance.libraryController.libraryModel;
_libraryVideoTableViewDataSource.groupsTableView = _videoLibraryGroupsTableView;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1459f67178938bc3f529f6f54aa0cec1e0bb6420...373df52b7eb9c711945eccd5baadd3c7d6c0b5a8
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1459f67178938bc3f529f6f54aa0cec1e0bb6420...373df52b7eb9c711945eccd5baadd3c7d6c0b5a8
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