Performance improvements for the status column.
parent
e58c172eeb
commit
c31eae4541
|
@ -217,21 +217,6 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
|
|||
return [key isEqualToString:@"currentEntry"] || [key isEqualToString:@"play"];
|
||||
}
|
||||
|
||||
- (void)initShowColumn:(NSMenuItem *)showColumn withIdentifier:(NSString *)identifier
|
||||
{
|
||||
id tc = [playlistView tableColumnWithIdentifier:identifier];
|
||||
|
||||
|
||||
if ([tc isHidden]) {
|
||||
[showColumn setState:NSOffState];
|
||||
}
|
||||
else {
|
||||
[showColumn setState:NSOnState];
|
||||
}
|
||||
|
||||
[showColumn setRepresentedObject: tc];
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[mainWindow setExcludedFromWindowsMenu:YES];
|
||||
|
@ -247,15 +232,6 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
|
|||
[repeatButton setToolTip:NSLocalizedString(@"RepeatButtonTooltip", @"")];
|
||||
[fileButton setToolTip:NSLocalizedString(@"FileButtonTooltip", @"")];
|
||||
|
||||
[self initShowColumn: showIndexColumn withIdentifier: @"index"];
|
||||
[self initShowColumn: showTitleColumn withIdentifier: @"title"];
|
||||
[self initShowColumn: showArtistColumn withIdentifier: @"artist"];
|
||||
[self initShowColumn: showAlbumColumn withIdentifier: @"album"];
|
||||
[self initShowColumn: showGenreColumn withIdentifier: @"genre"];
|
||||
[self initShowColumn: showLengthColumn withIdentifier: @"length"];
|
||||
[self initShowColumn: showTrackColumn withIdentifier: @"track"];
|
||||
[self initShowColumn: showYearColumn withIdentifier: @"year"];
|
||||
|
||||
[self registerHotKeys];
|
||||
|
||||
[fileTreeWindowController init];
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -20,7 +20,6 @@
|
|||
|
||||
- (IBAction)sortByPath:(id)sender;
|
||||
- (IBAction)shufflePlaylist:(id)sender;
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)item;
|
||||
|
||||
- (IBAction)toggleColumn:(id)sender;
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
#import "PlaybackController.h"
|
||||
#import "PlaylistController.h"
|
||||
|
||||
#import "PlaylistHeaderView.h"
|
||||
|
||||
#import "IndexFormatter.h"
|
||||
#import "SecondsFormatter.h"
|
||||
#import "PlaylistEntry.h"
|
||||
|
@ -33,6 +31,7 @@
|
|||
toObject:[NSUserDefaultsController sharedUserDefaultsController]
|
||||
withKeyPath:@"values.fontSize"
|
||||
options:bindOptions];
|
||||
|
||||
for(NSTableColumn *col in [self tableColumns]) {
|
||||
[[col dataCell] setControlSize:s];
|
||||
[[col dataCell] setFont:f];
|
||||
|
@ -44,15 +43,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
NSTableHeaderView *currentTableHeaderView = [self headerView];
|
||||
PlaylistHeaderView *customTableHeaderView = [[PlaylistHeaderView alloc] init];
|
||||
|
||||
[customTableHeaderView setFrame:[currentTableHeaderView frame]];
|
||||
[customTableHeaderView setBounds:[currentTableHeaderView bounds]];
|
||||
// [self setColumnAutoresizingStyle:NSTableViewNoColumnAutoresizing];
|
||||
|
||||
[self setHeaderView:customTableHeaderView];
|
||||
|
||||
//Set up formatters
|
||||
NSFormatter *secondsFormatter = [[SecondsFormatter alloc] init];
|
||||
[[[self tableColumnWithIdentifier:@"length"] dataCell] setFormatter:secondsFormatter];
|
||||
|
|
|
@ -10,7 +10,13 @@
|
|||
|
||||
|
||||
@interface StatusImageTransformer : NSObject {
|
||||
|
||||
NSImage *playImage;
|
||||
NSImage *queueImage;
|
||||
NSImage *errorImage;
|
||||
}
|
||||
|
||||
@property(retain) NSImage *playImage;
|
||||
@property(retain) NSImage *queueImage;
|
||||
@property(retain) NSImage *errorImage;
|
||||
|
||||
@end
|
||||
|
|
|
@ -12,25 +12,39 @@
|
|||
|
||||
@implementation StatusImageTransformer
|
||||
|
||||
@synthesize playImage;
|
||||
@synthesize queueImage;
|
||||
@synthesize errorImage;
|
||||
|
||||
+ (Class)transformedValueClass { return [NSImage class]; }
|
||||
+ (BOOL)allowsReverseTransformation { return NO; }
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
self.playImage = [NSImage imageNamed:@"play"];
|
||||
self.queueImage = [NSImage imageNamed:@"NSAddTemplate"];
|
||||
self.errorImage = [NSImage imageNamed:@"NSStopProgressTemplate"];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
// Convert from string to RepeatMode
|
||||
- (id)transformedValue:(id)value {
|
||||
NSLog(@"Transforming value: %@", value);
|
||||
|
||||
if (value == nil) return nil;
|
||||
|
||||
PlaylistEntryStatus status = [value integerValue];
|
||||
NSLog(@"STATUS IS %i", status);
|
||||
if (status == kCogEntryPlaying) {
|
||||
return [NSImage imageNamed:@"play"];
|
||||
return self.playImage;
|
||||
}
|
||||
else if (status == kCogEntryQueued) {
|
||||
return [NSImage imageNamed:@"NSAddTemplate"];
|
||||
return self.queueImage;
|
||||
}
|
||||
else if (status == kCogEntryError) {
|
||||
return [NSImage imageNamed:@"NSStopProgressTemplate"];
|
||||
return self.errorImage;
|
||||
}
|
||||
|
||||
return nil;
|
||||
|
|
Loading…
Reference in New Issue