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

KDE's Doxygen guidelines are available online.