Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef __PREFERENCESMANAGER_HPP__
00041 #define __PREFERENCESMANAGER_HPP__
00042
00043 #include <openfluid/dllexport.hpp>
00044 #include <openfluid/core/DateTime.hpp>
00045
00046 #include <map>
00047 #include <vector>
00048
00049
00050 #include <QSettings>
00051
00052
00053 namespace openfluid { namespace base {
00054
00055
00056
00057
00058
00059
00060 class DLLEXPORT PreferencesManager
00061 {
00062
00063 private:
00064
00065 static PreferencesManager* mp_Instance;
00066
00067 static QString m_FileName;
00068
00069 QSettings* mp_ConfFile;
00070
00071 PreferencesManager();
00072
00073 void setDefaultValues();
00074
00075 void setExtraPaths(const QString& Key, const QStringList& Paths);
00076
00077 void addExtraPath(const QString& Key, const QString& Path);
00078
00079 void removeExtraPath(const QString& Key, const QString& Path);
00080
00081 QStringList getExtraPaths(const QString& Key);
00082
00083 static QString guessLang();
00084
00085
00086 public:
00087
00088 static const int RecentProjectsLimit;
00089
00090 class RecentProject_t
00091 {
00092 public:
00093 QString Name;
00094 QString Path;
00095 };
00096
00097 typedef std::vector<RecentProject_t> RecentProjectsList_t;
00098
00099 typedef std::map<QString, QString> MarketPlaces_t;
00100
00101 static PreferencesManager* getInstance();
00102
00103 ~PreferencesManager();
00104
00105
00106
00107
00108
00109 static void setFileName(const QString& AbsoluteFileName);
00110
00111 QString getFileName();
00112
00113 bool isValidKey(const QString& Group, const QString& Key);
00114
00115
00116 void setLang(const QString& Lang);
00117
00118 QString getLang();
00119
00120 static QStringList getAvailableLangs();
00121
00122 static bool isAvailableLang(const QString& Lang);
00123
00124 void setRecentMax(int RecentMax);
00125
00126 int getRecentMax();
00127
00128 bool addRecentProject(const QString& ProjectName, const QString& ProjectPath = "");
00129
00130 RecentProjectsList_t getRecentProjects();
00131
00132 void clearRecentProjects();
00133
00134 void adaptRecentProjects();
00135
00136
00137 void setWorkspacePath(const QString& WorkPath);
00138
00139 QString getWorkspacePath();
00140
00141 QString getProjectsPath();
00142
00143
00144 void setExtraSimulatorsPaths(const QStringList& Paths);
00145
00146 void addExtraSimulatorsPath(const QString& Path);
00147
00148 void removeExtraSimulatorsPath(const QString& Path);
00149
00150 QStringList getExtraSimulatorsPaths();
00151
00152
00153 void setExtraExtensionsPaths(const QStringList& Paths);
00154
00155 void addExtraExtensionsPath(const QString& Path);
00156
00157 void removeExtraExtensionsPath(const QString& Path);
00158
00159 QStringList getExtraExtensionsPaths();
00160
00161
00162 void setExtraObserversPaths(const QStringList& Paths);
00163
00164 void addExtraObserversPath(const QString& Path);
00165
00166 void removeExtraObserversPath(const QString& Path);
00167
00168 QStringList getExtraObserversPaths();
00169
00170
00171 void setDeltaT(openfluid::core::Duration_t DeltaT);
00172
00173 openfluid::core::Duration_t getDeltaT();
00174
00175
00176 void setBegin(const QString& Begin);
00177
00178 QString getBegin();
00179
00180 void setEnd(const QString& End);
00181
00182 QString getEnd();
00183
00184
00185 bool addMarketplace(const QString& PlaceName, const QString& PlaceUrl);
00186
00187 void removeMarketplace(const QString& PlaceName);
00188
00189 MarketPlaces_t getMarketplaces();
00190
00191
00192 bool isExtensionValueExist(const QString& PluginName, const QString& Key);
00193
00194 QString getExtensionValue(const QString& PluginName, const QString& Key);
00195
00196 void setExtensionValue(const QString& PluginName, const QString& Key, const QString& Value);
00197
00198
00199 Qt::DockWidgetArea getDockPosition();
00200
00201 void setDockPosition(Qt::DockWidgetArea Position);
00202
00203 Qt::ToolBarArea getToolBarPosition();
00204
00205 void setToolBarPosition(Qt::ToolBarArea Position);
00206
00207
00208 bool isItemRemovalConfirm();
00209
00210 void setItemRemovalConfirm(bool Confirm);
00211
00212 bool isParamRemovalConfirm();
00213
00214 void setParamRemovalConfirm(bool Confirm);
00215
00216 bool isWaresWatchersActive();
00217
00218 void setWaresWatchersActive(bool Active);
00219
00220 bool isAutomaticSaveBeforeRun();
00221
00222 void setAutomaticSaveBeforeRun(bool AutoSave);
00223
00224 bool isSpatialUnitsRemovalConfirm();
00225
00226 void setSpatialUnitsRemovalConfirm(bool Confirm);
00227
00228 bool isSpatialConnsRemovalConfirm();
00229
00230 void setSpatialConnsRemovalConfirm(bool Confirm);
00231
00232 bool isSpatialAttrsRemovalConfirm();
00233
00234 void setSpatialAttrsRemovalConfirm(bool Confirm);
00235
00236 };
00237
00238 } }
00239
00240 #endif