File indexing completed on 2024-05-05 05:38:23
0001 /* 0002 SPDX-FileCopyrightText: 2017 Roman Gilg <subdiff@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #pragma once 0007 0008 #include "colorcorrect_export.h" 0009 0010 #include <qqmlregistration.h> 0011 0012 #include <Plasma5Support/DataEngine> 0013 #include <Plasma5Support/DataEngineConsumer> 0014 0015 namespace Plasma5Support 0016 { 0017 class DataEngine; 0018 } 0019 0020 namespace ColorCorrect 0021 { 0022 class COLORCORRECT_EXPORT Geolocator : public QObject, public Plasma5Support::DataEngineConsumer 0023 { 0024 Q_OBJECT 0025 QML_ELEMENT 0026 0027 Q_PROPERTY(double latitude READ latitude NOTIFY latitudeChanged) 0028 Q_PROPERTY(double longitude READ longitude NOTIFY longitudeChanged) 0029 0030 public: 0031 explicit Geolocator(QObject *parent = nullptr); 0032 ~Geolocator() override = default; 0033 0034 double latitude() const 0035 { 0036 return m_latitude; 0037 } 0038 double longitude() const 0039 { 0040 return m_longitude; 0041 } 0042 0043 public Q_SLOTS: 0044 /** 0045 * Called when data is updated by Plasma::DataEngine 0046 */ 0047 void dataUpdated(const QString &source, const Plasma5Support::DataEngine::Data &data); 0048 0049 Q_SIGNALS: 0050 void locationChanged(double latitude, double longitude); 0051 void latitudeChanged(); 0052 void longitudeChanged(); 0053 0054 private: 0055 Plasma5Support::DataEngine *m_engine = nullptr; 0056 0057 double m_latitude = 0; 0058 double m_longitude = 0; 0059 }; 0060 0061 }