From d24f813f3f2a05c112e803e4256b53535895fc98 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Wed, 14 Jul 2021 11:49:10 +1200 Subject: Initial mirror commit --- src/field-styles/FieldStyleFactory.h | 49 ++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/field-styles/FieldStyleFactory.h (limited to 'src/field-styles/FieldStyleFactory.h') 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 + +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 styles; + QStringList stylesNames; // Keeps order of styles +}; + +#endif -- cgit