File indexing completed on 2024-05-05 03:50:41

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