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;
}
@property int playbackStatus;
- (IBAction)toggleShowTimeRemaining:(id)sender;
- (IBAction)changeVolume:(id)sender;
- (IBAction)volumeDown:(id)sender;
@ -61,7 +63,7 @@
- (void)seekForward:(double)sender;
- (IBAction)eventSeekBackward:(id)sender;
- (void)seekBackward:(double)amount;
- (IBAction)fade:(id)sender withTime:(double)time;
- (IBAction)fade:(id)sender;
- (void)initDefaults;
- (void)audioFadeDown:(NSTimer *)audioTimer;

View File

@ -11,6 +11,7 @@
#define DEFAULT_SEEK 10
@synthesize playbackStatus;
- (id)init
{
@ -290,6 +291,7 @@
[audioPlayer setVolume:originalVolume];
[volumeSlider setDoubleValue: logarithmicToLinear(originalVolume)];
[audioTimer invalidate];
playbackStatus = kCogStatusPaused;
}
}
@ -313,12 +315,15 @@
{
[volumeSlider setDoubleValue: logarithmicToLinear(originalVolume)];
[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
if (playbackStatus == kCogStatusFading)
return;
@ -351,7 +356,7 @@
{
BOOL found = NO;
NSNumber *index = (NSNumber *)[[playlistController currentEntry] index];
int index = [[playlistController currentEntry] index];
NSString *origAlbum = [[playlistController currentEntry] album];
int i;
@ -361,10 +366,9 @@
for (i = 1; i < [[playlistController arrangedObjects] count]; i++)
{
pe = [playlistController entryAtIndex:[index intValue] + i];
if (pe == nil) {
pe = [playlistController entryAtIndex:index + i];
if (pe == nil)
break;
}
curAlbum = [pe album];
@ -385,7 +389,7 @@
if (found)
{
[self playEntryAtIndex:i + [index intValue]];
[self playEntryAtIndex:i + index];
}
}
@ -394,7 +398,7 @@
BOOL found = NO;
BOOL foundAlbum = NO;
NSNumber *index = (NSNumber *)[[playlistController currentEntry] index];
int index = [[playlistController currentEntry] index];
NSString *origAlbum = [[playlistController currentEntry] album];
NSString *curAlbum;
@ -404,10 +408,10 @@
for (i = 1; i < [[playlistController arrangedObjects] count]; i++)
{
pe = [playlistController entryAtIndex:[index intValue] - i];
if (pe == nil) {
pe = [playlistController entryAtIndex:index - i];
if (pe == nil)
break;
}
curAlbum = [pe album];
if (curAlbum == nil)
{
@ -437,7 +441,7 @@
{
if (foundAlbum == YES)
i--;
[self playEntryAtIndex:[index intValue] - i];
[self playEntryAtIndex:index - i];
}
}
@ -571,10 +575,10 @@
{
SEL action = [menuItem action];
if (action == @selector(seekBackward:) && (playbackStatus == kCogStatusStopped))
if (action == @selector(eventSeekBackward:) && (playbackStatus == kCogStatusStopped))
return NO;
if (action == @selector(seekForward:) && (playbackStatus == kCogStatusStopped))
if (action == @selector(eventSeekForward:) && (playbackStatus == kCogStatusStopped))
return NO;
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
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,
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
start or end of it (in Repeat All mode)
Repeat Album isn't implemented.
Menu items do not transform into "Hide Spotlight Panel" and
"Hide File Drawer" when they are active.
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

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

View File

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