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/dictionary/DicRecord.h |
Diffstat (limited to 'src/dictionary/DicRecord.h')
-rw-r--r-- | src/dictionary/DicRecord.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/dictionary/DicRecord.h b/src/dictionary/DicRecord.h new file mode 100644 index 0000000..913da08 --- /dev/null +++ b/src/dictionary/DicRecord.h @@ -0,0 +1,40 @@ +#ifndef DICENTRY_H +#define DICENTRY_H + +#include <QtCore> + +class Field; +class ICardPack; + +class DicRecord: public QObject +{ +Q_OBJECT + +public: + DicRecord(); + DicRecord( const DicRecord& aOther ); + + const QHash<QString, QString> getFields() const {return fields;} + QString getFieldValue(const QString& name) const { return fields.value(name); } + QStringList getFieldElements(const QString& fieldName) const; + QString getPreviewQuestionForPack(ICardPack* pack) const; + QString id04() const { return m_id04; } + void setField( QString aField, QString aValue ); + void setId04( const QString& aId ) { m_id04 = aId; } + void renameField( const QString aOldFieldName, const QString aNewFieldName ); + bool isValid(const QString& qstFieldName) const; + +private: + bool hasNonEmptyAnswerField(const QString& qstFieldName) const; + +signals: + void valueChanged( QString aField ); + +private: + QHash<QString, QString> fields; // Field name -> field value + QString m_id04; // For v. 0.4 +}; + +Q_DECLARE_METATYPE( DicRecord ) + +#endif |