Blame view

build4/epsilon-master/apps/hardware_test/screen_test_controller.cpp 841 Bytes
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  #include "screen_test_controller.h"
  extern "C" {
  #include <assert.h>
  }
  
  namespace HardwareTest {
  
  ScreenTestController::ScreenTestController(Responder * parentResponder) :
    ViewController(parentResponder),
    m_patternIndex(0),
    m_view()
  {
  }
  
  View * ScreenTestController::view() {
    return &m_view;
  }
  
  bool ScreenTestController::handleEvent(Ion::Events::Event event) {
    if (event != Ion::Events::OK) {
      return true;
    }
    if (m_patternIndex == Pattern::numberOfPatterns()) {
      // Go to the next step - this will be handled by the WizardViewController
      return false;
    } else {
      showNextPattern();
    }
    return true;
  }
  
  void ScreenTestController::viewWillAppear() {
    m_patternIndex = 0;
    showNextPattern();
  }
  
  void ScreenTestController::showNextPattern() {
    m_view.setPattern(Pattern::patternAtIndex(m_patternIndex++));
  }
  
  }