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
|
|
|
//
|
|
|
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
2008-02-10 16:16:45 +00:00
|
|
|
#import <Foundation/NSUndoManager.h>
|
2005-06-02 18:16:43 +00:00
|
|
|
#import "DNDArrayController.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) {
|
|
|
|
RepeatModeNoRepeat = 0,
|
|
|
|
RepeatModeRepeatOne,
|
|
|
|
RepeatModeRepeatAlbum,
|
|
|
|
RepeatModeRepeatAll
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline BOOL IsRepeatOneSet() {
|
|
|
|
return [[NSUserDefaults standardUserDefaults] integerForKey:@"repeat"] == RepeatModeRepeatOne;
|
2014-02-14 05:16:18 +00:00
|
|
|
}
|
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
typedef enum { ShuffleOff = 0, ShuffleAlbums, ShuffleAll } ShuffleMode;
|
|
|
|
|
|
|
|
typedef NS_ENUM(NSInteger, URLOrigin) {
|
|
|
|
URLOriginInternal = 0,
|
|
|
|
URLOriginExternal
|
|
|
|
};
|
|
|
|
|
|
|
|
@interface PlaylistController : DNDArrayController <NSTableViewDelegate> {
|
|
|
|
IBOutlet PlaylistLoader *playlistLoader;
|
|
|
|
IBOutlet SpotlightWindowController *spotlightWindowController;
|
|
|
|
IBOutlet PlaybackController *playbackController;
|
|
|
|
|
|
|
|
NSMutableArray *shuffleList;
|
|
|
|
NSMutableArray *queueList;
|
|
|
|
|
|
|
|
NSString *totalTime;
|
|
|
|
|
|
|
|
PlaylistEntry *currentEntry;
|
|
|
|
|
2013-10-11 19:33:58 +00:00
|
|
|
NSUndoManager *undoManager;
|
2005-06-02 18:16:43 +00:00
|
|
|
}
|
|
|
|
|
2013-09-30 00:27:55 +00:00
|
|
|
@property(nonatomic, retain) PlaylistEntry *currentEntry;
|
2008-02-24 17:32:50 +00:00
|
|
|
@property(retain) NSString *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;
|
2008-02-25 15:39:04 +00:00
|
|
|
- (IBAction)stopAfterCurrent:(id)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;
|
2008-02-21 19:14:20 +00:00
|
|
|
- (NSArray *)filterPlaylistOnAlbum:(NSString *)album;
|
2005-06-02 18:16:43 +00:00
|
|
|
|
2008-02-14 23:09:51 +00:00
|
|
|
- (PlaylistEntry *)getNextEntry:(PlaylistEntry *)pe;
|
|
|
|
- (PlaylistEntry *)getPrevEntry:(PlaylistEntry *)pe;
|
|
|
|
|
2008-02-10 16:16:45 +00:00
|
|
|
/* Methods for undoing various actions */
|
|
|
|
- (NSUndoManager *)undoManager;
|
|
|
|
|
2009-02-28 06:40:50 +00:00
|
|
|
- (IBAction)toggleShuffle:(id)sender;
|
2008-02-19 04:02:05 +00:00
|
|
|
|
2008-02-19 03:39:43 +00:00
|
|
|
- (IBAction)toggleRepeat:(id)sender;
|
2005-06-02 18:16:43 +00:00
|
|
|
|
2013-10-11 19:33:58 +00:00
|
|
|
- (IBAction)randomizeList:(id)sender;
|
2007-03-09 01:16:06 +00:00
|
|
|
|
2013-10-18 07:13:27 +00:00
|
|
|
- (IBAction)removeDuplicates:(id)sender;
|
2013-10-18 07:14:53 +00:00
|
|
|
- (IBAction)removeDeadItems:(id)sender;
|
2013-10-18 07:13:27 +00:00
|
|
|
|
2007-03-09 01:16:06 +00:00
|
|
|
- (IBAction)showEntryInFinder:(id)sender;
|
2007-05-26 14:09:03 +00:00
|
|
|
- (IBAction)clearFilterPredicate:(id)sender;
|
|
|
|
- (IBAction)clear:(id)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
|
|
|
|
- (IBAction)searchByArtist:(id)sender;
|
|
|
|
- (IBAction)searchByAlbum:(id)sender;
|
|
|
|
|
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
|
|
|
|
2021-04-30 01:16:24 +00:00
|
|
|
- (PlaylistEntry *)shuffledEntryAtIndex:(NSInteger)i;
|
|
|
|
- (PlaylistEntry *)entryAtIndex:(NSInteger)i;
|
2007-03-09 01:16:06 +00:00
|
|
|
|
2008-05-09 21:24:49 +00:00
|
|
|
// Event inlets:
|
2021-01-30 23:14:08 +00:00
|
|
|
- (void)willInsertURLs:(NSArray *)urls origin:(URLOrigin)origin;
|
|
|
|
- (void)didInsertURLs:(NSArray *)urls origin:(URLOrigin)origin;
|
2008-05-09 21:24:49 +00:00
|
|
|
|
2008-02-21 07:30:28 +00:00
|
|
|
// queue methods
|
2008-03-08 23:57:54 +00:00
|
|
|
- (IBAction)toggleQueued:(id)sender;
|
2008-02-21 07:30:28 +00:00
|
|
|
- (IBAction)emptyQueueList:(id)sender;
|
|
|
|
- (NSMutableArray *)queueList;
|
|
|
|
|
2021-01-30 23:14:08 +00:00
|
|
|
- (void)moveObjectsInArrangedObjectsFromIndexes:(NSIndexSet *)indexSet
|
2021-04-30 01:16:24 +00:00
|
|
|
toIndex:(NSUInteger)insertIndex;
|
2021-01-30 23:14:08 +00:00
|
|
|
|
2005-06-02 18:16:43 +00:00
|
|
|
@end
|