Marble

MarbleLegendBrowser.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2006-2007 Torsten Rahn <tackat@kde.org>
4// SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org>
5// SPDX-FileCopyrightText: 2013 Yazeed Zoabi <yazeedz.zoabi@gmail.com>
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
23class QEvent;
24class QUrl;
25class QString;
26
27namespace Marble
28{
29
30class MarbleModel;
31class MarbleLegendBrowserPrivate;
32
33class MARBLE_EXPORT MarbleLegendBrowser : public MarbleWebView
34{
35 Q_OBJECT
36
37public:
38 explicit MarbleLegendBrowser(QWidget *parent);
39 ~MarbleLegendBrowser() override;
40
41 void setMarbleModel(MarbleModel *marbleModel);
42 QSize sizeHint() const override;
43
44Q_SIGNALS:
45 void toggledShowProperty(const QString &, bool);
46 void tourLinkClicked(const QString &url);
47
48public Q_SLOTS:
49 void setCheckedProperty(const QString &name, bool checked);
50 void setRadioCheckedProperty(const QString &value, const QString &name, bool checked);
51
52private Q_SLOTS:
53 void initTheme();
54 void loadLegend();
55 void openLinkExternally(const QUrl &url);
56
57protected:
58 bool event(QEvent *event) override;
59 static QString readHtml(const QUrl &name);
60 QString generateSectionsHtml();
61 static void translateHtml(QString &html);
62
63private:
64 void injectWebChannel(QString &html);
65 void reverseSupportCheckboxes(QString &html);
66
67private:
68 Q_DISABLE_COPY(MarbleLegendBrowser)
69 MarbleLegendBrowserPrivate *const d;
70};
71
72class MarbleJsWrapper : public QObject
73{
75public:
76 explicit MarbleJsWrapper(MarbleLegendBrowser *parent)
77 : m_parent(parent)
78 {
79 }
80
81public Q_SLOTS:
82 void setCheckedProperty(const QString &name, bool checked)
83 {
84 m_parent->setCheckedProperty(name, checked);
85 }
86 void setRadioCheckedProperty(const QString &value, const QString &name, bool checked)
87 {
88 m_parent->setRadioCheckedProperty(value, name, checked);
89 }
90
91private:
92 MarbleLegendBrowser *m_parent;
93};
94
95}
96
97#endif
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
Binds a QML item to a specific geodetic location in screen coordinates.
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:37:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.