mirror of https://code.videolan.org/videolan/vlc
macosx: Move IBOutlets for toolbar items to toolbar delegate
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
This commit is contained in:
parent
51f765cd50
commit
f5c4fe8e1d
|
@ -501,21 +501,16 @@
|
|||
<outlet property="audioLibrarySplitView" destination="llh-BF-BEJ" id="gvt-K1-cGw"/>
|
||||
<outlet property="audioLibraryView" destination="lpg-UW-pTq" id="FYD-PV-Ce2"/>
|
||||
<outlet property="backwardsNavigationButton" destination="Bzq-ZV-i8j" id="Bac-Kb-ut"/>
|
||||
<outlet property="backwardsToolbarItem" destination="6Ie-eu-GDn" id="q3s-rt-8gy"/>
|
||||
<outlet property="controlsBar" destination="Uzf-Tf-H8x" id="n0G-92-F2Q"/>
|
||||
<outlet property="controlsBarHeightConstraint" destination="Fps-hR-AFq" id="E4g-JQ-fgx"/>
|
||||
<outlet property="emptyLibraryView" destination="YJf-1r-vaC" id="AJB-eN-4u6"/>
|
||||
<outlet property="flexibleSpaceToolbarItem" destination="89f-AL-zuU" id="3p9-t8-79g"/>
|
||||
<outlet property="forwardsNavigationButton" destination="jzy-je-h2k" id="for-Wa-rd"/>
|
||||
<outlet property="forwardsToolbarItem" destination="g2e-7o-Qet" id="3qp-rg-t2P"/>
|
||||
<outlet property="gridVsListSegmentedControl" destination="lIg-5J-C5F" id="u6B-Zx-4mX"/>
|
||||
<outlet property="homeLibraryStackView" destination="p8n-RC-fWF" id="jcF-ny-9D7"/>
|
||||
<outlet property="homeLibraryStackViewScrollView" destination="HXH-MZ-tkf" id="fzR-fb-nyS"/>
|
||||
<outlet property="homeLibraryView" destination="mMj-Qb-bS1" id="WeM-ZY-knV"/>
|
||||
<outlet property="librarySearchField" destination="ab6-kR-8Io" id="Qf7-UM-lol"/>
|
||||
<outlet property="librarySearchToolbarItem" destination="dv4-Il-y8X" id="Um3-s4-Ax4"/>
|
||||
<outlet property="librarySortButton" destination="Rja-6g-wNZ" id="FQ7-MU-hsk"/>
|
||||
<outlet property="libraryViewModeToolbarItem" destination="kBa-MC-Mdq" id="q39-28-tyf"/>
|
||||
<outlet property="mainSplitView" destination="u8g-jy-S4e" id="lI5-wR-kef"/>
|
||||
<outlet property="mediaSourceCollectionView" destination="r7v-GI-W1U" id="3JJ-GU-o5o"/>
|
||||
<outlet property="mediaSourceCollectionViewScrollView" destination="cFG-c9-cI9" id="QQq-Ql-uQ7"/>
|
||||
|
@ -533,13 +528,9 @@
|
|||
<outlet property="placeholderLabel" destination="adK-Pc-tnU" id="6Zw-IF-czx"/>
|
||||
<outlet property="playQueueToggle" destination="IaO-se-D0g" id="tqY-YM-KQC"/>
|
||||
<outlet property="renderersButton" destination="ffS-QP-Om3" id="rOM-No-rd0"/>
|
||||
<outlet property="renderersToolbarItem" destination="YEO-08-Qzi" id="mwx-8t-5o7"/>
|
||||
<outlet property="sortOrderToolbarItem" destination="Tbc-Ik-FaO" id="098-yp-97f"/>
|
||||
<outlet property="splitViewBottomConstraintToBottomBar" destination="QH8-mU-6ZP" id="b0t-C0-N5t"/>
|
||||
<outlet property="splitViewBottomConstraintToSuperView" destination="DQQ-ji-YSy" id="b0t-C0-5uP"/>
|
||||
<outlet property="splitViewController" destination="Kkr-kI-gpb" id="9aZ-xw-zrl"/>
|
||||
<outlet property="toggleNavSidebarToolbarItem" destination="5oK-0W-JJh" id="To1-7k-AJF"/>
|
||||
<outlet property="togglePlaylistToolbarItem" destination="Lf2-ec-tHh" id="gtf-cd-765"/>
|
||||
<outlet property="toolbarDelegate" destination="xXj-E8-b8X" id="VsJ-ky-NJg"/>
|
||||
<outlet property="videoLibraryCollectionView" destination="neh-e5-MUa" id="bmc-HF-k9s"/>
|
||||
<outlet property="videoLibraryCollectionViewScrollView" destination="9bN-bM-RVu" id="iLf-ff-boW"/>
|
||||
|
@ -1525,7 +1516,16 @@
|
|||
</customView>
|
||||
<customObject id="xXj-E8-b8X" customClass="VLCLibraryWindowToolbarDelegate">
|
||||
<connections>
|
||||
<outlet property="backwardsToolbarItem" destination="6Ie-eu-GDn" id="nqO-Tg-a1S"/>
|
||||
<outlet property="flexibleSpaceToolbarItem" destination="89f-AL-zuU" id="rza-T3-EQq"/>
|
||||
<outlet property="forwardsToolbarItem" destination="g2e-7o-Qet" id="4ex-8c-aSO"/>
|
||||
<outlet property="librarySearchToolbarItem" destination="dv4-Il-y8X" id="iip-l7-TuF"/>
|
||||
<outlet property="libraryViewModeToolbarItem" destination="kBa-MC-Mdq" id="e5b-Hd-Qha"/>
|
||||
<outlet property="libraryWindow" destination="QvC-M9-y7g" id="YT5-2G-VJ2"/>
|
||||
<outlet property="renderersToolbarItem" destination="YEO-08-Qzi" id="pXm-Aj-4Qg"/>
|
||||
<outlet property="sortOrderToolbarItem" destination="Tbc-Ik-FaO" id="MFb-EI-Dsa"/>
|
||||
<outlet property="toggleNavSidebarToolbarItem" destination="5oK-0W-JJh" id="xoK-Zo-nwh"/>
|
||||
<outlet property="togglePlaylistToolbarItem" destination="Lf2-ec-tHh" id="PX9-gs-T5Z"/>
|
||||
<outlet property="toolbar" destination="pr3-TD-J2z" id="0bl-3Z-WiA"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
|
|
|
@ -108,17 +108,6 @@ extern const NSUserInterfaceItemIdentifier VLCLibraryWindowIdentifier;
|
|||
@property (readwrite, weak) IBOutlet NSButton *forwardsNavigationButton;
|
||||
@property (readwrite, weak) IBOutlet NSButton *artworkButton;
|
||||
@property (readwrite, weak) IBOutlet VLCLibraryWindowToolbarDelegate *toolbarDelegate;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *toggleNavSidebarToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *trackingSeparatorToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSButton *renderersButton;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *backwardsToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *forwardsToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *libraryViewModeToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *sortOrderToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *flexibleSpaceToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *librarySearchToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *togglePlaylistToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *renderersToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSLayoutConstraint *splitViewBottomConstraintToBottomBar;
|
||||
|
||||
@property (nonatomic, readwrite, strong) IBOutlet NSView *emptyLibraryView;
|
||||
|
|
|
@ -147,17 +147,6 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
|
|||
self.tabbingMode = NSWindowTabbingModeDisallowed;
|
||||
}
|
||||
|
||||
if (@available(macOS 11.0, *)) {
|
||||
const NSInteger navSidebarToggleToolbarItemIndex = [self.toolbar.items indexOfObject:self.toggleNavSidebarToolbarItem];
|
||||
NSAssert(navSidebarToggleToolbarItemIndex != NSNotFound, @"Could not find navigation sidebar toggle toolbar item!");
|
||||
|
||||
const NSInteger trackingSeparatorItemIndex = navSidebarToggleToolbarItemIndex + 1;
|
||||
[self.toolbar insertItemWithItemIdentifier:VLCLibraryWindowTrackingSeparatorToolbarItemIdentifier
|
||||
atIndex:trackingSeparatorItemIndex];
|
||||
self.trackingSeparatorToolbarItem = [self.toolbar.items objectAtIndex:trackingSeparatorItemIndex];
|
||||
}
|
||||
|
||||
|
||||
VLCMain *mainInstance = VLCMain.sharedInstance;
|
||||
_playlistController = [mainInstance playlistController];
|
||||
|
||||
|
@ -214,7 +203,7 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
|
|||
|
||||
// Hide renderers toolbar item at first. Start discoveries and wait for notifications about
|
||||
// renderers being added or removed to keep hidden or show depending on outcome
|
||||
[self.toolbarDelegate hideToolbarItem:self.renderersToolbarItem];
|
||||
[self.toolbarDelegate hideToolbarItem:self.toolbarDelegate.renderersToolbarItem];
|
||||
[VLCMain.sharedInstance.mainMenu.rendererMenuController startRendererDiscoveries];
|
||||
|
||||
[self.toolbarDelegate updatePlayqueueToggleState];
|
||||
|
@ -659,9 +648,9 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
|
|||
[self clearFilterString];
|
||||
|
||||
// Make sure the back button is visible...
|
||||
[self.toolbarDelegate insertToolbarItem:self.backwardsToolbarItem
|
||||
inFrontOf:@[self.trackingSeparatorToolbarItem,
|
||||
self.toggleNavSidebarToolbarItem]];
|
||||
[self.toolbarDelegate insertToolbarItem:self.toolbarDelegate.backwardsToolbarItem
|
||||
inFrontOf:@[self.toolbarDelegate.trackingSeparatorToolbarItem,
|
||||
self.toolbarDelegate.toggleNavSidebarToolbarItem]];
|
||||
// And repurpose it to hide the video view
|
||||
[self.backwardsNavigationButton setEnabled:YES];
|
||||
|
||||
|
@ -751,16 +740,16 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
|
|||
const NSUInteger rendererCount =
|
||||
VLCMain.sharedInstance.mainMenu.rendererMenuController.rendererItems.count;
|
||||
const BOOL rendererToolbarItemVisible =
|
||||
[self.toolbar.items containsObject:self.renderersToolbarItem];
|
||||
[self.toolbar.items containsObject:self.toolbarDelegate.renderersToolbarItem];
|
||||
|
||||
if (rendererCount > 0 && !rendererToolbarItemVisible) {
|
||||
[self.toolbarDelegate insertToolbarItem:self.renderersToolbarItem
|
||||
inFrontOf:@[self.sortOrderToolbarItem,
|
||||
self.libraryViewModeToolbarItem,
|
||||
self.forwardsToolbarItem,
|
||||
self.backwardsToolbarItem]];
|
||||
[self.toolbarDelegate insertToolbarItem:self.toolbarDelegate.renderersToolbarItem
|
||||
inFrontOf:@[self.toolbarDelegate.sortOrderToolbarItem,
|
||||
self.toolbarDelegate.libraryViewModeToolbarItem,
|
||||
self.toolbarDelegate.forwardsToolbarItem,
|
||||
self.toolbarDelegate.backwardsToolbarItem]];
|
||||
} else if (rendererCount == 0 && rendererToolbarItemVisible) {
|
||||
[self.toolbarDelegate hideToolbarItem:self.renderersToolbarItem];
|
||||
[self.toolbarDelegate hideToolbarItem:self.toolbarDelegate.renderersToolbarItem];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,17 @@ extern NSString * const VLCLibraryWindowTrackingSeparatorToolbarItemIdentifier;
|
|||
@property (readwrite, weak) IBOutlet VLCLibraryWindow *libraryWindow;
|
||||
@property (readwrite, weak) IBOutlet NSToolbar *toolbar;
|
||||
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *toggleNavSidebarToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *trackingSeparatorToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *backwardsToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *forwardsToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *libraryViewModeToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *sortOrderToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *flexibleSpaceToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *librarySearchToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *togglePlaylistToolbarItem;
|
||||
@property (readwrite, weak) IBOutlet NSToolbarItem *renderersToolbarItem;
|
||||
|
||||
- (void)insertToolbarItem:(NSToolbarItem *)toolbarItem inFrontOf:(NSArray<NSToolbarItem *> *)items;
|
||||
- (void)hideToolbarItem:(NSToolbarItem *)toolbarItem;
|
||||
- (void)setForwardsBackwardsToolbarItemsVisible:(BOOL)visible;
|
||||
|
|
|
@ -33,6 +33,21 @@ NSString * const VLCLibraryWindowTrackingSeparatorToolbarItemIdentifier = @"VLCL
|
|||
- (void)awakeFromNib
|
||||
{
|
||||
self.toolbar.allowsUserCustomization = NO;
|
||||
|
||||
if (@available(macOS 11.0, *)) {
|
||||
const NSInteger navSidebarToggleToolbarItemIndex =
|
||||
[self.toolbar.items indexOfObject:self.toggleNavSidebarToolbarItem];
|
||||
|
||||
NSAssert(navSidebarToggleToolbarItemIndex != NSNotFound,
|
||||
@"Could not find navigation sidebar toggle toolbar item!");
|
||||
|
||||
const NSInteger trackingSeparatorItemIndex = navSidebarToggleToolbarItemIndex + 1;
|
||||
[self.toolbar
|
||||
insertItemWithItemIdentifier:VLCLibraryWindowTrackingSeparatorToolbarItemIdentifier
|
||||
atIndex:trackingSeparatorItemIndex];
|
||||
self.trackingSeparatorToolbarItem =
|
||||
[self.toolbar.items objectAtIndex:trackingSeparatorItemIndex];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar
|
||||
|
@ -92,41 +107,40 @@ NSString * const VLCLibraryWindowTrackingSeparatorToolbarItemIdentifier = @"VLCL
|
|||
- (void)setForwardsBackwardsToolbarItemsVisible:(BOOL)visible
|
||||
{
|
||||
if (!visible) {
|
||||
[self hideToolbarItem:self.libraryWindow.forwardsToolbarItem];
|
||||
[self hideToolbarItem:self.libraryWindow.backwardsToolbarItem];
|
||||
[self hideToolbarItem:self.forwardsToolbarItem];
|
||||
[self hideToolbarItem:self.backwardsToolbarItem];
|
||||
return;
|
||||
}
|
||||
|
||||
[self insertToolbarItem:self.libraryWindow.backwardsToolbarItem
|
||||
inFrontOf:@[
|
||||
self.libraryWindow.trackingSeparatorToolbarItem,
|
||||
self.libraryWindow.toggleNavSidebarToolbarItem]];
|
||||
[self insertToolbarItem:self.backwardsToolbarItem
|
||||
inFrontOf:@[self.trackingSeparatorToolbarItem,
|
||||
self.toggleNavSidebarToolbarItem]];
|
||||
|
||||
[self insertToolbarItem:self.libraryWindow.forwardsToolbarItem
|
||||
inFrontOf:@[self.libraryWindow.backwardsToolbarItem,
|
||||
self.libraryWindow.trackingSeparatorToolbarItem,
|
||||
self.libraryWindow.toggleNavSidebarToolbarItem]];
|
||||
[self insertToolbarItem:self.forwardsToolbarItem
|
||||
inFrontOf:@[self.backwardsToolbarItem,
|
||||
self.trackingSeparatorToolbarItem,
|
||||
self.toggleNavSidebarToolbarItem]];
|
||||
}
|
||||
|
||||
- (void)setSortOrderToolbarItemVisible:(BOOL)visible
|
||||
{
|
||||
if (!visible) {
|
||||
[self hideToolbarItem:self.libraryWindow.sortOrderToolbarItem];
|
||||
[self hideToolbarItem:self.sortOrderToolbarItem];
|
||||
return;
|
||||
}
|
||||
|
||||
[self insertToolbarItem:self.libraryWindow.sortOrderToolbarItem
|
||||
inFrontOf:@[self.libraryWindow.libraryViewModeToolbarItem,
|
||||
self.libraryWindow.forwardsToolbarItem,
|
||||
self.libraryWindow.backwardsToolbarItem,
|
||||
self.libraryWindow.trackingSeparatorToolbarItem,
|
||||
self.libraryWindow.toggleNavSidebarToolbarItem]];
|
||||
[self insertToolbarItem:self.sortOrderToolbarItem
|
||||
inFrontOf:@[self.libraryViewModeToolbarItem,
|
||||
self.forwardsToolbarItem,
|
||||
self.backwardsToolbarItem,
|
||||
self.trackingSeparatorToolbarItem,
|
||||
self.toggleNavSidebarToolbarItem]];
|
||||
}
|
||||
|
||||
- (void)setLibrarySearchToolbarItemVisible:(BOOL)visible
|
||||
{
|
||||
if (!visible) {
|
||||
[self hideToolbarItem:self.libraryWindow.librarySearchToolbarItem];
|
||||
[self hideToolbarItem:self.librarySearchToolbarItem];
|
||||
[self.libraryWindow clearFilterString];
|
||||
return;
|
||||
}
|
||||
|
@ -134,28 +148,28 @@ NSString * const VLCLibraryWindowTrackingSeparatorToolbarItemIdentifier = @"VLCL
|
|||
// Display as far to the right as possible, but not in front of the playlist toggle button
|
||||
NSMutableArray<NSToolbarItem *> * const currentToolbarItems =
|
||||
[NSMutableArray arrayWithArray:self.toolbar.items];
|
||||
if (currentToolbarItems.lastObject == self.libraryWindow.togglePlaylistToolbarItem) {
|
||||
if (currentToolbarItems.lastObject == self.togglePlaylistToolbarItem) {
|
||||
[currentToolbarItems removeLastObject];
|
||||
}
|
||||
|
||||
NSArray * const reversedCurrentToolbarItems =
|
||||
currentToolbarItems.reverseObjectEnumerator.allObjects;
|
||||
[self insertToolbarItem:self.libraryWindow.librarySearchToolbarItem
|
||||
[self insertToolbarItem:self.librarySearchToolbarItem
|
||||
inFrontOf:reversedCurrentToolbarItems];
|
||||
}
|
||||
|
||||
- (void)setViewModeToolbarItemVisible:(BOOL)visible
|
||||
{
|
||||
if (!visible) {
|
||||
[self hideToolbarItem:self.libraryWindow.libraryViewModeToolbarItem];
|
||||
[self hideToolbarItem:self.libraryViewModeToolbarItem];
|
||||
return;
|
||||
}
|
||||
|
||||
[self insertToolbarItem:self.libraryWindow.libraryViewModeToolbarItem
|
||||
inFrontOf:@[self.libraryWindow.toggleNavSidebarToolbarItem,
|
||||
self.libraryWindow.trackingSeparatorToolbarItem,
|
||||
self.libraryWindow.forwardsToolbarItem,
|
||||
self.libraryWindow.backwardsToolbarItem]];
|
||||
[self insertToolbarItem:self.libraryViewModeToolbarItem
|
||||
inFrontOf:@[self.toggleNavSidebarToolbarItem,
|
||||
self.trackingSeparatorToolbarItem,
|
||||
self.forwardsToolbarItem,
|
||||
self.backwardsToolbarItem]];
|
||||
}
|
||||
|
||||
- (void)updatePlayqueueToggleState
|
||||
|
|
Loading…
Reference in New Issue