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