libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout-client-qt
include
osmscoutclientqt
QmlSettings.h
Go to the documentation of this file.
1
#ifndef OSMSCOUT_CLIENT_QT_QMLSETTINGS_H
2
#define OSMSCOUT_CLIENT_QT_QMLSETTINGS_H
3
4
/*
5
OSMScout - a Qt backend for libosmscout and libosmscout-map
6
Copyright (C) 2023 Lukas Karas
7
8
This library is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Lesser General Public
10
License as published by the Free Software Foundation; either
11
version 2.1 of the License, or (at your option) any later version.
12
13
This library is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
Lesser General Public License for more details.
17
18
You should have received a copy of the GNU Lesser General Public
19
License along with this library; if not, write to the Free Software
20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
*/
22
23
#include <
osmscoutclientqt/ClientQtImportExport.h
>
24
25
#include <osmscoutclient/Settings.h>
26
27
#include <QObject>
28
29
namespace
osmscout
{
30
50
class
OSMSCOUT_CLIENT_QT_API
QmlSettings
:
public
QObject{
51
Q_OBJECT
52
Q_PROPERTY(
double
physicalDPI
READ
GetPhysicalDPI
CONSTANT)
53
Q_PROPERTY(
double
mapDPI
READ
GetMapDPI
WRITE
SetMapDPI
NOTIFY
MapDPIChange
)
54
Q_PROPERTY(
bool
onlineTiles
READ
GetOnlineTilesEnabled
WRITE
SetOnlineTilesEnabled
NOTIFY
OnlineTilesEnabledChanged
)
55
Q_PROPERTY(QString
onlineTileProviderId
READ
GetOnlineTileProviderId
WRITE
SetOnlineTileProviderId
NOTIFY
OnlineTileProviderIdChanged
)
56
Q_PROPERTY(
bool
offlineMap
READ
GetOfflineMap
WRITE
SetOfflineMap
NOTIFY
OfflineMapChanged
)
57
Q_PROPERTY(QString
styleSheetFile
READ
GetStyleSheetFile
WRITE
SetStyleSheetFile
NOTIFY
StyleSheetFileChanged
)
58
Q_PROPERTY(
bool
renderSea
READ
GetRenderSea
WRITE
SetRenderSea
NOTIFY
RenderSeaChanged
)
59
Q_PROPERTY(QString
fontName
READ
GetFontName
WRITE
SetFontName
NOTIFY
FontNameChanged
)
60
Q_PROPERTY(
double
fontSize
READ
GetFontSize
WRITE
SetFontSize
NOTIFY
FontSizeChanged
)
61
Q_PROPERTY(
bool
showAltLanguage
READ
GetShowAltLanguage
WRITE
SetShowAltLanguage
NOTIFY
ShowAltLanguageChanged
)
63
Q_PROPERTY(QString
units
READ
GetUnits
WRITE
SetUnits
NOTIFY
UnitsChanged
)
64
65
private:
66
SettingsRef settings;
67
68
// slots
69
Slot
<
double
> mapDPISlot{
70
[
this
](
const
double
&d){ this->
MapDPIChange
(d); }
71
};
72
73
Slot<bool>
onlineTilesEnabledSlot{
74
[
this
](
const
bool
&b){this->OnlineTilesEnabledChanged(b);}
75
};
76
77
Slot<std::string> onlineTileProviderIdSlot{
78
[
this
](
const
std::string &str){ this->OnlineTileProviderIdChanged(QString::fromStdString(str));}
79
};
80
81
Slot<bool> offlineMapSlot{
82
[
this
](
const
bool
&b){ this->OfflineMapChanged(b);}
83
};
84
85
Slot<std::string> styleSheetFileSlot{
86
[
this
](
const
std::string &str){ this->StyleSheetFileChanged(QString::fromStdString(str));}
87
};
88
89
Slot<bool> renderSeaSlot{
90
[
this
](
const
bool
&b){ this->RenderSeaChanged(b);}
91
};
92
93
Slot<std::string> fontNameSlot{
94
[
this
](
const
std::string &str){ this->FontNameChanged(QString::fromStdString(str));}
95
};
96
97
Slot<double> fontSizeSlot{
98
[
this
](
const
double
&d){ this->FontSizeChanged(d);}
99
};
100
101
Slot<bool> showAltLanguageSlot{
102
[
this
](
const
bool
&b){ this->ShowAltLanguageChanged(b);}
103
};
104
105
Slot<std::string> unitsSlot{
106
[
this
](
const
std::string &str){ this->UnitsChanged(QString::fromStdString(str));}
107
};
108
109
signals:
110
void
MapDPIChange
(
double
dpi);
111
void
OnlineTilesEnabledChanged
(
bool
enabled);
112
void
OnlineTileProviderIdChanged
(
const
QString
id
);
113
void
OfflineMapChanged
(
bool
);
114
void
StyleSheetFileChanged
(
const
QString file);
115
void
RenderSeaChanged
(
bool
);
116
void
FontNameChanged
(
const
QString
fontName
);
117
void
FontSizeChanged
(
double
fontSize
);
118
void
ShowAltLanguageChanged
(
bool
showAltLanguage
);
119
void
UnitsChanged
(
const
QString
units
);
120
121
public
:
122
QmlSettings
();
123
124
~QmlSettings
()
override
=
default
;
125
126
double
GetPhysicalDPI
()
const
;
127
128
void
SetMapDPI
(
double
dpi);
129
double
GetMapDPI
()
const
;
130
131
bool
GetOnlineTilesEnabled
()
const
;
132
void
SetOnlineTilesEnabled
(
bool
b);
133
134
const
QString
GetOnlineTileProviderId
()
const
;
135
void
SetOnlineTileProviderId
(QString
id
);
136
137
Q_INVOKABLE QString
onlineProviderCopyright
();
138
139
bool
GetOfflineMap
()
const
;
140
void
SetOfflineMap
(
bool
);
141
142
QString
GetStyleSheetFile
()
const
;
143
void
SetStyleSheetFile
(
const
QString file);
144
145
bool
GetRenderSea
()
const
;
146
void
SetRenderSea
(
bool
);
147
148
QString
GetFontName
()
const
;
149
void
SetFontName
(
const
QString
fontName
);
150
151
double
GetFontSize
()
const
;
152
void
SetFontSize
(
double
fontSize
);
153
154
bool
GetShowAltLanguage
()
const
;
155
void
SetShowAltLanguage
(
bool
showAltLanguage
);
156
157
QString
GetUnits
()
const
;
158
void
SetUnits
(
const
QString
units
);
159
};
160
161
}
162
163
#endif
//OSMSCOUT_CLIENT_QT_QMLSETTINGS_H
ClientQtImportExport.h
OSMSCOUT_CLIENT_QT_API
#define OSMSCOUT_CLIENT_QT_API
Definition
ClientQtImportExport.h:45
osmscout::QmlSettings::offlineMap
bool offlineMap
Definition
QmlSettings.h:56
osmscout::QmlSettings::OfflineMapChanged
void OfflineMapChanged(bool)
osmscout::QmlSettings::GetRenderSea
bool GetRenderSea() const
osmscout::QmlSettings::onlineProviderCopyright
Q_INVOKABLE QString onlineProviderCopyright()
osmscout::QmlSettings::FontNameChanged
void FontNameChanged(const QString fontName)
osmscout::QmlSettings::GetOnlineTilesEnabled
bool GetOnlineTilesEnabled() const
osmscout::QmlSettings::onlineTileProviderId
QString onlineTileProviderId
Definition
QmlSettings.h:55
osmscout::QmlSettings::MapDPIChange
void MapDPIChange(double dpi)
osmscout::QmlSettings::SetOfflineMap
void SetOfflineMap(bool)
osmscout::QmlSettings::SetMapDPI
void SetMapDPI(double dpi)
osmscout::QmlSettings::OnlineTilesEnabledChanged
void OnlineTilesEnabledChanged(bool enabled)
osmscout::QmlSettings::fontName
QString fontName
Definition
QmlSettings.h:59
osmscout::QmlSettings::SetOnlineTileProviderId
void SetOnlineTileProviderId(QString id)
osmscout::QmlSettings::GetFontSize
double GetFontSize() const
osmscout::QmlSettings::SetUnits
void SetUnits(const QString units)
osmscout::QmlSettings::units
QString units
metrics or imperial
Definition
QmlSettings.h:63
osmscout::QmlSettings::showAltLanguage
bool showAltLanguage
Definition
QmlSettings.h:61
osmscout::QmlSettings::GetShowAltLanguage
bool GetShowAltLanguage() const
osmscout::QmlSettings::SetFontSize
void SetFontSize(double fontSize)
osmscout::QmlSettings::GetOfflineMap
bool GetOfflineMap() const
osmscout::QmlSettings::GetStyleSheetFile
QString GetStyleSheetFile() const
osmscout::QmlSettings::onlineTiles
bool onlineTiles
Definition
QmlSettings.h:54
osmscout::QmlSettings::UnitsChanged
void UnitsChanged(const QString units)
osmscout::QmlSettings::GetPhysicalDPI
double GetPhysicalDPI() const
osmscout::QmlSettings::~QmlSettings
~QmlSettings() override=default
osmscout::QmlSettings::fontSize
double fontSize
Definition
QmlSettings.h:60
osmscout::QmlSettings::SetFontName
void SetFontName(const QString fontName)
osmscout::QmlSettings::OnlineTileProviderIdChanged
void OnlineTileProviderIdChanged(const QString id)
osmscout::QmlSettings::renderSea
bool renderSea
Definition
QmlSettings.h:58
osmscout::QmlSettings::styleSheetFile
QString styleSheetFile
Definition
QmlSettings.h:57
osmscout::QmlSettings::SetOnlineTilesEnabled
void SetOnlineTilesEnabled(bool b)
osmscout::QmlSettings::QmlSettings
QmlSettings()
osmscout::QmlSettings::GetOnlineTileProviderId
const QString GetOnlineTileProviderId() const
osmscout::QmlSettings::StyleSheetFileChanged
void StyleSheetFileChanged(const QString file)
osmscout::QmlSettings::GetUnits
QString GetUnits() const
osmscout::QmlSettings::physicalDPI
double physicalDPI
Definition
QmlSettings.h:52
osmscout::QmlSettings::RenderSeaChanged
void RenderSeaChanged(bool)
osmscout::QmlSettings::ShowAltLanguageChanged
void ShowAltLanguageChanged(bool showAltLanguage)
osmscout::QmlSettings::SetStyleSheetFile
void SetStyleSheetFile(const QString file)
osmscout::QmlSettings::GetMapDPI
double GetMapDPI() const
osmscout::QmlSettings::SetShowAltLanguage
void SetShowAltLanguage(bool showAltLanguage)
osmscout::QmlSettings::SetRenderSea
void SetRenderSea(bool)
osmscout::QmlSettings::FontSizeChanged
void FontSizeChanged(double fontSize)
osmscout::QmlSettings::GetFontName
QString GetFontName() const
osmscout::QmlSettings::mapDPI
double mapDPI
Definition
QmlSettings.h:53
osmscout::Slot
Definition
Signal.h:98
osmscout
Definition
Area.h:39
Generated by
1.17.0