1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2008 Torsten Rahn <tackat@kde.org>
4 //
5 
6 #ifndef COMPASS_FLOAT_ITEM_H
7 #define COMPASS_FLOAT_ITEM_H
8 
9 #include <QPixmap>
10 
11 #include "AbstractFloatItem.h"
12 #include "DialogConfigurationInterface.h"
13 
14 class QSvgRenderer;
15 
16 namespace Ui {
17     class CompassConfigWidget;
18 }
19 
20 namespace Marble
21 {
22 
23 /**
24  * @short The class that creates a compass
25  *
26  */
27 
28 class CompassFloatItem  : public AbstractFloatItem, public DialogConfigurationInterface
29 {
30     Q_OBJECT
31     Q_PLUGIN_METADATA(IID "org.kde.marble.CompassFloatItem")
32     Q_INTERFACES( Marble::RenderPluginInterface )
33     Q_INTERFACES( Marble::DialogConfigurationInterface )
34     MARBLE_PLUGIN( CompassFloatItem )
35  public:
36     CompassFloatItem();
37     explicit CompassFloatItem( const MarbleModel *marbleModel );
38     ~CompassFloatItem () override;
39 
40     QStringList backendTypes() const override;
41 
42     QString name() const override;
43 
44     QString guiString() const override;
45 
46     QString nameId() const override;
47 
48     QString version() const override;
49 
50     QString description() const override;
51 
52     QString copyrightYears() const override;
53 
54     QVector<PluginAuthor> pluginAuthors() const override;
55 
56     QIcon icon () const override;
57 
58     void initialize () override;
59 
60     bool isInitialized () const override;
61 
62     QPainterPath backgroundShape() const override;
63 
64     void setProjection( const ViewportParams *viewport ) override;
65 
66     void paintContent( QPainter *painter ) override;
67 
68     QDialog *configDialog() override;
69 
70     QHash<QString,QVariant> settings() const override;
71 
72     void setSettings( const QHash<QString,QVariant> &settings ) override;
73 
74 private Q_SLOTS:
75    void readSettings();
76 
77    void writeSettings();
78 
79  private:
80     Q_DISABLE_COPY( CompassFloatItem )
81 
82     bool           m_isInitialized;
83 
84     QSvgRenderer  *m_svgobj;
85     QPixmap        m_compass;
86 
87     /// allowed values: -1, 0, 1; default here: 0. FIXME: Declare enum
88     int            m_polarity;
89 
90     int m_themeIndex;
91     QDialog * m_configDialog;
92     Ui::CompassConfigWidget * m_uiConfigWidget;
93 };
94 }
95 
96 #endif
97