Marble

MarbleLegendBrowser.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2006-2007 Torsten Rahn <[email protected]>
4 // SPDX-FileCopyrightText: 2007 Inge Wallin <[email protected]>
5 // SPDX-FileCopyrightText: 2013 Yazeed Zoabi <[email protected]>
6 //
7 
8 //
9 // The Legend Browser displays the legend
10 //
11 
12 #ifndef MARBLE_MARBLELEGENDBROWSER_H
13 #define MARBLE_MARBLELEGENDBROWSER_H
14 
15 #ifdef MARBLE_NO_WEBKITWIDGETS
16 #include "NullMarbleWebView.h"
17 #else
18 #include "MarbleWebView.h"
19 #endif
20 
21 #include "marble_export.h"
22 
23 class QEvent;
24 class QUrl;
25 class QString;
26 
27 namespace Marble
28 {
29 
30 class MarbleModel;
31 class MarbleLegendBrowserPrivate;
32 
33 class MARBLE_EXPORT MarbleLegendBrowser : public MarbleWebView
34 {
35  Q_OBJECT
36 
37  public:
38  explicit MarbleLegendBrowser( QWidget* parent );
39  ~MarbleLegendBrowser() override;
40 
41  void setMarbleModel( MarbleModel *marbleModel );
42  QSize sizeHint() const override;
43 
44  Q_SIGNALS:
45  void toggledShowProperty( const QString&, bool );
46  void tourLinkClicked( const QString &url );
47 
48  public Q_SLOTS:
49  void setCheckedProperty( const QString& name, bool checked );
50  void setRadioCheckedProperty( const QString& value,const QString& name, bool checked );
51 
52  private Q_SLOTS:
53  void initTheme();
54  void loadLegend();
55  void openLinkExternally( const QUrl &url );
56 
57  protected:
58  bool event( QEvent * event ) override;
59  static QString readHtml(const QUrl &name);
60  QString generateSectionsHtml();
61  static void translateHtml(QString &html);
62 
63  private:
64  void injectWebChannel( QString &html );
65  void reverseSupportCheckboxes( QString &html );
66  private:
67  Q_DISABLE_COPY( MarbleLegendBrowser )
68  MarbleLegendBrowserPrivate * const d;
69 };
70 
71 class MarbleJsWrapper : public QObject
72 {
73  Q_OBJECT
74 public:
75  explicit MarbleJsWrapper( MarbleLegendBrowser* parent ) : m_parent(parent) {}
76 
77 public Q_SLOTS:
78  void setCheckedProperty( const QString& name, bool checked )
79  {
80  m_parent->setCheckedProperty(name, checked);
81  }
82  void setRadioCheckedProperty( const QString& value,const QString& name, bool checked )
83  {
84  m_parent->setRadioCheckedProperty(value, name, checked);
85  }
86 private:
87  MarbleLegendBrowser * m_parent;
88 };
89 
90 }
91 
92 #endif
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
Binds a QML item to a specific geodetic location in screen coordinates.
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Oct 4 2023 04:09:42 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.