libosmscout 1.1.1
Loading...
Searching...
No Matches
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
24
25#include <osmscoutclient/Settings.h>
26
27#include <QObject>
28
29namespace osmscout {
30
50class OSMSCOUT_CLIENT_QT_API QmlSettings: public QObject{
51Q_OBJECT
52 Q_PROPERTY(double physicalDPI READ GetPhysicalDPI CONSTANT)
53 Q_PROPERTY(double mapDPI READ GetMapDPI WRITE SetMapDPI NOTIFY MapDPIChange)
56 Q_PROPERTY(bool offlineMap READ GetOfflineMap WRITE SetOfflineMap NOTIFY OfflineMapChanged)
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)
63 Q_PROPERTY(QString units READ GetUnits WRITE SetUnits NOTIFY UnitsChanged)
64
65private:
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
109signals:
110 void MapDPIChange(double dpi);
111 void OnlineTilesEnabledChanged(bool enabled);
112 void OnlineTileProviderIdChanged(const QString id);
114 void StyleSheetFileChanged(const QString file);
116 void FontNameChanged(const QString fontName);
119 void UnitsChanged(const QString units);
120
121public:
123
124 ~QmlSettings() override = default;
125
126 double GetPhysicalDPI() const;
127
128 void SetMapDPI(double dpi);
129 double GetMapDPI() const;
130
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;
156
157 QString GetUnits() const;
158 void SetUnits(const QString units);
159};
160
161}
162
163#endif //OSMSCOUT_CLIENT_QT_QMLSETTINGS_H
#define OSMSCOUT_CLIENT_QT_API
Definition ClientQtImportExport.h:45
bool offlineMap
Definition QmlSettings.h:56
void OfflineMapChanged(bool)
bool GetRenderSea() const
Q_INVOKABLE QString onlineProviderCopyright()
void FontNameChanged(const QString fontName)
bool GetOnlineTilesEnabled() const
QString onlineTileProviderId
Definition QmlSettings.h:55
void MapDPIChange(double dpi)
void SetOfflineMap(bool)
void SetMapDPI(double dpi)
void OnlineTilesEnabledChanged(bool enabled)
QString fontName
Definition QmlSettings.h:59
void SetOnlineTileProviderId(QString id)
double GetFontSize() const
void SetUnits(const QString units)
QString units
metrics or imperial
Definition QmlSettings.h:63
bool showAltLanguage
Definition QmlSettings.h:61
bool GetShowAltLanguage() const
void SetFontSize(double fontSize)
bool GetOfflineMap() const
QString GetStyleSheetFile() const
bool onlineTiles
Definition QmlSettings.h:54
void UnitsChanged(const QString units)
double GetPhysicalDPI() const
~QmlSettings() override=default
double fontSize
Definition QmlSettings.h:60
void SetFontName(const QString fontName)
void OnlineTileProviderIdChanged(const QString id)
bool renderSea
Definition QmlSettings.h:58
QString styleSheetFile
Definition QmlSettings.h:57
void SetOnlineTilesEnabled(bool b)
const QString GetOnlineTileProviderId() const
void StyleSheetFileChanged(const QString file)
QString GetUnits() const
double physicalDPI
Definition QmlSettings.h:52
void RenderSeaChanged(bool)
void ShowAltLanguageChanged(bool showAltLanguage)
void SetStyleSheetFile(const QString file)
double GetMapDPI() const
void SetShowAltLanguage(bool showAltLanguage)
void FontSizeChanged(double fontSize)
QString GetFontName() const
double mapDPI
Definition QmlSettings.h:53
Definition Signal.h:98
Definition Area.h:39