QGIS API Documentation  3.8.0-Zanzibar (11aff65)
qgsserversettings.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsserversettings.h
3  -------------------
4  begin : December 19, 2016
5  copyright : (C) 2016 by Paul Blottiere
6  email : paul dot blottiere at oslandia dot com
7 
8 ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 
20 #ifndef QGSSERVERSETTINGS_H
21 #define QGSSERVERSETTINGS_H
22 
23 #include <QObject>
24 #include <QMetaEnum>
25 
26 #include "qgsmessagelog.h"
27 #include "qgis_server.h"
28 #include "qgis_sip.h"
29 
36 #ifndef SIP_RUN
37 class SERVER_EXPORT QgsServerSettingsEnv : public QObject
38 {
39  Q_OBJECT
40 
41  public:
43  enum Source
44  {
47  INI_FILE
48  };
49  Q_ENUM( Source )
50 
51 
52  enum EnvVar
53  {
67  QGIS_SERVER_WMS_MAX_WIDTH
68  };
69  Q_ENUM( EnvVar )
70 };
71 #endif
72 
79 class SERVER_EXPORT QgsServerSettings
80 {
81  public:
83  {
86  QString descr;
87  QString iniKey;
88  QVariant::Type type;
89  QVariant defaultVal;
90  QVariant val;
91  };
92 
97 
101  void load();
102 
107  bool load( const QString &envVarName );
108 
112  void logSummary() const;
113 
118  QString iniFile() const;
119 
124  bool parallelRendering() const;
125 
130  int maxThreads() const;
131 
136  int maxCacheLayers() const;
137 
142  Qgis::MessageLevel logLevel() const;
143 
148  QString projectFile() const;
149 
154  QString logFile() const;
155 
161  bool logStderr() const;
162 
167  qint64 cacheSize() const;
168 
173  QString cacheDirectory() const;
174 
180  QString overrideSystemLocale() const;
181 
187  bool showGroupSeparator() const;
188 
194  int wmsMaxHeight() const;
195 
201  int wmsMaxWidth() const;
202 
203  private:
204  void initSettings();
205  QVariant value( QgsServerSettingsEnv::EnvVar envVar ) const;
206  QMap<QgsServerSettingsEnv::EnvVar, QString> getEnv() const;
207  void loadQSettings( const QString &envOptPath ) const;
208  void prioritize( const QMap<QgsServerSettingsEnv::EnvVar, QString> &env );
209 
210  QMap< QgsServerSettingsEnv::EnvVar, Setting > mSettings;
211 };
212 
213 #endif
SERVER_EXPORT int wmsMaxWidth(const QgsProject &project)
Returns the maximum width for WMS images defined in a QGIS project.
Source
Source of the parameter used in the configuration.
Provides a way to retrieve settings by prioritizing according to environment variables, ini file and default values.
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition: qgis.h:66
Show group (thousands) separator when formatting numeric values, defaults to false (since QGIS 3...
Override system locale (since QGIS 3.8)
#define SIP_SKIP
Definition: qgis_sip.h:119
Provides some enum describing the environment currently supported for configuration.
QgsServerSettingsEnv::EnvVar envVar
QgsServerSettingsEnv::Source src
EnvVar
Environment variables to configure the server.
SERVER_EXPORT int wmsMaxHeight(const QgsProject &project)
Returns the maximum height for WMS images defined in a QGIS project.