Release No. 1.1
Added Auto-Lyrics Improved the preferences window
This commit is contained in:
@@ -5,19 +5,47 @@
|
||||
// Created by Kim Wittenburg on 14.06.12.
|
||||
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
//TODO: Implement Auto-Lyricds Interval
|
||||
//TODO: Set the title of the window when the toolbar button selection changed
|
||||
|
||||
#import "PreferencesController.h"
|
||||
|
||||
@implementation PreferencesController {
|
||||
NSMutableArray *hosters;
|
||||
AutoLyrics *autoLyrics;
|
||||
}
|
||||
@synthesize generalView;
|
||||
@synthesize autoLyricsView;
|
||||
@synthesize toggleAutoLyricsButton;
|
||||
@synthesize replaceOldCheckBox;
|
||||
@synthesize preferencesWindow;
|
||||
@synthesize generalButton;
|
||||
@synthesize hosterTable;
|
||||
|
||||
-(id)init {
|
||||
autoLyrics = [AutoLyrics autoLyrics];
|
||||
hosters = [[NSMutableArray alloc] init];
|
||||
return [super init];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Window Delegate Methods
|
||||
|
||||
-(void)awakeFromNib {
|
||||
if ([autoLyrics enabled]) {
|
||||
[self enableAutoLyrics:toggleAutoLyricsButton];
|
||||
} else {
|
||||
[self disableAutoLyrics:toggleAutoLyricsButton];
|
||||
}
|
||||
if ([autoLyrics replaceOldLyrics]) {
|
||||
[replaceOldCheckBox setState:NSOnState];
|
||||
} else {
|
||||
[replaceOldCheckBox setState:NSOffState];
|
||||
}
|
||||
[[preferencesWindow toolbar] setSelectedItemIdentifier:@"general"];
|
||||
[self showGeneralPreferences:nil];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Properties
|
||||
|
||||
@@ -42,6 +70,45 @@
|
||||
[hosterTable reloadData];
|
||||
}
|
||||
|
||||
- (IBAction)showGeneralPreferences:(id)sender {
|
||||
[self changeContentViewTo:generalView];
|
||||
}
|
||||
|
||||
-(IBAction)showAutoLyricsPreferences:(id)sender {
|
||||
[self changeContentViewTo:autoLyricsView];
|
||||
}
|
||||
|
||||
- (IBAction)toggleAutoLyrics:(id)sender {
|
||||
if ([autoLyrics enabled]) {
|
||||
[self disableAutoLyrics:sender];
|
||||
} else {
|
||||
[self enableAutoLyrics:sender];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)enableAutoLyrics: (id) sender{
|
||||
[autoLyrics setEnabled:YES];
|
||||
[sender setTitle:NSLocalizedString(@"iLyrics.text.disableAutoLyrics", @"")];
|
||||
}
|
||||
|
||||
-(void)disableAutoLyrics: (id) sender {
|
||||
[autoLyrics setEnabled:NO];
|
||||
[sender setTitle:NSLocalizedString(@"iLyrics.text.enableAutoLyrics", @"")];
|
||||
}
|
||||
|
||||
- (IBAction)changeAutoLyricsInterval:(id)sender {
|
||||
NSLog(@"%i", [sender intValue]);
|
||||
}
|
||||
|
||||
- (IBAction)toggleReplaceOldLyrics:(id)sender {
|
||||
[autoLyrics setReplaceOldLyrics:[sender state] == NSOnState];
|
||||
}
|
||||
|
||||
- (void)changeContentViewTo: (NSView *)view {
|
||||
[preferencesWindow setContentView:view];
|
||||
//[preferencesWindow setFrame:[view frame] display:YES animate:YES];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Table Data Source
|
||||
-(NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
|
||||
@@ -57,7 +124,6 @@
|
||||
[dateFormatter setDateStyle:NSDateFormatterLongStyle];
|
||||
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
|
||||
return [dateFormatter stringFromDate:version];
|
||||
// return desc == nil ? NSLocalizedString(@"iLyrics.text.illegalDateFormat", @"") : desc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user