Manual for OpenFLUID 2.1.10

PreferencesManager.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30 */
31 
32 /**
33  @file PreferencesManager.hpp
34 
35  @author Jean-Christophe Fabre <jean-christophe.fabre@inra.fr>
36  @author Aline LIBRES <libres@supagro.inra.fr>
37  */
38 
39 #ifndef __OPENFLUID_BASE_PREFERENCESMANAGER_HPP__
40 #define __OPENFLUID_BASE_PREFERENCESMANAGER_HPP__
41 
42 
43 #include <map>
44 #include <vector>
45 
46 #include <QSettings>
47 #include <QStringList>
48 
49 #include <openfluid/dllexport.hpp>
52 
53 
54 namespace openfluid { namespace base {
55 
56 
57 // =====================================================================
58 // =====================================================================
59 
60 
62 {
63 
65 
66  private:
67 
68  static QString m_FileName;
69 
70  QSettings* mp_ConfFile;
71 
73 
75 
76  void setDefaultValues();
77 
78  void setBuilderExtraPaths(const QString& Key, const QStringList& Paths);
79 
80  void addBuilderExtraPath(const QString& Key, const QString& Path);
81 
82  void removeBuilderExtraPath(const QString& Key, const QString& Path);
83 
84  QStringList getBuilderExtraPaths(const QString& Key);
85 
86  static QString guessLang();
87 
88 
89  public:
90 
91  static const int RecentProjectsLimit;
92 
94  {
95  public:
96  QString Name;
97  QString Path;
98  };
99 
101  {
102  QString m_Color;
103  QStringList m_Decoration;
104 
105  SyntaxHighlightingRule_t(const QString& Color,const QStringList& Decoration)
106  : m_Color(Color),m_Decoration(Decoration) {}
107  };
108 
109  typedef std::vector<RecentProject_t> RecentProjectsList_t;
110 
111  typedef QMap<QString, QStringList> ExternalToolsCommands_t;
112 
113  typedef QMap<QString, SyntaxHighlightingRule_t> SyntaxHighlightingRules_t;
114 
115  typedef std::map<QString, QString> MarketPlaces_t;
116 
117  enum ExternalToolContext { WORKSPACE, WARE, FILE };
118 
119  /* Used only if we want to set another file name for the conf file
120  * instead of the default one (for tests eg.)
121  * To be set before the first call of instance().
122  */
123  static void setFileName(const QString& AbsoluteFileName);
124 
125  QString getFileName();
126 
127  bool isValidKey(const QString& Group, const QString& Key);
128 
129 
130  void setLang(const QString& Lang);
131 
132  QString getLang();
133 
134  static QStringList getAvailableLangs();
135 
136  static bool isAvailableLang(const QString& Lang);
137 
138  void setBuilderRecentMax(int RecentMax);
139 
140  int getBuilderRecentMax();
141 
142  bool addBuilderRecentProject(const QString& ProjectName, const QString& ProjectPath = "");
143 
144  RecentProjectsList_t getBuilderRecentProjects();
145 
146  void clearBuilderRecentProjects();
147 
148  void adaptBuilderRecentProjects();
149 
150 
151  void setBuilderWorkspacesPaths(const QStringList& Paths);
152 
153  QStringList getBuilderWorkspacesPaths();
154 
155  QString getBuilderWorkspacePath();
156 
157  QString getBuilderProjectsPath();
158 
159 
160  void setBuilderExtraSimulatorsPaths(const QStringList& Paths);
161 
162  void addBuilderExtraSimulatorsPath(const QString& Path);
163 
164  void removeBuilderExtraSimulatorsPath(const QString& Path);
165 
166  QStringList getBuilderExtraSimulatorsPaths();
167 
168 
169  void setBuilderExtraExtensionsPaths(const QStringList& Paths);
170 
171  void addBuilderExtraExtensionsPath(const QString& Path);
172 
173  void removeBuilderExtraExtensionsPath(const QString& Path);
174 
175  QStringList getBuilderExtraExtensionsPaths();
176 
177 
178  void setBuilderExtraObserversPaths(const QStringList& Paths);
179 
180  void addBuilderExtraObserversPath(const QString& Path);
181 
182  void removeBuilderExtraObserversPath(const QString& Path);
183 
184  QStringList getBuilderExtraObserversPaths();
185 
186 
187  void setBuilderDeltaT(openfluid::core::Duration_t DeltaT);
188 
189  openfluid::core::Duration_t getBuilderDeltaT();
190 
191 
192  void setBuilderBegin(const QString& Begin);
193 
194  QString getBuilderBegin();
195 
196  void setBuilderEnd(const QString& End);
197 
198  QString getBuilderEnd();
199 
200 
201  bool addMarketplace(const QString& PlaceName, const QString& PlaceUrl);
202 
203  void removeMarketplace(const QString& PlaceName);
204 
205  MarketPlaces_t getMarketplaces();
206 
207 
208  bool isBuilderExtensionValueExist(const QString& PluginName, const QString& Key);
209 
210  QString getBuilderExtensionValue(const QString& PluginName, const QString& Key);
211 
212  void setBuilderExtensionValue(const QString& PluginName, const QString& Key, const QString& Value);
213 
214 
215  Qt::DockWidgetArea getBuilderDockPosition();
216 
217  void setBuilderDockPosition(Qt::DockWidgetArea Position);
218 
219  Qt::ToolBarArea getBuilderToolBarPosition();
220 
221  void setBuilderToolBarPosition(Qt::ToolBarArea Position);
222 
223 
224  bool isBuilderItemRemovalConfirm();
225 
226  void setBuilderItemRemovalConfirm(bool Confirm);
227 
228  bool isBuilderParamRemovalConfirm();
229 
230  void setBuilderParamRemovalConfirm(bool Confirm);
231 
232  bool isBuilderWaresWatchersActive();
233 
234  void setBuilderWaresWatchersActive(bool Active);
235 
236  bool isBuilderAutomaticSaveBeforeRun();
237 
238  void setBuilderAutomaticSaveBeforeRun(bool AutoSave);
239 
240  bool isBuilderSpatialUnitsRemovalConfirm();
241 
242  void setBuilderSpatialUnitsRemovalConfirm(bool Confirm);
243 
244  bool isBuilderSpatialConnsRemovalConfirm();
245 
246  void setBuilderSpatialConnsRemovalConfirm(bool Confirm);
247 
248  bool isBuilderSpatialAttrsRemovalConfirm();
249 
250  void setBuilderSpatialAttrsRemovalConfirm(bool Confirm);
251 
252 
253  bool isWaresdevAutomaticSaveBeforeBuild();
254 
255  void setWaresdevAutomaticSaveBeforeBuild(bool AutoSave);
256 
257  QList<QString> getWaresdevExternalToolsOrder();
258 
259  ExternalToolsCommands_t getWaresdevExternalToolsCommands();
260 
261  QMap<QString, QString> getWaresdevExternalToolsCommandsInContext(const ExternalToolContext Context);
262 
263  void setWaresdevExternalToolsCommands(const ExternalToolsCommands_t& Commands);
264 
265  void setWaresdevExternalToolsOrder(QList<QString> ToolsOrder);
266 
267  void setWaresdevTextEditorDefaults(bool ForceReset);
268 
269  bool isWaresdevSyntaxHighlightingEnabled();
270 
271  void setWaresdevSyntaxHighlightingEnabled(bool Enabled);
272 
273  SyntaxHighlightingRules_t getWaresdevSyntaxHighlightingRules();
274 
275  void setWaresdevSyntaxHighlightingRules(const SyntaxHighlightingRules_t& Rules);
276 
277  bool isWaresdevCurrentlineHighlightingEnabled();
278 
279  void setWaresdevCurrentlineHighlightingEnabled(bool Enabled);
280 
281  QString getWaresdevCurrentlineColor();
282 
283  void setWaresdevCurrentlineColor(const QString& Color);
284 
285  QString getWaresdevFontName();
286 
287  void setWaresdevFontName(const QString& FontName);
288 
289  bool isWaresdevLineWrappingEnabled();
290 
291  void setWaresdevLineWrappingEnabled(bool Enabled);
292 
293  int getWaresdevIndentSpaceNb();
294 
295  void setWaresdevIndentSpaceNb(int SpaceNumber);
296 
297  QString getWaresdevConfigEnv(const QString& Name);
298 
299  void setWaresdevConfigEnv(const QString& Name, const QString& Value);
300 
301  QString getWaresdevConfigOptions();
302 
303  void setWaresdevConfigOptions(const QString& Options);
304 
305  QString getWaresdevConfigGenerator();
306 
307  void setWaresdevConfigGenerator(const QString& Generator);
308 
309  QString getWaresdevBuildEnv(const QString& Name);
310 
311  void setWaresdevBuildEnv(const QString& Name, const QString& Value);
312 
313  bool isWaresdevShowCommandEnv(const QString& Name);
314 
315  void setWaresdevShowCommandEnv(const QString& Name, bool Enabled);
316 
317  bool isWaresdevGitSslNoVerify();
318 
319  void setWaresdevGitSslNoVerify(bool NoVerify);
320 
321  QString getWaresdevImportWaresHubLastUrl();
322 
323  void setWaresdevImportWaresHubLastUrl(const QString& Url);
324 
325  QString getWaresdevImportWaresHubLastUsername();
326 
327  void setWaresdevImportWaresHubLastUsername(const QString& Username);
328 };
329 
330 } } //namespaces
331 
332 #endif /* __OPENFLUID_BASE_PREFERENCESMANAGER_HPP__ */
QMap< QString, SyntaxHighlightingRule_t > SyntaxHighlightingRules_t
Definition: PreferencesManager.hpp:113
Definition: ApplicationException.hpp:47
#define OPENFLUID_SINGLETON_DEFINITION(T)
Definition: SingletonMacros.hpp:55
QMap< QString, QStringList > ExternalToolsCommands_t
Definition: PreferencesManager.hpp:111
std::uint64_t Duration_t
Definition: TypeDefs.hpp:312
std::vector< RecentProject_t > RecentProjectsList_t
Definition: PreferencesManager.hpp:109
QString m_Color
Definition: PreferencesManager.hpp:102
Definition: PreferencesManager.hpp:93
QString Name
Definition: PreferencesManager.hpp:96
SyntaxHighlightingRule_t(const QString &Color, const QStringList &Decoration)
Definition: PreferencesManager.hpp:105
std::map< QString, QString > MarketPlaces_t
Definition: PreferencesManager.hpp:115
QString Path
Definition: PreferencesManager.hpp:97
ExternalToolContext
Definition: PreferencesManager.hpp:117
QStringList m_Decoration
Definition: PreferencesManager.hpp:103
Definition: PreferencesManager.hpp:117
#define OPENFLUID_API
Definition: dllexport.hpp:86
static const int RecentProjectsLimit
Definition: PreferencesManager.hpp:91
Definition: PreferencesManager.hpp:61