Archived
1
This repository has been archived on 2022-08-08. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
ilyrics/iLyrics/PreferencesController.m
Kim Wittenburg e4fdd7e306 Release 1.0
iLyrics functionality added
Magistrix Lyrics Hoster added

Release 1.0.1
Added Split View in Main Window
Some little code changes
2012-06-16 16:29:56 +02:00

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