[vlc-commits] [Git][videolan/vlc][master] 23 commits: macosx: Connect/disconnect slave audio group data source within audio data source
Steve Lhomme (@robUx4)
gitlab at videolan.org
Mon Sep 16 06:59:05 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
2b0b486d by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Connect/disconnect slave audio group data source within audio data source
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
7452dde8 by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Add target view changed notification name
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
1d0c127a by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Add method to emit notification about current library target view subviews changing
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
4b7399c0 by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Call target view change handler on all "show" type methods in library window
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
9c509cee by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Disconnect audio data source when current library target view is not audio library
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
a1bf5a7e by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Remove handleLibraryTargetViewChanged from library window
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
88d16a39 by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Swap library target view notification for video view presented notification, handle correctly
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
de04bbdb by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Add starter VLCLibraryDataSource
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
413508ce by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Use library data source protocol in collection view/table view data source protocols
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
94ebff91 by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Add currentDataSource property to abstract segment view controller
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
5360293f by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Disconnect/reconnect current data source upon receiving video view notifications from library window
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
e89f56ab by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Implement currentDataSource in library video view controller
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
88c6543c by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Implement currentDataSource in playlist view controller
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
4edd175f by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Implement currentDataSource in groups view controller
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
eb13e7b3 by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Implement currentDataSource in library audio view controller
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
53127e74 by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Disconnect/reconnect containers when presenting or dismissing video playback view in library window
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
1fd229d1 by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Make placeholderImageViewSizeConstraints readonly in abstract segment view controller
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
621ae1e0 by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Remove embedded view presented/dismissed notifications and their use
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
e3e82404 by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Define connect/disconnect in abstract segment view controller
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
c85242cc by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Use view controller connect/disconnect in library window
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
5b6c3a41 by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Override connect/disconnect in home view segment controller
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
19bffd80 by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Add connected property to abstract segment view controller
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
abea8363 by Claudio Cambra at 2024-09-16T06:21:55+00:00
macosx: Use connected property in abstract segment view controller subclasses to (not) reconnect data sources after long loads if that is applicable
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
14 changed files:
- extras/package/macosx/VLC.xcodeproj/project.pbxproj
- modules/gui/macosx/Makefile.am
- modules/gui/macosx/library/VLCLibraryAbstractSegmentViewController.h
- modules/gui/macosx/library/VLCLibraryAbstractSegmentViewController.m
- modules/gui/macosx/library/VLCLibraryCollectionViewDataSource.h
- + modules/gui/macosx/library/VLCLibraryDataSource.h
- modules/gui/macosx/library/VLCLibraryTableViewDataSource.h
- modules/gui/macosx/library/VLCLibraryWindow.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
- modules/gui/macosx/library/groups-library/VLCLibraryGroupsViewController.m
- modules/gui/macosx/library/home-library/VLCLibraryHomeViewController.m
- modules/gui/macosx/library/playlist-library/VLCLibraryPlaylistViewController.m
- modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m
Changes:
=====================================
extras/package/macosx/VLC.xcodeproj/project.pbxproj
=====================================
@@ -314,6 +314,7 @@
5325720E2C4966630068DEC3 /* VLCLibraryShowsDataSource.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryShowsDataSource.m; sourceTree = "<group>"; };
5325C57B29302E6800B2B63A /* VLCLibraryAudioViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryAudioViewController.m; sourceTree = "<group>"; };
5325C57C29302E6800B2B63A /* VLCLibraryAudioViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCLibraryAudioViewController.h; sourceTree = "<group>"; };
+ 532CBCFD2C8E025F00899413 /* VLCLibraryDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryDataSource.h; sourceTree = "<group>"; };
533B5D2A29CF94C6003DE887 /* VLCBookmarksTableViewDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCBookmarksTableViewDataSource.h; sourceTree = "<group>"; };
533B5D2B29CF94C6003DE887 /* VLCBookmarksTableViewDataSource.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCBookmarksTableViewDataSource.m; sourceTree = "<group>"; };
534E73E029D2EDB1009982DE /* VLCBookmarksTableViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCBookmarksTableViewDelegate.h; sourceTree = "<group>"; };
@@ -1331,6 +1332,7 @@
7DBB7638227F3FBC002649E1 /* VLCLibraryCollectionViewSupplementaryElementView.m */,
7DFBDCA62269E77400B700A5 /* VLCLibraryController.h */,
7DFBDCA72269E77500B700A5 /* VLCLibraryController.m */,
+ 532CBCFD2C8E025F00899413 /* VLCLibraryDataSource.h */,
7DFBDCB2226CD00900B700A5 /* VLCLibraryDataTypes.h */,
7DFBDCB3226CD00900B700A5 /* VLCLibraryDataTypes.m */,
53B40FD52AA878E400C814E4 /* VLCLibraryHeroView.h */,
@@ -1339,7 +1341,7 @@
7D92AF2023DDCA8D00D81EA3 /* VLCLibraryImageCache.m */,
536283DC291146BC00640C15 /* VLCLibraryItemInternalMediaItemsDataSource.h */,
536283DF291146BC00640C15 /* VLCLibraryItemInternalMediaItemsDataSource.m */,
- 5360E99F2C5BE01F0046BA8B /* VLCLibraryMasterDetailViewTableViewDataSource.h */,
+ 5360E99F2C5BE01F0046BA8B /* VLCLibraryMasterDetailViewTableViewDataSource.h */,
5360E9A32C5BE5550046BA8B /* VLCLibraryMasterDetailViewTableViewDelegate.h */,
5360E9A42C5BE5550046BA8B /* VLCLibraryMasterDetailViewTableViewDelegate.m */,
7DFBDCAF226A518400B700A5 /* VLCLibraryMenuController.h */,
@@ -1596,8 +1598,8 @@
537BD6852C59216600446ED0 /* VLCLibraryGroupsViewController.m */,
);
path = "groups-library";
- sourceTree = "<group>";
- };
+ sourceTree = "<group>";
+ };
53A8F9CE2A7E1DE900BC11BF /* playlist-library */ = {
isa = PBXGroup;
children = (
=====================================
modules/gui/macosx/Makefile.am
=====================================
@@ -122,6 +122,7 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/library/VLCLibraryCollectionViewSupplementaryElementView.m \
gui/macosx/library/VLCLibraryController.h \
gui/macosx/library/VLCLibraryController.m \
+ gui/macosx/library/VLCLibraryDataSource.h \
gui/macosx/library/VLCLibraryDataTypes.h \
gui/macosx/library/VLCLibraryDataTypes.m \
gui/macosx/library/VLCLibraryHeroView.h \
=====================================
modules/gui/macosx/library/VLCLibraryAbstractSegmentViewController.h
=====================================
@@ -25,6 +25,7 @@
NS_ASSUME_NONNULL_BEGIN
@class VLCLibraryWindow;
+ at protocol VLCLibraryDataSource;
@interface VLCLibraryAbstractSegmentViewController : NSObject
@@ -33,10 +34,17 @@ NS_ASSUME_NONNULL_BEGIN
@property (readonly, weak) NSView *emptyLibraryView;
@property (readonly, weak) NSImageView *placeholderImageView;
@property (readonly, weak) NSTextField *placeholderLabel;
- at property (readwrite) NSArray<NSLayoutConstraint *> *placeholderImageViewSizeConstraints;
+
+// Implement getters for these properties in subclass
+ at property (readonly) NSArray<NSLayoutConstraint *> *placeholderImageViewSizeConstraints;
+ at property (readonly) id<VLCLibraryDataSource> currentDataSource;
+ at property (readonly) BOOL connected; // Meaning to library model notifications
- (instancetype)initWithLibraryWindow:(VLCLibraryWindow *)libraryWindow;
+- (void)connect;
+- (void)disconnect;
+
@end
NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/VLCLibraryAbstractSegmentViewController.m
=====================================
@@ -22,7 +22,8 @@
#import "VLCLibraryAbstractSegmentViewController.h"
-#import "VLCLibraryWindow.h"
+#import "library/VLCLibraryDataSource.h"
+#import "library/VLCLibraryWindow.h"
@implementation VLCLibraryAbstractSegmentViewController
@@ -40,4 +41,29 @@
return self;
}
+- (id<VLCLibraryDataSource>)currentDataSource
+{
+ [self doesNotRecognizeSelector:_cmd];
+ return nil;
+}
+
+// A note on the connected property.
+// This does not necessarily reflect the connection state of the data sources themselves.
+// We may disconnect the data sources via the view controllers when we detect that long loads are
+// taking place. However, keeping the connection state in the view controller allows us to
+// reconnect the data sources once the long loads are over (or not reconnect them, if the view
+// controller was originally disconnected, for example if the embedded video view is open)
+
+- (void)connect
+{
+ [self.currentDataSource connect];
+ _connected = YES;
+}
+
+- (void)disconnect
+{
+ [self.currentDataSource disconnect];
+ _connected = NO;
+}
+
@end
=====================================
modules/gui/macosx/library/VLCLibraryCollectionViewDataSource.h
=====================================
@@ -22,12 +22,14 @@
#import <Cocoa/Cocoa.h>
+#import "library/VLCLibraryDataSource.h"
+
NS_ASSUME_NONNULL_BEGIN
@class VLCLibraryRepresentedItem;
@protocol VLCMediaLibraryItemProtocol;
- at protocol VLCLibraryCollectionViewDataSource <NSCollectionViewDataSource>
+ at protocol VLCLibraryCollectionViewDataSource <NSCollectionViewDataSource, VLCLibraryDataSource>
@property (readonly) NSString *supplementaryDetailViewKind;
@@ -39,10 +41,6 @@ NS_ASSUME_NONNULL_BEGIN
- (void)reloadData;
- at optional
-- (void)connect;
-- (void)disconnect;
-
@end
NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/VLCLibraryDataSource.h
=====================================
@@ -0,0 +1,21 @@
+//
+// VLCLibraryDataSource.h
+// VLC
+//
+// Created by Claudio Cambra on 9/9/24.
+//
+
+#ifndef VLCLibraryDataSource_h
+#define VLCLibraryDataSource_h
+
+#import <Foundation/Foundation.h>
+
+ at protocol VLCLibraryDataSource <NSObject>
+
+ at optional
+- (void)connect;
+- (void)disconnect;
+
+ at end
+
+#endif /* VLCLibraryDataSource_h */
=====================================
modules/gui/macosx/library/VLCLibraryTableViewDataSource.h
=====================================
@@ -23,12 +23,11 @@
#import <Cocoa/Cocoa.h>
#import "library/VLCLibraryDataTypes.h"
+#import "library/VLCLibraryDataSource.h"
NS_ASSUME_NONNULL_BEGIN
- at protocol VLCMediaLibraryItemProtocol;
-
- at protocol VLCLibraryTableViewDataSource <NSTableViewDataSource>
+ at protocol VLCLibraryTableViewDataSource <NSTableViewDataSource, VLCLibraryDataSource>
@property (readonly) VLCMediaLibraryParentGroupType currentParentType;
@@ -36,10 +35,6 @@ NS_ASSUME_NONNULL_BEGIN
- (id<VLCMediaLibraryItemProtocol>)libraryItemAtRow:(NSInteger)row
forTableView:(nullable NSTableView *)tableView;
- at optional
-- (void)connect;
-- (void)disconnect;
-
@end
NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -437,7 +437,6 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
} else if (segmentType == VLCLibraryStreamsSegment) {
[self.libraryMediaSourceViewController presentStreamsView];
}
- _librarySegmentViewController = self.libraryMediaSourceViewController;
}
- (void)showGroupsLibrary
@@ -725,12 +724,14 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
[self.videoViewController showControls];
self.splitViewController.playlistSidebarViewController.mainVideoModeEnabled = YES;
+
+ [self.librarySegmentViewController disconnect];
}
- (void)disableVideoPlaybackAppearance
{
[self makeFirstResponder:self.splitViewController.playlistSidebarViewController.view];
- [VLCMain.sharedInstance.voutProvider updateWindowLevelForHelperWindows: NSNormalWindowLevel];
+ [VLCMain.sharedInstance.voutProvider updateWindowLevelForHelperWindows:NSNormalWindowLevel];
// restore alpha value to 1 for the case that macosx-opaqueness is set to < 1
self.alphaValue = 1.0;
@@ -739,6 +740,8 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
[self disableVideoTitleBarMode];
[self showControlsBarImmediately];
self.splitViewController.playlistSidebarViewController.mainVideoModeEnabled = NO;
+
+ [self.librarySegmentViewController connect];
}
- (void)mouseMoved:(NSEvent *)o_event
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.m
=====================================
@@ -395,12 +395,14 @@ NSString * const VLCLibraryAudioDataSourceDisplayedCollectionChangedNotification
name:VLCPlayerCurrentMediaItemChanged
object:nil];
+ [self.audioGroupDataSource connect];
[self reloadData];
}
- (void)disconnect
{
[NSNotificationCenter.defaultCenter removeObserver:self];
+ [self.audioGroupDataSource disconnect];
}
+ (void)setupCollectionView:(NSCollectionView *)collectionView
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
=====================================
@@ -133,7 +133,6 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
selector:@selector(libraryModelLongLoadFinished:)
name:audioMediaDeletedLongLoadFinishNotification
object:nil];
-
}
return self;
@@ -326,13 +325,20 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
_audioLibraryGridModeSplitViewListSelectionCollectionViewScrollView.scrollerInsets = audioScrollViewScrollerInsets;
}
-#pragma mark - Show the audio view
+#pragma mark - Superclass property overrides
- (NSArray<NSLayoutConstraint *> *)placeholderImageViewSizeConstraints
{
return _internalPlaceholderImageViewSizeConstraints;
}
+- (id<VLCLibraryDataSource>)currentDataSource
+{
+ return self.audioDataSource;
+}
+
+#pragma mark - Show the audio view
+
- (void)presentAudioView
{
self.libraryTargetView.subviews = @[];
@@ -635,8 +641,10 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
return;
}
- [self.audioDataSource disconnect];
- [self.audioGroupDataSource disconnect];
+ if (self.connected) {
+ [self.audioDataSource disconnect];
+ [self.audioGroupDataSource disconnect];
+ }
self.loadingOverlayView.wantsLayer = YES;
self.loadingOverlayView.alphaValue = 0.0;
@@ -658,8 +666,10 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
return;
}
- [self.audioDataSource connect];
- [self.audioGroupDataSource connect];
+ if (self.connected) {
+ [self.audioDataSource connect];
+ [self.audioGroupDataSource connect];
+ }
self.loadingOverlayView.wantsLayer = YES;
self.loadingOverlayView.alphaValue = 1.0;
=====================================
modules/gui/macosx/library/groups-library/VLCLibraryGroupsViewController.m
=====================================
@@ -189,6 +189,11 @@
self.selectedGroupTableView.dataSource = self.dataSource;
}
+- (id<VLCLibraryDataSource>)currentDataSource
+{
+ return self.dataSource;
+}
+
- (void)presentGroupsView
{
const VLCLibraryViewModeSegment viewModeSegment =
=====================================
modules/gui/macosx/library/home-library/VLCLibraryHomeViewController.m
=====================================
@@ -282,7 +282,9 @@
return;
}
- [self.stackViewController disconnectContainers];
+ if (self.connected) {
+ [self.stackViewController disconnectContainers];
+ }
self.loadingOverlayView.wantsLayer = YES;
self.loadingOverlayView.alphaValue = 0.0;
@@ -309,7 +311,9 @@
return;
}
- [self.stackViewController connectContainers];
+ if (self.connected) {
+ [self.stackViewController connectContainers];
+ }
self.loadingOverlayView.wantsLayer = YES;
self.loadingOverlayView.alphaValue = 1.0;
@@ -326,4 +330,14 @@
}];
}
+- (void)connect
+{
+ [self.stackViewController connectContainers];
+}
+
+- (void)disconnect
+{
+ [self.stackViewController disconnectContainers];
+}
+
@end
=====================================
modules/gui/macosx/library/playlist-library/VLCLibraryPlaylistViewController.m
=====================================
@@ -255,6 +255,11 @@
return _internalPlaceholderImageViewSizeConstraints;
}
+- (id<VLCLibraryDataSource>)currentDataSource
+{
+ return self.dataSource;
+}
+
// TODO: This is duplicated almost verbatim across all the library view
// controllers. Ideally we should have the placeholder view handle this
// itself, or move this into a common superclass
@@ -363,13 +368,16 @@
}
}
+// TODO: Duplicated a lot, move to abstract view controller?
- (void)libraryModelLongLoadStarted:(NSNotification *)notification
{
if ([self.libraryTargetView.subviews containsObject:self.loadingOverlayView]) {
return;
}
- [self.dataSource disconnect];
+ if (self.connected) {
+ [self.dataSource disconnect];
+ }
self.loadingOverlayView.wantsLayer = YES;
self.loadingOverlayView.alphaValue = 0.0;
@@ -391,7 +399,9 @@
return;
}
- [self.dataSource connect];
+ if (self.connected) {
+ [self.dataSource connect];
+ }
self.loadingOverlayView.wantsLayer = YES;
self.loadingOverlayView.alphaValue = 1.0;
=====================================
modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m
=====================================
@@ -291,6 +291,18 @@
return _internalPlaceholderImageViewSizeConstraints;
}
+- (id<VLCLibraryDataSource>)currentDataSource
+{
+ const NSInteger librarySegmentType = self.libraryWindow.librarySegmentType;
+ if (librarySegmentType == VLCLibraryVideoSegment) {
+ return self.libraryVideoDataSource;
+ } else if (librarySegmentType == VLCLibraryShowsVideoSubSegment) {
+ return self.libraryShowsDataSource;
+ } else {
+ return nil;
+ }
+}
+
- (void)updatePresentedVideoLibraryView
{
_libraryShowsDataSource = nil;
@@ -507,7 +519,9 @@
return;
}
- [self.libraryVideoDataSource disconnect];
+ if (self.connected) {
+ [self.libraryVideoDataSource disconnect];
+ }
self.loadingOverlayView.wantsLayer = YES;
self.loadingOverlayView.alphaValue = 0.0;
@@ -529,7 +543,9 @@
return;
}
- [self.libraryVideoDataSource connect];
+ if (self.connected) {
+ [self.libraryVideoDataSource connect];
+ }
self.loadingOverlayView.wantsLayer = YES;
self.loadingOverlayView.alphaValue = 1.0;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/45b36521edbac9d375e915ceda8ff29dda5cc416...abea8363674ba5f31c0d928a2d7a6da56d6d4c7d
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/45b36521edbac9d375e915ceda8ff29dda5cc416...abea8363674ba5f31c0d928a2d7a6da56d6d4c7d
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