macosx: Make VLCLibraryNavigationSidebarController a view controller, set as controller for new sidebar xib

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
This commit is contained in:
Claudio Cambra 2024-03-27 20:56:03 +08:00 committed by Steve Lhomme
parent a7e9c0dd59
commit 7c8bf13fe4
8 changed files with 120 additions and 29 deletions

View File

@ -80,7 +80,7 @@
53088E152AD7802C00C21358 /* VLCLibraryCarouselViewItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = 53088E142AD7802C00C21358 /* VLCLibraryCarouselViewItemView.m */; };
5310AFB12B4FE72700E75F9A /* NSArray+VLCAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 5310AFB02B4FE72700E75F9A /* NSArray+VLCAdditions.m */; };
5310AFB52B53EC4F00E75F9A /* iCarousel.m in Sources */ = {isa = PBXBuildFile; fileRef = 5310AFB32B53EC4E00E75F9A /* iCarousel.m */; };
531343E72A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 531343E62A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarController.m */; };
531343E72A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 531343E62A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarViewController.m */; };
531343EA2A8E8965007AEDFA /* VLCLibrarySegment.m in Sources */ = {isa = PBXBuildFile; fileRef = 531343E92A8E8965007AEDFA /* VLCLibrarySegment.m */; };
5317FE04294E3DD3001702F0 /* VLCLibraryCollectionViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5317FE03294E3DD3001702F0 /* VLCLibraryCollectionViewDelegate.m */; };
5325C57D29302E6800B2B63A /* VLCLibraryAudioViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5325C57B29302E6800B2B63A /* VLCLibraryAudioViewController.m */; };
@ -284,8 +284,8 @@
5310AFB02B4FE72700E75F9A /* NSArray+VLCAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSArray+VLCAdditions.m"; sourceTree = "<group>"; };
5310AFB32B53EC4E00E75F9A /* iCarousel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iCarousel.m; sourceTree = "<group>"; };
5310AFB42B53EC4E00E75F9A /* iCarousel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iCarousel.h; sourceTree = "<group>"; };
531343E52A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryWindowNavigationSidebarController.h; sourceTree = "<group>"; };
531343E62A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryWindowNavigationSidebarController.m; sourceTree = "<group>"; };
531343E52A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryWindowNavigationSidebarViewController.h; sourceTree = "<group>"; };
531343E62A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryWindowNavigationSidebarViewController.m; sourceTree = "<group>"; };
531343E82A8E8965007AEDFA /* VLCLibrarySegment.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibrarySegment.h; sourceTree = "<group>"; };
531343E92A8E8965007AEDFA /* VLCLibrarySegment.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibrarySegment.m; sourceTree = "<group>"; };
5317FE02294E3DD3001702F0 /* VLCLibraryCollectionViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryCollectionViewDelegate.h; sourceTree = "<group>"; };
@ -387,7 +387,7 @@
53C1EF862B466B13001AEEF5 /* VLCLibraryHomeViewStackViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryHomeViewStackViewController.m; sourceTree = "<group>"; };
53C1EF882B466B13001AEEF5 /* VLCLibraryHomeViewVideoGridContainerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCLibraryHomeViewVideoGridContainerView.h; sourceTree = "<group>"; };
53C1EF8A2B466B13001AEEF5 /* VLCLibraryHomeViewStackViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCLibraryHomeViewStackViewController.h; sourceTree = "<group>"; };
53D21A1B2BB428A20085C71B /* VLCLibraryWindowNavSidebarView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = VLCLibraryWindowNavSidebarView.xib; sourceTree = "<group>"; };
53D21A1B2BB428A20085C71B /* VLCLibraryWindowNavigationSidebarView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = VLCLibraryWindowNavigationSidebarView.xib; sourceTree = "<group>"; };
53D21A1C2BB428F00085C71B /* VLCLibraryWindowPlaylistView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = VLCLibraryWindowPlaylistView.xib; sourceTree = "<group>"; };
53D6664E2B6B82940042C03D /* VLCLibraryTableViewDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryTableViewDataSource.h; sourceTree = "<group>"; };
53D8ED982B583AAF00142EAD /* VLCLibraryModelChangeDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryModelChangeDelegate.h; sourceTree = "<group>"; };
@ -1318,8 +1318,8 @@
7D713D312201AE350042BEB7 /* VLCLibraryWindow.m */,
5362550B293FD639005D64FA /* VLCLibraryWindowController.h */,
5362550C293FD639005D64FA /* VLCLibraryWindowController.m */,
531343E52A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarController.h */,
531343E62A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarController.m */,
531343E52A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarViewController.h */,
531343E62A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarViewController.m */,
5352B37429E149AC0011CE03 /* VLCLibraryWindowPersistentPreferences.h */,
5352B37529E149AC0011CE03 /* VLCLibraryWindowPersistentPreferences.m */,
53F0209F2A91115D00E79705 /* VLCLibraryWindowSplitViewController.h */,
@ -1959,7 +1959,7 @@
7D0F64002201F66D00FDB91F /* VLCPlaylistTableCellView.xib */,
6B82241A1E4D2A9000833BE1 /* VLCStatusBarIconMainMenu.xib */,
7D713D332201BB130042BEB7 /* VLCLibraryWindow.xib */,
53D21A1B2BB428A20085C71B /* VLCLibraryWindowNavSidebarView.xib */,
53D21A1B2BB428A20085C71B /* VLCLibraryWindowNavigationSidebarView.xib */,
53D21A1C2BB428F00085C71B /* VLCLibraryWindowPlaylistView.xib */,
);
name = XIBs;
@ -2049,7 +2049,7 @@
1CCC88EE2078A3D500E5626F /* VLCStatusBarIconMainMenu.xib in Sources */,
1CCC88EF2078A3D500E5626F /* VLCFullScreenPanel.xib in Sources */,
536283F5291146BC00640C15 /* VLCLibraryCollectionViewSupplementaryDetailView.m in Sources */,
531343E72A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarController.m in Sources */,
531343E72A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarViewController.m in Sources */,
1CCC88F02078A3D500E5626F /* About.xib in Sources */,
7DFBDCA82269E77500B700A5 /* VLCLibraryController.m in Sources */,
535F1BC32B4979D300C78D98 /* VLCLibraryHomeViewBaseCarouselContainerView.m in Sources */,

View File

@ -152,8 +152,8 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/library/VLCLibraryWindow.m \
gui/macosx/library/VLCLibraryWindowController.h \
gui/macosx/library/VLCLibraryWindowController.m \
gui/macosx/library/VLCLibraryWindowNavigationSidebarController.h \
gui/macosx/library/VLCLibraryWindowNavigationSidebarController.m \
gui/macosx/library/VLCLibraryWindowNavigationSidebarViewController.h \
gui/macosx/library/VLCLibraryWindowNavigationSidebarViewController.m \
gui/macosx/library/VLCLibraryWindowPersistentPreferences.h \
gui/macosx/library/VLCLibraryWindowPersistentPreferences.m \
gui/macosx/library/VLCLibraryWindowSplitViewController.h \
@ -441,7 +441,7 @@ libmacosx_plugin_la_XIB_SOURCES = \
gui/macosx/UI/VLCLibraryAlbumTableCellView.xib \
gui/macosx/UI/VLCLibraryAudioGroupHeaderView.xib \
gui/macosx/UI/VLCLibraryWindow.xib \
gui/macosx/UI/VLCLibraryWindowNavSidebarView.xib \
gui/macosx/UI/VLCLibraryWindowNavigationSidebarView.xib \
gui/macosx/UI/VLCLibraryWindowPlaylistView.xib \
gui/macosx/UI/VLCLibraryTableCellView.xib \
gui/macosx/UI/VLCPlaylistTableCellView.xib \

View File

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22689"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="VLCLibraryWindowNavigationSidebarController">
<connections>
<outlet property="view" destination="gLW-4d-ery" id="npw-3d-WUw"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<scrollView identifier="VLCLibraryWindowNavigationSidebarIdentifier" borderType="none" autohidesScrollers="YES" horizontalLineScroll="17" horizontalPageScroll="10" verticalLineScroll="17" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="gLW-4d-ery">
<rect key="frame" x="0.0" y="0.0" width="52" height="408"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<clipView key="contentView" drawsBackground="NO" id="ENU-zz-PNN">
<rect key="frame" x="0.0" y="0.0" width="52" height="408"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="sourceList" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" floatsGroupRows="NO" indentationPerLevel="13" outlineTableColumn="0BA-rc-l73" id="7u8-Zm-gnd">
<rect key="frame" x="0.0" y="0.0" width="52" height="408"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="0.0"/>
<color key="backgroundColor" name="_sourceListBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn identifier="AutomaticTableColumnIdentifier.0" width="20" minWidth="16" maxWidth="1000" id="0BA-rc-l73">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="LOi-U5-mry">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView identifier="HeaderCell" id="kOq-UZ-niu">
<rect key="frame" x="11" y="0.0" width="29" height="0.0"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="BZj-wQ-l4Y">
<rect key="frame" x="0.0" y="-16" width="29" height="14"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Header Cell" id="raJ-4P-D2Y">
<font key="font" metaFont="systemMedium" size="11"/>
<color key="textColor" name="headerColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="textField" destination="BZj-wQ-l4Y" id="LPR-2S-f7O"/>
</connections>
</tableCellView>
<tableCellView identifier="VLCLibrarySegmentCellIdentifier" id="FOz-uD-GU6">
<rect key="frame" x="11" y="0.0" width="29" height="0.0"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="g5f-nN-6XM">
<rect key="frame" x="3" y="-17" width="17" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" imageScaling="proportionallyDown" image="NSActionTemplate" id="iLQ-Rx-S8F"/>
</imageView>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9Av-FK-YYz">
<rect key="frame" x="25" y="-17" width="4" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="maG-3E-S0m">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="imageView" destination="g5f-nN-6XM" id="R33-R1-9wo"/>
<outlet property="textField" destination="9Av-FK-YYz" id="sWz-d6-9rY"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
</tableColumns>
</outlineView>
</subviews>
<nil key="backgroundColor"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="JPx-dd-Chs">
<rect key="frame" x="0.0" y="392" width="52" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="7pD-oe-Gtt">
<rect key="frame" x="224" y="17" width="15" height="102"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<point key="canvasLocation" x="-148" y="-17"/>
</scrollView>
</objects>
<resources>
<image name="NSActionTemplate" width="20" height="20"/>
</resources>
</document>

View File

@ -39,7 +39,6 @@ NS_ASSUME_NONNULL_BEGIN
@class VLCPlaylistSortingMenuController;
@class VLCCustomEmptyLibraryBrowseButton;
@class VLCLibraryWindowSplitViewController;
@class VLCLibraryWindowNavigationSidebarController;
@class VLCLibraryWindowToolbarDelegate;
@protocol VLCMediaLibraryItemProtocol;
@ -142,7 +141,6 @@ extern const NSUserInterfaceItemIdentifier VLCLibraryWindowIdentifier;
@property (readwrite) BOOL nonembedded;
@property (readwrite, weak) IBOutlet VLCLibraryWindowSplitViewController *splitViewController;
@property (readonly) VLCLibraryWindowNavigationSidebarController *navSidebarController;
@property (readonly) VLCLibraryWindowToolbarDelegate *toolbarDelegate;
@property (readwrite) VLCLibraryNavigationStack *navigationStack;
@property (readonly) VLCLibraryAudioViewController *libraryAudioViewController;

View File

@ -47,7 +47,6 @@
#import "library/VLCLibrarySegment.h"
#import "library/VLCLibrarySortingMenuController.h"
#import "library/VLCLibraryUIUnits.h"
#import "library/VLCLibraryWindowNavigationSidebarController.h"
#import "library/VLCLibraryWindowPersistentPreferences.h"
#import "library/VLCLibraryWindowSplitViewController.h"
#import "library/VLCLibraryWindowToolbarDelegate.h"
@ -229,8 +228,6 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
context:nil];
}
_navSidebarController = [[VLCLibraryWindowNavigationSidebarController alloc] initWithLibraryWindow:self];
_playlistViewTitleTopConstraint.constant = VLCLibraryUIUnits.mediumSpacing + self.titlebarHeight;
_playlistDragDropView.dropTarget = self;
_playlistCounterTextField.useStrongRounding = YES;
@ -818,11 +815,6 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
return NO;
}
- (IBAction)goToBrowseSection:(id)sender
{
[_navSidebarController selectSegment:VLCLibraryBrowseSegment];
}
- (IBAction)backwardsNavigationAction:(id)sender
{
self.videoViewController.view.hidden ? [_navigationStack backwards] : [self disableVideoPlaybackAppearance];

View File

@ -25,7 +25,6 @@
#import "library/VLCLibraryNavigationStack.h"
#import "library/VLCLibrarySegment.h"
#import "library/VLCLibraryWindow.h"
#import "library/VLCLibraryWindowNavigationSidebarController.h"
#import "library/audio-library/VLCLibraryAudioViewController.h"
@ -65,8 +64,6 @@
NSInteger rememberedSelectedLibrarySegment = [state decodeIntegerForKey:@"macosx-library-selected-segment"];
NSInteger rememberedSelectedLibraryViewAudioSegment = [state decodeIntegerForKey:@"macosx-library-audio-view-selected-segment"];
[libraryWindow.navSidebarController selectSegment:rememberedSelectedLibrarySegment];
completionHandler(libraryWindow, nil);
}

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* VLCLibraryWindowNavigationSidebarController.h: MacOS X interface module
* VLCLibraryWindowNavigationSidebarViewController.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2023 VLC authors and VideoLAN
*
@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
@class VLCLibraryWindow;
@class VLCLibrarySegment;
@interface VLCLibraryWindowNavigationSidebarController : NSObject<NSOutlineViewDelegate>
@interface VLCLibraryWindowNavigationSidebarViewController : NSViewController<NSOutlineViewDelegate>
@property (readonly) VLCLibraryWindow *libraryWindow;
@property (readonly) NSArray<VLCLibrarySegment *> *segments;

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* VLCLibraryWindowNavigationSidebarController.h: MacOS X interface module
* VLCLibraryWindowNavigationSidebarViewController.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2023 VLC authors and VideoLAN
*
@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "VLCLibraryWindowNavigationSidebarController.h"
#import "VLCLibraryWindowNavigationSidebarViewController.h"
#import "library/VLCLibraryWindow.h"
#import "library/VLCLibrarySegment.h"
@ -28,7 +28,7 @@
// This needs to match whatever identifier has been set in the library window XIB
static NSString * const VLCLibrarySegmentCellIdentifier = @"VLCLibrarySegmentCellIdentifier";
@implementation VLCLibraryWindowNavigationSidebarController
@implementation VLCLibraryWindowNavigationSidebarViewController
- (instancetype)initWithLibraryWindow:(VLCLibraryWindow *)libraryWindow
{