diff 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
line wrap: on
line diff
--- a/PresetAlertViewController.mm	Wed May 15 17:43:51 2013 +0100
+++ b/PresetAlertViewController.mm	Mon May 20 11:09:14 2013 +0100
@@ -5,14 +5,10 @@
 //  Created by Robert Tubb on 07/01/2013.
 //
 //
-#include "presetManager.h"
 #include "testApp.h"
 #import "PresetAlertViewController.h"
 
 
-extern PresetManager presetManager;
-extern EventLogger eventLogger;
-
 @implementation PresetAlertViewController
 - (PresetAlertViewController *) init{
     [super init];
@@ -52,36 +48,18 @@
     }else{
         // save it
         self.alertShowing = NO;
-        if([[[alertView textFieldAtIndex:0] text] isEqualToString:@"newuser"]){
-            // call new user stufff
-            eventLogger.newUser();
-        }else if([[[alertView textFieldAtIndex:0] text] isEqualToString:@"printall"]){
-            presetManager.printAll();
-            eventLogger.printAll();
-        }else if([[[alertView textFieldAtIndex:0] text] isEqualToString:@"questionnaire"]){
-            ((testApp *)ofGetAppPtr())->showQuestionnaire();
-            
-        }else{
-            presetManager.addPreset([[[alertView textFieldAtIndex:0] text] cStringUsingEncoding:NSASCIIStringEncoding]);
-        }
+
+        ((testApp *)ofGetAppPtr())->savePreset([[[self.alert textFieldAtIndex:0] text] cStringUsingEncoding:NSASCIIStringEncoding]);
+
     }
 }
 
 -(BOOL)textFieldShouldReturn:(UITextField *)textField{
     // save it
     self.alertShowing = NO;
-    if([[[self.alert textFieldAtIndex:0] text] isEqualToString:@"newuser"]){
-        // call new user stufff
-        eventLogger.newUser();
-    }else if([[[self.alert textFieldAtIndex:0] text] isEqualToString:@"printall"]){
-        presetManager.printAll();
-        eventLogger.printAll();
-    }else if([[[self.alert textFieldAtIndex:0] text] isEqualToString:@"questionnaire"]){
-        ((testApp *)ofGetAppPtr())->showQuestionnaire();
-        
-    }else{
-        presetManager.addPreset([[[self.alert textFieldAtIndex:0] text] cStringUsingEncoding:NSASCIIStringEncoding]);
-    }
+
+        ((testApp *)ofGetAppPtr())->savePreset([[[self.alert textFieldAtIndex:0] text] cStringUsingEncoding:NSASCIIStringEncoding]);
+
     [self.alert dismissWithClickedButtonIndex:self.alert.firstOtherButtonIndex animated:YES];
     return YES;
 }