Marble

RoutingRunnerPlugin.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <[email protected]>
4 // SPDX-FileCopyrightText: 2011 Thibaut Gridel <[email protected]>
5 // SPDX-FileCopyrightText: 2012 Bernhard Beschow <[email protected]>
6 //
7 
8 #ifndef MARBLE_ROUTINGRUNNERPLUGIN_H
9 #define MARBLE_ROUTINGRUNNERPLUGIN_H
10 
11 #include <QObject>
12 #include "PluginInterface.h"
13 
14 #include <QHash>
15 #include <QWidget>
16 
17 #include "routing/RoutingProfilesModel.h"
18 
19 namespace Marble
20 {
21 
22 class MarbleAbstractRunner;
23 class RoutingRunner;
24 
25 /**
26  * A plugin for Marble to execute a routing task.
27  */
28 class MARBLE_EXPORT RoutingRunnerPlugin : public QObject, public PluginInterface
29 {
30  Q_OBJECT
31 
32 public:
33  /** Constructor with optional parent object */
34  explicit RoutingRunnerPlugin( QObject* parent = nullptr );
35 
36  /** Destructor */
37  ~RoutingRunnerPlugin() override;
38 
39  /**
40  * @brief Returns the string that should appear in the user interface.
41  *
42  * For example, "OpenRouteService" should be returned for the OpenRouteService routing plugin.
43  */
44  virtual QString guiString() const = 0;
45 
46  /** Plugin factory method to create a new runner instance.
47  * Method caller gets ownership of the returned object
48  */
49  virtual RoutingRunner *newRunner() const = 0;
50 
51  /** True if the plugin supports its tasks on the given planet */
52  bool supportsCelestialBody( const QString &celestialBodyId ) const;
53 
54  /** True if the plugin can execute its tasks without network access */
55  bool canWorkOffline() const;
56 
57  /**
58  * @brief Returns @code true @endcode if the plugin is able to perform its claimed task.
59  *
60  * The default implementation returns @code true @endcode. This method can be
61  * overridden for example to indicate an incomplete installation.
62  */
63  virtual bool canWork() const;
64 
65  // Overridden methods with default implementations
66 
67  QIcon icon() const override;
68 
69  /** A status message showing whether the plugin will be able to deliver results */
70  QString statusMessage() const;
71 
72  class ConfigWidget : public QWidget
73  {
74  public:
75  virtual void loadSettings( const QHash<QString, QVariant> &settings ) = 0;
76  virtual QHash<QString, QVariant> settings() const = 0;
77  };
78  /**
79  * @brief Method for getting a pointer to the configuration widget of the plugin.
80  *
81  * @return The configuration widget or, if no configuration widget exists, 0.
82  */
83  virtual ConfigWidget *configWidget();
84 
85  /** True if the plugin supports the given routing profile template */
86  virtual bool supportsTemplate( RoutingProfilesModel::ProfileTemplate profileTemplate ) const;
87 
88  /** Settings for the given routing profile template */
89  virtual QHash<QString, QVariant> templateSettings( RoutingProfilesModel::ProfileTemplate profileTemplate ) const;
90 
91 protected:
92  void setStatusMessage( const QString &message );
93 
94  void setSupportedCelestialBodies( const QStringList &celestialBodies );
95 
96  void setCanWorkOffline( bool canWorkOffline );
97 
98 private:
99  class Private;
100  Private *const d;
101 };
102 
103 }
104 
105 Q_DECLARE_INTERFACE( Marble::RoutingRunnerPlugin, "org.kde.Marble.RunnerRunnerPlugin/1.01" )
106 
107 #endif // MARBLE_ROUTINGRUNNERPLUGIN_H
This class specifies interface of a Marble plugin.
Binds a QML item to a specific geodetic location in screen coordinates.
A plugin for Marble to execute a routing task.
QString message
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Mar 23 2023 04:19:30 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.