diff --git a/Application/AppController.h b/Application/AppController.h index e92e04d36..cdf0be4c1 100644 --- a/Application/AppController.h +++ b/Application/AppController.h @@ -45,6 +45,7 @@ NDHotKeyEvent *playHotKey; NDHotKeyEvent *prevHotKey; NDHotKeyEvent *nextHotKey; + NDHotKeyEvent *spamHotKey; AppleRemote *remote; BOOL remoteButtonHeld; /* true as long as the user holds the left,right,plus or minus on the remote control */ @@ -78,6 +79,7 @@ OSStatus handleHotKey(EventHandlerCallRef nextHandler,EventRef theEvent,void *us - (void)clickPlay; - (void)clickPrev; - (void)clickNext; +- (void)clickSpam; - (IBAction)increaseFontSize:(id)sender; - (IBAction)decreaseFontSize:(id)sender; diff --git a/Application/AppController.m b/Application/AppController.m index 896bb6bb0..116c5763c 100644 --- a/Application/AppController.m +++ b/Application/AppController.m @@ -358,6 +358,19 @@ increase/decrease as long as the user holds the left/right, plus/minus button */ [userDefaultsValuesDict setObject:@"enqueue" forKey:@"openingFilesAlteredBehavior"]; [userDefaultsValuesDict setObject:@"albumGainWithPeak" forKey:@"volumeScaling"]; + + [userDefaultsValuesDict setObject:[NSNumber numberWithInt:0] forKey:@"hotKeyPlayKeyCode"]; + [userDefaultsValuesDict setObject:[NSNumber numberWithInt:0] forKey:@"hotKeyPlayCharacter"]; + [userDefaultsValuesDict setObject:[NSNumber numberWithInt:0] forKey:@"hotKeyPlayModifiers"]; + [userDefaultsValuesDict setObject:[NSNumber numberWithInt:0] forKey:@"hotKeyNextKeyCode"]; + [userDefaultsValuesDict setObject:[NSNumber numberWithInt:0] forKey:@"hotKeyNextCharacter"]; + [userDefaultsValuesDict setObject:[NSNumber numberWithInt:0] forKey:@"hotKeyNextModifiers"]; + [userDefaultsValuesDict setObject:[NSNumber numberWithInt:0] forKey:@"hotKeyPreviousKeyCode"]; + [userDefaultsValuesDict setObject:[NSNumber numberWithInt:0] forKey:@"hotKeyPreviousCharacter"]; + [userDefaultsValuesDict setObject:[NSNumber numberWithInt:0] forKey:@"hotKeyPreviousModifiers"]; + [userDefaultsValuesDict setObject:[NSNumber numberWithInt:0] forKey:@"hotKeySpamKeyCode"]; + [userDefaultsValuesDict setObject:[NSNumber numberWithInt:0] forKey:@"hotKeySpamCharacter"]; + [userDefaultsValuesDict setObject:[NSNumber numberWithInt:0] forKey:@"hotKeySpamModifiers"]; //Register and sync defaults [[NSUserDefaults standardUserDefaults] registerDefaults:userDefaultsValuesDict]; @@ -367,6 +380,8 @@ increase/decrease as long as the user holds the left/right, plus/minus button */ [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.hotKeyPlayKeyCode" options:0 context:nil]; [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.hotKeyPreviousKeyCode" options:0 context:nil]; [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.hotKeyNextKeyCode" options:0 context:nil]; + [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self + forKeyPath:@"values.hotKeySpamKeyCode" options:0 context:nil]; [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.remoteEnabled" options:0 context:nil]; [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.remoteOnlyOnActive" options:0 context:nil]; @@ -386,6 +401,9 @@ increase/decrease as long as the user holds the left/right, plus/minus button */ else if ([keyPath isEqualToString:@"values.hotKeyNextKeyCode"]) { [self registerHotKeys]; } + else if ([keyPath isEqualToString:@"values.hotKeySpamKeyCode"]) { + [self registerHotKeys]; + } else if ([keyPath isEqualToString:@"values.remoteEnabled"] || [keyPath isEqualToString:@"values.remoteOnlyOnActive"]) { if([[NSUserDefaults standardUserDefaults] boolForKey:@"remoteEnabled"]) { BOOL onlyOnActive = [[NSUserDefaults standardUserDefaults] boolForKey:@"remoteOnlyOnActive"]; @@ -405,33 +423,48 @@ increase/decrease as long as the user holds the left/right, plus/minus button */ - (void)registerHotKeys { [playHotKey release]; + if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayKeyCode"] intValue]) { playHotKey = [[NDHotKeyEvent alloc] initWithKeyCode: [[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayKeyCode"] intValue] character: [[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayCharacter"] intValue] modifierFlags: [[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPlayModifiers"] intValue] ]; + [playHotKey setTarget:self selector:@selector(clickPlay)]; + [playHotKey setEnabled:YES]; + } [prevHotKey release]; + if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyPreviousKeyCode"] intValue]) { prevHotKey = [[NDHotKeyEvent alloc] initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousKeyCode"] character: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousCharacter"] modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPreviousModifiers"] ]; + [prevHotKey setTarget:self selector:@selector(clickPrev)]; + [prevHotKey setEnabled:YES]; + } [nextHotKey release]; + if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeyNextKeyCode"] intValue]) { nextHotKey = [[NDHotKeyEvent alloc] initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyNextKeyCode"] character: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyNextCharacter"] modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyNextModifiers"] ]; - - [playHotKey setTarget:self selector:@selector(clickPlay)]; - [prevHotKey setTarget:self selector:@selector(clickPrev)]; - [nextHotKey setTarget:self selector:@selector(clickNext)]; - - [playHotKey setEnabled:YES]; - [prevHotKey setEnabled:YES]; - [nextHotKey setEnabled:YES]; + [nextHotKey setTarget:self selector:@selector(clickNext)]; + [nextHotKey setEnabled:YES]; + } + + [spamHotKey release]; + if ([[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"hotKeySpamKeyCode"] intValue]) { + spamHotKey = [[NDHotKeyEvent alloc] + initWithKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeySpamKeyCode"] + character: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeySpamCharacter"] + modifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeySpamModifiers"] + ]; + [spamHotKey setTarget:self selector:@selector(clickSpam)]; + [spamHotKey setEnabled:YES]; + } } - (void)clickPlay @@ -449,6 +482,11 @@ increase/decrease as long as the user holds the left/right, plus/minus button */ [playbackController next:nil]; } +- (void)clickSpam +{ + [playbackController spam]; +} + - (void)changeFontSize:(float)size { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; diff --git a/Application/PlaybackController.h b/Application/PlaybackController.h index 830466f42..a9871c9a9 100644 --- a/Application/PlaybackController.h +++ b/Application/PlaybackController.h @@ -63,6 +63,8 @@ extern NSDictionary * makeRGInfo(PlaylistEntry *pe); - (void)seekBackward:(double)amount; - (IBAction)fade:(id)sender; +- (IBAction)spam; + - (void)initDefaults; - (void)audioFadeDown:(NSTimer *)audioTimer; - (void)audioFadeUp:(NSTimer *)audioTimer; diff --git a/Application/PlaybackController.m b/Application/PlaybackController.m index 2391562fa..c1df6b290 100644 --- a/Application/PlaybackController.m +++ b/Application/PlaybackController.m @@ -170,6 +170,8 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe) double pos = [audioPlayer amountPlayed]; [self setPosition:pos]; + + [[playlistController currentEntry] setCurrentPosition:pos]; } - (IBAction)seek:(id)sender @@ -177,7 +179,17 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe) double time = [sender doubleValue]; [audioPlayer seekToTime:time]; - + + [[playlistController currentEntry] setCurrentPosition:time]; +} + +- (IBAction)spam +{ + NSPasteboard *pboard = [NSPasteboard generalPasteboard]; + + [pboard clearContents]; + + [pboard writeObjects:[NSArray arrayWithObjects:[[playlistController currentEntry] spam], nil]]; } - (IBAction)eventSeekForward:(id)sender @@ -514,6 +526,8 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe) - (void)setPosition:(double)p { position = p; + + [[playlistController currentEntry] setCurrentPosition:p]; } - (double)position diff --git a/English.lproj/Localizable.strings b/English.lproj/Localizable.strings index 5f9b39da6..a26aac07c 100644 --- a/English.lproj/Localizable.strings +++ b/English.lproj/Localizable.strings @@ -18,6 +18,9 @@ "RepeatButtonTooltip" = "Repeat mode"; "FileButtonTooltip" = "File drawer"; +"replayGainAlbumGain" = "The volume level of playback output will be detected through enumeration, \ + re"; + "InvalidURLShort" = "Invalid URL"; "InvalidURLLong" = "The URL is not valid."; diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index d5b0ce217..02d999ece 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -68,12 +68,12 @@ - + @@ -82,7 +82,7 @@ - + @@ -109,12 +109,12 @@ - + @@ -131,12 +131,12 @@ - + @@ -153,12 +153,12 @@ - + @@ -174,12 +174,12 @@ - + @@ -195,8 +195,8 @@ - + @@ -213,8 +213,8 @@ - + @@ -230,8 +230,8 @@ - + @@ -333,6 +333,12 @@ + + + All + (title contains[cd] $value) OR (artist contains[cd] $value) OR (album contains[cd] $value) OR (genre contains[cd] $value) + + Title @@ -347,26 +353,20 @@ - - artist contains[cd] $value + artist contains[cd] $value Album + - - genre contains[cd] $value + genre contains[cd] $value Genre - - - - - All - (title contains[cd] $value) OR (artist contains[cd] $value) OR (album contains[cd] $value) OR (genre contains[cd] $value) + @@ -383,7 +383,7 @@ - + @@ -408,13 +408,13 @@ - + @@ -572,14 +572,14 @@ - + - + - + @@ -601,9 +601,9 @@ - + @@ -685,7 +685,7 @@ + - + @@ -63,8 +75,20 @@ + + + + + + + + + + + + - + @@ -76,34 +100,34 @@ - + - + - + - + - + - + - + @@ -127,6 +151,15 @@ + + + + + + + + + diff --git a/Preferences/General/HotKeyPane.h b/Preferences/General/HotKeyPane.h index 1a7084024..bd131235c 100644 --- a/Preferences/General/HotKeyPane.h +++ b/Preferences/General/HotKeyPane.h @@ -14,11 +14,13 @@ IBOutlet HotKeyControl *playHotKeyControl; IBOutlet HotKeyControl *prevHotKeyControl; IBOutlet HotKeyControl *nextHotKeyControl; + IBOutlet HotKeyControl *spamHotKeyControl; } - (IBAction) grabPlayHotKey:(id)sender; - (IBAction) grabPrevHotKey:(id)sender; - (IBAction) grabNextHotKey:(id)sender; +- (IBAction) grabSpamHotKey:(id)sender; - (IBAction) hotKeyChanged:(id)sender; diff --git a/Preferences/General/HotKeyPane.m b/Preferences/General/HotKeyPane.m index 4d0e58d49..818ae8c74 100644 --- a/Preferences/General/HotKeyPane.m +++ b/Preferences/General/HotKeyPane.m @@ -33,6 +33,12 @@ [playHotKeyControl setModifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeyPlayModifiers"] ]; [playHotKeyControl updateStringValue]; + + [spamHotKeyControl setKeyCode: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeySpamKeyCode"] ]; + [spamHotKeyControl setCharacter: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeySpamCharacter"] ]; + [spamHotKeyControl setModifierFlags: [[NSUserDefaults standardUserDefaults] integerForKey:@"hotKeySpamModifiers"] ]; + + [spamHotKeyControl updateStringValue]; } - (NSString *)title @@ -60,6 +66,7 @@ [playHotKeyControl stopObserving]; [prevHotKeyControl stopObserving]; [nextHotKeyControl stopObserving]; + [spamHotKeyControl stopObserving]; } } @@ -78,6 +85,11 @@ [nextHotKeyControl startObserving]; } +- (IBAction) grabSpamHotKey:(id)sender +{ + [spamHotKeyControl startObserving]; +} + - (IBAction) hotKeyChanged:(id)sender { if (sender == playHotKeyControl) { @@ -95,6 +107,11 @@ [[NSUserDefaults standardUserDefaults] setInteger:[nextHotKeyControl modifierFlags] forKey:@"hotKeyNextModifiers"]; [[NSUserDefaults standardUserDefaults] setInteger:[nextHotKeyControl keyCode] forKey:@"hotKeyNextKeyCode"]; } + else if (sender == spamHotKeyControl) { + [[NSUserDefaults standardUserDefaults] setInteger:[spamHotKeyControl character] forKey:@"hotKeySpamCharacter"]; + [[NSUserDefaults standardUserDefaults] setInteger:[spamHotKeyControl modifierFlags] forKey:@"hotKeySpamModifiers"]; + [[NSUserDefaults standardUserDefaults] setInteger:[spamHotKeyControl keyCode] forKey:@"hotKeySpamKeyCode"]; + } [sender stopObserving]; }