Marble

RoutingRunnerPlugin.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2010 Dennis Nienhüser <nienhueser@kde.org>
4// SPDX-FileCopyrightText: 2011 Thibaut Gridel <tgridel@free.fr>
5// SPDX-FileCopyrightText: 2012 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
6//
7
8#ifndef MARBLE_ROUTINGRUNNERPLUGIN_H
9#define MARBLE_ROUTINGRUNNERPLUGIN_H
10
11#include "PluginInterface.h"
12#include <QObject>
13
14#include <QHash>
15#include <QWidget>
16
17#include "routing/RoutingProfilesModel.h"
18
19namespace Marble
20{
21
22class MarbleAbstractRunner;
23class RoutingRunner;
24
25/**
26 * A plugin for Marble to execute a routing task.
27 */
28class MARBLE_EXPORT RoutingRunnerPlugin : public QObject, public PluginInterface
29{
30 Q_OBJECT
31
32public:
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
91protected:
92 void setStatusMessage(const QString &message);
93
94 void setSupportedCelestialBodies(const QStringList &celestialBodies);
95
96 void setCanWorkOffline(bool canWorkOffline);
97
98private:
99 class Private;
100 Private *const d;
101};
102
103}
104
105Q_DECLARE_INTERFACE(Marble::RoutingRunnerPlugin, "org.kde.Marble.RunnerRunnerPlugin/1.01")
106
107#endif // MARBLE_ROUTINGRUNNERPLUGIN_H
This class specifies interface of a Marble plugin.
A plugin for Marble to execute a routing task.
virtual QString guiString() const =0
Returns the string that should appear in the user interface.
virtual RoutingRunner * newRunner() const =0
Plugin factory method to create a new runner instance.
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.