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

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