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];
|
||||
}
|
||||
|
||||
NSUndoManager *undoManager = [playlistController undoManager];
|
||||
[undoManager disableUndoRegistration];
|
||||
[[playlistController undoManager] disableUndoRegistration];
|
||||
NSString *filename = @"~/Library/Application Support/Cog/Default.m3u";
|
||||
[playlistLoader addURL:[NSURL fileURLWithPath:[filename stringByExpandingTildeInPath]]];
|
||||
[undoManager enableUndoRegistration];
|
||||
[[playlistController undoManager] enableUndoRegistration];
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)aNotification
|
||||
|
|
|
@ -66,4 +66,6 @@
|
|||
- (void)playEntryAtIndex:(int)i;
|
||||
- (void)playEntry:(PlaylistEntry *)pe;
|
||||
|
||||
- (int)status;
|
||||
|
||||
@end
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
@implementation PlaybackController
|
||||
|
||||
#define DEFAULT_SEEK 10
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
|
@ -196,38 +198,38 @@
|
|||
|
||||
- (IBAction)seekForward:(id)sender
|
||||
{
|
||||
double time;
|
||||
time = [audioPlayer amountPlayed];
|
||||
|
||||
if ((time + 10) > (int)[positionSlider maxValue])
|
||||
double seekTo = [audioPlayer amountPlayed] + DEFAULT_SEEK;
|
||||
|
||||
if (seekTo > (int)[positionSlider maxValue])
|
||||
{
|
||||
[self next:self];
|
||||
}
|
||||
else
|
||||
{
|
||||
[audioPlayer seekToTime:time + 10];
|
||||
[self updateTimeField:time + 10];
|
||||
[audioPlayer seekToTime:seekTo];
|
||||
[self updateTimeField:seekTo];
|
||||
[positionSlider setDoubleValue:seekTo];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)seekBackward:(id)sender
|
||||
{
|
||||
double time;
|
||||
time = [audioPlayer amountPlayed];
|
||||
|
||||
if ((time - 10) < 0)
|
||||
double seekTo = [audioPlayer amountPlayed] - DEFAULT_SEEK;
|
||||
|
||||
if (seekTo < 0)
|
||||
{
|
||||
[audioPlayer seekToTime:0];
|
||||
[self updateTimeField:0];
|
||||
[positionSlider setDoubleValue:0.0];
|
||||
}
|
||||
else
|
||||
{
|
||||
[audioPlayer seekToTime:time - 10];
|
||||
[self updateTimeField:time - 10];
|
||||
[audioPlayer seekToTime:seekTo];
|
||||
[self updateTimeField:seekTo];
|
||||
[positionSlider setDoubleValue:seekTo];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)changePlayButtonImage:(NSString *)name
|
||||
{
|
||||
NSImage *img = [NSImage imageNamed:name];
|
||||
|
@ -360,6 +362,10 @@
|
|||
|
||||
}
|
||||
|
||||
- (int)status
|
||||
{
|
||||
return playbackStatus;
|
||||
}
|
||||
|
||||
- (void)audioPlayer:(AudioPlayer *)player statusChanged:(id)s
|
||||
{
|
||||
|
@ -400,4 +406,22 @@
|
|||
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
|
||||
|
|
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];
|
||||
}
|
||||
else if (modifiers == NSControlKeyMask && c == 0xf703) // right arrow
|
||||
{
|
||||
[playbackController seekForward:self];
|
||||
}
|
||||
else if (modifiers == NSControlKeyMask && c == 0xf702) // left arrow
|
||||
{
|
||||
[playbackController seekBackward:self];
|
||||
}
|
||||
else
|
||||
{
|
||||
[super keyDown:e];
|
||||
|
|
Loading…
Reference in New Issue