QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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  {
69  QGIS_SERVER_API_WFS3_MAX_LIMIT
70  };
71  Q_ENUM( EnvVar )
72 };
73 #endif
74 
81 class SERVER_EXPORT QgsServerSettings
82 {
83  public:
85  {
88  QString descr;
89  QString iniKey;
90  QVariant::Type type;
91  QVariant defaultVal;
92  QVariant val;
93  };
94 
99 
103  void load();
104 
109  bool load( const QString &envVarName );
110 
114  void logSummary() const;
115 
120  QString iniFile() const;
121 
126  bool parallelRendering() const;
127 
132  int maxThreads() const;
133 
138  int maxCacheLayers() const;
139 
144  Qgis::MessageLevel logLevel() const;
145 
150  QString projectFile() const;
151 
156  QString logFile() const;
157 
163  bool logStderr() const;
164 
169  qint64 cacheSize() const;
170 
175  QString cacheDirectory() const;
176 
182  QString overrideSystemLocale() const;
183 
189  bool showGroupSeparator() const;
190 
196  int wmsMaxHeight() const;
197 
203  int wmsMaxWidth() const;
204 
213  QString apiResourcesDirectory() const;
214 
223  qlonglong apiWfs3MaxLimit() const;
224 
225  private:
226  void initSettings();
227  QVariant value( QgsServerSettingsEnv::EnvVar envVar ) const;
228  QMap<QgsServerSettingsEnv::EnvVar, QString> getEnv() const;
229  void loadQSettings( const QString &envOptPath ) const;
230  void prioritize( const QMap<QgsServerSettingsEnv::EnvVar, QString> &env );
231 
232  QMap< QgsServerSettingsEnv::EnvVar, Setting > mSettings;
233 };
234 
235 #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.
Maximum width for a WMS request. The most conservative between this and the project one is used (sinc...
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:67
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:126
Maximum height for a WMS request. The most conservative between this and the project one is used (sin...
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.