[vlc-commits] [Git][videolan/vlc][master] 15 commits: macosx: Build needed path items for path contorl in...

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Wed Feb 15 07:36:58 UTC 2023



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


Commits:
0bdaea2c by Claudio Cambra at 2023-02-15T07:22:46+00:00
macosx: Build needed path items for path contorl in VLCMediaSourceBaseDataSource rather than spoofing a URL

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
0bb4c3f7 by Claudio Cambra at 2023-02-15T07:22:46+00:00
macosx: Build needed path items for path control in VLCMediaSourceDataSource too

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
223a46b6 by Claudio Cambra at 2023-02-15T07:22:46+00:00
macosx: Update the path control when performing actions from the VLCLibraryNavigationStack

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
027f54c1 by Claudio Cambra at 2023-02-15T07:22:46+00:00
macosx: Properly handle home button action

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
b302daba by Claudio Cambra at 2023-02-15T07:22:46+00:00
macosx: Add a new VLCInputNodePathControlItem

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
d5b2ec03 by Claudio Cambra at 2023-02-15T07:22:46+00:00
macosx: Store VLCInputNode in custom path control item

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
da5d5ab7 by Claudio Cambra at 2023-02-15T07:22:46+00:00
macosx: Replace use of NSPathControlItem with VLCInputNodePathControlItem

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
45680115 by Claudio Cambra at 2023-02-15T07:22:46+00:00
macosx: Add VLCInputNodePathControl

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
cadf2fc1 by Claudio Cambra at 2023-02-15T07:22:46+00:00
macosx: Store custom path control items in dictionary of VLCInputNodePathControl

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
f04725c3 by Claudio Cambra at 2023-02-15T07:22:46+00:00
macosx: Use new path control component everywhere

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
91b179a0 by Claudio Cambra at 2023-02-15T07:22:46+00:00
macosx: Finally add functional breadcrumb interaction

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
be25b341 by Claudio Cambra at 2023-02-15T07:22:46+00:00
macosx: Add method to VLCInputNodePathControl to clear path control items ahead of given path control item

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
8a55eabf by Claudio Cambra at 2023-02-15T07:22:46+00:00
macosx: Properly update path control after interacting with it

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
945cdee0 by Claudio Cambra at 2023-02-15T07:22:46+00:00
macosx: Don't append path control item to input node path control if missing identifier

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
961d695f by Claudio Cambra at 2023-02-15T07:22:46+00:00
macosx: Fix streams not responding to user interaction

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/UI/VLCLibraryWindow.xib
- + modules/gui/macosx/library/VLCInputNodePathControl.h
- + modules/gui/macosx/library/VLCInputNodePathControl.m
- + modules/gui/macosx/library/VLCInputNodePathControlItem.h
- + modules/gui/macosx/library/VLCInputNodePathControlItem.m
- modules/gui/macosx/library/VLCLibraryNavigationStack.m
- modules/gui/macosx/library/VLCLibraryWindow.h
- modules/gui/macosx/library/media-source/VLCLibraryMediaSourceViewController.h
- modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.h
- modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.m
- modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.h
- modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.m


Changes:

=====================================
extras/package/macosx/VLC.xcodeproj/project.pbxproj
=====================================
@@ -105,6 +105,8 @@
 		53B447F8293BB47B00857588 /* VLCLibraryVideoCollectionViewsStackViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B447EF293BB47A00857588 /* VLCLibraryVideoCollectionViewsStackViewController.m */; };
 		53B447F9293BB47B00857588 /* VLCLibraryVideoTableViewDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B447F3293BB47A00857588 /* VLCLibraryVideoTableViewDataSource.m */; };
 		53B447FA293BB47B00857588 /* VLCLibraryVideoGroupDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B447F4293BB47A00857588 /* VLCLibraryVideoGroupDescriptor.m */; };
+		53F0E92D299B002300491D49 /* VLCInputNodePathControlItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 53F0E92C299B002300491D49 /* VLCInputNodePathControlItem.m */; };
+		53F0E930299B17DF00491D49 /* VLCInputNodePathControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 53F0E92F299B17DF00491D49 /* VLCInputNodePathControl.m */; };
 		6B0292E61F43256300A50082 /* VLCBottomBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0292E51F43256300A50082 /* VLCBottomBarView.m */; };
 		6B0AB0F01F1AC8B3003A1B4E /* VLCSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0AB0ED1F1AC8B3003A1B4E /* VLCSlider.m */; };
 		6B0AB0F11F1AC8B3003A1B4E /* VLCSliderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0AB0EF1F1AC8B3003A1B4E /* VLCSliderCell.m */; };
@@ -287,11 +289,11 @@
 		536EFBF4295BCB8300F4CB13 /* VLCLibraryUIUnits.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryUIUnits.m; sourceTree = "<group>"; };
 		536EFC37295E521600F4CB13 /* VLCLibraryVideoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryVideoViewController.h; sourceTree = "<group>"; };
 		536EFC38295E521600F4CB13 /* VLCLibraryVideoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryVideoViewController.m; sourceTree = "<group>"; };
+		536EFC3A295F828000F4CB13 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
 		53903D3829576ED500D0B308 /* VLCLibraryAudioGroupDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryAudioGroupDataSource.h; sourceTree = "<group>"; };
 		53903D3929576ED500D0B308 /* VLCLibraryAudioGroupDataSource.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryAudioGroupDataSource.m; sourceTree = "<group>"; };
 		539BA79D298C726200918C36 /* VLCAspectRatioRetainingVideoWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCAspectRatioRetainingVideoWindow.h; sourceTree = "<group>"; };
 		539BA79E298C726200918C36 /* VLCAspectRatioRetainingVideoWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCAspectRatioRetainingVideoWindow.m; sourceTree = "<group>"; };
-		536EFC3A295F828000F4CB13 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
 		53B447C82939823E00857588 /* VLCLibrarySongsTableViewSongPlayingTableCellView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibrarySongsTableViewSongPlayingTableCellView.h; sourceTree = "<group>"; };
 		53B447C92939823E00857588 /* VLCLibrarySongsTableViewSongPlayingTableCellView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibrarySongsTableViewSongPlayingTableCellView.m; sourceTree = "<group>"; };
 		53B447EC293BB47A00857588 /* VLCLibraryVideoCollectionViewContainerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryVideoCollectionViewContainerView.m; sourceTree = "<group>"; };
@@ -304,6 +306,10 @@
 		53B447F3293BB47A00857588 /* VLCLibraryVideoTableViewDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryVideoTableViewDataSource.m; sourceTree = "<group>"; };
 		53B447F4293BB47A00857588 /* VLCLibraryVideoGroupDescriptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryVideoGroupDescriptor.m; sourceTree = "<group>"; };
 		53B447F5293BB47B00857588 /* VLCLibraryVideoCollectionViewsStackViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCLibraryVideoCollectionViewsStackViewController.h; sourceTree = "<group>"; };
+		53F0E92B299B002300491D49 /* VLCInputNodePathControlItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCInputNodePathControlItem.h; sourceTree = "<group>"; };
+		53F0E92C299B002300491D49 /* VLCInputNodePathControlItem.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCInputNodePathControlItem.m; sourceTree = "<group>"; };
+		53F0E92E299B17DF00491D49 /* VLCInputNodePathControl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCInputNodePathControl.h; sourceTree = "<group>"; };
+		53F0E92F299B17DF00491D49 /* VLCInputNodePathControl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCInputNodePathControl.m; sourceTree = "<group>"; };
 		5CCED71014C0D4A90057F8D1 /* VLCExtensionsDialogProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCExtensionsDialogProvider.h; sourceTree = "<group>"; };
 		5CCED71114C0D4A90057F8D1 /* VLCExtensionsDialogProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCExtensionsDialogProvider.m; sourceTree = "<group>"; };
 		5CCED71214C0D4A90057F8D1 /* VLCExtensionsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCExtensionsManager.h; sourceTree = "<group>"; };
@@ -1138,6 +1144,10 @@
 				7DFBDCB8226CED3700B700A5 /* media-source */,
 				7DFBDCBF226DC16200B700A5 /* VLCInputItem.h */,
 				7DFBDCC0226DC16200B700A5 /* VLCInputItem.m */,
+				53F0E92E299B17DF00491D49 /* VLCInputNodePathControl.h */,
+				53F0E92F299B17DF00491D49 /* VLCInputNodePathControl.m */,
+				53F0E92B299B002300491D49 /* VLCInputNodePathControlItem.h */,
+				53F0E92C299B002300491D49 /* VLCInputNodePathControlItem.m */,
 				536283ED291146BC00640C15 /* VLCLibraryCollectionViewFlowLayout.h */,
 				536283EE291146BC00640C15 /* VLCLibraryCollectionViewFlowLayout.m */,
 				7D0F64032202047900FDB91F /* VLCLibraryCollectionViewItem.h */,
@@ -1946,6 +1956,7 @@
 				1C3113A31E508C6900D4DD76 /* VLCCoreDialogProvider.m in Sources */,
 				6B2EFC631F281A0900F3C0EA /* VLCVolumeSliderCell.m in Sources */,
 				1C3113A71E508C6900D4DD76 /* VLCLogWindowController.m in Sources */,
+				53F0E930299B17DF00491D49 /* VLCInputNodePathControl.m in Sources */,
 				1C3113A91E508C6900D4DD76 /* VLCDocumentController.m in Sources */,
 				1C3113AB1E508C6900D4DD76 /* VLCExtensionsDialogProvider.m in Sources */,
 				7D460B0C229EB4C700097948 /* VLCDragDropView.m in Sources */,
@@ -2006,6 +2017,7 @@
 				7D1BF28A22A153E20027C50F /* VLCRoundedCornerTextField.m in Sources */,
 				7DFBDCB4226CD00900B700A5 /* VLCLibraryDataTypes.m in Sources */,
 				1C3113DF1E508C6900D4DD76 /* VLCVideoEffectsWindowController.m in Sources */,
+				53F0E92D299B002300491D49 /* VLCInputNodePathControlItem.m in Sources */,
 				1C3113E11E508C6900D4DD76 /* VLCVoutView.m in Sources */,
 				1C3113E51E508C6900D4DD76 /* VLCInformationWindowController.m in Sources */,
 				6B7F1FDF1F07DA920002BDD8 /* VLCHexNumberFormatter.m in Sources */,


=====================================
modules/gui/macosx/Makefile.am
=====================================
@@ -85,6 +85,10 @@ libmacosx_plugin_la_SOURCES = \
 	gui/macosx/imported/SPMediaKeyTap/SPMediaKeyTap.m \
 	gui/macosx/library/VLCInputItem.h \
 	gui/macosx/library/VLCInputItem.m \
+	gui/macosx/library/VLCInputNodePathControl.h \
+	gui/macosx/library/VLCInputNodePathControl.m \
+	gui/macosx/library/VLCInputNodePathControlItem.h \
+	gui/macosx/library/VLCInputNodePathControlItem.m \
 	gui/macosx/library/VLCLibraryCollectionViewDataSource.h \
 	gui/macosx/library/VLCLibraryCollectionViewDelegate.h \
 	gui/macosx/library/VLCLibraryCollectionViewDelegate.m \


=====================================
modules/gui/macosx/UI/VLCLibraryWindow.xib
=====================================
@@ -1077,7 +1077,7 @@
                         <autoresizingMask key="autoresizingMask"/>
                     </scroller>
                 </scrollView>
-                <pathControl verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Rjk-Q6-FYy">
+                <pathControl verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Rjk-Q6-FYy" customClass="VLCInputNodePathControl">
                     <rect key="frame" x="46" y="381" width="472" height="20"/>
                     <pathCell key="cell" controlSize="small" selectable="YES" editable="YES" alignment="left" id="kIb-Jz-eus">
                         <font key="font" metaFont="message" size="11"/>


=====================================
modules/gui/macosx/library/VLCInputNodePathControl.h
=====================================
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * VLCInputNodePathControl.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 VLCInputNodePathControlItem;
+
+ at interface VLCInputNodePathControl : NSPathControl
+
+ at property (readonly) NSMutableDictionary *inputNodePathControlItems;
+
+- (void)appendInputNodePathControlItem:(VLCInputNodePathControlItem *)inputNodePathControlItem;
+- (void)removeLastInputNodePathControlItem;
+- (void)clearInputNodePathControlItems;
+- (void)clearPathControlItemsAheadOf:(NSPathControlItem *)item;
+
+ at end
+
+NS_ASSUME_NONNULL_END


=====================================
modules/gui/macosx/library/VLCInputNodePathControl.m
=====================================
@@ -0,0 +1,94 @@
+/*****************************************************************************
+ * VLCInputNodePathControl.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 "VLCInputNodePathControl.h"
+
+#import "VLCInputNodePathControlItem.h"
+
+ at implementation VLCInputNodePathControl
+
+- (void)appendInputNodePathControlItem:(VLCInputNodePathControlItem *)inputNodePathControlItem
+{
+    if (_inputNodePathControlItems == nil) {
+        _inputNodePathControlItems = [NSMutableDictionary dictionary];
+    }
+
+    if ([inputNodePathControlItem.image.name isEqualToString:@""]) {
+        return;
+    }
+
+    [_inputNodePathControlItems setObject:inputNodePathControlItem forKey:inputNodePathControlItem.image.name];
+
+    NSMutableArray *pathItems = [NSMutableArray arrayWithArray:self.pathItems];
+    [pathItems addObject:inputNodePathControlItem];
+    self.pathItems = pathItems;
+}
+
+- (void)removeLastInputNodePathControlItem
+{
+    if (self.pathItems.count == 0) {
+        _inputNodePathControlItems = [NSMutableDictionary dictionary];
+        return;
+    }
+
+    NSMutableArray *pathItems = [NSMutableArray arrayWithArray:self.pathItems];
+    NSPathControlItem *lastItem = pathItems.lastObject;
+
+    [pathItems removeLastObject];
+    self.pathItems = pathItems;
+    [_inputNodePathControlItems removeObjectForKey:lastItem.image.name];
+}
+
+- (void)clearInputNodePathControlItems
+{
+    _inputNodePathControlItems = [NSMutableDictionary dictionary];
+    self.pathItems = @[];
+}
+
+- (void)clearPathControlItemsAheadOf:(NSPathControlItem *)item
+{
+    if ([item.image.name isEqualToString:@""]) {
+        return;
+    }
+
+    NSUInteger indexOfItem = [self.pathItems indexOfObjectPassingTest:^BOOL(NSPathControlItem *searchItem, NSUInteger idx, BOOL *stop) {
+        return [searchItem.image.name isEqualToString:item.image.name];
+    }];
+
+    if (indexOfItem == NSNotFound) {
+        return;
+    }
+
+    NSMutableArray<NSPathControlItem *> *pathItems = [NSMutableArray arrayWithArray:self.pathItems];
+    NSArray<NSPathControlItem *> *itemsToRemove = [pathItems subarrayWithRange:NSMakeRange(indexOfItem + 1, pathItems.count - indexOfItem - 1)];
+    NSMutableArray<NSString *> *itemMrlsToRemove = [NSMutableArray arrayWithCapacity:itemsToRemove.count];
+
+    for (NSPathControlItem *searchItem in itemsToRemove) {
+        NSString *searchItemMrl = searchItem.image.name;
+        [itemMrlsToRemove addObject:searchItemMrl];
+    };
+
+    self.pathItems = [pathItems subarrayWithRange:NSMakeRange(0, indexOfItem + 1)];
+    [_inputNodePathControlItems removeObjectsForKeys:itemMrlsToRemove];
+}
+
+ at end


=====================================
modules/gui/macosx/library/VLCInputNodePathControlItem.h
=====================================
@@ -0,0 +1,37 @@
+/*****************************************************************************
+ * VLCInputNodePathControlItem.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 VLCInputNode;
+
+ at interface VLCInputNodePathControlItem : NSPathControlItem
+
+ at property (readonly) VLCInputNode *inputNode;
+
+- (instancetype)initWithInputNode:(VLCInputNode *)inputNode;
+
+ at end
+
+NS_ASSUME_NONNULL_END


=====================================
modules/gui/macosx/library/VLCInputNodePathControlItem.m
=====================================
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * VLCInputNodePathControlItem.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 "VLCInputNodePathControlItem.h"
+
+#import "VLCInputItem.h"
+#import "VLCLibraryImageCache.h"
+
+ at implementation VLCInputNodePathControlItem
+
+- (instancetype)initWithInputNode:(VLCInputNode *)inputNode
+{
+    self = [super init];
+    if (self && inputNode != nil && inputNode.inputItem != nil) {
+        _inputNode = inputNode;
+
+        VLCInputItem *inputItem = inputNode.inputItem;
+        self.image = [VLCLibraryImageCache thumbnailForInputItem:inputItem];
+        self.title = inputItem.name;
+
+        // HACK: We have no way when we get the clicked item from the path control
+        // of knowing specifically which input node this path item corresponds to,
+        // as the path control returns a copy for clickedPathItem that is not of
+        // this class. As a very awkward workaround, lets set the name of the image
+        // used here as the MRL of the node's input item
+        self.image.name = inputItem.MRL;
+    }
+    return self;
+}
+
+ at end


=====================================
modules/gui/macosx/library/VLCLibraryNavigationStack.m
=====================================
@@ -22,9 +22,11 @@
 
 #import "VLCLibraryNavigationStack.h"
 
-#import "VLCLibraryWindow.h"
-#import "VLCLibraryNavigationState.h"
 #import "VLCInputItem.h"
+#import "VLCInputNodePathControl.h"
+#import "VLCInputNodePathControlItem.h"
+#import "VLCLibraryNavigationState.h"
+#import "VLCLibraryWindow.h"
 
 #import "library/audio-library/VLCLibraryAudioViewController.h"
 
@@ -108,6 +110,11 @@
 
     NSUInteger newPositionIndex = _currentPosition.navigationStackIndex + 1;
     _currentPosition = [[VLCLibraryNavigationCurrentStackPosition alloc] initWithStackIndex:newPositionIndex andState:_navigationStates[newPositionIndex]];
+
+    VLCInputNode *node = _currentPosition.navigationState.currentNodeDisplayed;
+    VLCInputNodePathControlItem *nodePathItem = [[VLCInputNodePathControlItem alloc] initWithInputNode:node];
+    [_delegate.mediaSourcePathControl appendInputNodePathControlItem:nodePathItem];
+
     [self setDelegateToState:_currentPosition.navigationState];
 }
 
@@ -119,6 +126,9 @@
 
     NSUInteger newPositionIndex = _currentPosition.navigationStackIndex - 1;
     _currentPosition = [[VLCLibraryNavigationCurrentStackPosition alloc] initWithStackIndex:newPositionIndex andState:_navigationStates[newPositionIndex]];
+
+    [_delegate.mediaSourcePathControl removeLastInputNodePathControlItem];
+
     [self setDelegateToState:_currentPosition.navigationState];
 }
 


=====================================
modules/gui/macosx/library/VLCLibraryWindow.h
=====================================
@@ -26,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @class VLCDragDropView;
 @class VLCRoundedCornerTextField;
+ at class VLCInputNodePathControl;
 @class VLCLibraryNavigationStack;
 @class VLCLibraryAudioViewController;
 @class VLCLibraryMediaSourceViewController;
@@ -87,7 +88,7 @@ extern const NSUserInterfaceItemIdentifier VLCLibraryWindowIdentifier;
 @property (readwrite, weak) IBOutlet NSSegmentedControl *audioSegmentedControl;
 @property (readwrite, weak) IBOutlet NSView *mediaSourceView;
 @property (readwrite, weak) IBOutlet NSButton *mediaSourceHomeButton;
- at property (readwrite, weak) IBOutlet NSPathControl *mediaSourcePathControl;
+ at property (readwrite, weak) IBOutlet VLCInputNodePathControl *mediaSourcePathControl;
 @property (readwrite, weak) IBOutlet NSScrollView *mediaSourceTableViewScrollView;
 @property (readwrite, weak) IBOutlet NSTableView *mediaSourceTableView;
 @property (readwrite, weak) IBOutlet NSScrollView *mediaSourceCollectionViewScrollView;


=====================================
modules/gui/macosx/library/media-source/VLCLibraryMediaSourceViewController.h
=====================================
@@ -24,6 +24,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+ at class VLCInputNodePathControl;
 @class VLCLibraryWindow;
 @class VLCMediaSourceBaseDataSource;
 
@@ -37,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (readonly) NSTableView *tableView;
 @property (readonly) NSScrollView *tableViewScrollView;
 @property (readonly) NSButton *homeButton;
- at property (readonly) NSPathControl *pathControl;
+ at property (readonly) VLCInputNodePathControl *pathControl;
 @property (readonly) NSSegmentedControl *gridVsListSegmentedControl;
 
 @property (readonly) VLCMediaSourceBaseDataSource *baseDataSource;


=====================================
modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.h
=====================================
@@ -29,6 +29,7 @@ typedef NS_ENUM(NSInteger, VLCMediaSourceMode) {
 
 NS_ASSUME_NONNULL_BEGIN
 
+ at class VLCInputNodePathControl;
 @class VLCMediaSourceDataSource;
 
 @interface VLCMediaSourceBaseDataSource : NSObject <NSCollectionViewDataSource,
@@ -42,13 +43,14 @@ NS_ASSUME_NONNULL_BEGIN
 @property (readwrite) NSTableView *tableView;
 @property (readwrite) NSSegmentedControl *gridVsListSegmentedControl;
 @property (readwrite) NSButton *homeButton;
- at property (readwrite) NSPathControl *pathControl;
+ at property (readwrite) VLCInputNodePathControl *pathControl;
 @property (readwrite, nonatomic) VLCMediaSourceMode mediaSourceMode;
 @property (readwrite, nonatomic) VLCMediaSourceDataSource *childDataSource;
 
 - (void)setupViews;
 - (void)reloadViews;
 - (void)homeButtonAction:(id)sender;
+- (void)pathControlAction:(id)sender;
 - (void)setGridOrListMode:(id)sender;
 
 @end


=====================================
modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.m
=====================================
@@ -31,6 +31,8 @@
 #import "extensions/NSString+Helpers.h"
 
 #import "library/VLCLibraryWindow.h"
+#import "library/VLCInputNodePathControl.h"
+#import "library/VLCInputNodePathControlItem.h"
 #import "library/VLCLibraryNavigationStack.h"
 #import "library/VLCInputItem.h"
 #import "library/VLCLibraryCollectionViewSupplementaryElementView.h"
@@ -99,7 +101,9 @@ NSString *VLCMediaSourceTableViewCellIdentifier = @"VLCMediaSourceTableViewCellI
 
     self.homeButton.action = @selector(homeButtonAction:);
     self.homeButton.target = self;
-    self.pathControl.URL = nil;
+    [self.pathControl clearInputNodePathControlItems];
+    self.pathControl.action = @selector(pathControlAction:);
+    self.pathControl.target = self;
 
     self.tableView.dataSource = self;
     self.tableView.delegate = self;
@@ -119,7 +123,7 @@ NSString *VLCMediaSourceTableViewCellIdentifier = @"VLCMediaSourceTableViewCellI
 
 - (void)loadMediaSources
 {
-    self.pathControl.URL = nil;
+    [self.pathControl clearInputNodePathControlItems];
     NSArray *mediaSources;
     if (self.mediaSourceMode == VLCMediaSourceModeLAN) {
         mediaSources = [VLCMediaSourceProvider listOfLocalMediaSources];
@@ -404,9 +408,13 @@ referenceSizeForHeaderInSection:(NSInteger)section
     }
     
     _childDataSource = childDataSource;
-    
-    VLCInputItem *nodeInput = childDataSource.nodeToDisplay.inputItem;
-    self.pathControl.URL = [NSURL URLWithString:[NSString stringWithFormat:@"vlc://%@", [nodeInput.name stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLPathAllowedCharacterSet]]]];
+
+    if (_mediaSourceMode == VLCMediaSourceModeLAN) {
+        VLCInputNode *node = childDataSource.nodeToDisplay;
+        VLCInputNodePathControlItem *nodePathItem = [[VLCInputNodePathControlItem alloc] initWithInputNode:node];
+
+        [self.pathControl appendInputNodePathControlItem:nodePathItem];
+    }
     self.pathControl.hidden = NO;
     
     [_childDataSource setupViews];
@@ -428,6 +436,7 @@ referenceSizeForHeaderInSection:(NSInteger)section
     self.tableView.delegate = self;
 
     _childDataSource = nil;
+    [self.pathControl clearInputNodePathControlItems];
 
     [self reloadData];
 }
@@ -436,8 +445,22 @@ referenceSizeForHeaderInSection:(NSInteger)section
 {
     [self returnHome];
     VLCLibraryNavigationStack *mainNavStack = [VLCMain sharedInstance].libraryWindow.navigationStack;
-    if(sender != mainNavStack && sender != self) {
-        [[[[VLCMain sharedInstance] libraryWindow] navigationStack] appendCurrentLibraryState];
+    [mainNavStack clear];
+}
+
+- (void)pathControlAction:(id)sender
+{
+    if (_pathControl.clickedPathItem == nil || _childDataSource == nil) {
+        return;
+    }
+
+    NSPathControlItem *selectedItem = _pathControl.clickedPathItem;
+    NSString *itemNodeMrl = selectedItem.image.name;
+
+    VLCInputNodePathControlItem *matchingItem = [_pathControl.inputNodePathControlItems objectForKey:itemNodeMrl];
+    if (matchingItem != nil) {
+        _childDataSource.nodeToDisplay = matchingItem.inputNode;
+        [_pathControl clearPathControlItemsAheadOf:selectedItem];
     }
 }
 


=====================================
modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.h
=====================================
@@ -26,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @class VLCInputItem;
 @class VLCInputNode;
+ at class VLCInputNodePathControl;
 @class VLCMediaSource;
 
 @interface VLCMediaSourceDataSource : NSObject <NSCollectionViewDataSource,
@@ -38,7 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (readwrite, retain, nonatomic) VLCInputNode *nodeToDisplay;
 @property (readwrite, assign) NSCollectionView *collectionView;
 @property (readwrite, assign) NSTableView *tableView;
- at property (readwrite) NSPathControl *pathControl;
+ at property (readwrite) VLCInputNodePathControl *pathControl;
 @property (readwrite) BOOL gridViewMode;
 
 - (void)setupViews;


=====================================
modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.m
=====================================
@@ -28,10 +28,12 @@
 #import "extensions/NSString+Helpers.h"
 
 #import "library/VLCInputItem.h"
-#import "library/VLCLibraryWindow.h"
+#import "library/VLCInputNodePathControl.h"
+#import "library/VLCInputNodePathControlItem.h"
 #import "library/VLCLibraryNavigationStack.h"
 #import "library/VLCLibraryTableCellView.h"
 #import "library/VLCLibraryUIUnits.h"
+#import "library/VLCLibraryWindow.h"
 
 #import "main/VLCMain.h"
 
@@ -200,9 +202,12 @@
     VLCInputItem *childRootInput = node.inputItem;
 
     if (childRootInput.inputType == ITEM_TYPE_DIRECTORY || childRootInput.inputType == ITEM_TYPE_NODE) {
-        self.pathControl.URL = [NSURL URLWithString:[self.pathControl.URL.path stringByAppendingPathComponent:[childRootInput.name stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLPathAllowedCharacterSet]]]];
+        VLCInputNodePathControlItem *nodePathItem = [[VLCInputNodePathControlItem alloc] initWithInputNode:node];
+        [self.pathControl appendInputNodePathControlItem:nodePathItem];
+
         [self.displayedMediaSource preparseInputNodeWithinTree:node];
         self.nodeToDisplay = node;
+
         [[VLCMain sharedInstance].libraryWindow.navigationStack appendCurrentLibraryState];
     } else if (childRootInput.inputType == ITEM_TYPE_FILE && allowPlayback) {
         [[[VLCMain sharedInstance] playlistController] addInputItem:childRootInput.vlcInputItem atPosition:-1 startPlayback:YES];



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e9705c553cb29fcf0da45e354ec27b462f5202c6...961d695fb7ec3f54e99d221ff600a9815f40db75

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e9705c553cb29fcf0da45e354ec27b462f5202c6...961d695fb7ec3f54e99d221ff600a9815f40db75
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