1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2008 Henry de Valence <hdevalence@gmail.com>
4 // SPDX-FileCopyrightText: 2011 Friedrich W. H. Kossebau <kossebau@kde.org>
5 
6 #ifndef MARBLE_LATLONEDIT_H
7 #define MARBLE_LATLONEDIT_H
8 
9 #include <QWidget>
10 
11 #include "GeoDataCoordinates.h"
12 #include "MarbleGlobal.h"
13 #include "marble_export.h"
14 
15 namespace Marble
16 {
17 
18 class LatLonEditPrivate;
19 
20 class MARBLE_EXPORT  LatLonEdit : public QWidget
21 {
22     Q_OBJECT
23     //FIXME: make the dimension enum work
24     //Q_PROPERTY( qreal value READ value WRITE setValue )
25     //Q_PROPERTY( int dimension READ dimension WRITE setDimension )
26 
27 public:
28     /**
29      * @brief This enum is used to choose the dimension.
30      */
31     enum Dimension {
32         Latitude,             ///< Latitude
33         Longitude            ///< Longitude
34     };
35 
36     explicit LatLonEdit(QWidget *parent = nullptr, Dimension dimension = Longitude,
37                         GeoDataCoordinates::Notation notation = GeoDataCoordinates::DMS);
38     ~LatLonEdit() override;
39     qreal value() const;
40     Dimension dimension() const;
41     GeoDataCoordinates::Notation notation() const;
42 public Q_SLOTS:
43     void setValue(qreal newvalue);
44     void setDimension( Dimension dimension );
45     void setNotation(GeoDataCoordinates::Notation notation);
46 Q_SIGNALS:
47     void valueChanged( qreal value );
48 private Q_SLOTS:
49     void checkIntValueOverflow();
50     void checkUIntValueOverflow();
51     void checkFloatValueOverflow();
52     void onSignChanged();
53 private:
54     // recalculates m_value based on spinboxes
55     void recalculate();
56 private:
57     LatLonEditPrivate * const d;
58 };
59 
60 }
61 
62 #endif
63