| 1 | // Copyright (C) 2016 Canonical, Ltd |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | #ifndef QLIDSENSOR_H |
| 4 | #define QLIDSENSOR_H |
| 5 | |
| 6 | #include <QtSensors/qsensor.h> |
| 7 | |
| 8 | QT_BEGIN_NAMESPACE |
| 9 | |
| 10 | class QLidReadingPrivate; |
| 11 | |
| 12 | class Q_SENSORS_EXPORT QLidReading : public QSensorReading |
| 13 | { |
| 14 | Q_OBJECT |
| 15 | Q_PROPERTY(bool backLidClosed READ backLidClosed) |
| 16 | Q_PROPERTY(bool frontLidClosed READ frontLidClosed) |
| 17 | DECLARE_READING(QLidReading) |
| 18 | public: |
| 19 | |
| 20 | bool backLidClosed() const; |
| 21 | void setBackLidClosed(bool closed); |
| 22 | |
| 23 | bool frontLidClosed() const; |
| 24 | void setFrontLidClosed(bool closed); |
| 25 | |
| 26 | Q_SIGNALS: |
| 27 | void backLidChanged(bool closed); |
| 28 | void frontLidChanged(bool closed); |
| 29 | }; |
| 30 | |
| 31 | class Q_SENSORS_EXPORT QLidFilter : public QSensorFilter |
| 32 | { |
| 33 | public: |
| 34 | virtual bool filter(QLidReading *reading) = 0; |
| 35 | private: |
| 36 | bool filter(QSensorReading *reading) override; |
| 37 | }; |
| 38 | |
| 39 | class Q_SENSORS_EXPORT QLidSensor : public QSensor |
| 40 | { |
| 41 | Q_OBJECT |
| 42 | public: |
| 43 | explicit QLidSensor(QObject *parent = nullptr); |
| 44 | ~QLidSensor(); |
| 45 | QLidReading *reading() const; |
| 46 | static char const * const sensorType; |
| 47 | |
| 48 | private: |
| 49 | Q_DISABLE_COPY(QLidSensor) |
| 50 | }; |
| 51 | |
| 52 | QT_END_NAMESPACE |
| 53 | |
| 54 | #endif |
| 55 | |