iLyrics functionality added Magistrix Lyrics Hoster added Release 1.0.1 Added Split View in Main Window Some little code changes
65 lines
1.7 KiB
Objective-C
65 lines
1.7 KiB
Objective-C
//
|
|
// PreferencesController.m
|
|
// iLyrics
|
|
//
|
|
// Created by Kim Wittenburg on 14.06.12.
|
|
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
|
//
|
|
|
|
#import "PreferencesController.h"
|
|
|
|
@implementation PreferencesController {
|
|
NSMutableArray *hosters;
|
|
}
|
|
@synthesize hosterTable;
|
|
|
|
-(id)init {
|
|
hosters = [[NSMutableArray alloc] init];
|
|
return [super init];
|
|
}
|
|
|
|
#pragma mark -
|
|
#pragma mark Properties
|
|
|
|
-(NSArray *)hosters {
|
|
return hosters;
|
|
}
|
|
|
|
-(void)setHosters:(NSArray *)hstrs {
|
|
hosters = [NSMutableArray arrayWithArray:hstrs];
|
|
[hosterTable reloadData];
|
|
}
|
|
|
|
#pragma mark Modifying hosters
|
|
|
|
-(void)addHoster:(id<LyricsHoster>)hoster {
|
|
[hosters addObject:hoster];
|
|
[hosterTable reloadData];
|
|
}
|
|
|
|
-(void)removeHoster:(id<LyricsHoster>)hoster {
|
|
[hosters removeObject:hoster];
|
|
[hosterTable reloadData];
|
|
}
|
|
|
|
#pragma mark -
|
|
#pragma mark Table Data Source
|
|
-(NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
|
|
return [hosters count];
|
|
}
|
|
|
|
-(id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
|
|
if ([[tableColumn identifier] isEqualToString:@"hoster"]) {
|
|
return [[hosters objectAtIndex:row] name];
|
|
} else {
|
|
NSDate *version = [[hosters objectAtIndex:row] hosterVersion];
|
|
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
|
[dateFormatter setDateStyle:NSDateFormatterLongStyle];
|
|
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
|
|
return [dateFormatter stringFromDate:version];
|
|
// return desc == nil ? NSLocalizedString(@"iLyrics.text.illegalDateFormat", @"") : desc;
|
|
}
|
|
}
|
|
|
|
@end
|