//
//  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