Marble

PluginManager.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2006-2008 Torsten Rahn <tackat@kde.org>
4// SPDX-FileCopyrightText: 2009 Jens-Michael Hoffmann <jensmh@gmx.de>
5//
6
7#ifndef MARBLE_PLUGINMANAGER_H
8#define MARBLE_PLUGINMANAGER_H
9
10#include "marble_export.h"
11#include <QList>
12#include <QObject>
13
14namespace Marble
15{
16
17class RenderPlugin;
18class PositionProviderPlugin;
19class PluginManagerPrivate;
20class SearchRunnerPlugin;
21class ReverseGeocodingRunnerPlugin;
22class RoutingRunnerPlugin;
23class ParseRunnerPlugin;
24
25/**
26 * @short The class that handles Marble's plugins.
27 *
28 * Ownership policy for plugins:
29 *
30 * On every invocation of createNetworkPlugins and
31 * createFloatItems the PluginManager creates new objects and transfers
32 * ownership to the calling site. In order to create
33 * the objects, the PluginManager internally has a list of the plugins
34 * which are owned by the PluginManager and destroyed by it.
35 *
36 */
37
38class MARBLE_EXPORT PluginManager : public QObject
39{
40 Q_OBJECT
41
42public:
43 explicit PluginManager(QObject *parent = nullptr);
44
45 ~PluginManager() override;
46
47 /**
48 * @brief Returns all available RenderPlugins.
49 *
50 * Ownership of the items remains in PluginManager.
51 * In order to use the RenderPlugins, first create new instances using
52 * RenderPlugin::newInstance().
53 */
54 QList<const RenderPlugin *> renderPlugins() const;
55
56 /**
57 * @brief Add a RenderPlugin manually to the list of known plugins. Normally you
58 * don't need to call this method since all plugins are loaded automatically.
59 * @param plugin The plugin to add. Ownership retains with the caller.
60 */
61 void addRenderPlugin(const RenderPlugin *plugin);
62
63 /**
64 * @brief Returns all available PositionProviderPlugins.
65 *
66 * Ownership of the items remains in PluginManager.
67 * In order to use the PositionProviderPlugins, first create new instances using
68 * PositionProviderPlugin::newInstance().
69 */
70 QList<const PositionProviderPlugin *> positionProviderPlugins() const;
71
72 /**
73 * @brief Add a PositionProviderPlugin manually to the list of known plugins. Normally you
74 * don't need to call this method since all plugins are loaded automatically.
75 * @param plugin The plugin to add. Ownership retains with the caller.
76 */
77 void addPositionProviderPlugin(const PositionProviderPlugin *plugin);
78
79 /**
80 * Returns all search runner plugins.
81 * @note: Runner plugins are owned by the PluginManager, do not delete them.
82 */
83 QList<const SearchRunnerPlugin *> searchRunnerPlugins() const;
84
85 /**
86 * @brief Add a SearchRunnerPlugin manually to the list of known plugins. Normally you
87 * don't need to call this method since all plugins are loaded automatically.
88 * @param plugin The plugin to add. Ownership retains with the caller.
89 */
90 void addSearchRunnerPlugin(const SearchRunnerPlugin *plugin);
91
92 /**
93 * Returns all reverse geocoding runner plugins.
94 * @note: The runner plugins are owned by the PluginManager, do not delete them.
95 */
96 QList<const ReverseGeocodingRunnerPlugin *> reverseGeocodingRunnerPlugins() const;
97
98 /**
99 * @brief Add a ReverseGeocodingRunnerPlugin manually to the list of known plugins. Normally you
100 * don't need to call this method since all plugins are loaded automatically.
101 * @param plugin The plugin to add. Ownership retains with the caller.
102 */
103 void addReverseGeocodingRunnerPlugin(const ReverseGeocodingRunnerPlugin *plugin);
104
105 /**
106 * Returns all routing runner plugins.
107 * @note: The runner plugins are owned by the PluginManager, do not delete them.
108 */
109 QList<RoutingRunnerPlugin *> routingRunnerPlugins() const;
110
111 /**
112 * @brief Add a RoutingRunnerPlugin manually to the list of known plugins. Normally you
113 * don't need to call this method since all plugins are loaded automatically.
114 * @param plugin The plugin to add. Ownership retains with the caller.
115 */
116 void addRoutingRunnerPlugin(RoutingRunnerPlugin *plugin);
117
118 /**
119 * Returns all parse runner plugins.
120 * @note: The runner plugins are owned by the PluginManager, do not delete them.
121 */
122 QList<const ParseRunnerPlugin *> parsingRunnerPlugins() const;
123
124 /**
125 * @brief Add a ParseRunnerPlugin manually to the list of known plugins. Normally you
126 * don't need to call this method since all plugins are loaded automatically.
127 * @param plugin The plugin to add. Ownership retains with the caller.
128 */
129 void addParseRunnerPlugin(const ParseRunnerPlugin *plugin);
130
131 /**
132 * @brief blacklistPlugin Prevent that a plugin is loaded from the given filename
133 * @param filename The name of the file (excluding prefix and file extension) to blacklist. E.g.
134 * to ignore "libWikipedia.so" on Linux and "Wikipedia.dll" on Windows, pass "Wikipedia"
135 */
136 static void blacklistPlugin(const QString &filename);
137
138 /**
139 * @brief whitelistPlugin Add a plugin to the whitelist of plugins. If the whitelist is not
140 * empty, only whitelisted plugins are loaded. If a plugin is both whitelisted and blacklisted,
141 * it will not be loaded
142 * @param filename The name of the file (excluding prefix and file extension) to whitelist. E.g.
143 * to ignore "libWikipedia.so" on Linux and "Wikipedia.dll" on Windows, pass "Wikipedia"
144 */
145 static void whitelistPlugin(const QString &filename);
146
147Q_SIGNALS:
148 void renderPluginsChanged();
149
150 void positionProviderPluginsChanged();
151
152 void searchRunnerPluginsChanged();
153
154 void reverseGeocodingRunnerPluginsChanged();
155
156 void routingRunnerPluginsChanged();
157
158 void parseRunnerPluginsChanged();
159
160private:
161 Q_DISABLE_COPY(PluginManager)
162
163#ifdef Q_OS_ANDROID
164 void installPluginsFromAssets() const;
165#endif
166
167 PluginManagerPrivate *const d;
168};
169
170}
171
172#endif
A plugin for Marble to execute a parsing task.
The class that handles Marble's plugins.
The abstract class that provides position information.
The abstract class that creates a renderable item.
A plugin for Marble to execute a reverse geocoding task.
A plugin for Marble to execute a routing task.
A plugin for Marble to execute a placemark search.
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 Sat Dec 21 2024 17:04:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.