[vlc-commits] [Git][videolan/vlc][master] 2 commits: macosx: Fix dragging and dropping albums and genres from library view onto playlist table view

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun Mar 5 18:18:26 UTC 2023



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


Commits:
c20a1929 by Claudio Cambra at 2023-03-05T16:57:55+00:00
macosx: Fix dragging and dropping albums and genres from library view onto playlist table view

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

- - - - -
f61680a0 by Claudio Cambra at 2023-03-05T16:57:55+00:00
macosx: Fix drag and drop from genre and artist views by correctly implementing expected protocol

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

- - - - -


3 changed files:

- modules/gui/macosx/library/VLCLibraryCollectionViewDelegate.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupDataSource.h
- modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupDataSource.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryCollectionViewDelegate.m
=====================================
@@ -111,14 +111,15 @@ writeItemsAtIndexPaths:(NSSet<NSIndexPath *> *)indexPaths
         id<VLCMediaLibraryItemProtocol> libraryItem = [vlcDataSource libraryItemAtIndexPath:indexPath
                                                                           forCollectionView:collectionView];
 
-        VLCMediaLibraryMediaItem *mediaItem = libraryItem.firstMediaItem;
-        [encodedLibraryItemsArray addObject:mediaItem];
-
-        VLCMediaLibraryFile *file = mediaItem.files.firstObject;
-        if (file) {
-            NSURL *url = [NSURL URLWithString:file.MRL];
-            [filePathsArray addObject:url.path];
-        }
+        [libraryItem iterateMediaItemsWithBlock:^(VLCMediaLibraryMediaItem *mediaItem) {
+            [encodedLibraryItemsArray addObject:mediaItem];
+
+            VLCMediaLibraryFile *file = mediaItem.files.firstObject;
+            if (file) {
+                NSURL *url = [NSURL URLWithString:file.MRL];
+                [filePathsArray addObject:url.path];
+            }
+        }];
     }
 
     NSData *data = [NSKeyedArchiver archivedDataWithRootObject:encodedLibraryItemsArray];


=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupDataSource.h
=====================================
@@ -22,6 +22,7 @@
 
 #import <Cocoa/Cocoa.h>
 
+#import "library/VLCLibraryCollectionViewDataSource.h"
 #import "library/VLCLibraryTableView.h"
 
 NS_ASSUME_NONNULL_BEGIN
@@ -30,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
 @class VLCLibraryAudioGroupDataSource;
 @class VLCMediaLibraryAlbum;
 
- at interface VLCLibraryAudioGroupDataSource : NSObject <VLCLibraryTableViewDataSource, NSTableViewDelegate, NSCollectionViewDataSource>
+ at interface VLCLibraryAudioGroupDataSource : NSObject <VLCLibraryTableViewDataSource, NSTableViewDelegate, VLCLibraryCollectionViewDataSource>
 
 @property (readwrite, retain, nullable) NSArray <VLCMediaLibraryAlbum *> *representedListOfAlbums;
 


=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupDataSource.m
=====================================
@@ -117,4 +117,10 @@ viewForSupplementaryElementOfKind:(NSCollectionViewSupplementaryElementKind)kind
     return nil;
 }
 
+- (id<VLCMediaLibraryItemProtocol>)libraryItemAtIndexPath:(NSIndexPath *)indexPath
+                                        forCollectionView:(NSCollectionView *)collectionView
+{
+    return _representedListOfAlbums[indexPath.item];
+}
+
 @end



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/398b417eac174cb870175b6715ba0d5dc331c8da...f61680a096e4b4ab0bfbeb1f193684ab08f5c13f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/398b417eac174cb870175b6715ba0d5dc331c8da...f61680a096e4b4ab0bfbeb1f193684ab08f5c13f
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