File indexing completed on 2024-12-08 03:36:06

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2008 Torsten Rahn <tackat@kde.org>
0004 // SPDX-FileCopyrightText: 2010 Cezar Mocan <mocancezar@gmail.com>
0005 //
0006 
0007 //
0008 // This class is a crosshairs plugin.
0009 //
0010 
0011 #ifndef MARBLE_CROSSHAIRSPLUGIN_H
0012 #define MARBLE_CROSSHAIRSPLUGIN_H
0013 
0014 #include <QPixmap>
0015 
0016 
0017 #include "RenderPlugin.h"
0018 #include "DialogConfigurationInterface.h"
0019 
0020 class QSvgRenderer;
0021 
0022 namespace Ui {
0023     class CrosshairsConfigWidget;
0024 }
0025 
0026 namespace Marble
0027 {
0028 
0029 
0030 /**
0031  * @short The class that specifies the Marble layer interface of a plugin.
0032  *
0033  */
0034 
0035 class CrosshairsPlugin : public RenderPlugin, public DialogConfigurationInterface
0036 {
0037     Q_OBJECT
0038     Q_PLUGIN_METADATA(IID "org.kde.marble.CrosshairsPlugin")
0039     Q_INTERFACES( Marble::RenderPluginInterface )
0040     Q_INTERFACES( Marble::DialogConfigurationInterface )
0041     MARBLE_PLUGIN(CrosshairsPlugin)
0042 
0043  public:
0044     CrosshairsPlugin();
0045 
0046     explicit CrosshairsPlugin( const MarbleModel *marbleModel );
0047 
0048     ~CrosshairsPlugin() override;
0049 
0050     QStringList backendTypes() const override;
0051 
0052     QString renderPolicy() const override;
0053 
0054     QStringList renderPosition() const override;
0055 
0056     RenderType renderType() const override;
0057 
0058     QString name() const override;
0059 
0060     QString guiString() const override;
0061 
0062     QString nameId() const override;
0063 
0064     QString version() const override;
0065 
0066     QString description() const override;
0067 
0068     QString copyrightYears() const override;
0069 
0070     QVector<PluginAuthor> pluginAuthors() const override;
0071 
0072     QIcon icon () const override;
0073 
0074     void initialize () override;
0075 
0076     bool isInitialized () const override;
0077 
0078     bool render( GeoPainter *painter, ViewportParams *viewport, const QString& renderPos, GeoSceneLayer * layer = nullptr ) override;
0079 
0080     QDialog *configDialog() override;
0081 
0082     QHash<QString,QVariant> settings() const override;
0083 
0084     void setSettings( const QHash<QString,QVariant> &settings ) override;
0085 
0086 private Q_SLOTS:
0087    void readSettings();
0088 
0089    void writeSettings();
0090 
0091  private:
0092     Q_DISABLE_COPY( CrosshairsPlugin )
0093 
0094     bool m_isInitialized;
0095 
0096     QSvgRenderer *m_svgobj;
0097     QPixmap m_crosshairs;
0098     int m_themeIndex;
0099 
0100     QString m_theme;
0101 
0102     QDialog * m_configDialog;
0103     Ui::CrosshairsConfigWidget * m_uiConfigWidget;
0104 };
0105 
0106 }
0107 
0108 #endif // MARBLE_CROSSHAIRSPLUGIN_H