| 1 | #ifndef SETTINGS_H |
| 2 | #define SETTINGS_H |
| 3 | |
| 4 | #include <QSettings> |
| 5 | #include <QFont> |
| 6 | #include <QColor> |
| 7 | |
| 8 | class Settings : public QSettings |
| 9 | { |
| 10 | Q_OBJECT |
| 11 | public: |
| 12 | enum DebuggerConfig { |
| 13 | AUTO_RELOAD_SYMBOLS, PRESERVE_LOST_SYMBOLS, PRESERVE_BREAKPOINT_SYMBOL, |
| 14 | CONFIG_END |
| 15 | }; |
| 16 | enum DebuggerFont { |
| 17 | APP_FONT, FIXED_FONT, CODE_FONT, LABEL_FONT, HEX_FONT, FONT_END |
| 18 | }; |
| 19 | enum DebuggerFontType { |
| 20 | APPLICATION_DEFAULT, FIXED_DEFAULT, CUSTOM |
| 21 | }; |
| 22 | |
| 23 | static Settings& get(); |
| 24 | |
| 25 | QString fontName(DebuggerFont f) const; |
| 26 | const QFont& font(DebuggerFont f) const; |
| 27 | void setFont(DebuggerFont f, const QFont& ft); |
| 28 | DebuggerFontType fontType(DebuggerFont f) const; |
| 29 | void setFontType(DebuggerFont f, DebuggerFontType t); |
| 30 | const QColor& fontColor(DebuggerFont f) const; |
| 31 | void setFontColor(DebuggerFont f, const QColor& c); |
| 32 | |
| 33 | bool autoReloadSymbols() const; |
| 34 | void setAutoReloadSymbols(bool b); |
| 35 | bool preserveLostSymbols() const; |
| 36 | void setPreserveLostSymbols(bool b); |
| 37 | bool preserveBreakpointSymbol() const; |
| 38 | void setPreserveBreakpointSymbol(bool b); |
| 39 | void setConfig(DebuggerConfig c, const QVariant& v); |
| 40 | |
| 41 | private: |
| 42 | Settings(); |
| 43 | ~Settings() override = default; |
| 44 | |
| 45 | QFont fonts[FONT_END]; |
| 46 | DebuggerFontType fontTypes[FONT_END]; |
| 47 | QColor fontColors[FONT_END]; |
| 48 | |
| 49 | QVariant config[CONFIG_END]; |
| 50 | |
| 51 | void getBoolFromSetting(DebuggerConfig c, bool defaultValue); |
| 52 | void getConfigFromSettings(); |
| 53 | void getFontsFromSettings(); |
| 54 | void updateFonts(); |
| 55 | }; |
| 56 | |
| 57 | #endif // SETTINGS_H |