[vlc-commits] [Git][videolan/vlc][master] 6 commits: macosx: Stop appending library navigation states to the navigation stack each...

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Feb 12 16:42:01 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
c1e52461 by Claudio Cambra at 2023-02-12T16:27:16+00:00
macosx: Stop appending library navigation states to the navigation stack each time some library navigation happens

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

- - - - -
ef4a062b by Claudio Cambra at 2023-02-12T16:27:16+00:00
macosx: Stop paying attention to library segments in navigation stack and states

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

- - - - -
c9526822 by Claudio Cambra at 2023-02-12T16:27:16+00:00
macosx: Fix back/forward buttons not updating the collection or table views in media source view

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

- - - - -
92540df4 by Claudio Cambra at 2023-02-12T16:27:16+00:00
macosx: Fix crashing when pushing forward button in media source view

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

- - - - -
248fd114 by Claudio Cambra at 2023-02-12T16:27:16+00:00
macosx: Add 'clear' method to VLCLibraryNavigationStack

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

- - - - -
d99fb8ed by Claudio Cambra at 2023-02-12T16:27:16+00:00
macosx: Clear the library navigation stack when the media source view is changed

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

- - - - -


10 changed files:

- modules/gui/macosx/library/VLCLibraryNavigationStack.h
- modules/gui/macosx/library/VLCLibraryNavigationStack.m
- modules/gui/macosx/library/VLCLibraryNavigationState.h
- modules/gui/macosx/library/VLCLibraryNavigationState.m
- modules/gui/macosx/library/VLCLibraryWindow.m
- modules/gui/macosx/library/VLCLibraryWindowController.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
- modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.m
- modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryNavigationStack.h
=====================================
@@ -36,6 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)forwards;
 
 - (void)appendCurrentLibraryState;
+- (void)clear;
 
 @end
 


=====================================
modules/gui/macosx/library/VLCLibraryNavigationStack.m
=====================================
@@ -175,16 +175,16 @@
         return;
     }
 
-    [_delegate.segmentedTitleControl setSelectedSegment:state.libraryWindowSelectedSegment];
-    [_delegate.audioSegmentedControl setSelectedSegment:state.audioLibraryViewSelectedSegment];
-    [_delegate.gridVsListSegmentedControl setSelectedSegment:state.viewModeSelectedSegment];
     [_delegate.libraryMediaSourceViewController.baseDataSource setChildDataSource:state.currentMediaSource];
     [_delegate.libraryMediaSourceViewController.baseDataSource.childDataSource setNodeToDisplay:state.currentNodeDisplayed];
 
-    [_delegate segmentedControlAction:self];
-    [_delegate.libraryAudioViewController segmentedControlAction:self];
-    [_delegate.libraryMediaSourceViewController.baseDataSource setGridOrListMode:self];
+    [self updateDelegateNavigationButtons];
+}
 
+- (void)clear
+{
+    _navigationStates = [NSMutableArray array];
+    _currentPosition = nil;
     [self updateDelegateNavigationButtons];
 }
 


=====================================
modules/gui/macosx/library/VLCLibraryNavigationState.h
=====================================
@@ -31,9 +31,6 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface VLCLibraryNavigationState : NSObject
 
- at property (readonly) NSInteger libraryWindowSelectedSegment;
- at property (readonly) NSInteger viewModeSelectedSegment;
- at property (readonly) NSInteger audioLibraryViewSelectedSegment;
 @property (readonly) VLCMediaSourceDataSource *currentMediaSource;
 @property (readonly) VLCInputNode *currentNodeDisplayed;
 


=====================================
modules/gui/macosx/library/VLCLibraryNavigationState.m
=====================================
@@ -35,9 +35,6 @@
     VLCLibraryNavigationState* navState = [super init];
 
     if(navState) {
-        _libraryWindowSelectedSegment = libraryWindow.segmentedTitleControl.selectedSegment;
-        _viewModeSelectedSegment = libraryWindow.gridVsListSegmentedControl.selectedSegment;
-        _audioLibraryViewSelectedSegment = libraryWindow.audioSegmentedControl.selectedSegment;
         _currentMediaSource = libraryWindow.libraryMediaSourceViewController.baseDataSource.childDataSource;
         _currentNodeDisplayed = libraryWindow.libraryMediaSourceViewController.baseDataSource.childDataSource.nodeToDisplay;
     }


=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -411,10 +411,6 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
 
     [self setViewForSelectedSegment];
     [self invalidateRestorableState];
-
-    if(sender != _navigationStack) {
-        [self.navigationStack appendCurrentLibraryState];
-    }
 }
 
 - (void)hideToolbarItem:(NSToolbarItem *)toolbarItem
@@ -529,6 +525,7 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
 {
     NSParameterAssert(segment == VLCLibraryBrowseSegment || segment == VLCLibraryStreamsSegment);
 
+    [self.navigationStack clear];
     [self setForwardsBackwardsToolbarItemsVisible:YES];
     [self setSortOrderToolbarItemVisible:NO];
     [self setLibrarySearchToolbarItemVisible:NO];


=====================================
modules/gui/macosx/library/VLCLibraryWindowController.m
=====================================
@@ -75,15 +75,11 @@
     [libraryWindow.gridVsListSegmentedControl setSelectedSegment:rememberedSelectedLibraryViewModeSegment];
     [libraryWindow.audioSegmentedControl setSelectedSegment:rememberedSelectedLibraryViewAudioSegment];
 
-    // We don't want to add these to the navigation stack...
-    [libraryWindow segmentedControlAction:libraryWindow.navigationStack];
+    [libraryWindow segmentedControlAction:self];
     if (rememberedSelectedLibrarySegment == VLCLibraryMusicSegment) {
-        [libraryWindow.libraryAudioViewController segmentedControlAction:libraryWindow.navigationStack];
+        [libraryWindow.libraryAudioViewController segmentedControlAction:self];
     }
 
-    // But we do want the "final" initial position to be added. So we manually invoke the navigation stack
-    [libraryWindow.navigationStack appendCurrentLibraryState];
-
     completionHandler(libraryWindow, nil);
 }
 


=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.m
=====================================
@@ -26,7 +26,6 @@
 
 #import "library/VLCInputItem.h"
 #import "library/VLCLibraryWindow.h"
-#import "library/VLCLibraryNavigationStack.h"
 #import "library/VLCLibraryModel.h"
 #import "library/VLCLibraryController.h"
 #import "library/VLCLibraryDataTypes.h"


=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
=====================================
@@ -363,11 +363,6 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
 - (IBAction)segmentedControlAction:(id)sender
 {
     [self updatePresentedView];
-
-    VLCLibraryNavigationStack *globalNavStack = VLCMain.sharedInstance.libraryWindow.navigationStack;
-    if(sender != globalNavStack) {
-        [globalNavStack appendCurrentLibraryState];
-    }
 }
 
 - (void)reloadData


=====================================
modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.m
=====================================
@@ -377,6 +377,8 @@ referenceSizeForHeaderInSection:(NSInteger)section
         NSLog(@"Received bad node or media source, could not configure child data media source");
         return;
     }
+
+    [mediaSource preparseInputNodeWithinTree:node];
     
     VLCMediaSourceDataSource *newChildDataSource = [[VLCMediaSourceDataSource alloc] init];
     


=====================================
modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.m
=====================================
@@ -50,9 +50,8 @@
 - (void)setNodeToDisplay:(nonnull VLCInputNode*)nodeToDisplay
 {
     NSAssert(nodeToDisplay, @"Nil node to display, will not set");
-    
     _nodeToDisplay = nodeToDisplay;
-    [self.displayedMediaSource preparseInputNodeWithinTree:_nodeToDisplay];
+    [self reloadData];
 }
 
 - (void)setupViews
@@ -202,8 +201,8 @@
 
     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]]]];
+        [self.displayedMediaSource preparseInputNodeWithinTree:node];
         self.nodeToDisplay = node;
-        [self reloadData];
         [[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/0745da734f6e9f9afe7c1ebdbf3c0a2872d76bae...d99fb8edc1715aebbddaa1c5342c6a9eeb3e5700

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0745da734f6e9f9afe7c1ebdbf3c0a2872d76bae...d99fb8edc1715aebbddaa1c5342c6a9eeb3e5700
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