QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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  {
66  };
67  Q_ENUM( EnvVar )
68 };
69 #endif
70 
77 class SERVER_EXPORT QgsServerSettings
78 {
79  public:
81  {
84  QString descr;
85  QString iniKey;
86  QVariant::Type type;
87  QVariant defaultVal;
88  QVariant val;
89  };
90 
95 
99  void load();
100 
105  bool load( const QString &envVarName );
106 
110  void logSummary() const;
111 
116  QString iniFile() const;
117 
122  bool parallelRendering() const;
123 
128  int maxThreads() const;
129 
134  int maxCacheLayers() const;
135 
140  Qgis::MessageLevel logLevel() const;
141 
146  QString projectFile() const;
147 
152  QString logFile() const;
153 
159  bool logStderr() const;
160 
165  qint64 cacheSize() const;
166 
171  QString cacheDirectory() const;
172 
178  QString overrideSystemLocale() const;
179 
185  bool showGroupSeparator() const;
186 
187  private:
188  void initSettings();
189  QVariant value( QgsServerSettingsEnv::EnvVar envVar ) const;
190  QMap<QgsServerSettingsEnv::EnvVar, QString> getEnv() const;
191  void loadQSettings( const QString &envOptPath ) const;
192  void prioritize( const QMap<QgsServerSettingsEnv::EnvVar, QString> &env );
193 
194  QMap< QgsServerSettingsEnv::EnvVar, Setting > mSettings;
195 };
196 
197 #endif
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:79
Show group (thousands) separator when formatting numeric values, defaults to FALSE (since QGIS 3...
#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.