-/*
-Things to do:
-¥ Make preferences window pretty
-¥ Optimize
-¥ Apple Events! Apple Events! Apple Events!
-¥ Manual and webpage
-¥ Finish up registration frontend
-*/
-
#import "MenuTunes.h"
#import "PreferencesController.h"
#import "HotKeyCenter.h"
menu = [[NSMenu alloc] initWithTitle:@""];
- if ([currentRemote isAppRunning]) {
+ if ( ( [currentRemote remotePlayerStatus] == ITMTRemotePlayerRunning ) ) {
[self remotePlayerLaunched:nil];
} else {
[self remotePlayerTerminated:nil];
NSMenuItem *menuItem;
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
- if (!isAppRunning) {
+ if ( ( isAppRunning = ITMTRemotePlayerNotRunning ) ) {
return;
}
- (void)rebuildEQPresetsMenu
{
NSArray *eqPresets = [currentRemote eqPresets];
+ NSMenuItem *enabledItem;
int i;
if (eqMenu && ([[currentRemote eqPresets] count] == [eqMenu numberOfItems]))
[eqMenu release];
eqMenu = [[NSMenu alloc] initWithTitle:@""];
+ enabledItem = [eqMenu addItemWithTitle:@"EQ Enabled"
+ action:NULL
+ keyEquivalent:@""];
+ [eqMenu addItem:[NSMenuItem separatorItem]];
+
for (i = 0; i < [eqPresets count]; i++) {
NSString *setName = [eqPresets objectAtIndex:i];
NSMenuItem *tempItem;
}
[eqItem setSubmenu:eqMenu];
- [[eqMenu itemAtIndex:[currentRemote currentEQPresetIndex] - 1] setState:NSOnState];
+ [[eqMenu itemAtIndex:[currentRemote currentEQPresetIndex] + 1] setState:NSOnState];
}
- (void)clearHotKeys
- (void)remotePlayerLaunched:(NSNotification *)note
{
- isAppRunning = YES;
+ isAppRunning = ITMTRemotePlayerRunning;
//Restart the timer
refreshTimer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(timerUpdate) userInfo:nil repeats:YES];
[self rebuildMenu]; //Rebuild the menu since no songs will be playing
- [self rebuildPlaylistMenu];
+ if (playlistItem) {
+ [self rebuildPlaylistMenu];
+ }
+ if (eqItem) {
+ [self rebuildEQPresetsMenu];
+ }
[statusItem setMenu:menu]; //Set the menu back to the main one
}
- (void)remotePlayerTerminated:(NSNotification *)note
{
- isAppRunning = NO;
+ isAppRunning = ITMTRemotePlayerNotRunning;
[menu release];
menu = [[NSMenu alloc] initWithTitle:@""];
- (void)setSongRating:(id)sender
{
- //[currentRemote setCurrentSongRating:[sender tag]];
+ NSLog(@"%f", (float)[sender tag] / 100.0);
+ [currentRemote setCurrentSongRating:(float)[sender tag] / 100.0];
}
//
- (void)closePreferences
{
- if (isAppRunning) {
+ if ( ( isAppRunning == ITMTRemotePlayerRunning) ) {
[self setupHotKeys];
}
[prefsController release];