Added seeking menu entries, validation of Control menu entries, updated KnownIssues
parent
299285f0cd
commit
64f0a25a52
|
@ -236,11 +236,10 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
|
||||||
[remote startListening:self];
|
[remote startListening:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSUndoManager *undoManager = [playlistController undoManager];
|
[[playlistController undoManager] disableUndoRegistration];
|
||||||
[undoManager disableUndoRegistration];
|
|
||||||
NSString *filename = @"~/Library/Application Support/Cog/Default.m3u";
|
NSString *filename = @"~/Library/Application Support/Cog/Default.m3u";
|
||||||
[playlistLoader addURL:[NSURL fileURLWithPath:[filename stringByExpandingTildeInPath]]];
|
[playlistLoader addURL:[NSURL fileURLWithPath:[filename stringByExpandingTildeInPath]]];
|
||||||
[undoManager enableUndoRegistration];
|
[[playlistController undoManager] enableUndoRegistration];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillTerminate:(NSNotification *)aNotification
|
- (void)applicationWillTerminate:(NSNotification *)aNotification
|
||||||
|
|
|
@ -66,4 +66,6 @@
|
||||||
- (void)playEntryAtIndex:(int)i;
|
- (void)playEntryAtIndex:(int)i;
|
||||||
- (void)playEntry:(PlaylistEntry *)pe;
|
- (void)playEntry:(PlaylistEntry *)pe;
|
||||||
|
|
||||||
|
- (int)status;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
@implementation PlaybackController
|
@implementation PlaybackController
|
||||||
|
|
||||||
|
#define DEFAULT_SEEK 10
|
||||||
|
|
||||||
- (id)init
|
- (id)init
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
@ -196,38 +198,38 @@
|
||||||
|
|
||||||
- (IBAction)seekForward:(id)sender
|
- (IBAction)seekForward:(id)sender
|
||||||
{
|
{
|
||||||
double time;
|
double seekTo = [audioPlayer amountPlayed] + DEFAULT_SEEK;
|
||||||
time = [audioPlayer amountPlayed];
|
|
||||||
|
if (seekTo > (int)[positionSlider maxValue])
|
||||||
if ((time + 10) > (int)[positionSlider maxValue])
|
|
||||||
{
|
{
|
||||||
[self next:self];
|
[self next:self];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[audioPlayer seekToTime:time + 10];
|
[audioPlayer seekToTime:seekTo];
|
||||||
[self updateTimeField:time + 10];
|
[self updateTimeField:seekTo];
|
||||||
|
[positionSlider setDoubleValue:seekTo];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)seekBackward:(id)sender
|
- (IBAction)seekBackward:(id)sender
|
||||||
{
|
{
|
||||||
double time;
|
double seekTo = [audioPlayer amountPlayed] - DEFAULT_SEEK;
|
||||||
time = [audioPlayer amountPlayed];
|
|
||||||
|
if (seekTo < 0)
|
||||||
if ((time - 10) < 0)
|
|
||||||
{
|
{
|
||||||
[audioPlayer seekToTime:0];
|
[audioPlayer seekToTime:0];
|
||||||
[self updateTimeField:0];
|
[self updateTimeField:0];
|
||||||
|
[positionSlider setDoubleValue:0.0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[audioPlayer seekToTime:time - 10];
|
[audioPlayer seekToTime:seekTo];
|
||||||
[self updateTimeField:time - 10];
|
[self updateTimeField:seekTo];
|
||||||
|
[positionSlider setDoubleValue:seekTo];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)changePlayButtonImage:(NSString *)name
|
- (void)changePlayButtonImage:(NSString *)name
|
||||||
{
|
{
|
||||||
NSImage *img = [NSImage imageNamed:name];
|
NSImage *img = [NSImage imageNamed:name];
|
||||||
|
@ -360,6 +362,10 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (int)status
|
||||||
|
{
|
||||||
|
return playbackStatus;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)audioPlayer:(AudioPlayer *)player statusChanged:(id)s
|
- (void)audioPlayer:(AudioPlayer *)player statusChanged:(id)s
|
||||||
{
|
{
|
||||||
|
@ -400,4 +406,22 @@
|
||||||
playbackStatus = status;
|
playbackStatus = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(BOOL)validateMenuItem:(NSMenuItem*)menuItem
|
||||||
|
{
|
||||||
|
SEL action = [menuItem action];
|
||||||
|
|
||||||
|
if (action == @selector(seekBackward:) && (playbackStatus == kCogStatusStopped))
|
||||||
|
return NO;
|
||||||
|
|
||||||
|
if (action == @selector(seekForward:) && (playbackStatus == kCogStatusStopped))
|
||||||
|
return NO;
|
||||||
|
|
||||||
|
if (action == @selector(stop:) && (playbackStatus == kCogStatusStopped))
|
||||||
|
return NO;
|
||||||
|
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -0,0 +1,4 @@
|
||||||
|
* Undo does not work for Playlist -> Clear
|
||||||
|
* UndoManager starts dropping old undo entries after 25 undos
|
||||||
|
on the stack. Memleak?
|
||||||
|
|
|
@ -200,14 +200,6 @@
|
||||||
{
|
{
|
||||||
[playlistController clearFilterPredicate:self];
|
[playlistController clearFilterPredicate:self];
|
||||||
}
|
}
|
||||||
else if (modifiers == NSControlKeyMask && c == 0xf703) // right arrow
|
|
||||||
{
|
|
||||||
[playbackController seekForward:self];
|
|
||||||
}
|
|
||||||
else if (modifiers == NSControlKeyMask && c == 0xf702) // left arrow
|
|
||||||
{
|
|
||||||
[playbackController seekBackward:self];
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[super keyDown:e];
|
[super keyDown:e];
|
||||||
|
|
Loading…
Reference in New Issue