2005-06-02 18:16:43 +00:00
|
|
|
//
|
|
|
|
// PlaylistController.h
|
|
|
|
// Cog
|
|
|
|
//
|
|
|
|
// Created by Vincent Spader on 3/18/05.
|
2005-07-02 21:02:06 +00:00
|
|
|
// Copyright 2005 Vincent Spader All rights reserved.
|
2005-06-02 18:16:43 +00:00
|
|
|
//
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
#import "DNDArrayController.h"
|
2005-06-02 18:16:43 +00:00
|
|
|
#import <Cocoa/Cocoa.h>
|
2008-02-10 16:16:45 +00:00
|
|
|
#import <Foundation/NSUndoManager.h>
|
2007-03-09 01:16:06 +00:00
|
|
|
|
|
|
|
@class PlaylistLoader;
|
|
|
|
@class PlaylistEntry;
|
2008-02-16 16:13:21 +00:00
|
|
|
@class SpotlightWindowController;
|
2008-05-09 21:24:49 +00:00
|
|
|
@class PlaybackController;
|
2005-06-02 18:16:43 +00:00
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
typedef NS_ENUM(NSInteger, RepeatMode) {
|
2022-02-07 05:49:27 +00:00
|
|
|
RepeatModeNoRepeat = 0,
|
|
|
|
RepeatModeRepeatOne,
|
|
|
|
RepeatModeRepeatAlbum,
|
|
|
|
RepeatModeRepeatAll
|
2021-01-30 23:14:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline BOOL IsRepeatOneSet() {
|
2022-02-07 05:49:27 +00:00
|
|
|
return [[NSUserDefaults standardUserDefaults] integerForKey:@"repeat"] == RepeatModeRepeatOne;
|
2014-02-14 05:16:18 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
typedef enum { ShuffleOff = 0,
|
|
|
|
ShuffleAlbums,
|
|
|
|
ShuffleAll } ShuffleMode;
|
2021-01-30 23:14:08 +00:00
|
|
|
|
|
|
|
typedef NS_ENUM(NSInteger, URLOrigin) {
|
2022-02-07 05:49:27 +00:00
|
|
|
URLOriginInternal = 0,
|
|
|
|
URLOriginExternal
|
2021-01-30 23:14:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
@interface PlaylistController : DNDArrayController <NSTableViewDelegate> {
|
2022-02-07 05:49:27 +00:00
|
|
|
IBOutlet PlaylistLoader *playlistLoader;
|
|
|
|
IBOutlet SpotlightWindowController *spotlightWindowController;
|
|
|
|
IBOutlet PlaybackController *playbackController;
|
|
|
|
|
|
|
|
NSValueTransformer *statusImageTransformer;
|
2021-01-30 23:14:08 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
NSMutableArray *shuffleList;
|
|
|
|
NSMutableArray *queueList;
|
2021-01-30 23:14:08 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
NSString *totalTime;
|
2021-01-30 23:14:08 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
PlaylistEntry *currentEntry;
|
2021-01-30 23:14:08 +00:00
|
|
|
|
2022-02-10 05:04:17 +00:00
|
|
|
PlaylistEntry *nextEntryAfterDeleted;
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
NSUndoManager *undoManager;
|
2005-06-02 18:16:43 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
@property(nonatomic, retain) PlaylistEntry *_Nullable currentEntry;
|
|
|
|
@property(retain) NSString *_Nullable totalTime;
|
2008-02-23 19:46:23 +00:00
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
// Private Methods
|
2006-04-13 18:40:23 +00:00
|
|
|
- (void)updateTotalTime;
|
2008-02-24 17:32:50 +00:00
|
|
|
- (void)updatePlaylistIndexes;
|
2022-02-07 05:49:27 +00:00
|
|
|
- (IBAction)stopAfterCurrent:(id _Nullable)sender;
|
2006-04-13 18:40:23 +00:00
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
// PUBLIC METHODS
|
2009-03-10 04:04:46 +00:00
|
|
|
- (void)setShuffle:(ShuffleMode)s;
|
|
|
|
- (ShuffleMode)shuffle;
|
2008-02-19 03:39:43 +00:00
|
|
|
- (void)setRepeat:(RepeatMode)r;
|
|
|
|
- (RepeatMode)repeat;
|
2022-02-07 05:49:27 +00:00
|
|
|
- (NSArray *_Nullable)filterPlaylistOnAlbum:(NSString *_Nullable)album;
|
2005-06-02 18:16:43 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (PlaylistEntry *_Nullable)getNextEntry:(PlaylistEntry *_Nullable)pe;
|
|
|
|
- (PlaylistEntry *_Nullable)getPrevEntry:(PlaylistEntry *_Nullable)pe;
|
2008-02-14 23:09:51 +00:00
|
|
|
|
2008-02-10 16:16:45 +00:00
|
|
|
/* Methods for undoing various actions */
|
2022-02-07 05:49:27 +00:00
|
|
|
- (NSUndoManager *_Nullable)undoManager;
|
2008-02-10 16:16:45 +00:00
|
|
|
|
2022-01-20 22:59:26 +00:00
|
|
|
- (IBAction)toggleShuffle:(id _Nullable)sender;
|
2008-02-19 04:02:05 +00:00
|
|
|
|
2022-01-20 22:59:26 +00:00
|
|
|
- (IBAction)toggleRepeat:(id _Nullable)sender;
|
2005-06-02 18:16:43 +00:00
|
|
|
|
2022-01-20 22:59:26 +00:00
|
|
|
- (IBAction)randomizeList:(id _Nullable)sender;
|
2007-03-09 01:16:06 +00:00
|
|
|
|
2022-01-20 22:59:26 +00:00
|
|
|
- (IBAction)removeDuplicates:(id _Nullable)sender;
|
|
|
|
- (IBAction)removeDeadItems:(id _Nullable)sender;
|
2013-10-18 07:13:27 +00:00
|
|
|
|
2022-02-11 05:35:13 +00:00
|
|
|
- (IBAction)remove:(id _Nullable)sender;
|
|
|
|
- (IBAction)trash:(id _Nullable)sender;
|
|
|
|
|
2022-01-20 22:59:26 +00:00
|
|
|
- (IBAction)showEntryInFinder:(id _Nullable)sender;
|
|
|
|
- (IBAction)clearFilterPredicate:(id _Nullable)sender;
|
|
|
|
- (IBAction)clear:(id _Nullable)sender;
|
2007-02-18 22:27:55 +00:00
|
|
|
|
2008-11-21 15:14:23 +00:00
|
|
|
//- (IBAction)showTagEditor:(id)sender;
|
|
|
|
|
2008-02-16 16:13:21 +00:00
|
|
|
// Spotlight
|
2022-01-20 22:59:26 +00:00
|
|
|
- (IBAction)searchByArtist:(id _Nullable)sender;
|
|
|
|
- (IBAction)searchByAlbum:(id _Nullable)sender;
|
2008-02-16 16:13:21 +00:00
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
// FUN PLAYLIST MANAGEMENT STUFF!
|
2006-01-29 14:57:48 +00:00
|
|
|
- (BOOL)next;
|
|
|
|
- (BOOL)prev;
|
2006-01-20 15:22:03 +00:00
|
|
|
|
|
|
|
- (void)addShuffledListToBack;
|
|
|
|
- (void)addShuffledListToFront;
|
|
|
|
- (void)resetShuffleList;
|
2005-06-02 18:16:43 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (PlaylistEntry *_Nullable)shuffledEntryAtIndex:(NSInteger)i;
|
|
|
|
- (PlaylistEntry *_Nullable)entryAtIndex:(NSInteger)i;
|
2007-03-09 01:16:06 +00:00
|
|
|
|
2008-05-09 21:24:49 +00:00
|
|
|
// Event inlets:
|
2022-02-07 05:49:27 +00:00
|
|
|
- (void)willInsertURLs:(NSArray *_Nullable)urls origin:(URLOrigin)origin;
|
|
|
|
- (void)didInsertURLs:(NSArray *_Nullable)urls origin:(URLOrigin)origin;
|
2008-05-09 21:24:49 +00:00
|
|
|
|
2008-02-21 07:30:28 +00:00
|
|
|
// queue methods
|
2022-01-20 22:59:26 +00:00
|
|
|
- (IBAction)toggleQueued:(id _Nullable)sender;
|
|
|
|
- (IBAction)emptyQueueList:(id _Nullable)sender;
|
2021-12-24 09:01:21 +00:00
|
|
|
- (void)emptyQueueListUnsynced;
|
2022-02-07 05:49:27 +00:00
|
|
|
- (NSMutableArray *_Nullable)queueList;
|
2008-02-21 07:30:28 +00:00
|
|
|
|
2021-07-03 22:32:13 +00:00
|
|
|
// reload metadata of selection
|
2022-01-20 22:59:26 +00:00
|
|
|
- (IBAction)reloadTags:(id _Nullable)sender;
|
2021-07-03 22:32:13 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (void)moveObjectsInArrangedObjectsFromIndexes:(NSIndexSet *_Nullable)indexSet
|
2021-04-30 01:16:24 +00:00
|
|
|
toIndex:(NSUInteger)insertIndex;
|
2021-01-30 23:14:08 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (void)insertObjectsUnsynced:(NSArray *_Nullable)objects atArrangedObjectIndexes:(NSIndexSet *_Nullable)indexes;
|
2021-12-24 09:01:21 +00:00
|
|
|
|
2005-06-02 18:16:43 +00:00
|
|
|
@end
|