Debian Codegraph @

tests/manual/qardboard/abstractdeviceorientation.cpp

raw symbols SCIP
1 // Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 #include "abstractdeviceorientation.h"
5
6 #include <QDateTime>
7 #include <QDebug>
8 #include <QtMath>
9 #include <QScreen>
10
11
12 AbstractDeviceOrientation::AbstractDeviceOrientation(QObject *parent)
13 : QObject(parent)
14 , m_roll(0)
15 , m_pitch(0)
16 , m_yaw(0)
17 , m_enabled(false)
18 {
19 }
20
21 bool AbstractDeviceOrientation::enabled() const
22 {
23 return m_enabled;
24 }
25
26 void AbstractDeviceOrientation::stop()
27 {
28 if (m_enabled) {
29 m_enabled = false;
30 emit enabledChanged(m_enabled);
31 }
32 }
33
34 void AbstractDeviceOrientation::setRoll(qreal v)
35 {
36 if (v != m_roll) {
37 m_roll = v;
38 emit rollChanged(v);
39 }
40 }
41
42 void AbstractDeviceOrientation::setPitch(qreal v)
43 {
44 if (v != m_pitch) {
45 m_pitch = v;
46 emit pitchChanged(v);
47 }
48 }
49
50 void AbstractDeviceOrientation::setYaw(qreal v)
51 {
52 if (v != m_yaw) {
53 m_yaw = v;
54 emit yawChanged(v);
55 }
56 }
57
58 void AbstractDeviceOrientation::setEnabled(bool v)
59 {
60 if (v && !m_enabled) {
61 start();
62 } else if (!v && m_enabled) {
63 stop();
64 }
65 }