Marble

RenderPlugin.h
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2008 Torsten Rahn <[email protected]>
9 // Copyright 2008 Inge Wallin <[email protected]>
10 // Copyright 2011,2012 Bernhard Beschow <[email protected]>
11 // Copyright 2012 Illya Kovalevskyy <[email protected]>
12 //
13 
14 #ifndef MARBLE_RENDERPLUGIN_H
15 #define MARBLE_RENDERPLUGIN_H
16 
17 #include <QObject>
18 #include <QString>
19 #include <QRegion>
20 
21 #include "RenderPluginInterface.h"
22 #include "marble_export.h"
23 
24 
25 class QAction;
26 class QActionGroup;
27 class QStandardItem;
28 
29 namespace Marble
30 {
31 
32 class MarbleModel;
33 class RenderPluginModel;
34 
43 class MARBLE_EXPORT RenderPlugin : public QObject, public RenderPluginInterface
44 {
45  Q_OBJECT
46 
47  Q_PROPERTY ( QString name READ name CONSTANT )
48  Q_PROPERTY ( QString nameId READ nameId CONSTANT )
49  Q_PROPERTY ( QString version READ version CONSTANT )
50  Q_PROPERTY ( QString description READ description CONSTANT )
51  Q_PROPERTY ( bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged )
52  Q_PROPERTY ( bool visible READ visible WRITE setVisible NOTIFY visibilityChanged )
53  Q_PROPERTY ( bool userCheckable READ isUserCheckable WRITE setUserCheckable NOTIFY userCheckableChanged )
54 
55  public:
59  enum RenderType {
60  UnknownRenderType,
61  TopLevelRenderType,
62  PanelRenderType,
63  OnlineRenderType,
64  ThemeRenderType
65  };
66 
67  explicit RenderPlugin( const MarbleModel *marbleModel );
68  ~RenderPlugin() override;
69 
79  virtual QString guiString() const = 0;
80 
91  virtual RenderPlugin *newInstance( const MarbleModel *marbleModel ) const = 0;
92 
102  const MarbleModel* marbleModel() const;
103 
114  virtual const QList<QActionGroup*>* actionGroups() const;
115 
126  virtual const QList<QActionGroup*>* toolbarActionGroups() const;
127 
139  bool enabled() const;
140 
151  bool visible() const;
152 
166  bool isUserCheckable() const;
167 
178  virtual QHash<QString,QVariant> settings() const;
179 
188  virtual void setSettings( const QHash<QString,QVariant> &settings );
189 
199  virtual RenderType renderType() const;
200 
201  RenderState renderState() const override;
202 
203  QString runtimeTrace() const override;
204 
205  public Q_SLOTS:
217  void setEnabled( bool enabled );
218 
227  void setVisible( bool visible );
228 
238  void setUserCheckable(bool isUserCheckable);
239 
246  void restoreDefaultSettings();
247 
256  QStringList settingKeys() const;
257 
267  bool setSetting( const QString & key, const QVariant & value );
268 
278  QVariant setting( const QString & key ) const;
279 
287  QAction *action() const;
288 
289  Q_SIGNALS:
293  void visibilityChanged( bool visible, const QString &nameId );
294 
298  void enabledChanged( bool enable );
299 
303  void userCheckableChanged(bool isUserCheckable);
304 
308  void settingsChanged( const QString& nameId );
309 
314  void actionGroupsChanged();
315 
321  void repaintNeeded( const QRegion& dirtyRegion = QRegion() );
322 
323  protected:
324  bool eventFilter( QObject *, QEvent * ) override;
325 
326  private:
327  friend class RenderPluginModel;
328 
329  QStandardItem *item();
330 
331  void applyItemState();
332  void retrieveItemState();
333 
334  private:
335  Q_DISABLE_COPY( RenderPlugin )
336  class Private;
337  Private * const d;
338 };
339 
340 #define MARBLE_PLUGIN(T) public:\
341  RenderPlugin* newInstance( const MarbleModel *marbleModel ) const override { return new T( marbleModel ); }
342 }
343 
344 #endif
Provides common access to various kinds of plugins without having to know about their details...
The class that specifies the Marble layer interface of a plugin.
Binds a QML item to a specific geodetic location in screen coordinates.
The data model (not based on QAbstractModel) for a MarbleWidget.
Definition: MarbleModel.h:91
RenderType
A Type of plugin.
Definition: RenderPlugin.h:59
The abstract class that creates a renderable item.
Definition: RenderPlugin.h:43
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Oct 22 2020 23:24:19 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.