File indexing completed on 2024-04-14 03:48:00

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // Most of the code is taken from MarbleRenderPluginInterface.h
0004 // by Torsten Rahn and Inge Wallin.
0005 //
0006 // SPDX-FileCopyrightText: 2009 Jens-Michael Hoffmann <jensmh@gmx.de>
0007 // SPDX-FileCopyrightText: 2012 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
0008 //
0009 #ifndef MARBLE_PLUGININTERFACE_H
0010 #define MARBLE_PLUGININTERFACE_H
0011 
0012 #include <QVector>
0013 #include <QCoreApplication> // for Q_DECLARE_TR_FUNCTIONS
0014 #include <QString>
0015 #include <QtPlugin>
0016 
0017 #include "marble_export.h"
0018 
0019 class QIcon;
0020 
0021 namespace Marble
0022 {
0023 
0024 struct MARBLE_EXPORT PluginAuthor
0025 {
0026     Q_DECLARE_TR_FUNCTIONS(PluginAuthor)
0027 public:
0028     PluginAuthor()
0029     {}
0030 
0031     PluginAuthor( const QString &name_, const QString &email_, const QString &task_ = PluginAuthor::tr( "Developer" ) ) :
0032         name( name_ ),
0033         task( task_ ),
0034         email( email_ )
0035     {}
0036 
0037     QString name;
0038     QString task;
0039     QString email;
0040 };
0041 
0042 /**
0043  * @short This class specifies interface of a Marble plugin.
0044  */
0045 
0046 class MARBLE_EXPORT PluginInterface
0047 {
0048  public:
0049     virtual ~PluginInterface();
0050 
0051     /**
0052      * @brief Returns the user-visible name of the plugin.
0053      *
0054      * The user-visible name should be context free, i.e. the name should
0055      * provide enough information as to what the plugin is about in the context
0056      * of Marble.
0057      *
0058      * Example: "Starry Sky Background", "OpenRouteService Routing"
0059      */
0060     virtual QString name() const = 0;
0061 
0062     /**
0063      * @brief Returns the unique name of the plugin.
0064      *
0065      * Examples: "starrysky", "openrouteservice"
0066      */
0067     virtual QString nameId() const = 0;
0068 
0069     virtual QString version() const = 0;
0070 
0071     /**
0072      * @brief Returns a user description of the plugin.
0073      */
0074     virtual QString description() const = 0;
0075 
0076     /**
0077      * @brief Returns an icon for the plugin.
0078      */
0079     virtual QIcon icon() const = 0;
0080 
0081     virtual QString copyrightYears() const = 0;
0082 
0083     /**
0084      * @since 0.26.0
0085      */
0086     virtual QVector<PluginAuthor> pluginAuthors() const = 0;
0087 
0088     /**
0089      * @brief Returns about text (credits) for external data the plugin uses.
0090      *
0091      * The default implementation returns the empty string. Please override
0092      * this method to give credits for all data from 3rd-partys.
0093      */
0094     virtual QString aboutDataText() const;
0095 };
0096 
0097 }
0098 
0099 Q_DECLARE_TYPEINFO(Marble::PluginAuthor, Q_MOVABLE_TYPE);
0100 
0101 Q_DECLARE_INTERFACE( Marble::PluginInterface, "org.kde.Marble.PluginInterface/1.1" )
0102 
0103 #endif