QCAD
Open Source 2D CAD
RSettings.h
Go to the documentation of this file.
1 
20 #ifndef RSETTINGS_H
21 #define RSETTINGS_H
22 
23 #include "core_global.h"
24 
25 #include <QDir>
26 #include <QSettings>
27 #include <QFont>
28 
29 #include "RColor.h"
30 
31 // workaround for src2srcml bug:
32 #ifndef RDEFAULT_RCOLOR
33 #define RDEFAULT_RCOLOR RColor()
34 #endif
35 
36 #ifndef RDEFAULT_QVARIANT
37 #define RDEFAULT_QVARIANT QVariant()
38 #endif
39 
40 #ifndef RDEFAULT_QSTRINGLIST
41 #define RDEFAULT_QSTRINGLIST QStringList()
42 #endif
43 
49 public:
50  static void uninit();
51 
52  static QString getAppId();
53 
54  static double getDevicePixelRatio();
55 
56  static QString getLocale();
57  static void loadTranslations(const QString& module, const QStringList& dirs = RDEFAULT_QSTRINGLIST);
58  static QString translate(const QString& context, const QString& str);
59 
60  static QStringList getOriginalArguments();
61  static void setOriginalArguments(const QStringList& a);
62 
63  static bool isDeployed();
64  static QString getApplicationPath();
65  static QStringList getPluginPaths();
66  static QString getPluginPath();
67 
68  static QString getStandardLocation(int sl);
69  static QString getCacheLocation();
70  static QString getDataLocation();
71  static QString getDesktopLocation();
72  static QString getDocumentsLocation();
73  static QString getHomeLocation();
74 
75  //static void setEventBlocking(bool on);
76  //static bool isEventBlockingEnabled();
77  static bool isGuiEnabled();
78  static bool isDebuggerEnabled();
79  static bool hasQuitFlag();
80  static void setQuitFlag();
81 
82  static QString getFileName();
83  static QString getPath();
84  static QString getLaunchPath();
85  static void setLaunchPath(const QString& launchPath);
86 
87  static QString getDefaultStyle();
88 
89  // GraphicsView Appearance Fonts
90  static void setRulerFont(const QFont& font);
91  static QFont getRulerFont();
92  static void setSnapLabelFont(const QFont& font);
93  static QFont getSnapLabelFont();
94  static QFont getInfoLabelFont();
95  static QFont getStatusBarFont();
96 
97  static RColor getSelectionColor();
98 
99  static bool getHighResolutionGraphicsView();
100  static bool getAutoScaleGrid();
101  static bool getAutoScaleMetaGrid();
102  static bool getAutoScalePatterns();
103  static bool getColorCorrection();
104  static int getColorThreshold();
105  static int getTextHeightThreshold();
106  static double getArcAngleLengthThreshold();
107  static double getMinArcAngleStep();
108  static int getDashThreshold();
109  static QString getQtVersion();
110  static bool isQt(int majorVersion);
111  static QString getCompilerVersion();
112  static QString getOSVersion();
113  static QString getReleaseDate();
114  static QString getVersionString();
115  static QString getNumericalVersionString();
116  static int getMajorVersion();
117  static int getMinorVersion();
118  static int getRevisionVersion();
119  static int getBuildVersion();
120  static int getSnapRange();
121  static int getPickRange();
122  static int getZeroWeightWeight();
123  static int getPreviewEntities();
124  static bool getLimitZoomAndScroll();
125  static bool getShowCrosshair();
126  static void setShowCrosshair(bool on);
127  static bool getShowLargeCrosshair();
128  static void setShowLargeCrosshair(bool on);
129  static bool getShowLargeOriginAxis();
130  static void setShowLargeOriginAxis(bool on);
131  static bool getConcurrentDrawing();
132  static void setConcurrentDrawing(bool on);
133  static QLocale getNumberLocale();
134 
135  static void initRecentFiles();
136  static void addRecentFile(const QString& fileName);
137  static void removeRecentFile(const QString& fileName);
138  static QStringList getRecentFiles();
139  static void clearRecentFiles();
140 
141  static RColor getColor(const QString& key, const RColor& defaultValue=RDEFAULT_RCOLOR);
142 
143  static bool hasValue(const QString& key);
144  static QVariant getValue(const QString& key, const QVariant& defaultValue=RDEFAULT_QVARIANT);
145  static RColor getColorValue(const QString& key, const RColor& defaultValue);
146  static bool getBoolValue(const QString& key, bool defaultValue);
147  static double getDoubleValue(const QString& key, double defaultValue);
148  static int getIntValue(const QString& key, int defaultValue);
149  static QString getStringValue(const QString& key, const QString& defaultValue);
150  static QStringList getStringListValue(const QString& key, const QStringList& defaultValue);
151 
152  static void setValue(const QString& key, const QVariant& value, bool overwrite=true);
153  static void removeValue(const QString& key);
154 
155  static void setApplicationName(const QString& n);
156 
157  static QStringList getAllKeys(const QString& group);
158 
159  static QSettings* getQSettings();
160 
161  static void resetCache();
162 
163  static void setXDataEnabled(bool on);
164  static bool isXDataEnabled();
165 
166  static bool getAutoScaleLinetypePatterns();
167  static bool getUseSecondarySelectionColor();
168  static bool getUseSolidLineSelection();
169 
170  static int getMouseThreshold();
171 
172 private:
173  static bool isInitialized();
174  static void shortenRecentFiles();
175 
176 private:
177  // cache for faster access:
178  static QVariantMap cache;
179 
180  // variables for very fast access:
181  static QFont* rulerFont;
182  static QFont* snapLabelFont;
183  static QFont* infoLabelFont;
184  static QFont* statusBarFont;
186  static int snapRange;
187  static int pickRange;
188  static int zeroWeightWeight;
189  static int showCrosshair;
190  static int showLargeCrosshair;
192  static int concurrentDrawing;
194  static int previewEntities;
195  static int limitZoomAndScroll;
199  static int mouseThreshold;
200  static double arcAngleLengthThreshold;
201  static double minArcAngleStep;
202  static int dashThreshold;
203  static QStringList recentFiles;
204  static QLocale* numberLocale;
205 
206  static QString applicationNameOverride;
207 
208  static QString launchPath;
209 
210  static QSettings* qSettings;
211 
212  static QStringList originalArguments;
213 
214  static bool quitFlag;
215 
216  static bool xDataEnabled;
217 };
218 
220 
221 #endif
static QVariantMap cache
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RSettings.h:178
static int useSecondarySelectionColor
Definition: RSettings.h:198
Definition: RSettings.h:48
#define RDEFAULT_QVARIANT
Definition: RSettings.h:37
static QFont * snapLabelFont
Definition: RSettings.h:182
static int limitZoomAndScroll
Definition: RSettings.h:195
static QFont * statusBarFont
Definition: RSettings.h:184
static QFont * infoLabelFont
Definition: RSettings.h:183
static QStringList recentFiles
Definition: RSettings.h:203
#define QCADCORE_EXPORT
Definition: core_global.h:10
static bool xDataEnabled
Definition: RSettings.h:216
static int showLargeOriginAxis
Definition: RSettings.h:191
static double minArcAngleStep
Definition: RSettings.h:201
static QString applicationNameOverride
Definition: RSettings.h:206
static int useSolidLineSelection
Definition: RSettings.h:197
Color.
Definition: RColor.h:42
static QLocale * numberLocale
Definition: RSettings.h:204
static int highResolutionGraphicsView
Definition: RSettings.h:193
static int pickRange
Definition: RSettings.h:187
static int autoScaleLinetypePattern
Definition: RSettings.h:196
Q_DECLARE_METATYPE(RMath *)
static int mouseThreshold
Definition: RSettings.h:199
#define RDEFAULT_QSTRINGLIST
Definition: RSettings.h:41
static QString launchPath
Definition: RSettings.h:208
void loadTranslations(void addOns, void splash)
Loads translations for all add-ons if appropriate.
Definition: autostart.js:50
static int dashThreshold
Definition: RSettings.h:202
static int concurrentDrawing
Definition: RSettings.h:192
static int showCrosshair
Definition: RSettings.h:189
static double arcAngleLengthThreshold
Definition: RSettings.h:200
static int previewEntities
Definition: RSettings.h:194
static QFont * rulerFont
Definition: RSettings.h:181
static int snapRange
Definition: RSettings.h:186
static int zeroWeightWeight
Definition: RSettings.h:188
static QSettings * qSettings
Definition: RSettings.h:210
static RColor * selectionColor
Definition: RSettings.h:185
#define RDEFAULT_RCOLOR
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RSettings.h:33
static bool quitFlag
Definition: RSettings.h:214
static int showLargeCrosshair
Definition: RSettings.h:190
static QStringList originalArguments
Definition: RSettings.h:212