Added status column with playing and queued status support.

CQTexperiment
vspader 2008-02-22 02:19:46 +00:00
parent 184525a47a
commit fe331624f5
7 changed files with 2562 additions and 2487 deletions

View File

@ -10,6 +10,7 @@
07E18DF30D62B38400BB0E11 /* NSArray+ShuffleUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 07E18DF20D62B38400BB0E11 /* NSArray+ShuffleUtils.m */; };
170680630B950158006BA573 /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 170680620B950158006BA573 /* Growl.framework */; };
170680840B950164006BA573 /* Growl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 170680620B950158006BA573 /* Growl.framework */; };
170B55940D6E5E7B006B9E92 /* StatusImageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 170B55930D6E5E7B006B9E92 /* StatusImageTransformer.m */; };
171192BD0D691ED600FD76C5 /* PathWatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 171192BC0D691ED600FD76C5 /* PathWatcher.m */; };
171B57DD0C091F2B00F6AFAF /* flac.icns in Resources */ = {isa = PBXBuildFile; fileRef = 171B57D90C091F2B00F6AFAF /* flac.icns */; };
171B57DE0C091F2B00F6AFAF /* m4a.icns in Resources */ = {isa = PBXBuildFile; fileRef = 171B57DA0C091F2B00F6AFAF /* m4a.icns */; };
@ -474,6 +475,8 @@
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
1705F1420B8BCB0C00C8B40D /* English */ = {isa = PBXFileReference; lastKnownFileType = folder; name = English; path = English.lproj/Help; sourceTree = "<group>"; };
170680620B950158006BA573 /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Growl.framework; path = ThirdParty/Frameworks/Growl.framework; sourceTree = "<group>"; };
170B55920D6E5E7B006B9E92 /* StatusImageTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatusImageTransformer.h; sourceTree = "<group>"; };
170B55930D6E5E7B006B9E92 /* StatusImageTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatusImageTransformer.m; sourceTree = "<group>"; };
171192BB0D691ED600FD76C5 /* PathWatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PathWatcher.h; sourceTree = "<group>"; };
171192BC0D691ED600FD76C5 /* PathWatcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PathWatcher.m; sourceTree = "<group>"; };
171B57D90C091F2B00F6AFAF /* flac.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = flac.icns; sourceTree = "<group>"; };
@ -1211,6 +1214,8 @@
173428F40D5FB1C400E8D854 /* EntriesController.m */,
17A8F6350D6A7B0F0095DA13 /* RepeatTransformers.h */,
17A8F6360D6A7B0F0095DA13 /* RepeatTransformers.m */,
170B55920D6E5E7B006B9E92 /* StatusImageTransformer.h */,
170B55930D6E5E7B006B9E92 /* StatusImageTransformer.m */,
);
path = Playlist;
sourceTree = "<group>";
@ -1674,6 +1679,7 @@
56AE86C10D6901BC00B0F89B /* FontSizetoLineHeightTransformer.m in Sources */,
171192BD0D691ED600FD76C5 /* PathWatcher.m in Sources */,
17A8F6370D6A7B0F0095DA13 /* RepeatTransformers.m in Sources */,
170B55940D6E5E7B006B9E92 /* StatusImageTransformer.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

File diff suppressed because it is too large Load Diff

View File

@ -14,5 +14,4 @@ Repeat Album isn't implemented.
Menu items do not transform into "Hide Spotlight Panel" and
"Hide File Drawer" when they are active.
mp3 bitrate is a tad off.
I anticipate that status should be flag based so statuses are not mutually exclusive.

View File

@ -12,6 +12,8 @@
#import "Shuffle.h"
#import "SpotlightWindowController.h"
#import "RepeatTransformers.h"
#import "StatusImageTransformer.h"
#import "CogAudio/AudioPlayer.h"
@implementation PlaylistController
@ -38,6 +40,10 @@
NSValueTransformer *repeatModeImageTransformer = [[[RepeatModeImageTransformer alloc] init] autorelease];
[NSValueTransformer setValueTransformer:repeatModeImageTransformer
forName:@"RepeatModeImageTransformer"];
NSValueTransformer *statusImageTransformer = [[[StatusImageTransformer alloc] init] autorelease];
[NSValueTransformer setValueTransformer:statusImageTransformer
forName:@"StatusImageTransformer"];
}
- (id)initWithCoder:(NSCoder *)decoder
@ -70,6 +76,12 @@
[self updateIndexesFromRow:0];
}
- (NSString *)tableView:(NSTableView *)tv toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tc row:(int)row mouseLocation:(NSPoint)mouseLocation
{
NSLog(@"GETTING STATUS FOR ROW: %i: %@!", row, [[[self arrangedObjects] objectAtIndex:row] statusMessage]);
return [[[self arrangedObjects] objectAtIndex:row] statusMessage];
}
-(void)moveObjectsFromArrangedObjectIndexes:(NSArray *) sources toIndexes:(NSArray *)destinations
{
[super moveObjectsFromArrangedObjectIndexes:sources toIndexes:destinations];
@ -380,6 +392,16 @@
pe = [queueList objectAtIndex:0];
[queueList removeObjectAtIndex:0];
[pe setStatus:[NSNumber numberWithInteger:kCogEntryNormal]];
[pe setStatusMessage:nil];
int i;
for (i = 0; i < [queueList count]; i++)
{
PlaylistEntry *queueItem = [queueList objectAtIndex:i];
[queueItem setStatusMessage:[NSString stringWithFormat:@"Queued: %i", i+1]];
}
return pe;
}
@ -541,9 +563,12 @@
- (void)setCurrentEntry:(PlaylistEntry *)pe
{
[currentEntry setCurrent:[NSNumber numberWithBool:NO]];
[currentEntry setStatus:[NSNumber numberWithInteger:kCogEntryNormal]];
[currentEntry setStatusMessage:nil];
[pe setStatus:[NSNumber numberWithInteger:kCogEntryPlaying]];
[pe setStatusMessage:@"Playing..."];
[pe setCurrent:[NSNumber numberWithBool:YES]];
[tableView scrollRowToVisible:[[pe index] intValue]];
[pe retain];
@ -627,7 +652,12 @@
- (IBAction)addToQueue:(id)sender
{
for (PlaylistEntry *queueItem in [self selectedObjects])
{
[queueItem setStatus: [NSNumber numberWithInteger:kCogEntryQueued]];
[queueItem setStatusMessage: [NSString stringWithFormat:@"Queued: %i", [queueList count] + 1]];
[queueList addObject:queueItem];
}
}
@end

View File

@ -8,10 +8,19 @@
#import <Cocoa/Cocoa.h>
typedef enum {
kCogEntryNormal = 0,
kCogEntryPlaying,
kCogEntryError,
kCogEntryQueued,
kCogEntryRemoved
} PlaylistEntryStatus;
@interface PlaylistEntry : NSObject {
NSNumber *index;
NSNumber *shuffleIndex;
NSNumber *current;
NSNumber *status;
NSString *statusMessage;
NSURL *URL;
@ -43,7 +52,8 @@
@property(retain) NSNumber *index;
@property(retain) NSNumber *shuffleIndex;
@property(retain) NSNumber *current;
@property(retain) NSNumber *status;
@property(retain) NSString *statusMessage;;
@property(retain) NSURL *URL;

View File

@ -14,7 +14,8 @@
@synthesize index;
@synthesize shuffleIndex;
@synthesize current;
@synthesize status;
@synthesize statusMessage;
@synthesize URL;

View File

@ -36,11 +36,13 @@
for(NSTableColumn *col in [self tableColumns]) {
[[col dataCell] setControlSize:s];
[[col dataCell] setFont:f];
if ([[col dataCell] respondsToSelector:@selector(setFontSize:)]) {
[col bind:@"fontSize"
toObject:[NSUserDefaultsController sharedUserDefaultsController]
withKeyPath:@"values.fontSize"
options:nil];
}
}
NSTableHeaderView *currentTableHeaderView = [self headerView];
PlaylistHeaderView *customTableHeaderView = [[PlaylistHeaderView alloc] init];