Mercurial > hg > wabletios
comparison PresetAlertViewController.mm @ 12:5bf377b4c780
Saving.
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Mon, 20 May 2013 11:09:14 +0100 |
parents | 274864620848 |
children |
comparison
equal
deleted
inserted
replaced
11:274864620848 | 12:5bf377b4c780 |
---|---|
3 // oscSenderExample | 3 // oscSenderExample |
4 // | 4 // |
5 // Created by Robert Tubb on 07/01/2013. | 5 // Created by Robert Tubb on 07/01/2013. |
6 // | 6 // |
7 // | 7 // |
8 #include "presetManager.h" | |
9 #include "testApp.h" | 8 #include "testApp.h" |
10 #import "PresetAlertViewController.h" | 9 #import "PresetAlertViewController.h" |
11 | 10 |
12 | |
13 extern PresetManager presetManager; | |
14 extern EventLogger eventLogger; | |
15 | 11 |
16 @implementation PresetAlertViewController | 12 @implementation PresetAlertViewController |
17 - (PresetAlertViewController *) init{ | 13 - (PresetAlertViewController *) init{ |
18 [super init]; | 14 [super init]; |
19 self = [super init]; | 15 self = [super init]; |
50 NSLog(@"preset save was cancelled"); | 46 NSLog(@"preset save was cancelled"); |
51 self.alertShowing = NO; | 47 self.alertShowing = NO; |
52 }else{ | 48 }else{ |
53 // save it | 49 // save it |
54 self.alertShowing = NO; | 50 self.alertShowing = NO; |
55 if([[[alertView textFieldAtIndex:0] text] isEqualToString:@"newuser"]){ | 51 |
56 // call new user stufff | 52 ((testApp *)ofGetAppPtr())->savePreset([[[self.alert textFieldAtIndex:0] text] cStringUsingEncoding:NSASCIIStringEncoding]); |
57 eventLogger.newUser(); | 53 |
58 }else if([[[alertView textFieldAtIndex:0] text] isEqualToString:@"printall"]){ | |
59 presetManager.printAll(); | |
60 eventLogger.printAll(); | |
61 }else if([[[alertView textFieldAtIndex:0] text] isEqualToString:@"questionnaire"]){ | |
62 ((testApp *)ofGetAppPtr())->showQuestionnaire(); | |
63 | |
64 }else{ | |
65 presetManager.addPreset([[[alertView textFieldAtIndex:0] text] cStringUsingEncoding:NSASCIIStringEncoding]); | |
66 } | |
67 } | 54 } |
68 } | 55 } |
69 | 56 |
70 -(BOOL)textFieldShouldReturn:(UITextField *)textField{ | 57 -(BOOL)textFieldShouldReturn:(UITextField *)textField{ |
71 // save it | 58 // save it |
72 self.alertShowing = NO; | 59 self.alertShowing = NO; |
73 if([[[self.alert textFieldAtIndex:0] text] isEqualToString:@"newuser"]){ | 60 |
74 // call new user stufff | 61 ((testApp *)ofGetAppPtr())->savePreset([[[self.alert textFieldAtIndex:0] text] cStringUsingEncoding:NSASCIIStringEncoding]); |
75 eventLogger.newUser(); | 62 |
76 }else if([[[self.alert textFieldAtIndex:0] text] isEqualToString:@"printall"]){ | |
77 presetManager.printAll(); | |
78 eventLogger.printAll(); | |
79 }else if([[[self.alert textFieldAtIndex:0] text] isEqualToString:@"questionnaire"]){ | |
80 ((testApp *)ofGetAppPtr())->showQuestionnaire(); | |
81 | |
82 }else{ | |
83 presetManager.addPreset([[[self.alert textFieldAtIndex:0] text] cStringUsingEncoding:NSASCIIStringEncoding]); | |
84 } | |
85 [self.alert dismissWithClickedButtonIndex:self.alert.firstOtherButtonIndex animated:YES]; | 63 [self.alert dismissWithClickedButtonIndex:self.alert.firstOtherButtonIndex animated:YES]; |
86 return YES; | 64 return YES; |
87 } | 65 } |
88 | 66 |
89 - (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView | 67 - (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView |