File indexing completed on 2024-04-28 16:54:30
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 <Plasma/DataEngine> 0011 #include <Plasma/DataEngineConsumer> 0012 0013 namespace Plasma 0014 { 0015 class DataEngine; 0016 } 0017 0018 namespace ColorCorrect 0019 { 0020 class COLORCORRECT_EXPORT Geolocator : public QObject, public Plasma::DataEngineConsumer 0021 { 0022 Q_OBJECT 0023 0024 Q_PROPERTY(double latitude READ latitude NOTIFY latitudeChanged) 0025 Q_PROPERTY(double longitude READ longitude NOTIFY longitudeChanged) 0026 0027 public: 0028 explicit Geolocator(QObject *parent = nullptr); 0029 ~Geolocator() override = default; 0030 0031 double latitude() const 0032 { 0033 return m_latitude; 0034 } 0035 double longitude() const 0036 { 0037 return m_longitude; 0038 } 0039 0040 public Q_SLOTS: 0041 /** 0042 * Called when data is updated by Plasma::DataEngine 0043 */ 0044 void dataUpdated(const QString &source, const Plasma::DataEngine::Data &data); 0045 0046 Q_SIGNALS: 0047 void locationChanged(double latitude, double longitude); 0048 void latitudeChanged(); 0049 void longitudeChanged(); 0050 0051 private: 0052 Plasma::DataEngine *m_engine = nullptr; 0053 0054 double m_latitude = 0; 0055 double m_longitude = 0; 0056 }; 0057 0058 }