Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
150b34bf by Claudio Cambra at 2022-12-10T09:08:15+00:00
macosx: Move VLCLibraryWindowController to own files

Signed-off-by: Claudio Cambra <develo...@claudiocambra.com>

- - - - -


8 changed files:

- extras/package/macosx/VLC.xcodeproj/project.pbxproj
- modules/gui/macosx/Makefile.am
- modules/gui/macosx/library/VLCLibraryWindow.h
- modules/gui/macosx/library/VLCLibraryWindow.m
- + modules/gui/macosx/library/VLCLibraryWindowController.h
- + modules/gui/macosx/library/VLCLibraryWindowController.m
- modules/gui/macosx/main/VLCMain.m
- modules/gui/macosx/menus/VLCMainMenu.m


Changes:

=====================================
extras/package/macosx/VLC.xcodeproj/project.pbxproj
=====================================
@@ -78,6 +78,10 @@
                1CCC89062078A3D500E5626F /* TimeSelectionPanel.xib in Sources 
*/ = {isa = PBXBuildFile; fileRef = 6B8224161E4D2A9000833BE1 /* 
TimeSelectionPanel.xib */; };
                1CFE8D591EA0D42A00E94451 /* VLCErrorWindowController.m in 
Sources */ = {isa = PBXBuildFile; fileRef = 1CFE8D581EA0D42A00E94451 /* 
VLCErrorWindowController.m */; };
                5325C57D29302E6800B2B63A /* VLCLibraryAudioViewController.m in 
Sources */ = {isa = PBXBuildFile; fileRef = 5325C57B29302E6800B2B63A /* 
VLCLibraryAudioViewController.m */; };
+               5325C56A292D59FB00B2B63A /* 
VLCLibraryVideoCollectionViewContainerViewDataSource.m in Sources */ = {isa = 
PBXBuildFile; fileRef = 5325C569292D59FB00B2B63A /* 
VLCLibraryVideoCollectionViewContainerViewDataSource.m */; };
+               5325C56D292D5CEB00B2B63A /* VLCLibraryVideoGroupDescriptor.m in 
Sources */ = {isa = PBXBuildFile; fileRef = 5325C56C292D5CEB00B2B63A /* 
VLCLibraryVideoGroupDescriptor.m */; };
+               5325C570292D5E8F00B2B63A /* 
VLCLibraryVideoCollectionViewContainerView.m in Sources */ = {isa = 
PBXBuildFile; fileRef = 5325C56F292D5E8F00B2B63A /* 
VLCLibraryVideoCollectionViewContainerView.m */; };
+               5362550D293FD639005D64FA /* VLCLibraryWindowController.m in 
Sources */ = {isa = PBXBuildFile; fileRef = 5362550C293FD639005D64FA /* 
VLCLibraryWindowController.m */; };
                536283F0291146BC00640C15 /* VLCLibraryTableView.m in Sources */ 
= {isa = PBXBuildFile; fileRef = 536283DE291146BC00640C15 /* 
VLCLibraryTableView.m */; };
                536283F1291146BC00640C15 /* VLCLibraryAlbumTracksDataSource.m 
in Sources */ = {isa = PBXBuildFile; fileRef = 536283DF291146BC00640C15 /* 
VLCLibraryAlbumTracksDataSource.m */; };
                536283F2291146BC00640C15 /* 
VLCLibraryCollectionViewAlbumSupplementaryDetailView.m in Sources */ = {isa = 
PBXBuildFile; fileRef = 536283E1291146BC00640C15 /* 
VLCLibraryCollectionViewAlbumSupplementaryDetailView.m */; };
@@ -236,6 +240,14 @@
                1CFE8D581EA0D42A00E94451 /* VLCErrorWindowController.m */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.objc; path = VLCErrorWindowController.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>"; 
};
+               5325C568292D59FB00B2B63A /* 
VLCLibraryVideoCollectionViewContainerViewDataSource.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 
VLCLibraryVideoCollectionViewContainerViewDataSource.h; sourceTree = "<group>"; 
};
+               5325C569292D59FB00B2B63A /* 
VLCLibraryVideoCollectionViewContainerViewDataSource.m */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = 
VLCLibraryVideoCollectionViewContainerViewDataSource.m; sourceTree = "<group>"; 
};
+               5325C56B292D5CEB00B2B63A /* VLCLibraryVideoGroupDescriptor.h */ 
= {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 
VLCLibraryVideoGroupDescriptor.h; sourceTree = "<group>"; };
+               5325C56C292D5CEB00B2B63A /* VLCLibraryVideoGroupDescriptor.m */ 
= {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = 
VLCLibraryVideoGroupDescriptor.m; sourceTree = "<group>"; };
+               5325C56E292D5E8F00B2B63A /* 
VLCLibraryVideoCollectionViewContainerView.h */ = {isa = PBXFileReference; 
lastKnownFileType = sourcecode.c.h; path = 
VLCLibraryVideoCollectionViewContainerView.h; sourceTree = "<group>"; };
+               5325C56F292D5E8F00B2B63A /* 
VLCLibraryVideoCollectionViewContainerView.m */ = {isa = PBXFileReference; 
lastKnownFileType = sourcecode.c.objc; path = 
VLCLibraryVideoCollectionViewContainerView.m; sourceTree = "<group>"; };
+               5362550B293FD639005D64FA /* VLCLibraryWindowController.h */ = 
{isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 
VLCLibraryWindowController.h; sourceTree = "<group>"; };
+               5362550C293FD639005D64FA /* VLCLibraryWindowController.m */ = 
{isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = 
VLCLibraryWindowController.m; sourceTree = "<group>"; };
                536283DC291146BC00640C15 /* VLCLibraryAlbumTracksDataSource.h 
*/ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.h; path = VLCLibraryAlbumTracksDataSource.h; sourceTree = 
"<group>"; };
                536283DD291146BC00640C15 /* VLCLibrarySongTableCellView.h */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
path = VLCLibrarySongTableCellView.h; sourceTree = "<group>"; };
                536283DE291146BC00640C15 /* VLCLibraryTableView.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= VLCLibraryTableView.m; sourceTree = "<group>"; };
@@ -1141,6 +1153,8 @@
                                536283DE291146BC00640C15 /* 
VLCLibraryTableView.m */,
                                7D713D302201AE350042BEB7 /* VLCLibraryWindow.h 
*/,
                                7D713D312201AE350042BEB7 /* VLCLibraryWindow.m 
*/,
+                               5362550B293FD639005D64FA /* 
VLCLibraryWindowController.h */,
+                               5362550C293FD639005D64FA /* 
VLCLibraryWindowController.m */,
                        );
                        path = library;
                        sourceTree = "<group>";
@@ -1950,6 +1964,7 @@
                                6B4D50A71E7AB52C004479B5 /* 
NSScreen+VLCAdditions.m in Sources */,
                                1C3113DD1E508C6900D4DD76 /* 
VLCTrackSynchronizationWindowController.m in Sources */,
                                7D0F5A9B2264EB410009C48A /* 
VLCHotkeysController.m in Sources */,
+                               5362550D293FD639005D64FA /* 
VLCLibraryWindowController.m in Sources */,
                                6B6FFF701EF9EC350001CEB1 /* 
CompatibilityFixes.m in Sources */,
                                7D1BF28A22A153E20027C50F /* 
VLCRoundedCornerTextField.m in Sources */,
                                7DFBDCB4226CD00900B700A5 /* 
VLCLibraryDataTypes.m in Sources */,


=====================================
modules/gui/macosx/Makefile.am
=====================================
@@ -92,6 +92,8 @@ libmacosx_plugin_la_SOURCES = \
        gui/macosx/library/VLCLibraryTableCellView.m \
        gui/macosx/library/VLCLibraryWindow.h \
        gui/macosx/library/VLCLibraryWindow.m \
+       gui/macosx/library/VLCLibraryWindowController.h \
+       gui/macosx/library/VLCLibraryWindowController.m \
        
gui/macosx/library/video-library/VLCLibraryVideoCollectionViewsStackViewController.h
 \
        
gui/macosx/library/video-library/VLCLibraryVideoCollectionViewsStackViewController.m
 \
        
gui/macosx/library/video-library/VLCLibraryVideoCollectionViewContainerView.h \


=====================================
modules/gui/macosx/library/VLCLibraryWindow.h
=====================================
@@ -50,14 +50,12 @@ typedef NS_ENUM(NSUInteger, VLCViewModeSegment) {
     VLCListViewModeSegment
 };
 
-@interface VLCLibraryWindowController : NSWindowController<NSWindowRestoration>
-
-- (instancetype)initWithLibraryWindow;
-
-@end
-
 @interface VLCLibraryWindow : 
VLCVideoWindowCommon<NSUserInterfaceItemIdentification>
 
+extern const CGFloat VLCLibraryWindowMinimalWidth;
+extern const CGFloat VLCLibraryWindowMinimalHeight;
+extern const NSUserInterfaceItemIdentifier VLCLibraryWindowIdentifier;
+
 @property (readwrite, weak) IBOutlet NSSegmentedControl *segmentedTitleControl;
 @property (readwrite, weak) IBOutlet NSToolbarItem 
*segmentedTitleControlToolbarItem;
 @property (readwrite, weak) IBOutlet NSSegmentedControl 
*gridVsListSegmentedControl;
@@ -133,6 +131,7 @@ typedef NS_ENUM(NSUInteger, VLCViewModeSegment) {
 
 - (void)videoPlaybackWillBeStarted;
 - (void)reopenVideoView;
+- (void)togglePlaylist;
 
 - (IBAction)playlistDoubleClickAction:(id)sender;
 - (IBAction)shuffleAction:(id)sender;


=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -70,8 +70,10 @@ const CGFloat VLCLibraryWindowSmallRowHeight = 24.;
 const CGFloat VLCLibraryWindowLargeRowHeight = 50.;
 const CGFloat VLCLibraryWindowDefaultPlaylistWidth = 340.;
 const CGFloat VLCLibraryWindowMinimalPlaylistWidth = 170.;
+const NSUserInterfaceItemIdentifier VLCLibraryWindowIdentifier = 
@"VLCLibraryWindow";
 
-static NSUserInterfaceItemIdentifier const kVLCLibraryWindowIdentifier = 
@"VLCLibraryWindow";
+static NSArray<NSLayoutConstraint *> *videoPlaceholderImageViewSizeConstraints;
+static NSArray<NSLayoutConstraint *> *audioPlaceholderImageViewSizeConstraints;
 
 @interface VLCLibraryWindow () <VLCDragDropTarget, NSSplitViewDelegate>
 {
@@ -128,7 +130,7 @@ static void addShadow(NSImageView *__unsafe_unretained 
imageView)
 
 - (void)awakeFromNib
 {
-    self.identifier = kVLCLibraryWindowIdentifier;
+    self.identifier = VLCLibraryWindowIdentifier;
     
     VLCMain *mainInstance = [VLCMain sharedInstance];
     _playlistController = [mainInstance playlistController];
@@ -898,63 +900,3 @@ static void addShadow(NSImageView *__unsafe_unretained 
imageView)
 }
 
 @end
-
-@implementation VLCLibraryWindowController
-
-- (instancetype)initWithLibraryWindow
-{
-    self = [super initWithWindowNibName:@"VLCLibraryWindow"];
-    return self;
-}
-
-- (void)windowDidLoad
-{
-    VLCLibraryWindow *window = (VLCLibraryWindow *)self.window;
-    [window setRestorationClass:[self class]];
-    [window setExcludedFromWindowsMenu:YES];
-    [window setAcceptsMouseMovedEvents:YES];
-    [window setContentMinSize:NSMakeSize(VLCLibraryWindowMinimalWidth, 
VLCLibraryWindowMinimalHeight)];
-
-    // HACK: On initialisation, the window refuses to accept any border 
resizing. It seems the split view
-    // holds a monopoly on the edges of the window (which can be seen as the 
right-side of the split view
-    // lets you resize the playlist, and after doing so the window becomes 
resizeable.
-    
-    // This can be worked around by maximizing the window, or toggling the 
playlist.
-    // Toggling the playlist is simplest.
-    [window togglePlaylist];
-    [window togglePlaylist];
-}
-
-+ (void)restoreWindowWithIdentifier:(NSUserInterfaceItemIdentifier)identifier 
-                              state:(NSCoder *)state 
-                  completionHandler:(void (^)(NSWindow *, NSError 
*))completionHandler
-{
-    if([identifier isEqualToString:kVLCLibraryWindowIdentifier] == NO) {
-        return;
-    }
-    
-    if([VLCMain sharedInstance].libraryWindowController == nil) {
-        [VLCMain sharedInstance].libraryWindowController = 
[[VLCLibraryWindowController alloc] initWithLibraryWindow];
-    }
-
-    VLCLibraryWindow *libraryWindow = [VLCMain sharedInstance].libraryWindow;
-
-    NSInteger rememberedSelectedLibrarySegment = [state 
decodeIntegerForKey:@"macosx-library-selected-segment"];
-    NSInteger rememberedSelectedLibraryViewModeSegment = [state 
decodeIntegerForKey:@"macosx-library-view-mode-selected-segment"];
-    NSInteger rememberedSelectedLibraryViewAudioSegment = [state 
decodeIntegerForKey:@"macosx-library-audio-view-selected-segment"];
-
-    [libraryWindow.segmentedTitleControl 
setSelectedSegment:rememberedSelectedLibrarySegment];
-    [libraryWindow.gridVsListSegmentedControl 
setSelectedSegment:rememberedSelectedLibraryViewModeSegment];
-    [libraryWindow.audioSegmentedControl 
setSelectedSegment:rememberedSelectedLibraryViewAudioSegment];
-
-    // We don't want to add these to the navigation stack...
-    [libraryWindow.libraryAudioViewController 
segmentedControlAction:libraryWindow.navigationStack];
-    [libraryWindow segmentedControlAction:libraryWindow.navigationStack];
-
-    // But we do want the "final" initial position to be added. So we manually 
invoke the navigation stack
-    [libraryWindow.navigationStack appendCurrentLibraryState];
-
-    completionHandler(libraryWindow, nil);
-}
-
-@end


=====================================
modules/gui/macosx/library/VLCLibraryWindowController.h
=====================================
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * VLCLibraryWindowController.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2022 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <develo...@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
+
+@interface VLCLibraryWindowController : NSWindowController<NSWindowRestoration>
+
+- (instancetype)initWithLibraryWindow;
+
+@end
+
+NS_ASSUME_NONNULL_END


=====================================
modules/gui/macosx/library/VLCLibraryWindowController.m
=====================================
@@ -0,0 +1,88 @@
+/*****************************************************************************
+ * VLCLibraryWindowController.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2022 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <develo...@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 "VLCLibraryWindowController.h"
+
+#import "library/VLCLibraryNavigationStack.h"
+#import "library/VLCLibraryWindow.h"
+#import "library/audio-library/VLCLibraryAudioViewController.h"
+#import "main/VLCMain.h"
+
+@implementation VLCLibraryWindowController
+
+- (instancetype)initWithLibraryWindow
+{
+    self = [super initWithWindowNibName:@"VLCLibraryWindow"];
+    return self;
+}
+
+- (void)windowDidLoad
+{
+    VLCLibraryWindow *window = (VLCLibraryWindow *)self.window;
+    [window setRestorationClass:[self class]];
+    [window setExcludedFromWindowsMenu:YES];
+    [window setAcceptsMouseMovedEvents:YES];
+    [window setContentMinSize:NSMakeSize(VLCLibraryWindowMinimalWidth, 
VLCLibraryWindowMinimalHeight)];
+
+    // HACK: On initialisation, the window refuses to accept any border 
resizing. It seems the split view
+    // holds a monopoly on the edges of the window (which can be seen as the 
right-side of the split view
+    // lets you resize the playlist, and after doing so the window becomes 
resizeable.
+
+    // This can be worked around by maximizing the window, or toggling the 
playlist.
+    // Toggling the playlist is simplest.
+    [window togglePlaylist];
+    [window togglePlaylist];
+}
+
++ (void)restoreWindowWithIdentifier:(NSUserInterfaceItemIdentifier)identifier
+                              state:(NSCoder *)state
+                  completionHandler:(void (^)(NSWindow *, NSError 
*))completionHandler
+{
+    if([identifier isEqualToString:VLCLibraryWindowIdentifier] == NO) {
+        return;
+    }
+
+    if([VLCMain sharedInstance].libraryWindowController == nil) {
+        [VLCMain sharedInstance].libraryWindowController = 
[[VLCLibraryWindowController alloc] initWithLibraryWindow];
+    }
+
+    VLCLibraryWindow *libraryWindow = [VLCMain sharedInstance].libraryWindow;
+
+    NSInteger rememberedSelectedLibrarySegment = [state 
decodeIntegerForKey:@"macosx-library-selected-segment"];
+    NSInteger rememberedSelectedLibraryViewModeSegment = [state 
decodeIntegerForKey:@"macosx-library-view-mode-selected-segment"];
+    NSInteger rememberedSelectedLibraryViewAudioSegment = [state 
decodeIntegerForKey:@"macosx-library-audio-view-selected-segment"];
+
+    [libraryWindow.segmentedTitleControl 
setSelectedSegment:rememberedSelectedLibrarySegment];
+    [libraryWindow.gridVsListSegmentedControl 
setSelectedSegment:rememberedSelectedLibraryViewModeSegment];
+    [libraryWindow.audioSegmentedControl 
setSelectedSegment:rememberedSelectedLibraryViewAudioSegment];
+
+    // We don't want to add these to the navigation stack...
+    [libraryWindow.libraryAudioViewController 
segmentedControlAction:libraryWindow.navigationStack];
+    [libraryWindow segmentedControlAction:libraryWindow.navigationStack];
+
+    // But we do want the "final" initial position to be added. So we manually 
invoke the navigation stack
+    [libraryWindow.navigationStack appendCurrentLibraryState];
+
+    completionHandler(libraryWindow, nil);
+}
+
+@end


=====================================
modules/gui/macosx/main/VLCMain.m
=====================================
@@ -44,6 +44,7 @@
 #include <vlc_variables.h>
 
 #import "library/VLCLibraryWindow.h"
+#import "library/VLCLibraryWindowController.h"
 
 #import "main/CompatibilityFixes.h"
 #import "main/VLCMain+OldPrefs.h"


=====================================
modules/gui/macosx/menus/VLCMainMenu.m
=====================================
@@ -29,6 +29,7 @@
 #import "extensions/NSString+Helpers.h"
 
 #import "library/VLCLibraryWindow.h"
+#import "library/VLCLibraryWindowController.h"
 
 #import "menus/renderers/VLCRendererMenuController.h"
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/150b34bf26cd73621e8f9d831309de084b43af7f

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/150b34bf26cd73621e8f9d831309de084b43af7f
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to