Some more cleaning up.

CQTexperiment
vspader 2008-02-20 00:12:25 +00:00
parent 76594c1062
commit 38e23ef442
2 changed files with 12 additions and 13 deletions

View File

@ -349,7 +349,7 @@
BOOL found = NO; BOOL found = NO;
NSNumber *index = (NSNumber *)[[playlistController currentEntry] index]; NSNumber *index = (NSNumber *)[[playlistController currentEntry] index];
NSString *origAlbum = [[playlistController entryAtIndex:[index intValue]] album]; NSString *origAlbum = [[playlistController currentEntry] album];
int playlistLength = [[playlistController arrangedObjects] count] - 1; int playlistLength = [[playlistController arrangedObjects] count] - 1;
int i = [index intValue] + 1; int i = [index intValue] + 1;
@ -390,7 +390,7 @@
BOOL foundAlbum = NO; BOOL foundAlbum = NO;
NSNumber *index = (NSNumber *)[[playlistController currentEntry] index]; NSNumber *index = (NSNumber *)[[playlistController currentEntry] index];
NSString *origAlbum = [[playlistController entryAtIndex:[index intValue]] album]; NSString *origAlbum = [[playlistController currentEntry] album];
NSString *curAlbum; NSString *curAlbum;
int i = [index intValue] - 1; int i = [index intValue] - 1;
@ -424,7 +424,7 @@
foundAlbum = YES; foundAlbum = YES;
// now we need to move up to the first song in the album, so we'll // now we need to move up to the first song in the album, so we'll
// go till we either find index 0, or the first song in the album // go till we either find index 0, or the first song in the album
origAlbum = [[playlistController entryAtIndex:i] album]; origAlbum = [[[playlistController arrangedObjects] objectAtIndex:i] album];
i--; i--;
} }
else else

View File

@ -328,14 +328,14 @@
{ {
if (i < 0) if (i < 0)
{ {
if (repeat == RepeatAll) if (repeat != RepeatNone)
i += [[self arrangedObjects] count]; i += [[self arrangedObjects] count];
else else
return nil; return nil;
} }
else if (i >= [[self arrangedObjects] count]) else if (i >= [[self arrangedObjects] count])
{ {
if (repeat == RepeatAll) if (repeat != RepeatNone)
i -= [[self arrangedObjects] count]; i -= [[self arrangedObjects] count];
else else
return nil; return nil;
@ -453,8 +453,6 @@
return YES; return YES;
} }
//Need to do...when first generated, need to have current entry at the beginning of the list.
- (void)addShuffledListToFront - (void)addShuffledListToFront
{ {
NSArray *newList = [Shuffle shuffleList:[self arrangedObjects]]; NSArray *newList = [Shuffle shuffleList:[self arrangedObjects]];
@ -489,7 +487,7 @@
[self addShuffledListToFront]; [self addShuffledListToFront];
if (currentEntry && [[currentEntry index] intValue] != -1) if (currentEntry && [[currentEntry index] intValue] >= 0)
{ {
[shuffleList insertObject:currentEntry atIndex:0]; [shuffleList insertObject:currentEntry atIndex:0];
[currentEntry setShuffleIndex:0]; [currentEntry setShuffleIndex:0];
@ -497,15 +495,16 @@
//Need to rejigger so the current entry is at the start now... //Need to rejigger so the current entry is at the start now...
int i; int i;
BOOL found = NO; BOOL found = NO;
for (i = 1; i < [shuffleList count]; i++) for (i = 1; i < [shuffleList count] && !found; i++)
{ {
if (found == NO && [[shuffleList objectAtIndex:i] url] == [currentEntry url]) if ([shuffleList objectAtIndex:i] == currentEntry)
{ {
found = YES; found = YES;
[shuffleList removeObjectAtIndex:i]; [shuffleList removeObjectAtIndex:i];
} }
else {
[[shuffleList objectAtIndex:i] setShuffleIndex:[NSNumber numberWithInt:i]]; [[shuffleList objectAtIndex:i] setShuffleIndex:[NSNumber numberWithInt:i]];
}
} }
} }
} }
@ -573,7 +572,7 @@
if ([self selectionIndex] < 0) if ([self selectionIndex] < 0)
return; return;
NSURL *url = [[self entryAtIndex:[self selectionIndex]] url]; NSURL *url = [[[self selectedObjects] objectAtIndex:0] url];
if ([url isFileURL]) if ([url isFileURL])
[ws selectFile:[url path] inFileViewerRootedAtPath:[url path]]; [ws selectFile:[url path] inFileViewerRootedAtPath:[url path]];
} }