diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2021-07-14 11:49:10 +1200 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2021-07-14 11:49:10 +1200 |
commit | d24f813f3f2a05c112e803e4256b53535895fc98 (patch) | |
tree | 601e6ae9a1cd44bcfdcf91739a5ca36aedd827c9 /src/field-styles/FieldStyleFactory.h |
Diffstat (limited to 'src/field-styles/FieldStyleFactory.h')
-rw-r--r-- | src/field-styles/FieldStyleFactory.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/field-styles/FieldStyleFactory.h b/src/field-styles/FieldStyleFactory.h new file mode 100644 index 0000000..072bdd5 --- /dev/null +++ b/src/field-styles/FieldStyleFactory.h @@ -0,0 +1,49 @@ +#ifndef FIELDSTYLEFACTORY_H +#define FIELDSTYLEFACTORY_H + +#include "FieldStyle.h" + +#include <QtCore> + +class FieldStyleFactory +{ +public: + static FieldStyleFactory* inst(); + +public: + FieldStyleFactory(); + const QStringList getStyleNames() const + { return stylesNames; } + const FieldStyle getStyle(const QString& aStyleName) const + { return styles[aStyleName]; } + FieldStyle* getStylePtr( const QString& aStyleName ) + { return &( styles[aStyleName] ); } + void setStyle(const QString& aStyleName, FieldStyle aStyle ); + void load(); + void save(); + +private: + void initStyles(); + void loadStyle(QSettings& settings, const QString& styleName); + void loadStyleMainProperties(const QSettings& settings, FieldStyle& curStyle, + const FieldStyle& defaultStyle); + void loadKeywordStyle(const QSettings& settings, FieldStyle& curStyle, + const FieldStyle& defaultStyle); + void saveStyle(QSettings& settings, const QString& styleName); + void saveStyleMainProperties(QSettings& settings, const FieldStyle& curStyle, + const FieldStyle& defaultStyle); + void saveKeywordStyle(QSettings& settings, const FieldStyle& curStyle, + const FieldStyle& defaultStyle); + +public: + static const QString DefaultStyle; + +public: + QColor cardBgColor; + +private: + QHash<QString, FieldStyle> styles; + QStringList stylesNames; // Keeps order of styles +}; + +#endif |