+ } else if ( [sender tag] == 1040) {
+ // This will not be executed. Song info always shows the title of the song.
+ // [df setBool:SENDER_STATE forKey:@"showName"];
+ } else if ( [sender tag] == 1050) {
+ [df setBool:SENDER_STATE forKey:@"showArtist"];
+ } else if ( [sender tag] == 1055) {
+ [df setBool:SENDER_STATE forKey:@"showComposer"];
+ } else if ( [sender tag] == 1060) {
+ [df setBool:SENDER_STATE forKey:@"showAlbum"];
+ } else if ( [sender tag] == 1070) {
+ [df setBool:SENDER_STATE forKey:@"showTime"];
+ } else if ( [sender tag] == 1080) {
+ [df setBool:SENDER_STATE forKey:@"showTrackNumber"];
+ } else if ( [sender tag] == 1085) {
+ [df setBool:SENDER_STATE forKey:@"showPlayCount"];
+ } else if ( [sender tag] == 1090) {
+ [df setBool:SENDER_STATE forKey:@"showTrackRating"];
+ } else if ( [sender tag] == 1100) {
+ [df setBool:SENDER_STATE forKey:@"showAlbumArtwork"];
+ } else if ( [sender tag] == 1110) {
+ [df setBool:SENDER_STATE forKey:@"runScripts"];
+ if (SENDER_STATE) {
+ [runScriptsCheckbox setState:NSOnState];
+ [showScriptsButton setEnabled:YES];
+ } else {
+ [showScriptsButton setEnabled:NO];
+ }
+ } else if ( [sender tag] == 1120) {
+ mkdir([[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Application Support/MenuTunes/Scripts"] cString], 0744);
+ [[NSWorkspace sharedWorkspace] openFile:[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Application Support/MenuTunes/Scripts"]];
+ }
+ [df synchronize];
+}
+
+- (IBAction)changeSharingSetting:(id)sender
+{
+ ITDebugLog(@"Changing sharing setting of tag %i.", [sender tag]);
+ if ( [sender tag] == 5010 ) {
+ BOOL state = SENDER_STATE;
+ [df setBool:state forKey:@"enableSharing"];
+ //Disable/enable the use of shared player options
+ [useSharedMenuTunesCheckbox setEnabled:!state];
+ [passwordTextField setEnabled:state];
+ [nameTextField setEnabled:state];
+ [selectSharedPlayerButton setEnabled:NO];
+ [controller setServerStatus:state]; //Set server status
+ } else if ( [sender tag] == 5015 ) {
+ [df setObject:[sender stringValue] forKey:@"sharedPlayerName"];
+ [[NetworkController sharedController] resetServerName];
+ } else if ( [sender tag] == 5030 ) {
+ //Set the server password
+ const char *instring = [[sender stringValue] UTF8String];
+ const char *password = "p4s5w0rdMT1.2";
+ unsigned char *result;
+ NSData *hashedPass, *passwordStringHash;
+ if ([[sender stringValue] length] == 0) {
+ [df setObject:[NSData data] forKey:@"sharedPlayerPassword"];
+ return;
+ }
+ result = SHA1(instring, strlen(instring), NULL);
+ hashedPass = [NSData dataWithBytes:result length:strlen(result)];
+ result = SHA1(password, strlen(password), NULL);
+ passwordStringHash = [NSData dataWithBytes:result length:strlen(result)];
+ if (![hashedPass isEqualToData:passwordStringHash]) {
+ [df setObject:hashedPass forKey:@"sharedPlayerPassword"];
+ [sender setStringValue:@"p4s5w0rdMT1.2"];
+ }
+ } else if ( [sender tag] == 5040 ) {
+ BOOL state = SENDER_STATE;
+ [df setBool:state forKey:@"useSharedPlayer"];
+ //Disable/enable the use of sharing options
+ [shareMenuTunesCheckbox setEnabled:!state];
+ [passwordTextField setEnabled:NO];
+ [nameTextField setEnabled:NO];
+ [selectSharedPlayerButton setEnabled:state];