3 #include "keycontroller.h" |
3 #include "keycontroller.h" |
4 #include "orientationcontroller.h" |
4 #include "orientationcontroller.h" |
5 #include "view.h" |
5 #include "view.h" |
6 |
6 |
7 |
7 |
8 OrientationController::OrientationController( ): KeyController(){ |
8 OrientationController::OrientationController(): KeyController(){ |
9 m_delay=20; |
9 m_delay=10; |
10 m_step=7; |
10 m_step=10; |
11 } |
|
12 |
|
13 |
|
14 void OrientationController::startSensor() |
|
15 { |
|
16 m_orientationSensor.connectToBackend(); |
11 m_orientationSensor.connectToBackend(); |
17 m_orientationSensor.start(); |
12 m_orientationSensor.start(); |
18 connect(&m_orientationSensor, SIGNAL(readingChanged()), this, SLOT(update())); |
13 connect(&m_orientationSensor, SIGNAL(readingChanged()), this, SLOT(update())); |
|
14 |
19 } |
15 } |
20 |
16 |
21 void OrientationController::stopSensor(){ m_orientationSensor.stop();} |
17 OrientationController::~OrientationController(){ |
22 |
18 m_orientationSensor.stop(); |
|
19 disconnect(&m_orientationSensor); |
|
20 } |
23 |
21 |
24 void OrientationController::updateCoordinates(){ |
22 void OrientationController::updateCoordinates(){ |
25 handleKeyPress(m_exCode); |
23 handleKeyPress(m_exCode); |
26 m_step = m_exCode!=0? m_step+2 : 5; |
24 m_step = m_exCode!=0 ? m_step+5 : 10; |
27 } |
25 } |
28 |
26 |
29 |
27 |
30 void OrientationController::update() |
28 void OrientationController::update() |
31 { |
29 { |