Release 1.0
iLyrics functionality added Magistrix Lyrics Hoster added Release 1.0.1 Added Split View in Main Window Some little code changes
This commit is contained in:
@@ -7,14 +7,95 @@
|
||||
//
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "Magistrix.h"
|
||||
|
||||
@implementation AppDelegate
|
||||
@implementation AppDelegate {
|
||||
iTunesApplication *iTunes;
|
||||
NSArray *keyTokens;
|
||||
NSMutableArray *searchFormat;
|
||||
Magistrix *magistrix;
|
||||
}
|
||||
|
||||
@synthesize window = _window;
|
||||
@synthesize window;
|
||||
@synthesize mainController;
|
||||
@synthesize preferencesWindow;
|
||||
@synthesize preferencesController;
|
||||
@synthesize quitWhenAllWindowClosedCheckBox;
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
||||
{
|
||||
// Insert code here to initialize your application
|
||||
magistrix = [[Magistrix alloc] init];
|
||||
[preferencesController addHoster:magistrix];
|
||||
keyTokens = [NSArray arrayWithObjects:@"%name%", @"%artist%", @"%album%", nil];
|
||||
[window setExcludedFromWindowsMenu:YES];
|
||||
iTunes = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"];
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
[quitWhenAllWindowClosedCheckBox setState:[defaults boolForKey:@"Quit when all windows are closed"]?NSOnState:NSOffState];
|
||||
[mainController loadFromDefaults:defaults];
|
||||
}
|
||||
|
||||
-(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
[defaults setBool:[quitWhenAllWindowClosedCheckBox state] == NSOnState forKey:@"Quit when all windows are closed"];
|
||||
[mainController saveToDefalts:defaults];
|
||||
[defaults synchronize];
|
||||
return NSTerminateNow;
|
||||
}
|
||||
|
||||
-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender {
|
||||
return [quitWhenAllWindowClosedCheckBox state] == NSOnState;
|
||||
}
|
||||
|
||||
-(BOOL)validateMenuItem:(NSMenuItem *)menuItem {
|
||||
SEL action = [menuItem action];
|
||||
if (action == @selector(runitunes:)) {
|
||||
return ![iTunes isRunning];
|
||||
}
|
||||
if (action == @selector(quitiTunes:) || action == @selector(playPauseiTunes:) || action == @selector(previousTrack:) || action == @selector(nextTrack:)) {
|
||||
return [iTunes isRunning];
|
||||
}
|
||||
return [self respondsToSelector:action];
|
||||
}
|
||||
/*
|
||||
- (IBAction)showPreferences:(id)sender {
|
||||
[searchFormatField setObjectValue:searchFormat];
|
||||
[preferencesWindow makeKeyAndOrderFront:sender];
|
||||
}
|
||||
|
||||
- (IBAction)searchFormatChanged:(id)sender {
|
||||
NSArray *tokens = [searchFormatField objectValue];
|
||||
[searchFormat removeAllObjects];
|
||||
[searchFormat addObjectsFromArray:tokens];
|
||||
}
|
||||
*/
|
||||
-(NSString *)searchFormat {
|
||||
NSMutableString *string = [[NSMutableString alloc] init];
|
||||
for (NSString *token in searchFormat) {
|
||||
[string appendString:token];
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
- (IBAction)runiTunes:(id)sender {
|
||||
[iTunes run];
|
||||
[window update];
|
||||
}
|
||||
|
||||
- (IBAction)quitiTunes:(id)sender {
|
||||
[iTunes quit];
|
||||
[window update];
|
||||
}
|
||||
|
||||
- (IBAction)playPauseiTunes:(id)sender {
|
||||
[iTunes playpause];
|
||||
[window update];
|
||||
}
|
||||
|
||||
- (IBAction)previousTrack:(id)sender {
|
||||
[iTunes previousTrack];
|
||||
}
|
||||
|
||||
- (IBAction)nextTrack:(id)sender {
|
||||
[iTunes nextTrack];
|
||||
}
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user