Changeset View
Changeset View
Standalone View
Standalone View
libcolorcorrect/geolocator.h
- This file was added.
1 | /******************************************************************** | ||||
---|---|---|---|---|---|
2 | Copyright 2017 Roman Gilg <subdiff@gmail.com> | ||||
3 | | ||||
4 | This program is free software; you can redistribute it and/or modify | ||||
5 | it under the terms of the GNU General Public License as published by | ||||
6 | the Free Software Foundation; either version 2 of the License, or | ||||
7 | (at your option) any later version. | ||||
8 | | ||||
9 | This program is distributed in the hope that it will be useful, | ||||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | GNU General Public License for more details. | ||||
13 | | ||||
14 | You should have received a copy of the GNU General Public License | ||||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
16 | *********************************************************************/ | ||||
17 | #ifndef COLORCORRECT_GEOLOCATOR_H | ||||
18 | #define COLORCORRECT_GEOLOCATOR_H | ||||
19 | | ||||
20 | #include "colorcorrect_export.h" | ||||
21 | | ||||
22 | #include <Plasma/DataEngine> | ||||
23 | #include <Plasma/DataEngineConsumer> | ||||
24 | | ||||
25 | namespace Plasma | ||||
26 | { | ||||
27 | | ||||
28 | class DataEngine; | ||||
29 | | ||||
30 | } | ||||
31 | | ||||
32 | namespace ColorCorrect | ||||
33 | { | ||||
34 | | ||||
35 | class COLORCORRECT_EXPORT Geolocator : public QObject, public Plasma::DataEngineConsumer | ||||
36 | { | ||||
37 | Q_OBJECT | ||||
38 | | ||||
39 | Q_PROPERTY(double latitude READ latitude NOTIFY latitudeChanged) | ||||
40 | Q_PROPERTY(double longitude READ longitude NOTIFY longitudeChanged) | ||||
41 | | ||||
42 | public: | ||||
43 | explicit Geolocator(QObject *parent = nullptr); | ||||
44 | virtual ~Geolocator() = default; | ||||
45 | | ||||
46 | double latitude() const { | ||||
47 | return m_latitude; | ||||
48 | } | ||||
49 | double longitude() const { | ||||
50 | return m_longitude; | ||||
51 | } | ||||
52 | | ||||
53 | public Q_SLOTS: | ||||
54 | /** | ||||
55 | * Called when data is updated by Plasma::DataEngine | ||||
56 | */ | ||||
57 | void dataUpdated(const QString &source, const Plasma::DataEngine::Data &data); | ||||
58 | | ||||
59 | Q_SIGNALS: | ||||
60 | void locationChanged(double latitude, double longitude); | ||||
61 | void latitudeChanged(); | ||||
62 | void longitudeChanged(); | ||||
63 | | ||||
64 | private: | ||||
65 | Plasma::DataEngine *m_engine = nullptr; | ||||
66 | | ||||
67 | double m_latitude = 0; | ||||
68 | double m_longitude = 0; | ||||
69 | }; | ||||
70 | | ||||
71 | } | ||||
72 | | ||||
73 | #endif // COLORCORRECT_GEOLOCATOR_H |