Completely redesigned all menus, fixed crashers due to new PlaylistEntry structure, validated menu items, added menu entry for fading, synthesized playbackStatus, updated KnownIssues

CQTexperiment
areff 2008-02-23 22:20:14 +00:00
parent 86f691b769
commit d2e95a50f8
6 changed files with 3242 additions and 3003 deletions

View File

@ -38,6 +38,8 @@
AudioScrobbler *scrobbler; AudioScrobbler *scrobbler;
} }
@property int playbackStatus;
- (IBAction)toggleShowTimeRemaining:(id)sender; - (IBAction)toggleShowTimeRemaining:(id)sender;
- (IBAction)changeVolume:(id)sender; - (IBAction)changeVolume:(id)sender;
- (IBAction)volumeDown:(id)sender; - (IBAction)volumeDown:(id)sender;
@ -61,7 +63,7 @@
- (void)seekForward:(double)sender; - (void)seekForward:(double)sender;
- (IBAction)eventSeekBackward:(id)sender; - (IBAction)eventSeekBackward:(id)sender;
- (void)seekBackward:(double)amount; - (void)seekBackward:(double)amount;
- (IBAction)fade:(id)sender withTime:(double)time; - (IBAction)fade:(id)sender;
- (void)initDefaults; - (void)initDefaults;
- (void)audioFadeDown:(NSTimer *)audioTimer; - (void)audioFadeDown:(NSTimer *)audioTimer;

View File

@ -11,6 +11,7 @@
#define DEFAULT_SEEK 10 #define DEFAULT_SEEK 10
@synthesize playbackStatus;
- (id)init - (id)init
{ {
@ -290,6 +291,7 @@
[audioPlayer setVolume:originalVolume]; [audioPlayer setVolume:originalVolume];
[volumeSlider setDoubleValue: logarithmicToLinear(originalVolume)]; [volumeSlider setDoubleValue: logarithmicToLinear(originalVolume)];
[audioTimer invalidate]; [audioTimer invalidate];
playbackStatus = kCogStatusPaused;
} }
} }
@ -313,12 +315,15 @@
{ {
[volumeSlider setDoubleValue: logarithmicToLinear(originalVolume)]; [volumeSlider setDoubleValue: logarithmicToLinear(originalVolume)];
[audioTimer invalidate]; [audioTimer invalidate];
playbackStatus = kCogStatusPlaying;
} }
} }
- (IBAction)fade:(id)sender withTime:(double)time - (IBAction)fade:(id)sender
{ {
double time = 0.1;
// we can not allow multiple fade timers to be registered // we can not allow multiple fade timers to be registered
if (playbackStatus == kCogStatusFading) if (playbackStatus == kCogStatusFading)
return; return;
@ -351,7 +356,7 @@
{ {
BOOL found = NO; BOOL found = NO;
NSNumber *index = (NSNumber *)[[playlistController currentEntry] index]; int index = [[playlistController currentEntry] index];
NSString *origAlbum = [[playlistController currentEntry] album]; NSString *origAlbum = [[playlistController currentEntry] album];
int i; int i;
@ -361,10 +366,9 @@
for (i = 1; i < [[playlistController arrangedObjects] count]; i++) for (i = 1; i < [[playlistController arrangedObjects] count]; i++)
{ {
pe = [playlistController entryAtIndex:[index intValue] + i]; pe = [playlistController entryAtIndex:index + i];
if (pe == nil) { if (pe == nil)
break; break;
}
curAlbum = [pe album]; curAlbum = [pe album];
@ -385,7 +389,7 @@
if (found) if (found)
{ {
[self playEntryAtIndex:i + [index intValue]]; [self playEntryAtIndex:i + index];
} }
} }
@ -394,7 +398,7 @@
BOOL found = NO; BOOL found = NO;
BOOL foundAlbum = NO; BOOL foundAlbum = NO;
NSNumber *index = (NSNumber *)[[playlistController currentEntry] index]; int index = [[playlistController currentEntry] index];
NSString *origAlbum = [[playlistController currentEntry] album]; NSString *origAlbum = [[playlistController currentEntry] album];
NSString *curAlbum; NSString *curAlbum;
@ -404,10 +408,10 @@
for (i = 1; i < [[playlistController arrangedObjects] count]; i++) for (i = 1; i < [[playlistController arrangedObjects] count]; i++)
{ {
pe = [playlistController entryAtIndex:[index intValue] - i]; pe = [playlistController entryAtIndex:index - i];
if (pe == nil) { if (pe == nil)
break; break;
}
curAlbum = [pe album]; curAlbum = [pe album];
if (curAlbum == nil) if (curAlbum == nil)
{ {
@ -437,7 +441,7 @@
{ {
if (foundAlbum == YES) if (foundAlbum == YES)
i--; i--;
[self playEntryAtIndex:[index intValue] - i]; [self playEntryAtIndex:index - i];
} }
} }
@ -571,10 +575,10 @@
{ {
SEL action = [menuItem action]; SEL action = [menuItem action];
if (action == @selector(seekBackward:) && (playbackStatus == kCogStatusStopped)) if (action == @selector(eventSeekBackward:) && (playbackStatus == kCogStatusStopped))
return NO; return NO;
if (action == @selector(seekForward:) && (playbackStatus == kCogStatusStopped)) if (action == @selector(eventSeekForward:) && (playbackStatus == kCogStatusStopped))
return NO; return NO;
if (action == @selector(stop:) && (playbackStatus == kCogStatusStopped)) if (action == @selector(stop:) && (playbackStatus == kCogStatusStopped))

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
Font resize of playlist does not change file tree, and Font resize of playlist does not change file tree, and
does not resize columns (needs a lower bound) does not resize columns (needs a lower bound), currently
only resizes title column.
Code for seeking should be moved into the AudioPlayer, Code for seeking should be moved into the AudioPlayer,
so we can escape ugly event* functions (the problem is so we can escape ugly event* functions (the problem is
@ -9,13 +10,9 @@ because of apple remote seeking incrementally)
Shuffle list is not reshuffled when shuffling reaches Shuffle list is not reshuffled when shuffling reaches
start or end of it (in Repeat All mode) start or end of it (in Repeat All mode)
Repeat Album isn't implemented.
Menu items do not transform into "Hide Spotlight Panel" and Menu items do not transform into "Hide Spotlight Panel" and
"Hide File Drawer" when they are active. "Hide File Drawer" when they are active.
I anticipate that status should be flag based so statuses are not mutually exclusive. I anticipate that status should be flag based so statuses are not mutually exclusive.
Right click menu item should gray out when not applicable.
Issues with queueing the same song multiple times Issues with queueing the same song multiple times

View File

@ -685,5 +685,24 @@
} }
} }
-(BOOL)validateMenuItem:(NSMenuItem*)menuItem
{
SEL action = [menuItem action];
if (action == @selector(removeFromQueue:))
{
for (PlaylistEntry *q in [self selectedObjects])
if (q.queuePosition > 0)
return YES;
return NO;
}
if (action == @selector(emptyQueueList:) && ([queueList count] < 1))
return NO;
return YES;
}
@end @end

View File

@ -14,6 +14,8 @@
#import "SecondsFormatter.h" #import "SecondsFormatter.h"
#import "PlaylistEntry.h" #import "PlaylistEntry.h"
#import "CogAudio/Status.h"
@implementation PlaylistView @implementation PlaylistView
- (void)awakeFromNib - (void)awakeFromNib
@ -262,11 +264,6 @@
{ {
[playlistController clearFilterPredicate:self]; [playlistController clearFilterPredicate:self];
} }
// shift+command+p - fade to pause
else if (modifiers == (NSCommandKeyMask | NSShiftKeyMask) && c == 0x70)
{
[playbackController fade:self withTime:0.1];
}
else else
{ {
[super keyDown:e]; [super keyDown:e];
@ -275,8 +272,8 @@
- (IBAction)scrollToCurrentEntry:(id)sender - (IBAction)scrollToCurrentEntry:(id)sender
{ {
[self scrollRowToVisible:[(NSNumber *)[[playlistController currentEntry] index] intValue]]; [self scrollRowToVisible:[[playlistController currentEntry] index]];
[self selectRow:[(NSNumber *)[[playlistController currentEntry] index] intValue] byExtendingSelection:NO]; [self selectRow:[[playlistController currentEntry] index] byExtendingSelection:NO];
} }
- (IBAction)sortByPath:(id)sender - (IBAction)sortByPath:(id)sender
@ -320,7 +317,10 @@
else else
return NO; return NO;
} }
if (action == @selector(scrollToCurrentEntry:) && ([playbackController playbackStatus] == kCogStatusStopped))
return NO;
return [super validateUserInterfaceItem:anItem]; return [super validateUserInterfaceItem:anItem];
} }