[vlc-commits] [Git][videolan/vlc][master] 9 commits: macosx: Add VLCLibraryMediaSourceViewController class
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Thu Jan 12 11:13:32 UTC 2023
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
8713bcd3 by Claudio Cambra at 2023-01-12T10:47:29+00:00
macosx: Add VLCLibraryMediaSourceViewController class
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
2243fb6a by Claudio Cambra at 2023-01-12T10:47:29+00:00
macosx: Move media source components into library folder
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
7c71d98e by Claudio Cambra at 2023-01-12T10:47:29+00:00
macosx: Add init that pulls required components from library window in VLCLibraryMediaSourceViewController
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
6ed09487 by Claudio Cambra at 2023-01-12T10:47:29+00:00
macosx: Move media source data source and its configuration into VLCLibraryMediaSourceViewController
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
e7d67ddf by Claudio Cambra at 2023-01-12T10:47:29+00:00
macosx: Make VLCLibraryMediaSourceViewController responsible for presenting the media source views
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
0b00a23b by Claudio Cambra at 2023-01-12T10:47:29+00:00
macosx: Add dynamic item sizing to media source collection views
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
f1cf6977 by Claudio Cambra at 2023-01-12T10:47:29+00:00
macosx: Add dynamic collection view item sizing calculating method to VLCLibraryUIUnits
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
2502c0e2 by Claudio Cambra at 2023-01-12T10:47:29+00:00
macosx: Remove duplicate dynamic collection view item sizing calculation from various collection view delegates, use VLCLibraryUIUnits method instead
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
027cf369 by Claudio Cambra at 2023-01-12T10:47:29+00:00
macosx: Fix moved media-source file paths in POTFILES
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
24 changed files:
- extras/package/macosx/VLC.xcodeproj/project.pbxproj
- modules/gui/macosx/Makefile.am
- modules/gui/macosx/library/VLCLibraryCollectionViewDelegate.m
- modules/gui/macosx/library/VLCLibraryNavigationStack.m
- modules/gui/macosx/library/VLCLibraryNavigationState.m
- modules/gui/macosx/library/VLCLibraryUIUnits.h
- modules/gui/macosx/library/VLCLibraryUIUnits.m
- modules/gui/macosx/library/VLCLibraryWindow.h
- modules/gui/macosx/library/VLCLibraryWindow.m
- + modules/gui/macosx/library/media-source/VLCLibraryMediaSourceViewController.h
- + modules/gui/macosx/library/media-source/VLCLibraryMediaSourceViewController.m
- modules/gui/macosx/media-source/VLCMediaSource.h → modules/gui/macosx/library/media-source/VLCMediaSource.h
- modules/gui/macosx/media-source/VLCMediaSource.m → modules/gui/macosx/library/media-source/VLCMediaSource.m
- modules/gui/macosx/media-source/VLCMediaSourceBaseDataSource.h → modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.h
- modules/gui/macosx/media-source/VLCMediaSourceBaseDataSource.m → modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.m
- modules/gui/macosx/media-source/VLCMediaSourceCollectionViewItem.h → modules/gui/macosx/library/media-source/VLCMediaSourceCollectionViewItem.h
- modules/gui/macosx/media-source/VLCMediaSourceCollectionViewItem.m → modules/gui/macosx/library/media-source/VLCMediaSourceCollectionViewItem.m
- modules/gui/macosx/media-source/VLCMediaSourceDataSource.h → modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.h
- modules/gui/macosx/media-source/VLCMediaSourceDataSource.m → modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.m
- modules/gui/macosx/media-source/VLCMediaSourceDeviceCollectionViewItem.h → modules/gui/macosx/library/media-source/VLCMediaSourceDeviceCollectionViewItem.h
- modules/gui/macosx/media-source/VLCMediaSourceDeviceCollectionViewItem.m → modules/gui/macosx/library/media-source/VLCMediaSourceDeviceCollectionViewItem.m
- modules/gui/macosx/media-source/VLCMediaSourceProvider.h → modules/gui/macosx/library/media-source/VLCMediaSourceProvider.h
- modules/gui/macosx/media-source/VLCMediaSourceProvider.m → modules/gui/macosx/library/media-source/VLCMediaSourceProvider.m
- po/POTFILES.in
Changes:
=====================================
extras/package/macosx/VLC.xcodeproj/project.pbxproj
=====================================
@@ -78,6 +78,7 @@
1CCC89062078A3D500E5626F /* TimeSelectionPanel.xib in Sources */ = {isa = PBXBuildFile; fileRef = 6B8224161E4D2A9000833BE1 /* TimeSelectionPanel.xib */; };
1CFE8D591EA0D42A00E94451 /* VLCErrorWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CFE8D581EA0D42A00E94451 /* VLCErrorWindowController.m */; };
5307A6F52967859F001E0C6A /* NSImage+VLCAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 5307A6F42967859F001E0C6A /* NSImage+VLCAdditions.m */; };
+ 5307A6F82969904D001E0C6A /* VLCLibraryMediaSourceViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5307A6F72969904D001E0C6A /* VLCLibraryMediaSourceViewController.m */; };
5317FE04294E3DD3001702F0 /* VLCLibraryCollectionViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5317FE03294E3DD3001702F0 /* VLCLibraryCollectionViewDelegate.m */; };
5325C57D29302E6800B2B63A /* VLCLibraryAudioViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5325C57B29302E6800B2B63A /* VLCLibraryAudioViewController.m */; };
5362550D293FD639005D64FA /* VLCLibraryWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5362550C293FD639005D64FA /* VLCLibraryWindowController.m */; };
@@ -242,6 +243,8 @@
1CFE8D581EA0D42A00E94451 /* VLCErrorWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCErrorWindowController.m; sourceTree = "<group>"; };
5307A6F32967859F001E0C6A /* NSImage+VLCAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSImage+VLCAdditions.h"; sourceTree = "<group>"; };
5307A6F42967859F001E0C6A /* NSImage+VLCAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSImage+VLCAdditions.m"; sourceTree = "<group>"; };
+ 5307A6F62969904D001E0C6A /* VLCLibraryMediaSourceViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryMediaSourceViewController.h; sourceTree = "<group>"; };
+ 5307A6F72969904D001E0C6A /* VLCLibraryMediaSourceViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryMediaSourceViewController.m; sourceTree = "<group>"; };
5317FE02294E3DD3001702F0 /* VLCLibraryCollectionViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryCollectionViewDelegate.h; sourceTree = "<group>"; };
5317FE03294E3DD3001702F0 /* VLCLibraryCollectionViewDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryCollectionViewDelegate.m; sourceTree = "<group>"; };
5317FE05294E8D1A001702F0 /* VLCLibraryCollectionViewDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryCollectionViewDataSource.h; sourceTree = "<group>"; };
@@ -837,7 +840,6 @@
1C1ED5122204B0B500811EC0 /* imported */,
1C1ED5132204B0CB00811EC0 /* library */,
1C1ED50E2204B01C00811EC0 /* main */,
- 7DFBDCB8226CED3700B700A5 /* media-source */,
1C1ED50F2204B04A00811EC0 /* menus */,
1C1ED50C2204AFD900811EC0 /* os-integration */,
1C1ED5032204A99400811EC0 /* panels */,
@@ -1126,6 +1128,7 @@
children = (
53B447EB293BB47A00857588 /* video-library */,
5325C5742930026600B2B63A /* audio-library */,
+ 7DFBDCB8226CED3700B700A5 /* media-source */,
7DFBDCBF226DC16200B700A5 /* VLCInputItem.h */,
7DFBDCC0226DC16200B700A5 /* VLCInputItem.m */,
536283ED291146BC00640C15 /* VLCLibraryCollectionViewFlowLayout.h */,
@@ -1605,6 +1608,8 @@
7D67318422C8F4050000AD40 /* VLCMediaSourceCollectionViewItem.m */,
7D2554C422C8E8B500F2D9C2 /* VLCMediaSourceDeviceCollectionViewItem.h */,
7D2554C322C8E8B400F2D9C2 /* VLCMediaSourceDeviceCollectionViewItem.m */,
+ 5307A6F62969904D001E0C6A /* VLCLibraryMediaSourceViewController.h */,
+ 5307A6F72969904D001E0C6A /* VLCLibraryMediaSourceViewController.m */,
);
path = "media-source";
sourceTree = "<group>";
@@ -1880,6 +1885,7 @@
536283F7291146BC00640C15 /* VLCLibraryNavigationState.m in Sources */,
1CCC89052078A3D500E5626F /* TextfieldPanel.xib in Sources */,
1CCC89062078A3D500E5626F /* TimeSelectionPanel.xib in Sources */,
+ 5307A6F82969904D001E0C6A /* VLCLibraryMediaSourceViewController.m in Sources */,
6B81662C1EBFC38100C26F1B /* VLCUIWidgets.m in Sources */,
6B0AB0F11F1AC8B3003A1B4E /* VLCSliderCell.m in Sources */,
6B8166291EBFC34300C26F1B /* VLCDefaultValueSlider.m in Sources */,
=====================================
modules/gui/macosx/Makefile.am
=====================================
@@ -132,6 +132,20 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/library/audio-library/VLCLibrarySongTableCellView.m \
gui/macosx/library/audio-library/VLCLibrarySongsTableViewSongPlayingTableCellView.h \
gui/macosx/library/audio-library/VLCLibrarySongsTableViewSongPlayingTableCellView.m \
+ gui/macosx/library/media-source/VLCLibraryMediaSourceViewController.h \
+ gui/macosx/library/media-source/VLCLibraryMediaSourceViewController.m \
+ gui/macosx/library/media-source/VLCMediaSource.h \
+ gui/macosx/library/media-source/VLCMediaSource.m \
+ gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.h \
+ gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.m \
+ gui/macosx/library/media-source/VLCMediaSourceCollectionViewItem.h \
+ gui/macosx/library/media-source/VLCMediaSourceCollectionViewItem.m \
+ gui/macosx/library/media-source/VLCMediaSourceDataSource.h \
+ gui/macosx/library/media-source/VLCMediaSourceDataSource.m \
+ gui/macosx/library/media-source/VLCMediaSourceDeviceCollectionViewItem.h \
+ gui/macosx/library/media-source/VLCMediaSourceDeviceCollectionViewItem.m \
+ gui/macosx/library/media-source/VLCMediaSourceProvider.h \
+ gui/macosx/library/media-source/VLCMediaSourceProvider.m \
gui/macosx/main/CompatibilityFixes.h \
gui/macosx/main/CompatibilityFixes.m \
gui/macosx/main/VLCApplication.h \
@@ -141,18 +155,6 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/main/VLCMain.h \
gui/macosx/main/VLCMain.m \
gui/macosx/main/macosx.m \
- gui/macosx/media-source/VLCMediaSource.h \
- gui/macosx/media-source/VLCMediaSource.m \
- gui/macosx/media-source/VLCMediaSourceBaseDataSource.h \
- gui/macosx/media-source/VLCMediaSourceBaseDataSource.m \
- gui/macosx/media-source/VLCMediaSourceCollectionViewItem.h \
- gui/macosx/media-source/VLCMediaSourceCollectionViewItem.m \
- gui/macosx/media-source/VLCMediaSourceDataSource.h \
- gui/macosx/media-source/VLCMediaSourceDataSource.m \
- gui/macosx/media-source/VLCMediaSourceDeviceCollectionViewItem.h \
- gui/macosx/media-source/VLCMediaSourceDeviceCollectionViewItem.m \
- gui/macosx/media-source/VLCMediaSourceProvider.h \
- gui/macosx/media-source/VLCMediaSourceProvider.m \
gui/macosx/menus/VLCMainMenu.h \
gui/macosx/menus/VLCMainMenu.m \
gui/macosx/menus/VLCStatusBarIcon.h \
=====================================
modules/gui/macosx/library/VLCLibraryCollectionViewDelegate.m
=====================================
@@ -77,59 +77,13 @@
VLCLibraryCollectionViewFlowLayout *collectionViewFlowLayout = (VLCLibraryCollectionViewFlowLayout*)collectionViewLayout;
if (collectionViewLayout) {
VLCLibraryCollectionViewFlowLayout *collectionViewFlowLayout = (VLCLibraryCollectionViewFlowLayout*)collectionViewLayout;
- return [self adjustedItemSizeForCollectionView:collectionView
- withLayout:collectionViewFlowLayout];
+ return [VLCLibraryUIUnits adjustedCollectionViewItemSizeForCollectionView:collectionView
+ withLayout:collectionViewFlowLayout];
}
return NSZeroSize;
}
-- (NSSize)adjustedItemSizeForCollectionView:(NSCollectionView *)collectionView
- withLayout:(VLCLibraryCollectionViewFlowLayout *)collectionViewLayout
-{
- static uint numItemsInRow = 5;
-
- NSSize itemSize = [self itemSizeForCollectionView:collectionView
- withLayout:collectionViewLayout
- withNumberOfItemsInRow:numItemsInRow];
-
- while (itemSize.width > [VLCLibraryUIUnits dynamicCollectionViewItemMaximumWidth]) {
- ++numItemsInRow;
- itemSize = [self itemSizeForCollectionView:collectionView
- withLayout:collectionViewLayout
- withNumberOfItemsInRow:numItemsInRow];
- }
- while (itemSize.width < [VLCLibraryUIUnits dynamicCollectionViewItemMinimumWidth]) {
- --numItemsInRow;
- itemSize = [self itemSizeForCollectionView:collectionView
- withLayout:collectionViewLayout
- withNumberOfItemsInRow:numItemsInRow];
- }
-
- return itemSize;
-}
-
-- (NSSize)itemSizeForCollectionView:(NSCollectionView *)collectionView
- withLayout:(VLCLibraryCollectionViewFlowLayout *)collectionViewLayout
- withNumberOfItemsInRow:(uint)numItemsInRow
-{
- NSParameterAssert(numItemsInRow > 0);
- NSParameterAssert(collectionView);
- NSParameterAssert(collectionViewLayout);
-
- const NSEdgeInsets sectionInsets = collectionViewLayout.sectionInset;
- const CGFloat interItemSpacing = collectionViewLayout.minimumInteritemSpacing;
-
- const CGFloat rowOfItemsWidth = collectionView.bounds.size.width -
- (sectionInsets.left +
- sectionInsets.right +
- (interItemSpacing * (numItemsInRow - 1)) +
- 1);
-
- const CGFloat itemWidth = rowOfItemsWidth / numItemsInRow;
- return NSMakeSize(itemWidth, itemWidth + [VLCLibraryCollectionViewItem bottomTextViewsHeight]);
-}
-
- (BOOL)collectionView:(NSCollectionView *)collectionView
canDragItemsAtIndexPaths:(NSSet<NSIndexPath *> *)indexPaths
withEvent:(NSEvent *)event
=====================================
modules/gui/macosx/library/VLCLibraryNavigationStack.m
=====================================
@@ -28,6 +28,7 @@
#import "library/audio-library/VLCLibraryAudioViewController.h"
+#import "media-source/VLCLibraryMediaSourceViewController.h"
#import "media-source/VLCMediaSourceBaseDataSource.h"
#import "media-source/VLCMediaSourceDataSource.h"
#import "media-source/VLCMediaSource.h"
@@ -177,12 +178,12 @@
[_delegate.segmentedTitleControl setSelectedSegment:state.libraryWindowSelectedSegment];
[_delegate.audioSegmentedControl setSelectedSegment:state.audioLibraryViewSelectedSegment];
[_delegate.gridVsListSegmentedControl setSelectedSegment:state.viewModeSelectedSegment];
- [_delegate.mediaSourceDataSource setChildDataSource:state.currentMediaSource];
- [_delegate.mediaSourceDataSource.childDataSource setNodeToDisplay:state.currentNodeDisplayed];
+ [_delegate.libraryMediaSourceViewController.baseDataSource setChildDataSource:state.currentMediaSource];
+ [_delegate.libraryMediaSourceViewController.baseDataSource.childDataSource setNodeToDisplay:state.currentNodeDisplayed];
[_delegate segmentedControlAction:self];
[_delegate.libraryAudioViewController segmentedControlAction:self];
- [_delegate.mediaSourceDataSource setGridOrListMode:self];
+ [_delegate.libraryMediaSourceViewController.baseDataSource setGridOrListMode:self];
[self updateDelegateNavigationButtons];
}
=====================================
modules/gui/macosx/library/VLCLibraryNavigationState.m
=====================================
@@ -23,6 +23,8 @@
#import "VLCLibraryNavigationState.h"
#import "VLCLibraryWindow.h"
+
+#import "media-source/VLCLibraryMediaSourceViewController.h"
#import "media-source/VLCMediaSourceBaseDataSource.h"
#import "media-source/VLCMediaSourceDataSource.h"
@@ -36,8 +38,8 @@
_libraryWindowSelectedSegment = libraryWindow.segmentedTitleControl.selectedSegment;
_viewModeSelectedSegment = libraryWindow.gridVsListSegmentedControl.selectedSegment;
_audioLibraryViewSelectedSegment = libraryWindow.audioSegmentedControl.selectedSegment;
- _currentMediaSource = libraryWindow.mediaSourceDataSource.childDataSource;
- _currentNodeDisplayed = libraryWindow.mediaSourceDataSource.childDataSource.nodeToDisplay;
+ _currentMediaSource = libraryWindow.libraryMediaSourceViewController.baseDataSource.childDataSource;
+ _currentNodeDisplayed = libraryWindow.libraryMediaSourceViewController.baseDataSource.childDataSource.nodeToDisplay;
}
return navState;
=====================================
modules/gui/macosx/library/VLCLibraryUIUnits.h
=====================================
@@ -22,6 +22,8 @@
#import <Cocoa/Cocoa.h>
+ at class VLCLibraryCollectionViewFlowLayout;
+
NS_ASSUME_NONNULL_BEGIN
@interface VLCLibraryUIUnits : NSObject
@@ -44,6 +46,9 @@ NS_ASSUME_NONNULL_BEGIN
+ (const CGFloat)dynamicCollectionViewItemMinimumWidth;
+ (const CGFloat)dynamicCollectionViewItemMaximumWidth;
++ (const NSSize)adjustedCollectionViewItemSizeForCollectionView:(NSCollectionView *)collectionView
+ withLayout:(VLCLibraryCollectionViewFlowLayout *)collectionViewLayout;
+
@end
NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/VLCLibraryUIUnits.m
=====================================
@@ -22,6 +22,9 @@
#import "VLCLibraryUIUnits.h"
+#import "library/VLCLibraryCollectionViewFlowLayout.h"
+#import "library/VLCLibraryCollectionViewItem.h"
+
@implementation VLCLibraryUIUnits
+ (const CGFloat)largeSpacing
@@ -79,4 +82,50 @@
return 280;
}
++ (const NSSize)adjustedCollectionViewItemSizeForCollectionView:(NSCollectionView *)collectionView
+ withLayout:(VLCLibraryCollectionViewFlowLayout *)collectionViewLayout
+{
+ static uint numItemsInRow = 5;
+
+ NSSize itemSize = [self itemSizeForCollectionView:collectionView
+ withLayout:collectionViewLayout
+ withNumberOfItemsInRow:numItemsInRow];
+
+ while (itemSize.width > [VLCLibraryUIUnits dynamicCollectionViewItemMaximumWidth]) {
+ ++numItemsInRow;
+ itemSize = [self itemSizeForCollectionView:collectionView
+ withLayout:collectionViewLayout
+ withNumberOfItemsInRow:numItemsInRow];
+ }
+ while (itemSize.width < [VLCLibraryUIUnits dynamicCollectionViewItemMinimumWidth]) {
+ --numItemsInRow;
+ itemSize = [self itemSizeForCollectionView:collectionView
+ withLayout:collectionViewLayout
+ withNumberOfItemsInRow:numItemsInRow];
+ }
+
+ return itemSize;
+}
+
++ (const NSSize)itemSizeForCollectionView:(NSCollectionView *)collectionView
+ withLayout:(VLCLibraryCollectionViewFlowLayout *)collectionViewLayout
+ withNumberOfItemsInRow:(uint)numItemsInRow
+{
+ NSParameterAssert(numItemsInRow > 0);
+ NSParameterAssert(collectionView);
+ NSParameterAssert(collectionViewLayout);
+
+ const NSEdgeInsets sectionInsets = collectionViewLayout.sectionInset;
+ const CGFloat interItemSpacing = collectionViewLayout.minimumInteritemSpacing;
+
+ const CGFloat rowOfItemsWidth = collectionView.bounds.size.width -
+ (sectionInsets.left +
+ sectionInsets.right +
+ (interItemSpacing * (numItemsInRow - 1)) +
+ 1);
+
+ const CGFloat itemWidth = rowOfItemsWidth / numItemsInRow;
+ return NSMakeSize(itemWidth, itemWidth + [VLCLibraryCollectionViewItem bottomTextViewsHeight]);
+}
+
@end
=====================================
modules/gui/macosx/library/VLCLibraryWindow.h
=====================================
@@ -28,9 +28,9 @@ NS_ASSUME_NONNULL_BEGIN
@class VLCRoundedCornerTextField;
@class VLCLibraryNavigationStack;
@class VLCLibraryAudioViewController;
+ at class VLCLibraryMediaSourceViewController;
@class VLCLibraryVideoViewController;
@class VLCLibrarySortingMenuController;
- at class VLCMediaSourceBaseDataSource;
@class VLCPlaylistDataSource;
@class VLCPlaylistController;
@class VLCPlaylistSortingMenuController;
@@ -122,9 +122,9 @@ extern const NSUserInterfaceItemIdentifier VLCLibraryWindowIdentifier;
@property (readwrite) BOOL nonembedded;
@property (readwrite) VLCLibraryNavigationStack *navigationStack;
@property (readonly) VLCLibraryAudioViewController *libraryAudioViewController;
+ at property (readonly) VLCLibraryMediaSourceViewController *libraryMediaSourceViewController;
@property (readonly) VLCLibraryVideoViewController *libraryVideoViewController;
@property (readonly) VLCLibrarySortingMenuController *librarySortingMenuController;
- at property (readonly) VLCMediaSourceBaseDataSource *mediaSourceDataSource;
@property (readonly) VLCPlaylistDataSource *playlistDataSource;
@property (readonly) VLCPlaylistSortingMenuController *playlistSortingMenuController;
@property (readonly) VLCPlaylistController *playlistController;
=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -49,6 +49,7 @@
#import "library/audio-library/VLCLibraryAudioViewController.h"
#import "media-source/VLCMediaSourceBaseDataSource.h"
+#import "media-source/VLCLibraryMediaSourceViewController.h"
#import "views/VLCCustomWindowButton.h"
#import "views/VLCDragDropView.h"
@@ -233,15 +234,8 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
_audioLibraryGridModeSplitViewListTableView.rowHeight = [VLCLibraryUIUnits mediumTableViewRowHeight];
_audioGroupSelectionTableView.rowHeight = [VLCLibraryAlbumTableCellView defaultHeight];
- _mediaSourceDataSource = [[VLCMediaSourceBaseDataSource alloc] init];
- _mediaSourceDataSource.collectionView = _mediaSourceCollectionView;
- _mediaSourceDataSource.collectionViewScrollView = _mediaSourceCollectionViewScrollView;
- _mediaSourceDataSource.homeButton = _mediaSourceHomeButton;
- _mediaSourceDataSource.pathControl = _mediaSourcePathControl;
- _mediaSourceDataSource.gridVsListSegmentedControl = _gridVsListSegmentedControl;
+ _libraryMediaSourceViewController = [[VLCLibraryMediaSourceViewController alloc] initWithLibraryWindow:self];
_mediaSourceTableView.rowHeight = [VLCLibraryUIUnits mediumTableViewRowHeight];
- _mediaSourceDataSource.tableView = _mediaSourceTableView;
- [_mediaSourceDataSource setupViews];
self.upNextLabel.font = [NSFont VLClibrarySectionHeaderFont];
self.upNextLabel.stringValue = _NS("Playlist");
@@ -485,8 +479,10 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
[self showAudioLibrary];
break;
case VLCLibraryBrowseSegment:
+ [_libraryMediaSourceViewController presentBrowseView];
+ break;
case VLCLibraryStreamsSegment:
- [self showMediaSourceAppearance];
+ [_libraryMediaSourceViewController presentStreamsView];
break;
default:
break;
@@ -524,33 +520,6 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
self.gridVsListSegmentedControl.action = @selector(segmentedControlAction:);
}
-- (void)showMediaSourceAppearance
-{
- if (_videoLibraryView.superview != nil) {
- [_videoLibraryView removeFromSuperview];
- }
- if (_audioLibraryView.superview != nil) {
- [_audioLibraryView removeFromSuperview];
- }
- if (_emptyLibraryView.superview != nil) {
- [_emptyLibraryView removeFromSuperview];
- }
- if (_mediaSourceView.superview == nil) {
- _mediaSourceView.translatesAutoresizingMaskIntoConstraints = NO;
- [_libraryTargetView addSubview:_mediaSourceView];
- NSDictionary *dict = NSDictionaryOfVariableBindings(_mediaSourceView);
- [_libraryTargetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_mediaSourceView(>=572.)]|" options:0 metrics:0 views:dict]];
- [_libraryTargetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_mediaSourceView(>=444.)]|" options:0 metrics:0 views:dict]];
- }
- _mediaSourceDataSource.mediaSourceMode = _segmentedTitleControl.selectedSegment == 2 ? VLCMediaSourceModeLAN : VLCMediaSourceModeInternet;
- _librarySortButton.hidden = YES;
- _librarySearchField.enabled = NO;
- [self clearLibraryFilterString];
- _optionBarView.hidden = YES;
- _audioSegmentedControl.hidden = YES;
- [_mediaSourceDataSource reloadViews];
-}
-
- (IBAction)playlistDoubleClickAction:(id)sender
{
NSInteger selectedRow = self.playlistTableView.selectedRow;
=====================================
modules/gui/macosx/library/media-source/VLCLibraryMediaSourceViewController.h
=====================================
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * VLCLibraryMediaSourceViewController.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 class VLCLibraryWindow;
+ at class VLCMediaSourceBaseDataSource;
+
+ at interface VLCLibraryMediaSourceViewController : NSObject
+
+ at property (readonly) NSView *libraryTargetView;
+ at property (readonly) NSView *mediaSourceView;
+ at property (readonly) NSCollectionView *collectionView;
+ at property (readonly) NSScrollView *collectionViewScrollView;
+ at property (readonly) NSTableView *tableView;
+ at property (readonly) NSScrollView *tableViewScrollView;
+ at property (readonly) NSButton *homeButton;
+ at property (readonly) NSPathControl *pathControl;
+ at property (readonly) NSSegmentedControl *gridVsListSegmentedControl;
+ at property (readonly) NSButton *librarySortButton;
+ at property (readonly) NSSearchField *librarySearchField;
+ at property (readonly) NSVisualEffectView *optionBarView;
+
+ at property (readonly) VLCMediaSourceBaseDataSource *baseDataSource;
+
+- (instancetype)initWithLibraryWindow:(VLCLibraryWindow *)libraryWindow;
+
+- (void)presentBrowseView;
+- (void)presentStreamsView;
+
+ at end
+
+NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/media-source/VLCLibraryMediaSourceViewController.m
=====================================
@@ -0,0 +1,116 @@
+/*****************************************************************************
+ * VLCLibraryMediaSourceViewController.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 "VLCLibraryMediaSourceViewController.h"
+
+#import "VLCMediaSourceBaseDataSource.h"
+
+#import "library/VLCLibraryCollectionViewFlowLayout.h"
+#import "library/VLCLibraryController.h"
+#import "library/VLCLibraryWindow.h"
+
+#import "main/VLCMain.h"
+
+ at implementation VLCLibraryMediaSourceViewController
+
+- (instancetype)initWithLibraryWindow:(VLCLibraryWindow *)libraryWindow
+{
+ self = [super init];
+ if (self) {
+ [self setupPropertiesFromLibraryWindow:libraryWindow];
+ [self setupBaseDataSource];
+ [self setupCollectionView];
+ }
+ return self;
+}
+
+- (void)setupPropertiesFromLibraryWindow:(VLCLibraryWindow *)libraryWindow
+{
+ NSParameterAssert(libraryWindow);
+ _libraryTargetView = libraryWindow.libraryTargetView;
+ _mediaSourceView = libraryWindow.mediaSourceView;
+ _collectionView = libraryWindow.mediaSourceCollectionView;
+ _collectionViewScrollView = libraryWindow.mediaSourceCollectionViewScrollView;
+ _tableView = libraryWindow.mediaSourceTableView;
+ _tableViewScrollView = libraryWindow.mediaSourceTableViewScrollView;
+ _homeButton = libraryWindow.mediaSourceHomeButton;
+ _pathControl = libraryWindow.mediaSourcePathControl;
+ _gridVsListSegmentedControl = libraryWindow.gridVsListSegmentedControl;
+ _optionBarView = libraryWindow.optionBarView;
+ _librarySortButton = libraryWindow.librarySortButton;
+ _librarySearchField = libraryWindow.librarySearchField;
+
+}
+
+- (void)setupBaseDataSource
+{
+ _baseDataSource = [[VLCMediaSourceBaseDataSource alloc] init];
+ _baseDataSource.collectionView = _collectionView;
+ _baseDataSource.collectionViewScrollView = _collectionViewScrollView;
+ _baseDataSource.homeButton = _homeButton;
+ _baseDataSource.pathControl = _pathControl;
+ _baseDataSource.gridVsListSegmentedControl = _gridVsListSegmentedControl;
+ _baseDataSource.tableView = _tableView;
+ [_baseDataSource setupViews];
+}
+
+- (void)setupCollectionView
+{
+ _collectionView.collectionViewLayout = [[VLCLibraryCollectionViewFlowLayout alloc] init];
+}
+
+- (void)presentBrowseView
+{
+ [self presentMediaSourceView:VLCLibraryBrowseSegment];
+}
+
+- (void)presentStreamsView
+{
+ [self presentMediaSourceView:VLCLibraryStreamsSegment];
+}
+
+- (void)presentMediaSourceView:(VLCLibrarySegment)viewSegment
+{
+ for (NSView *subview in _libraryTargetView.subviews) {
+ [subview removeFromSuperview];
+ }
+
+ if (_mediaSourceView.superview == nil) {
+ _mediaSourceView.translatesAutoresizingMaskIntoConstraints = NO;
+ [_libraryTargetView addSubview:_mediaSourceView];
+ NSDictionary *dict = NSDictionaryOfVariableBindings(_mediaSourceView);
+ [_libraryTargetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_mediaSourceView(>=572.)]|" options:0 metrics:0 views:dict]];
+ [_libraryTargetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_mediaSourceView(>=444.)]|" options:0 metrics:0 views:dict]];
+ }
+
+ _baseDataSource.mediaSourceMode = viewSegment == VLCLibraryBrowseSegment ? VLCMediaSourceModeLAN : VLCMediaSourceModeInternet;
+
+ _librarySortButton.hidden = YES;
+ _librarySearchField.enabled = NO;
+ _librarySearchField.stringValue = @"";
+ [VLCMain.sharedInstance.libraryController filterByString:@""];
+ _optionBarView.hidden = YES;
+
+ [_baseDataSource reloadViews];
+}
+
+ at end
=====================================
modules/gui/macosx/media-source/VLCMediaSource.h → modules/gui/macosx/library/media-source/VLCMediaSource.h
=====================================
=====================================
modules/gui/macosx/media-source/VLCMediaSource.m → modules/gui/macosx/library/media-source/VLCMediaSource.m
=====================================
@@ -22,10 +22,10 @@
#import "VLCMediaSource.h"
-#import "library/VLCInputItem.h"
-
#import "extensions/NSString+Helpers.h"
+#import "library/VLCInputItem.h"
+
@interface VLCMediaSource ()
{
BOOL _respondsToDiskChanges;
=====================================
modules/gui/macosx/media-source/VLCMediaSourceBaseDataSource.h → modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.h
=====================================
@@ -31,7 +31,11 @@ NS_ASSUME_NONNULL_BEGIN
@class VLCMediaSourceDataSource;
- at interface VLCMediaSourceBaseDataSource : NSObject
+ at interface VLCMediaSourceBaseDataSource : NSObject <NSCollectionViewDataSource,
+ NSCollectionViewDelegate,
+ NSCollectionViewDelegateFlowLayout,
+ NSTableViewDelegate,
+ NSTableViewDataSource>
@property (readwrite) NSCollectionView *collectionView;
@property (readwrite) NSScrollView *collectionViewScrollView;
=====================================
modules/gui/macosx/media-source/VLCMediaSourceBaseDataSource.m → modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.m
=====================================
@@ -22,20 +22,25 @@
#import "VLCMediaSourceBaseDataSource.h"
-#import "media-source/VLCMediaSourceProvider.h"
-#import "media-source/VLCMediaSource.h"
-#import "media-source/VLCMediaSourceDeviceCollectionViewItem.h"
-#import "media-source/VLCMediaSourceCollectionViewItem.h"
-#import "media-source/VLCMediaSourceDataSource.h"
+#import "VLCMediaSourceProvider.h"
+#import "VLCMediaSource.h"
+#import "VLCMediaSourceDeviceCollectionViewItem.h"
+#import "VLCMediaSourceCollectionViewItem.h"
+#import "VLCMediaSourceDataSource.h"
+
+#import "extensions/NSString+Helpers.h"
-#import "main/VLCMain.h"
-#import "views/VLCImageView.h"
#import "library/VLCLibraryWindow.h"
#import "library/VLCLibraryNavigationStack.h"
#import "library/VLCInputItem.h"
#import "library/VLCLibraryCollectionViewSupplementaryElementView.h"
#import "library/VLCLibraryTableCellView.h"
-#import "extensions/NSString+Helpers.h"
+#import "library/VLCLibraryUIUnits.h"
+
+#import "main/VLCMain.h"
+
+#import "views/VLCImageView.h"
+
NSString *VLCMediaSourceTableViewCellIdentifier = @"VLCMediaSourceTableViewCellIdentifier";
@@ -273,6 +278,16 @@ referenceSizeForHeaderInSection:(NSInteger)section
return [VLCLibraryCollectionViewSupplementaryElementView defaultHeaderSize];
}
+- (NSSize)collectionView:(NSCollectionView *)collectionView
+ layout:(NSCollectionViewLayout *)collectionViewLayout
+ sizeForItemAtIndexPath:(NSIndexPath *)indexPath
+{
+ VLCLibraryCollectionViewFlowLayout *collectionViewFlowLayout = (VLCLibraryCollectionViewFlowLayout*)collectionViewLayout;
+ NSAssert(collectionViewLayout, @"This should be a flow layout and thus a valid pointer");
+ return [VLCLibraryUIUnits adjustedCollectionViewItemSizeForCollectionView:collectionView
+ withLayout:collectionViewFlowLayout];
+}
+
#pragma mark - table view data source and delegation
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
=====================================
modules/gui/macosx/media-source/VLCMediaSourceCollectionViewItem.h → modules/gui/macosx/library/media-source/VLCMediaSourceCollectionViewItem.h
=====================================
=====================================
modules/gui/macosx/media-source/VLCMediaSourceCollectionViewItem.m → modules/gui/macosx/library/media-source/VLCMediaSourceCollectionViewItem.m
=====================================
@@ -33,6 +33,8 @@
#import "main/VLCMain.h"
+#import "main/VLCMain.h"
+
#import "playlist/VLCPlaylistController.h"
#import "views/VLCImageView.h"
=====================================
modules/gui/macosx/media-source/VLCMediaSourceDataSource.h → modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.h
=====================================
@@ -28,7 +28,11 @@ NS_ASSUME_NONNULL_BEGIN
@class VLCInputNode;
@class VLCMediaSource;
- at interface VLCMediaSourceDataSource : NSObject <NSCollectionViewDataSource, NSCollectionViewDelegate, NSTableViewDelegate, NSTableViewDataSource>
+ at interface VLCMediaSourceDataSource : NSObject <NSCollectionViewDataSource,
+ NSCollectionViewDelegate,
+ NSCollectionViewDelegateFlowLayout,
+ NSTableViewDelegate,
+ NSTableViewDataSource>
@property (readwrite, retain) VLCMediaSource *displayedMediaSource;
@property (readwrite, retain, nonatomic) VLCInputNode *nodeToDisplay;
=====================================
modules/gui/macosx/media-source/VLCMediaSourceDataSource.m → modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.m
=====================================
@@ -22,16 +22,22 @@
#import "VLCMediaSourceDataSource.h"
+#import "VLCMediaSourceCollectionViewItem.h"
+#import "VLCMediaSource.h"
+
+#import "extensions/NSString+Helpers.h"
+
#import "library/VLCInputItem.h"
#import "library/VLCLibraryWindow.h"
#import "library/VLCLibraryNavigationStack.h"
#import "library/VLCLibraryTableCellView.h"
-#import "media-source/VLCMediaSourceCollectionViewItem.h"
-#import "media-source/VLCMediaSource.h"
+#import "library/VLCLibraryUIUnits.h"
+
#import "main/VLCMain.h"
+
#import "playlist/VLCPlaylistController.h"
+
#import "views/VLCImageView.h"
-#import "extensions/NSString+Helpers.h"
@interface VLCMediaSourceDataSource()
{
@@ -100,6 +106,16 @@
[self performActionForNode:childNode allowPlayback:YES];
}
+- (NSSize)collectionView:(NSCollectionView *)collectionView
+ layout:(NSCollectionViewLayout *)collectionViewLayout
+ sizeForItemAtIndexPath:(NSIndexPath *)indexPath
+{
+ VLCLibraryCollectionViewFlowLayout *collectionViewFlowLayout = (VLCLibraryCollectionViewFlowLayout*)collectionViewLayout;
+ NSAssert(collectionViewLayout, @"This should be a flow layout and thus a valid pointer");
+ return [VLCLibraryUIUnits adjustedCollectionViewItemSizeForCollectionView:collectionView
+ withLayout:collectionViewFlowLayout];
+}
+
#pragma mark - table view data source and delegation
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
=====================================
modules/gui/macosx/media-source/VLCMediaSourceDeviceCollectionViewItem.h → modules/gui/macosx/library/media-source/VLCMediaSourceDeviceCollectionViewItem.h
=====================================
=====================================
modules/gui/macosx/media-source/VLCMediaSourceDeviceCollectionViewItem.m → modules/gui/macosx/library/media-source/VLCMediaSourceDeviceCollectionViewItem.m
=====================================
@@ -21,7 +21,9 @@
*****************************************************************************/
#import "VLCMediaSourceDeviceCollectionViewItem.h"
+
#import "extensions/NSColor+VLCAdditions.h"
+
#import "views/VLCImageView.h"
NSString *VLCMediaSourceDeviceCellIdentifier = @"VLCMediaSourceDeviceCellIdentifier";
=====================================
modules/gui/macosx/media-source/VLCMediaSourceProvider.h → modules/gui/macosx/library/media-source/VLCMediaSourceProvider.h
=====================================
=====================================
modules/gui/macosx/media-source/VLCMediaSourceProvider.m → modules/gui/macosx/library/media-source/VLCMediaSourceProvider.m
=====================================
@@ -22,7 +22,8 @@
#import "VLCMediaSourceProvider.h"
-#import "media-source/VLCMediaSource.h"
+#import "VLCMediaSource.h"
+
#import "main/VLCMain.h"
#import <vlc_media_source.h>
=====================================
po/POTFILES.in
=====================================
@@ -482,6 +482,18 @@ modules/gui/macosx/library/audio-library/VLCLibraryAlbumTableCellView.h
modules/gui/macosx/library/audio-library/VLCLibraryAlbumTableCellView.m
modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.h
modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.m
+modules/gui/macosx/library/media-source/VLCMediaSource.h
+modules/gui/macosx/library/media-source/VLCMediaSource.m
+modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.h
+modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.m
+modules/gui/macosx/library/media-source/VLCMediaSourceCollectionViewItem.h
+modules/gui/macosx/library/media-source/VLCMediaSourceCollectionViewItem.m
+modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.h
+modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.m
+modules/gui/macosx/library/media-source/VLCMediaSourceDeviceCollectionViewItem.h
+modules/gui/macosx/library/media-source/VLCMediaSourceDeviceCollectionViewItem.m
+modules/gui/macosx/library/media-source/VLCMediaSourceProvider.h
+modules/gui/macosx/library/media-source/VLCMediaSourceProvider.m
modules/gui/macosx/library/video-library/VLCLibraryVideoGroupDescriptor.h
modules/gui/macosx/library/video-library/VLCLibraryVideoGroupDescriptor.m
modules/gui/macosx/library/video-library/VLCLibraryVideoTableViewDataSource.h
@@ -497,18 +509,6 @@ modules/gui/macosx/main/VLCMain+OldPrefs.m
modules/gui/macosx/main/VLCMain.h
modules/gui/macosx/main/VLCMain.m
modules/gui/macosx/main/macosx.m
-modules/gui/macosx/media-source/VLCMediaSource.h
-modules/gui/macosx/media-source/VLCMediaSource.m
-modules/gui/macosx/media-source/VLCMediaSourceBaseDataSource.h
-modules/gui/macosx/media-source/VLCMediaSourceBaseDataSource.m
-modules/gui/macosx/media-source/VLCMediaSourceCollectionViewItem.h
-modules/gui/macosx/media-source/VLCMediaSourceCollectionViewItem.m
-modules/gui/macosx/media-source/VLCMediaSourceDataSource.h
-modules/gui/macosx/media-source/VLCMediaSourceDataSource.m
-modules/gui/macosx/media-source/VLCMediaSourceDeviceCollectionViewItem.h
-modules/gui/macosx/media-source/VLCMediaSourceDeviceCollectionViewItem.m
-modules/gui/macosx/media-source/VLCMediaSourceProvider.h
-modules/gui/macosx/media-source/VLCMediaSourceProvider.m
modules/gui/macosx/menus/VLCMainMenu.h
modules/gui/macosx/menus/VLCMainMenu.m
modules/gui/macosx/menus/VLCStatusBarIcon.h
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8294dbc391cce10c8bb04fe3380bdb9bca556d3e...027cf369f56256a873f2c156477a454325a03b99
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8294dbc391cce10c8bb04fe3380bdb9bca556d3e...027cf369f56256a873f2c156477a454325a03b99
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