2018-05-16 05:02:12 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-05-18 18:36:48 +00:00
|
|
|
#include "MetaData/MetaDataModel.h"
|
2018-06-04 16:23:51 +00:00
|
|
|
#include "GenusModel.h"
|
|
|
|
#include "VerbEndModel.h"
|
2018-06-04 16:48:58 +00:00
|
|
|
#include "PluralModel.h"
|
2018-06-17 16:44:54 +00:00
|
|
|
#include "AkkusativModel.h"
|
|
|
|
#include "DativModel.h"
|
2018-06-25 21:04:32 +00:00
|
|
|
#include "V2SvkModel.h"
|
2019-01-30 22:07:11 +00:00
|
|
|
#include "TPeModel.h"
|
2018-06-26 14:59:51 +00:00
|
|
|
#include "PassivModel.h"
|
|
|
|
#include "GenitivModel.h"
|
2018-05-16 05:02:12 +00:00
|
|
|
|
2018-06-06 16:05:30 +00:00
|
|
|
#include "ResultModel.h"
|
|
|
|
|
2018-05-16 05:02:12 +00:00
|
|
|
#include <QJsonObject>
|
|
|
|
|
|
|
|
class DataModel : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
MetaDataModel m_metaData;
|
2018-05-23 16:43:57 +00:00
|
|
|
VerbEndModel m_verbEnd;
|
2018-05-22 18:23:03 +00:00
|
|
|
GenusModel m_genus;
|
2018-06-04 16:48:58 +00:00
|
|
|
PluralModel m_plural;
|
2018-06-17 16:44:54 +00:00
|
|
|
AkkusativModel m_akkusativ;
|
|
|
|
DativModel m_dativ;
|
2019-01-30 22:07:11 +00:00
|
|
|
|
2018-06-25 21:04:32 +00:00
|
|
|
V2SvkModel m_v2Svk;
|
2019-01-30 22:07:11 +00:00
|
|
|
TPeModel m_tPeModel;
|
|
|
|
|
2018-06-26 14:59:51 +00:00
|
|
|
PassivModel m_passiv;
|
|
|
|
GenitivModel m_genitiv;
|
2018-05-16 05:02:12 +00:00
|
|
|
|
2018-06-06 16:05:30 +00:00
|
|
|
ResultModel m_results;
|
|
|
|
|
2018-05-16 05:02:12 +00:00
|
|
|
public:
|
|
|
|
DataModel(QObject *parent);
|
|
|
|
|
2018-11-03 21:29:38 +00:00
|
|
|
std::string toHtml() const;
|
|
|
|
|
2019-01-29 19:14:24 +00:00
|
|
|
void write(const QString &filename) const;
|
|
|
|
void read(const QString &filename);
|
2018-11-13 23:17:29 +00:00
|
|
|
|
2018-09-29 11:31:23 +00:00
|
|
|
signals:
|
|
|
|
void modelChanged();
|
|
|
|
|
2018-05-24 19:07:42 +00:00
|
|
|
private:
|
|
|
|
template <class ModelType>
|
|
|
|
void write(
|
|
|
|
const ModelType &model, QJsonObject &target, const char *name) const
|
|
|
|
{
|
|
|
|
QJsonObject jsonObject;
|
|
|
|
model.write(jsonObject);
|
|
|
|
target[name] = jsonObject;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class ModelType>
|
|
|
|
void read(
|
|
|
|
ModelType &model, const QJsonObject &source, const char *name) const
|
|
|
|
{
|
|
|
|
const auto &jsonObject = source[name];
|
|
|
|
if (jsonObject.isObject())
|
|
|
|
{
|
|
|
|
model.read(jsonObject.toObject());
|
|
|
|
}
|
|
|
|
}
|
2018-06-08 18:25:21 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void pluralModelChanged();
|
|
|
|
void metaDataChanged();
|
2018-06-15 15:53:43 +00:00
|
|
|
void genusModelChanged();
|
2018-06-15 16:36:58 +00:00
|
|
|
void verbEndModelChanged();
|
2018-06-17 16:44:54 +00:00
|
|
|
void akkusativModelChanged();
|
|
|
|
void dativModelChanged();
|
2018-06-25 21:04:32 +00:00
|
|
|
void v2SvkModelChanged();
|
2018-06-26 14:59:51 +00:00
|
|
|
void passivModelChanged();
|
|
|
|
void genitivModelChanged();
|
2018-05-16 05:02:12 +00:00
|
|
|
};
|