Merge branch 'release/subtest_1_block'

This commit is contained in:
Michael Mandl 2019-01-31 20:23:55 +01:00
commit 3c059f134d
16 changed files with 453 additions and 103 deletions

View file

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.6) cmake_minimum_required(VERSION 3.6)
set(BUILD_VERSION_MAJOR_MINOR 0.2) set(BUILD_VERSION_MAJOR_MINOR 0.3)
if ($ENV{BUILD_NUMBER}) if ($ENV{BUILD_NUMBER})
set(BUILD_VERSION_PATCH $ENV{BUILD_NUMBER}) set(BUILD_VERSION_PATCH $ENV{BUILD_NUMBER})

View file

@ -14,7 +14,10 @@ DataModel::DataModel(QObject *parent)
, m_results(this) , m_results(this)
, m_akkusativ(this) , m_akkusativ(this)
, m_dativ(this) , m_dativ(this)
, m_v2Svk(this) , m_wfModel(this)
, m_otModel(this)
, m_tPrModel(this)
, m_tPeModel(this)
, m_passiv(this) , m_passiv(this)
, m_genitiv(this) , m_genitiv(this)
{ {
@ -24,7 +27,12 @@ DataModel::DataModel(QObject *parent)
connect(&m_verbEnd, &VerbEndModel::dataChanged, this, &DataModel::verbEndModelChanged); connect(&m_verbEnd, &VerbEndModel::dataChanged, this, &DataModel::verbEndModelChanged);
connect(&m_akkusativ, &AkkusativModel::dataChanged, this, &DataModel::akkusativModelChanged); connect(&m_akkusativ, &AkkusativModel::dataChanged, this, &DataModel::akkusativModelChanged);
connect(&m_dativ, &DativModel::dataChanged, this, &DataModel::dativModelChanged); connect(&m_dativ, &DativModel::dataChanged, this, &DataModel::dativModelChanged);
connect(&m_v2Svk, &V2SvkModel::dataChanged, this, &DataModel::v2SvkModelChanged);
connect(&m_wfModel, &WFModel::dataChanged, this, &DataModel::v2SvkModelChanged);
connect(&m_otModel, &OTModel::dataChanged, this, &DataModel::v2SvkModelChanged);
connect(&m_tPrModel, &TPrModel::dataChanged, this, &DataModel::v2SvkModelChanged);
connect(&m_tPeModel, &TPeModel::dataChanged, this, &DataModel::v2SvkModelChanged);
connect(&m_passiv, &PassivModel::dataChanged, this, &DataModel::passivModelChanged); connect(&m_passiv, &PassivModel::dataChanged, this, &DataModel::passivModelChanged);
connect(&m_genitiv, &GenitivModel::dataChanged, this, &DataModel::genitivModelChanged); connect(&m_genitiv, &GenitivModel::dataChanged, this, &DataModel::genitivModelChanged);
} }
@ -34,7 +42,12 @@ void DataModel::write(const QString &filename) const
ESGRAF48::DataModel dataModel; ESGRAF48::DataModel dataModel;
m_metaData.write(*dataModel.mutable_metadata()); m_metaData.write(*dataModel.mutable_metadata());
m_v2Svk.write(*dataModel.mutable_v2svk());
m_wfModel.write(*dataModel.mutable_v2svk());
m_otModel.write(*dataModel.mutable_v2svk());
m_tPrModel.write(*dataModel.mutable_v2svk());
m_tPeModel.write(*dataModel.mutable_v2svk());
m_verbEnd.write(*dataModel.mutable_verbend()); m_verbEnd.write(*dataModel.mutable_verbend());
m_genus.write(*dataModel.mutable_genus()); m_genus.write(*dataModel.mutable_genus());
m_akkusativ.write(*dataModel.mutable_akkusativ()); m_akkusativ.write(*dataModel.mutable_akkusativ());
@ -72,7 +85,12 @@ void DataModel::read(const QString &filename)
} }
m_metaData.read(dataModel.metadata()); m_metaData.read(dataModel.metadata());
m_v2Svk.read(dataModel.v2svk());
m_wfModel.read(dataModel.v2svk());
m_otModel.read(dataModel.v2svk());
m_tPrModel.read(dataModel.v2svk());
m_tPeModel.read(dataModel.v2svk());
m_verbEnd.read(dataModel.verbend()); m_verbEnd.read(dataModel.verbend());
m_genus.read(dataModel.genus()); m_genus.read(dataModel.genus());
m_akkusativ.read(dataModel.akkusativ()); m_akkusativ.read(dataModel.akkusativ());
@ -149,8 +167,10 @@ void DataModel::dativModelChanged()
void DataModel::v2SvkModelChanged() void DataModel::v2SvkModelChanged()
{ {
m_results.setV2Result(m_v2Svk.getV2Points()); m_results.setV2Result(m_wfModel.getV2Points() + m_otModel.getV2Points()
m_results.setSvkResult(m_v2Svk.getSvkPoints()); + m_tPrModel.getV2Points() + m_tPeModel.getV2Points());
m_results.setSvkResult(m_wfModel.getSvkPoints() + m_otModel.getSvkPoints()
+ m_tPrModel.getSvkPoints() + m_tPeModel.getSvkPoints());
emit modelChanged(); emit modelChanged();
} }

View file

@ -6,7 +6,12 @@
#include "PluralModel.h" #include "PluralModel.h"
#include "AkkusativModel.h" #include "AkkusativModel.h"
#include "DativModel.h" #include "DativModel.h"
#include "V2SvkModel.h"
#include "WFModel.h"
#include "OTModel.h"
#include "TPrModel.h"
#include "TPeModel.h"
#include "PassivModel.h" #include "PassivModel.h"
#include "GenitivModel.h" #include "GenitivModel.h"
@ -25,7 +30,12 @@ public:
PluralModel m_plural; PluralModel m_plural;
AkkusativModel m_akkusativ; AkkusativModel m_akkusativ;
DativModel m_dativ; DativModel m_dativ;
V2SvkModel m_v2Svk;
WFModel m_wfModel;
OTModel m_otModel;
TPrModel m_tPrModel;
TPeModel m_tPeModel;
PassivModel m_passiv; PassivModel m_passiv;
GenitivModel m_genitiv; GenitivModel m_genitiv;

View file

@ -19,7 +19,10 @@ protobuf_generate_cpp(V2Svk_PROTO_SRCS V2Svk_PROTO_HDRS ${V2Svk_PROTO_FILES})
add_library(${PROJECT_NAME} add_library(${PROJECT_NAME}
V2SvkWidget.cpp V2SvkWidget.cpp
V2SvkModel.cpp WFModel.cpp
OTModel.cpp
TPrModel.cpp
TPeModel.cpp
${UI_HEADERS} ${UI_HEADERS}
${V2Svk_PROTO_SRCS} ${V2Svk_PROTO_SRCS}
${V2Svk_PROTO_HDRS} ${V2Svk_PROTO_HDRS}

View file

@ -0,0 +1,105 @@
#include "OTModel.h"
OTModel::OTModel(QObject *parent)
: CheckableTestModel(parent)
{
m_tests = {
{"Objekt-Topikalisierung",
{"Affe", "Affe", "Affe", "Affe", "Schwein", "Schwein", "Schwein", "Schwein", "Gans",
"Gans", "Gans", "Gans"}},
{"SVK: Stamm",
{"Affe", "Affe", "Affe", "Affe", "Schwein", "Schwein", "Schwein", "Schwein", "Gans",
"Gans", "Gans", "Gans"}},
};
}
unsigned int OTModel::getV2Points()
{
unsigned int points = 0;
for (auto testIndex : {0})
{
const auto &test = m_tests.at(testIndex);
for (const auto &item : test.items())
{
if (item.isChecked())
{
points++;
}
}
}
return points;
}
unsigned int OTModel::getSvkPoints()
{
unsigned int points = 0;
for (auto testIndex : {1})
{
const auto &test = m_tests.at(testIndex);
for (const auto &item : test.items())
{
if (item.isChecked())
{
points++;
}
}
}
return points;
}
void OTModel::write(ESGRAF48::V2SvkModel &model) const
{
auto writeFourVals = [&](ESGRAF48::V2SvkModel::FourEach *modelData, int testIndex) {
if (modelData != nullptr)
{
const auto &testItems = m_tests.at(testIndex).items();
modelData->set_affe1(testItems[0].isChecked());
modelData->set_affe2(testItems[1].isChecked());
modelData->set_affe3(testItems[2].isChecked());
modelData->set_affe4(testItems[3].isChecked());
modelData->set_schwein1(testItems[4].isChecked());
modelData->set_schwein2(testItems[5].isChecked());
modelData->set_schwein3(testItems[6].isChecked());
modelData->set_schwein4(testItems[7].isChecked());
modelData->set_gans1(testItems[8].isChecked());
modelData->set_gans2(testItems[9].isChecked());
modelData->set_gans3(testItems[10].isChecked());
modelData->set_gans4(testItems[11].isChecked());
}
};
writeFourVals(model.mutable_objtop(), 0);
writeFourVals(model.mutable_svkstamm(), 1);
}
void OTModel::read(const ESGRAF48::V2SvkModel &model)
{
auto readFourVals = [&](const ESGRAF48::V2SvkModel::FourEach &modelData, int testIndex) {
auto &testItems = m_tests.at(testIndex).items();
testItems[0].setState(modelData.affe1());
testItems[1].setState(modelData.affe2());
testItems[2].setState(modelData.affe3());
testItems[3].setState(modelData.affe4());
testItems[4].setState(modelData.schwein1());
testItems[5].setState(modelData.schwein2());
testItems[6].setState(modelData.schwein3());
testItems[7].setState(modelData.schwein4());
testItems[8].setState(modelData.gans1());
testItems[9].setState(modelData.gans2());
testItems[10].setState(modelData.gans3());
testItems[11].setState(modelData.gans4());
};
readFourVals(model.objtop(), 0);
readFourVals(model.svkstamm(), 1);
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
}

View file

@ -0,0 +1,18 @@
#pragma once
#include "CheckableTestModel.h"
#include "V2SvkModel.pb.h"
class OTModel : public CheckableTestModel
{
Q_OBJECT
public:
OTModel(QObject *parent);
unsigned int getV2Points();
unsigned int getSvkPoints();
void write(ESGRAF48::V2SvkModel &model) const;
void read(const ESGRAF48::V2SvkModel &model);
};

View file

@ -0,0 +1,95 @@
#include "TPeModel.h"
TPeModel::TPeModel(QObject *parent)
: CheckableTestModel(parent)
{
m_tests = {
{"Temporaladverb Perfekt", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
{"Verbtrennung", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
{"SVK: /-e/ o. Stamm", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
{"Partizip", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
};
}
unsigned int TPeModel::getV2Points()
{
unsigned int points = 0;
for (auto testIndex : {0, 1})
{
const auto &test = m_tests.at(testIndex);
for (const auto &item : test.items())
{
if (item.isChecked())
{
points++;
}
}
}
return points;
}
unsigned int TPeModel::getSvkPoints()
{
unsigned int points = 0;
for (auto testIndex : {2, 3})
{
const auto &test = m_tests.at(testIndex);
for (const auto &item : test.items())
{
if (item.isChecked())
{
points++;
}
}
}
return points;
}
void TPeModel::write(ESGRAF48::V2SvkModel &model) const
{
auto writeTwoVals = [&](ESGRAF48::V2SvkModel::TwoEach *modelData, int testIndex) {
if (modelData != nullptr)
{
const auto &testItems = m_tests.at(testIndex).items();
modelData->set_affe1(testItems[0].isChecked());
modelData->set_affe2(testItems[1].isChecked());
modelData->set_schwein1(testItems[2].isChecked());
modelData->set_schwein2(testItems[3].isChecked());
modelData->set_gans1(testItems[4].isChecked());
modelData->set_gans2(testItems[5].isChecked());
}
};
writeTwoVals(model.mutable_tempperf(), 0);
writeTwoVals(model.mutable_verbtrennung2(), 1);
writeTwoVals(model.mutable_svke2(), 2);
writeTwoVals(model.mutable_partizip(), 3);
}
void TPeModel::read(const ESGRAF48::V2SvkModel &model)
{
auto readTwoVals = [&](const ESGRAF48::V2SvkModel::TwoEach &modelData, int testIndex) {
auto &testItems = m_tests.at(testIndex).items();
testItems[0].setState(modelData.affe1());
testItems[1].setState(modelData.affe2());
testItems[2].setState(modelData.schwein1());
testItems[3].setState(modelData.schwein2());
testItems[4].setState(modelData.gans1());
testItems[5].setState(modelData.gans2());
};
readTwoVals(model.tempperf(), 0);
readTwoVals(model.verbtrennung2(), 1);
readTwoVals(model.svke2(), 2);
readTwoVals(model.partizip(), 3);
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
}

View file

@ -0,0 +1,18 @@
#pragma once
#include "CheckableTestModel.h"
#include "V2SvkModel.pb.h"
class TPeModel : public CheckableTestModel
{
Q_OBJECT
public:
TPeModel(QObject *parent);
unsigned int getV2Points();
unsigned int getSvkPoints();
void write(ESGRAF48::V2SvkModel &model) const;
void read(const ESGRAF48::V2SvkModel &model);
};

View file

@ -0,0 +1,89 @@
#include "TPrModel.h"
TPrModel::TPrModel(QObject *parent)
: CheckableTestModel(parent)
{
m_tests = {
{"Temporaladverb Präsens", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
{"SKV: /-e/ o. Stamm", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
};
}
unsigned int TPrModel::getV2Points()
{
unsigned int points = 0;
for (auto testIndex : {0})
{
const auto &test = m_tests.at(testIndex);
for (const auto &item : test.items())
{
if (item.isChecked())
{
points++;
}
}
}
return points;
}
unsigned int TPrModel::getSvkPoints()
{
unsigned int points = 0;
for (auto testIndex : {1})
{
const auto &test = m_tests.at(testIndex);
for (const auto &item : test.items())
{
if (item.isChecked())
{
points++;
}
}
}
return points;
}
void TPrModel::write(ESGRAF48::V2SvkModel &model) const
{
auto writeTwoVals = [&](ESGRAF48::V2SvkModel::TwoEach *modelData, int testIndex) {
if (modelData != nullptr)
{
const auto &testItems = m_tests.at(testIndex).items();
modelData->set_affe1(testItems[0].isChecked());
modelData->set_affe2(testItems[1].isChecked());
modelData->set_schwein1(testItems[2].isChecked());
modelData->set_schwein2(testItems[3].isChecked());
modelData->set_gans1(testItems[4].isChecked());
modelData->set_gans2(testItems[5].isChecked());
}
};
writeTwoVals(model.mutable_temppraes(), 0);
writeTwoVals(model.mutable_svke1(), 1);
}
void TPrModel::read(const ESGRAF48::V2SvkModel &model)
{
auto readTwoVals = [&](const ESGRAF48::V2SvkModel::TwoEach &modelData, int testIndex) {
auto &testItems = m_tests.at(testIndex).items();
testItems[0].setState(modelData.affe1());
testItems[1].setState(modelData.affe2());
testItems[2].setState(modelData.schwein1());
testItems[3].setState(modelData.schwein2());
testItems[4].setState(modelData.gans1());
testItems[5].setState(modelData.gans2());
};
readTwoVals(model.temppraes(), 0);
readTwoVals(model.svke1(), 1);
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
}

View file

@ -0,0 +1,18 @@
#pragma once
#include "CheckableTestModel.h"
#include "V2SvkModel.pb.h"
class TPrModel : public CheckableTestModel
{
Q_OBJECT
public:
TPrModel(QObject *parent);
unsigned int getV2Points();
unsigned int getSvkPoints();
void write(ESGRAF48::V2SvkModel &model) const;
void read(const ESGRAF48::V2SvkModel &model);
};

View file

@ -1,14 +1,20 @@
#include "V2SvkWidget.h" #include "V2SvkWidget.h"
#include "ui_V2SvkWidget.h" #include "ui_V2SvkWidget.h"
#include "V2SvkModel.h" #include "WFModel.h"
#include "OTModel.h"
#include "TPrModel.h"
#include "TPeModel.h"
V2SvkWidget::V2SvkWidget(QWidget *parent) V2SvkWidget::V2SvkWidget(QWidget *parent)
: QWidget(parent) : QWidget(parent)
, ui(new Ui::V2SvkWidget) , ui(new Ui::V2SvkWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->v2SvkTableView->horizontalHeader()->hide(); ui->wfTableView->horizontalHeader()->hide();
ui->otTableView->horizontalHeader()->hide();
ui->tprTableView->horizontalHeader()->hide();
ui->tpeTableView->horizontalHeader()->hide();
} }
V2SvkWidget::~V2SvkWidget() V2SvkWidget::~V2SvkWidget()
@ -16,7 +22,22 @@ V2SvkWidget::~V2SvkWidget()
delete ui; delete ui;
} }
void V2SvkWidget::setV2SvkModel(V2SvkModel *model) void V2SvkWidget::setWFModel(WFModel *model)
{ {
ui->v2SvkTableView->setModel(model); ui->wfTableView->setModel(model);
}
void V2SvkWidget::setOTModel(OTModel *model)
{
ui->otTableView->setModel(model);
}
void V2SvkWidget::setTPrModel(TPrModel *model)
{
ui->tprTableView->setModel(model);
}
void V2SvkWidget::setTPeModel(TPeModel *model)
{
ui->tpeTableView->setModel(model);
} }

View file

@ -2,7 +2,10 @@
#include <QWidget> #include <QWidget>
class V2SvkModel; class WFModel;
class OTModel;
class TPrModel;
class TPeModel;
namespace Ui { namespace Ui {
class V2SvkWidget; class V2SvkWidget;
@ -19,5 +22,8 @@ public:
V2SvkWidget(QWidget *parent = nullptr); V2SvkWidget(QWidget *parent = nullptr);
~V2SvkWidget(); ~V2SvkWidget();
void setV2SvkModel(V2SvkModel *model); void setWFModel(WFModel *model);
void setOTModel(OTModel *model);
void setTPrModel(TPrModel *model);
void setTPeModel(TPeModel *model);
}; };

View file

@ -15,7 +15,16 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QTableView" name="v2SvkTableView"/> <widget class="QTableView" name="wfTableView"/>
</item>
<item>
<widget class="QTableView" name="otTableView"/>
</item>
<item>
<widget class="QTableView" name="tprTableView"/>
</item>
<item>
<widget class="QTableView" name="tpeTableView"/>
</item> </item>
</layout> </layout>
</widget> </widget>

View file

@ -1,6 +1,6 @@
#include "V2SvkModel.h" #include "WFModel.h"
V2SvkModel::V2SvkModel(QObject *parent) WFModel::WFModel(QObject *parent)
: CheckableTestModel(parent) : CheckableTestModel(parent)
{ {
m_tests = { m_tests = {
@ -11,29 +11,14 @@ V2SvkModel::V2SvkModel(QObject *parent)
{"SVK: /-st/", {"SVK: /-st/",
{"Affe", "Affe", "Affe", "Affe", "Schwein", "Schwein", "Schwein", "Schwein", "Gans", {"Affe", "Affe", "Affe", "Affe", "Schwein", "Schwein", "Schwein", "Schwein", "Gans",
"Gans", "Gans", "Gans"}}, "Gans", "Gans", "Gans"}},
{"Objekt-Topikalisierung",
{"Affe", "Affe", "Affe", "Affe", "Schwein", "Schwein", "Schwein", "Schwein", "Gans",
"Gans", "Gans", "Gans"}},
{"SVK: Stamm",
{"Affe", "Affe", "Affe", "Affe", "Schwein", "Schwein", "Schwein", "Schwein", "Gans",
"Gans", "Gans", "Gans"}},
{"Temporaladverb Präsens", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
{"SKV: /-e/ o. Stamm", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
{"Temporaladverb Perfekt", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
{"Verbtrennung", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
{"SVK: /-e/ o. Stamm", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
{"Partizip", {"Affe", "Affe", "Schwein", "Schwein", "Gans", "Gans"}},
}; };
} }
unsigned int V2SvkModel::getV2Points() unsigned int WFModel::getV2Points()
{ {
unsigned int points = 0; unsigned int points = 0;
for (auto testIndex : {0, 1, 3, 5, 7, 8}) for (auto testIndex : {0, 1})
{ {
const auto &test = m_tests.at(testIndex); const auto &test = m_tests.at(testIndex);
@ -49,11 +34,11 @@ unsigned int V2SvkModel::getV2Points()
return points; return points;
} }
unsigned int V2SvkModel::getSvkPoints() unsigned int WFModel::getSvkPoints()
{ {
unsigned int points = 0; unsigned int points = 0;
for (auto testIndex : {2, 4, 6, 9, 10}) for (auto testIndex : {2})
{ {
const auto &test = m_tests.at(testIndex); const auto &test = m_tests.at(testIndex);
@ -69,25 +54,17 @@ unsigned int V2SvkModel::getSvkPoints()
return points; return points;
} }
bool V2SvkModel::isValidIndex(const QModelIndex &index) const bool WFModel::isValidIndex(const QModelIndex &index) const
{ {
switch (index.row()) if (index.row() == 1)
{ {
case 1:
return index.column() == 1 || index.column() == 7 || index.column() == 10; return index.column() == 1 || index.column() == 7 || index.column() == 10;
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
return index.column() < 6;
default:
return CheckableTestModel::isValidIndex(index);
} }
return CheckableTestModel::isValidIndex(index);
} }
void V2SvkModel::write(ESGRAF48::V2SvkModel &model) const void WFModel::write(ESGRAF48::V2SvkModel &model) const
{ {
auto writeOneVal = [&](ESGRAF48::V2SvkModel::OneEach *modelData, int testIndex) { auto writeOneVal = [&](ESGRAF48::V2SvkModel::OneEach *modelData, int testIndex) {
if (modelData != nullptr) if (modelData != nullptr)
@ -100,20 +77,6 @@ void V2SvkModel::write(ESGRAF48::V2SvkModel &model) const
} }
}; };
auto writeTwoVals = [&](ESGRAF48::V2SvkModel::TwoEach *modelData, int testIndex) {
if (modelData != nullptr)
{
const auto &testItems = m_tests.at(testIndex).items();
modelData->set_affe1(testItems[0].isChecked());
modelData->set_affe2(testItems[1].isChecked());
modelData->set_schwein1(testItems[2].isChecked());
modelData->set_schwein2(testItems[3].isChecked());
modelData->set_gans1(testItems[4].isChecked());
modelData->set_gans2(testItems[5].isChecked());
}
};
auto writeFourVals = [&](ESGRAF48::V2SvkModel::FourEach *modelData, int testIndex) { auto writeFourVals = [&](ESGRAF48::V2SvkModel::FourEach *modelData, int testIndex) {
if (modelData != nullptr) if (modelData != nullptr)
{ {
@ -136,18 +99,9 @@ void V2SvkModel::write(ESGRAF48::V2SvkModel &model) const
writeFourVals(model.mutable_wfrage(), 0); writeFourVals(model.mutable_wfrage(), 0);
writeOneVal(model.mutable_verbtrennung1(), 1); writeOneVal(model.mutable_verbtrennung1(), 1);
writeFourVals(model.mutable_svkst(), 2);
writeFourVals(model.mutable_objtop(), 3);
writeFourVals(model.mutable_svkstamm(), 4);
writeTwoVals(model.mutable_temppraes(), 5);
writeTwoVals(model.mutable_svke1(), 6);
writeTwoVals(model.mutable_tempperf(), 7);
writeTwoVals(model.mutable_verbtrennung2(), 8);
writeTwoVals(model.mutable_svke2(), 9);
writeTwoVals(model.mutable_partizip(), 10);
} }
void V2SvkModel::read(const ESGRAF48::V2SvkModel &model) void WFModel::read(const ESGRAF48::V2SvkModel &model)
{ {
auto readOneVal = [&](const ESGRAF48::V2SvkModel::OneEach &modelData, int testIndex) { auto readOneVal = [&](const ESGRAF48::V2SvkModel::OneEach &modelData, int testIndex) {
auto &testItems = m_tests.at(testIndex).items(); auto &testItems = m_tests.at(testIndex).items();
@ -157,17 +111,6 @@ void V2SvkModel::read(const ESGRAF48::V2SvkModel &model)
testItems[10].setState(modelData.gans()); testItems[10].setState(modelData.gans());
}; };
auto readTwoVals = [&](const ESGRAF48::V2SvkModel::TwoEach &modelData, int testIndex) {
auto &testItems = m_tests.at(testIndex).items();
testItems[0].setState(modelData.affe1());
testItems[1].setState(modelData.affe2());
testItems[2].setState(modelData.schwein1());
testItems[3].setState(modelData.schwein2());
testItems[4].setState(modelData.gans1());
testItems[5].setState(modelData.gans2());
};
auto readFourVals = [&](const ESGRAF48::V2SvkModel::FourEach &modelData, int testIndex) { auto readFourVals = [&](const ESGRAF48::V2SvkModel::FourEach &modelData, int testIndex) {
auto &testItems = m_tests.at(testIndex).items(); auto &testItems = m_tests.at(testIndex).items();
@ -187,15 +130,6 @@ void V2SvkModel::read(const ESGRAF48::V2SvkModel &model)
readFourVals(model.wfrage(), 0); readFourVals(model.wfrage(), 0);
readOneVal(model.verbtrennung1(), 1); readOneVal(model.verbtrennung1(), 1);
readFourVals(model.svkst(), 2);
readFourVals(model.objtop(), 3);
readFourVals(model.svkstamm(), 4);
readTwoVals(model.temppraes(), 5);
readTwoVals(model.svke1(), 6);
readTwoVals(model.tempperf(), 7);
readTwoVals(model.verbtrennung2(), 8);
readTwoVals(model.svke2(), 9);
readTwoVals(model.partizip(), 10);
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1)); emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
} }

View file

@ -3,12 +3,12 @@
#include "CheckableTestModel.h" #include "CheckableTestModel.h"
#include "V2SvkModel.pb.h" #include "V2SvkModel.pb.h"
class V2SvkModel : public CheckableTestModel class WFModel : public CheckableTestModel
{ {
Q_OBJECT Q_OBJECT
public: public:
V2SvkModel(QObject *parent); WFModel(QObject *parent);
unsigned int getV2Points(); unsigned int getV2Points();
unsigned int getSvkPoints(); unsigned int getSvkPoints();
@ -16,6 +16,5 @@ public:
void write(ESGRAF48::V2SvkModel &model) const; void write(ESGRAF48::V2SvkModel &model) const;
void read(const ESGRAF48::V2SvkModel &model); void read(const ESGRAF48::V2SvkModel &model);
protected: bool isValidIndex(const QModelIndex &index) const;
bool isValidIndex(const QModelIndex &index) const override;
}; };

View file

@ -48,7 +48,12 @@ void MainWindow::setupUi()
ui->pluralWidget->setModel(&m_dataModel.m_plural); ui->pluralWidget->setModel(&m_dataModel.m_plural);
ui->akkusativDativWidget->setAkkusativModel(&m_dataModel.m_akkusativ); ui->akkusativDativWidget->setAkkusativModel(&m_dataModel.m_akkusativ);
ui->akkusativDativWidget->setDativModel(&m_dataModel.m_dativ); ui->akkusativDativWidget->setDativModel(&m_dataModel.m_dativ);
ui->v2SvkWidget->setV2SvkModel(&m_dataModel.m_v2Svk);
ui->v2SvkWidget->setWFModel(&m_dataModel.m_wfModel);
ui->v2SvkWidget->setOTModel(&m_dataModel.m_otModel);
ui->v2SvkWidget->setTPrModel(&m_dataModel.m_tPrModel);
ui->v2SvkWidget->setTPeModel(&m_dataModel.m_tPeModel);
ui->lateSkillsWidget->setPassivModel(&m_dataModel.m_passiv); ui->lateSkillsWidget->setPassivModel(&m_dataModel.m_passiv);
ui->lateSkillsWidget->setGenitivModel(&m_dataModel.m_genitiv); ui->lateSkillsWidget->setGenitivModel(&m_dataModel.m_genitiv);
ui->resultWidget->setModel(&m_dataModel.m_results); ui->resultWidget->setModel(&m_dataModel.m_results);