File indexing completed on 2025-01-05 03:59:24

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2008 Torsten Rahn <tackat@kde.org>
0004 //
0005 
0006 #ifndef MARBLE_COMPASS_FLOAT_ITEM_H
0007 #define MARBLE_COMPASS_FLOAT_ITEM_H
0008 
0009 #include <QPixmap>
0010 
0011 #include "AbstractFloatItem.h"
0012 #include "DialogConfigurationInterface.h"
0013 
0014 class QSvgRenderer;
0015 
0016 namespace Ui
0017 {
0018     class CompassConfigWidget;
0019 }
0020 
0021 namespace Marble
0022 {
0023 
0024 /**
0025  * @short The class that creates a compass
0026  */
0027 class CompassFloatItem : public AbstractFloatItem,
0028                          public DialogConfigurationInterface
0029 {
0030     Q_OBJECT
0031     Q_PLUGIN_METADATA(IID "org.kde.marble.CompassFloatItem")
0032     Q_INTERFACES( Marble::RenderPluginInterface )
0033     Q_INTERFACES( Marble::DialogConfigurationInterface )
0034     MARBLE_PLUGIN( CompassFloatItem )
0035 
0036  public:
0037 
0038     CompassFloatItem();
0039     explicit CompassFloatItem( const MarbleModel *marbleModel );
0040     ~CompassFloatItem () override;
0041 
0042     QStringList backendTypes() const override;
0043 
0044     QString name() const override;
0045 
0046     QString guiString() const override;
0047 
0048     QString nameId() const override;
0049 
0050     QString version() const override;
0051 
0052     QString description() const override;
0053 
0054     QString copyrightYears() const override;
0055 
0056     QVector<PluginAuthor> pluginAuthors() const override;
0057 
0058     QIcon icon () const override;
0059 
0060     void initialize () override;
0061 
0062     bool isInitialized () const override;
0063 
0064     QPainterPath backgroundShape() const override;
0065 
0066     void setProjection( const ViewportParams *viewport ) override;
0067 
0068     void paintContent( QPainter *painter ) override;
0069 
0070     QDialog *configDialog() override;
0071 
0072     QHash<QString,QVariant> settings() const override;
0073 
0074     void setSettings( const QHash<QString,QVariant> &settings ) override;
0075 
0076 private Q_SLOTS:
0077 
0078    void readSettings();
0079    void writeSettings();
0080 
0081  private:
0082 
0083     Q_DISABLE_COPY( CompassFloatItem )
0084 
0085     bool                     m_isInitialized;
0086 
0087     QSvgRenderer*            m_svgobj;
0088     QPixmap                  m_compass;
0089 
0090     /// allowed values: -1, 0, 1; default here: 0. FIXME: Declare enum
0091     int                      m_polarity;
0092 
0093     int                      m_themeIndex;
0094     QDialog*                 m_configDialog;
0095     Ui::CompassConfigWidget* m_uiConfigWidget;
0096 };
0097 
0098 } // namespace Marble
0099 
0100 #endif // MARBLE_COMPASS_FLOAT_ITEM_H