File indexing completed on 2024-04-28 11:31:18

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <nienhueser@kde.org>
0004 // SPDX-FileCopyrightText: 2011 Thibaut Gridel <tgridel@free.fr>
0005 // SPDX-FileCopyrightText: 2012 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
0006 //
0007 
0008 #ifndef MARBLE_REVERSEGEOCODINGRUNNERPLUGIN_H
0009 #define MARBLE_REVERSEGEOCODINGRUNNERPLUGIN_H
0010 
0011 #include <QObject>
0012 #include "PluginInterface.h"
0013 
0014 namespace Marble
0015 {
0016 
0017 class ReverseGeocodingRunner;
0018 
0019 /**
0020   * A plugin for Marble to execute a reverse geocoding task.
0021   */
0022 class MARBLE_EXPORT ReverseGeocodingRunnerPlugin : public QObject, public PluginInterface
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     /** Constructor with optional parent object */
0028     explicit ReverseGeocodingRunnerPlugin( QObject* parent = nullptr );
0029 
0030     /** Destructor */
0031     ~ReverseGeocodingRunnerPlugin() override;
0032 
0033     /**
0034      * @brief Returns the string that should appear in the user interface.
0035      *
0036      * For example, "Nominatim" should be returned for the Nominatim reverse geocoding plugin.
0037      */
0038     virtual QString guiString() const = 0;
0039 
0040     /** Plugin factory method to create a new runner instance.
0041       * Method caller gets ownership of the returned object
0042       */
0043     virtual ReverseGeocodingRunner *newRunner() const = 0;
0044 
0045     /** True if the plugin supports its tasks on the given planet */
0046     bool supportsCelestialBody( const QString &celestialBodyId ) const;
0047 
0048     /** True if the plugin can execute its tasks without network access */
0049     bool canWorkOffline() const;
0050 
0051     /**
0052      * @brief Returns @code true @endcode if the plugin is able to perform its claimed task.
0053      *
0054      * The default implementation returns @code true @endcode. This method can be
0055      * overridden for example to indicate an incomplete installation.
0056      */
0057     virtual bool canWork() const;
0058 
0059     // Overridden methods with default implementations
0060 
0061     QIcon icon() const override;
0062 
0063 protected:
0064     void setSupportedCelestialBodies( const QStringList &celestialBodies );
0065 
0066     void setCanWorkOffline( bool canWorkOffline );
0067 
0068 private:
0069     class Private;
0070     Private * const d;
0071 };
0072 
0073 }
0074 
0075 Q_DECLARE_INTERFACE( Marble::ReverseGeocodingRunnerPlugin, "org.kde.Marble.ReverseGeocodingRunnerPlugin/1.01" )
0076 
0077 #endif // MARBLE_REVERSEGEOCODINGRUNNERPLUGIN_H