Settings.h 887 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef SETTINGS_H
  2. #define SETTINGS_H
  3. #include <QSettings>
  4. #include <QFont>
  5. #include <QColor>
  6. class Settings : public QSettings
  7. {
  8. Q_OBJECT
  9. public:
  10. enum DebuggerFont {
  11. APP_FONT, FIXED_FONT, CODE_FONT, LABEL_FONT, HEX_FONT, FONT_END
  12. };
  13. enum DebuggerFontType {
  14. APPLICATION_DEFAULT, FIXED_DEFAULT, CUSTOM
  15. };
  16. static Settings& get();
  17. QString fontName(DebuggerFont f) const;
  18. const QFont& font(DebuggerFont f) const;
  19. void setFont(DebuggerFont f, const QFont& ft);
  20. DebuggerFontType fontType(DebuggerFont f) const;
  21. void setFontType(DebuggerFont f, DebuggerFontType t);
  22. const QColor& fontColor(DebuggerFont f) const;
  23. void setFontColor(DebuggerFont f, const QColor& c);
  24. private:
  25. Settings();
  26. ~Settings();
  27. QFont fonts[FONT_END];
  28. DebuggerFontType fontTypes[FONT_END];
  29. QColor fontColors[FONT_END];
  30. void getFontsFromSettings();
  31. void updateFonts();
  32. };
  33. #endif // SETTINGS_H