# HG changeset patch # User Robert Tubb # Date 1358363211 0 # Node ID 12e4156ae216cf9a72632ffa87ae7aa1b2f37818 # Parent 27314a86d71c16962edf02b59d13ebc2bb8520c1# Parent 6a9191f5b2695f1c063f17edeab39f278d1682d7 merge the fukker diff -r 27314a86d71c -r 12e4156ae216 QuestionnaireViewController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QuestionnaireViewController.h Wed Jan 16 19:06:51 2013 +0000 @@ -0,0 +1,24 @@ +// +// QuestionnaireViewController.h +// oscSenderExample +// +// Created by Robert Tubb on 16/01/2013. +// +// + +#import + +@interface QuestionnaireViewController : UIViewController +@property (retain, nonatomic) IBOutlet UISegmentedControl *answerPressed; +@property (retain, nonatomic) IBOutlet UILabel *questionText; + +//---------------------------------------------------------------- +-(IBAction)hide:(id)sender; +//---------------------------------------------------------------- +-(IBAction)show:(id)sender; +//---------------------------------------------------------------- +- (IBAction)nextQuestionPressed:(id)sender; + +-(void)populateQuestionArray; +@end + diff -r 27314a86d71c -r 12e4156ae216 QuestionnaireViewController.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QuestionnaireViewController.m Wed Jan 16 19:06:51 2013 +0000 @@ -0,0 +1,116 @@ +// +// QuestionnaireViewController.m +// oscSenderExample +// +// Created by Robert Tubb on 16/01/2013. +// +// + +#import "QuestionnaireViewController.h" + +@interface QuestionnaireViewController () + // the "model" is an array of questions +@property (strong, nonatomic) NSArray * questionArray; +@property (strong, nonatomic) NSArray * answerArray; +@property (nonatomic) NSInteger currentQuestionIndex; +/* +@"I am familiar with music software and synthesisers." +@"The best way to get a feel for the possibilities of the synth was with:" +@"Interesting sounds could be discovered more quickly as a result of using:" +@"A sound could be fine tuned more easily using:" +@"The correspondence between the sliders and the grid was understandable." +@"The interface that felt more familiar was:" +@"Scrolling a greater distance the zoom grid seemed to correspond to larger difference in the sound." +@"The ability to see other presets on the grid was useful." +@"The range of sounds was too limited to be able to judge the eventual usefulness of the interface." +@"The interface better for generating new ideas was" +@"The interface better for live performance would be:" + @"A specific type of sound could be found more quickly using:" + @"I felt more in control when using:" +@"The Zoomer was an improvement on just using the randomiser." +@"The combination of Zoomer and Sliders was more useful than either individually." +@"Overall, I preferred using:" + +*/ + +@end + +@implementation QuestionnaireViewController + +//---------------------------------------------------------------- +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + // Custom initialization + + [self populateQuestionArray ]; + + + } + return self; +} +//---------------------------------------------------------------- +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view from its nib. + self.currentQuestionIndex = 0; + // load question 1 + [self loadQuestion:self.currentQuestionIndex]; +} +//---------------------------------------------------------------- +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} +//---------------------------------------------------------------- +- (void)dealloc { + [_answerPressed release]; + [_questionText release]; + [super dealloc]; +} +//---------------------------------------------------------------- +- (void)viewDidUnload { + [self setAnswerPressed:nil]; + [self setQuestionText:nil]; + [super viewDidUnload]; +} +//---------------------------------------------------------------- +- (IBAction)answerWasSelected:(id)sender { + // look at property? + +} + +//---------------------------------------------------------------- +-(IBAction)hide:(id)sender{ + self.view.hidden = YES; +} +//---------------------------------------------------------------- +-(IBAction)show:(id)sender{ + self.view.hidden = NO; +} +//---------------------------------------------------------------- + +- (IBAction)nextQuestionPressed:(id)sender { + // save answer ? no button did that hopefully + // if last question show thanks + + // else go to next + self.currentQuestionIndex++; + [self loadQuestion:self.currentQuestionIndex]; +} +//---------------------------------------------------------------- +- (void)loadQuestion:(NSInteger)questionIndex { + // populate text fields with question + self.questionText.text = [self.questionArray objectAtIndex:questionIndex]; + +} +//---------------------------------------------------------------- +- (void)populateQuestionArray{ + self.questionArray = [[NSArray alloc] initWithObjects:@"one", @"two", @"buckle", nil]; +} +//---------------------------------------------------------------- + +@end // end implementation \ No newline at end of file diff -r 27314a86d71c -r 12e4156ae216 QuestionnaireViewController.xib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QuestionnaireViewController.xib Wed Jan 16 19:06:51 2013 +0000 @@ -0,0 +1,898 @@ + + + + 1536 + 11G63 + 2844 + 1138.51 + 569.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 1930 + + + IBNSLayoutConstraint + IBProxyObject + IBUIButton + IBUILabel + IBUISegmentedControl + IBUIView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBIPadFramework + + + IBFirstResponder + IBIPadFramework + + + + 292 + + + + 292 + {{118, 96}, {137, 53}} + + + + _NS:9 + NO + YES + 7 + NO + IBIPadFramework + YES + + Question 1 + + + 1 + MCAwIDAAA + darkTextColor + + + Helvetica + 25 + 16 + + + + + + + + 0 + NO + + + + 292 + {{118, 178}, {533, 124}} + + + + _NS:9 + NO + YES + 7 + NO + IBIPadFramework + What did you think about all this crazy stuff that happened when you were using the thing that was going on before? + + + 0 + 3 + + 1 + 18 + + + Helvetica + 18 + 16 + + NO + 533 + + + + 292 + {{530, 482}, {121, 44}} + + + + _NS:9 + NO + IBIPadFramework + 0 + 0 + 1 + Next Question + + 3 + MQA + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + 3 + MC41AA + + + 2 + 15 + + + Helvetica-Bold + 15 + 16 + + + + + 292 + {{118, 482}, {157, 44}} + + + + _NS:9 + NO + IBIPadFramework + 0 + 0 + 1 + Previous Question + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + + + + + 292 + {{118, 347}, {533, 44}} + + + + _NS:9 + NO + IBIPadFramework + 5 + 0 + + No + Disagree + Neither + Agree + Well Agree + + + + + + + + + + + + + + + + + {0, 0} + {0, 0} + {0, 0} + {0, 0} + {0, 0} + + + + + + + + + + + + 292 + {{530, 897}, {121, 44}} + + + _NS:9 + NO + IBIPadFramework + 0 + 0 + 1 + Finish + + + 1 + MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA + + + + + + + {{0, 20}, {768, 1004}} + + + + + 3 + MQA + + 2 + + + NO + + 2 + + IBIPadFramework + + + + + + + view + + + + 3 + + + + questionText + + + + 41 + + + + nextQuestionPressed: + + + 7 + + 40 + + + + hide: + + + 7 + + 39 + + + + + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 2 + + + + + 4 + 0 + + 4 + 1 + + 64 + + 1000 + + 3 + 9 + 3 + + + + 5 + 0 + + 5 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 6 + 0 + + 6 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 6 + 0 + + 6 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 3 + 0 + + 3 + 1 + + 482 + + 1000 + + 3 + 9 + 3 + + + + 11 + 0 + + 11 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 5 + 0 + + 5 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 3 + 0 + + 3 + 1 + + 347 + + 1000 + + 3 + 9 + 3 + + + + 9 + 0 + + 9 + 1 + + 0.0 + + 1000 + + 5 + 22 + 2 + + + + 3 + 0 + + 3 + 1 + + 178 + + 1000 + + 3 + 9 + 3 + + + + 5 + 0 + + 5 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 6 + 0 + + 6 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 5 + 0 + + 5 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 3 + 0 + + 3 + 1 + + 96 + + 1000 + + 3 + 9 + 3 + + + + + + + + + + + + 4 + + + + + 7 + 0 + + 0 + 1 + + 137 + + 1000 + + 3 + 9 + 1 + + + + 8 + 0 + + 0 + 1 + + 53 + + 1000 + + 3 + 9 + 1 + + + + + + 5 + + + + + 7 + 0 + + 0 + 1 + + 533 + + 1000 + + 3 + 9 + 1 + + + + 8 + 0 + + 0 + 1 + + 124 + + 1000 + + 3 + 9 + 1 + + + + + + 6 + + + + + 7 + 0 + + 0 + 1 + + 121 + + 1000 + + 3 + 9 + 1 + + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 16 + + + + + 18 + + + + + 19 + + + + + 20 + + + + + 21 + + + + + 24 + + + + + 26 + + + + + 29 + + + + + 30 + + + + + 31 + + + + + 32 + + + + + 33 + + + + + 34 + + + + + 35 + + + + + + + QuestionnaireViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + + + + + + + + + + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + + 41 + + + + + NSLayoutConstraint + NSObject + + IBProjectSource + ./Classes/NSLayoutConstraint.h + + + + QuestionnaireViewController + UIViewController + + id + id + id + id + + + + answerWasSelected: + id + + + hide: + id + + + nextQuestionPressed: + id + + + show: + id + + + + UISegmentedControl + UILabel + + + + answerPressed + UISegmentedControl + + + questionText + UILabel + + + + IBProjectSource + ./Classes/QuestionnaireViewController.h + + + + + 0 + IBIPadFramework + YES + 3 + YES + 1930 + + diff -r 27314a86d71c -r 12e4156ae216 eventLogger.h --- a/eventLogger.h Wed Jan 16 19:04:55 2013 +0000 +++ b/eventLogger.h Wed Jan 16 19:06:51 2013 +0000 @@ -25,7 +25,7 @@ #include "json.h" #import "iViewController.h" - +#import "QuestionnaireViewController.h" // can add but don't change ordering - this will invalidate logs enum leventType {SAVE_PRESET, @@ -106,32 +106,44 @@ class EventLogger{ public: + bool loggingEnabled; + bool internetConnectionOK; + unsigned int deviceID; // unique get something from hardware?? + unsigned int totalInteractionTime, sessionTime, sessionStartTime; + string userName; // not unique + + EventLogger(); + void init(); + void exitAndSave(); + void setUsername(const char *u); + void logEvent(const leventType& evtType,const TwoVector& centre = TwoVector(), const double& scale = 1.0, const int& sliderID = -1, const double& sliderVal = 0.0); + + +private: // what we need... /* time, type, value */ - bool loggingEnabled; - bool internetConnectionOK; + + vector theEvents; + QuestionnaireViewController * questionnaireViewController; + // values applicable to all events + + unsigned int nextUploadQty; + - // values applicable to all events - unsigned int deviceID; // unique get something from hardware?? - unsigned int totalInteractionTime, sessionTime, sessionStartTime; - string userName; // not unique - unsigned int nextUploadQty; - EventLogger(); - void init(); + bool testConnection(); - void setUsername(const char *u); - void logEvent(const leventType& evtType,const TwoVector& centre = TwoVector(), const double& scale = 1.0, const int& sliderID = -1, const double& sliderVal = 0.0); + void sendHttp(); void checkLogFile(); bool attemptUpload(); void firstEverAppOpen(); void readJsonToLog(const string &jsonFile); - void exitAndSave(); + Json::Value logsToJson(); void printAll(){ cout << "ALL LOGGED EVENTS!: \n"; diff -r 27314a86d71c -r 12e4156ae216 eventLogger.mm --- a/eventLogger.mm Wed Jan 16 19:04:55 2013 +0000 +++ b/eventLogger.mm Wed Jan 16 19:06:51 2013 +0000 @@ -15,7 +15,13 @@ //--------------------------------------------------------------------------- EventLogger::EventLogger(){ + //QuestionnaireViewController * questionnaireViewController; + + questionnaireViewController = [[QuestionnaireViewController alloc] initWithNibName:@"QuestionnaireViewController" bundle:nil]; + + + loggingEnabled = true; internetConnectionOK = false; nextUploadQty = 5000; // amount of data uploaded is always more than 5000 events @@ -28,10 +34,11 @@ testConnection(); + [ofxiPhoneGetGLParentView() addSubview:questionnaireViewController.view]; } //--------------------------------------------------------------------------- bool EventLogger::testConnection(){ - string url = "http://127.0.0.1:8080/testservice/testConnection?testtext={%22yo%22=%22dude%22}"; + string url = "http://127.0.0.1:8080/testservice/testConnection?testtext={%22test%22=%22sometext%22}"; bool success = false; ofURLFileLoader fileLoader; ofHttpResponse resp; @@ -104,7 +111,18 @@ attemptUpload(); } // TODO if the total interaction time is greater than a certain amount && no questions answered - questionnaire time! + cout << "Total interaction time: " << totalInteractionTime << '\n'; + if(totalInteractionTime > 0){ + // questionnaireViewController.show; + [questionnaireViewController show:(id)this]; + + //IF THE VIEW IS HIDDEN LETS BRING IT BACK! + if( questionnaireViewController.view.hidden ){ + questionnaireViewController.view.hidden = NO; + } + + } // is there logged stuff that hasn't been uploaded yet? // don't actually need to load old ones unless uploading? or saving... diff -r 27314a86d71c -r 12e4156ae216 iViewController.h --- a/iViewController.h Wed Jan 16 19:04:55 2013 +0000 +++ b/iViewController.h Wed Jan 16 19:06:51 2013 +0000 @@ -11,12 +11,13 @@ #include "eventLogger.h" #include "presetManager.h" -@interface IViewController : NSObject +@interface IViewController : NSObject +//@property (weak, nonatomic) NSString * aString; -(void)showUserNamePrompt; - (void)showPresetNamePrompt; -- (void)showQuestionPrompt:(NSString *)question; +//- (void)showQuestionPrompt:(NSString *)question; @end diff -r 27314a86d71c -r 12e4156ae216 iViewController.mm --- a/iViewController.mm Wed Jan 16 19:04:55 2013 +0000 +++ b/iViewController.mm Wed Jan 16 19:06:51 2013 +0000 @@ -44,7 +44,7 @@ [alert show]; [alert release]; } - +/* - (void)showQuestionPrompt:(NSString *)question{ UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Save" message:@"Are you mad?" @@ -55,6 +55,7 @@ [alert show]; [alert release]; } + */ // shheet - only one delegate fnc // we're actually overriding alertViews function here?