From 6b2c7688b3f344f350125f8b9713a6a77b82c3dd Mon Sep 17 00:00:00 2001 From: Wolfgang Beck Date: Fri, 2 Sep 2011 13:29:38 +1000 Subject: MTMW-98 QML API Version 2 Change-Id: I10c610ae22974d291fad663088c5a11449a86b05 Reviewed-on: http://codereview.qt-project.org/4107 Reviewed-by: Wolfgang Beck --- src/imports/sensors2/qsensor2ambientlight.h | 90 +++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 src/imports/sensors2/qsensor2ambientlight.h (limited to 'src/imports/sensors2/qsensor2ambientlight.h') diff --git a/src/imports/sensors2/qsensor2ambientlight.h b/src/imports/sensors2/qsensor2ambientlight.h new file mode 100644 index 00000000..5b9a516a --- /dev/null +++ b/src/imports/sensors2/qsensor2ambientlight.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QSENSOR2AMBIENTLIGHT_H +#define QSENSOR2AMBIENTLIGHT_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QSensor2AmbientLight : public QObject, public QAmbientLightFilter +{ + Q_OBJECT + Q_ENUMS(LightLevel) + Q_PROPERTY(LightLevel lightLevel READ lightLevel NOTIFY lightLevelChanged) + Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged) + +public: + QSensor2AmbientLight(QObject* parent = 0); + virtual ~QSensor2AmbientLight(); + + enum LightLevel { + Undefined = 0, + Dark, + Twilight, + Light, + Bright, + Sunny + }; + +Q_SIGNALS: + void lightLevelChanged(); + void runningChanged(); + +private: + // Override of QAmbientLightFilter::filter(QAmbientLightReading*) + bool filter(QAmbientLightReading *reading); + LightLevel lightLevel(); + bool running(); + void setRunning(bool val); + + QAmbientLightSensor* _ambientLight; + LightLevel _lightLevel; +}; + +QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QSensor2AmbientLight)) + +QT_END_NAMESPACE + + +#endif // QSENSOR2AMBIENTLIGHT_H -- cgit v1.2.3