|
22 | 22 |
|
23 | 23 | #import "VLCLibraryAudioDataSource.h"
|
24 | 24 |
|
| 25 | +#import "main/VLCMain.h" |
| 26 | + |
25 | 27 | #import "library/VLCLibraryModel.h"
|
| 28 | +#import "library/VLCLibraryController.h" |
26 | 29 | #import "library/VLCLibraryDataTypes.h"
|
27 | 30 | #import "library/VLCLibraryTableCellView.h"
|
28 | 31 | #import "library/VLCLibraryAlbumTableCellView.h"
|
@@ -66,6 +69,9 @@ - (void)setupAppearance
|
66 | 69 | flowLayout.minimumLineSpacing = 20.;
|
67 | 70 | flowLayout.minimumInteritemSpacing = 20.;
|
68 | 71 |
|
| 72 | + _groupSelectionTableView.target = self; |
| 73 | + _groupSelectionTableView.doubleAction = @selector(groubSelectionDoubleClickAction:); |
| 74 | + |
69 | 75 | [self reloadAppearance];
|
70 | 76 | }
|
71 | 77 |
|
@@ -273,6 +279,34 @@ - (void)tableViewSelectionDidChange:(NSNotification *)notification
|
273 | 279 | [self.groupSelectionTableView reloadData];
|
274 | 280 | }
|
275 | 281 |
|
| 282 | +#pragma mark - table view double click actions |
| 283 | + |
| 284 | +- (void)groubSelectionDoubleClickAction:(id)sender |
| 285 | +{ |
| 286 | + NSArray *listOfAlbums = _groupDataSource.representedListOfAlbums; |
| 287 | + NSUInteger albumCount = listOfAlbums.count; |
| 288 | + if (!listOfAlbums || albumCount == 0) { |
| 289 | + return; |
| 290 | + } |
| 291 | + |
| 292 | + NSInteger clickedRow = _groupSelectionTableView.clickedRow; |
| 293 | + if (clickedRow > albumCount) { |
| 294 | + return; |
| 295 | + } |
| 296 | + |
| 297 | + VLCLibraryController *libraryController = [[VLCMain sharedInstance] libraryController]; |
| 298 | + |
| 299 | + NSArray *tracks = [listOfAlbums[clickedRow] tracksAsMediaItems]; |
| 300 | + NSUInteger trackCount = tracks.count; |
| 301 | + BOOL playImmediately = YES; |
| 302 | + for (NSUInteger x = 0; x < trackCount; x++) { |
| 303 | + [libraryController appendItemToPlaylist:tracks[x] playImmediately:playImmediately]; |
| 304 | + if (playImmediately) { |
| 305 | + playImmediately = NO; |
| 306 | + } |
| 307 | + } |
| 308 | +} |
| 309 | + |
276 | 310 | #pragma mark - collection view data source and delegation
|
277 | 311 |
|
278 | 312 | - (NSInteger)collectionView:(NSCollectionView *)collectionView
|
|
0 commit comments