added late skills test
This commit is contained in:
parent
76264eb814
commit
0a1eea0fe2
@ -45,6 +45,7 @@ target_link_libraries(${PROJECT_NAME}
|
||||
Genus
|
||||
AkkusativDativ
|
||||
V2Svk
|
||||
LateSkills
|
||||
ResultWidget
|
||||
Qt5::Widgets
|
||||
)
|
||||
|
@ -12,6 +12,8 @@ DataModel::DataModel(QObject *parent)
|
||||
, m_akkusativ(this)
|
||||
, m_dativ(this)
|
||||
, m_v2Svk(this)
|
||||
, m_passiv(this)
|
||||
, m_genitiv(this)
|
||||
{
|
||||
connect(&m_plural, &PluralModel::dataChanged, this,
|
||||
&DataModel::pluralModelChanged);
|
||||
@ -27,6 +29,10 @@ DataModel::DataModel(QObject *parent)
|
||||
&DataModel::dativModelChanged);
|
||||
connect(&m_v2Svk, &V2SvkModel::dataChanged, this,
|
||||
&DataModel::v2SvkModelChanged);
|
||||
connect(&m_passiv, &PassivModel::dataChanged, this,
|
||||
&DataModel::passivModelChanged);
|
||||
connect(&m_genitiv, &GenitivModel::dataChanged, this,
|
||||
&DataModel::genitivModelChanged);
|
||||
}
|
||||
|
||||
void DataModel::write(QJsonObject &target) const
|
||||
@ -38,6 +44,8 @@ void DataModel::write(QJsonObject &target) const
|
||||
write(m_akkusativ, target, "Akkusativ");
|
||||
write(m_dativ, target, "Dativ");
|
||||
write(m_v2Svk, target, "V2Svk");
|
||||
write(m_passiv, target, "Passiv");
|
||||
write(m_genitiv, target, "Genitiv");
|
||||
}
|
||||
|
||||
void DataModel::read(const QJsonObject &source)
|
||||
@ -49,6 +57,8 @@ void DataModel::read(const QJsonObject &source)
|
||||
read(m_akkusativ, source, "Akkusativ");
|
||||
read(m_dativ, source, "Dativ");
|
||||
read(m_v2Svk, source, "V2Svk");
|
||||
read(m_passiv, source, "Passiv");
|
||||
read(m_genitiv, source, "Genitiv");
|
||||
}
|
||||
|
||||
void DataModel::pluralModelChanged()
|
||||
@ -86,3 +96,13 @@ void DataModel::v2SvkModelChanged()
|
||||
m_results.setV2Result(m_v2Svk.getV2Points());
|
||||
m_results.setSvkResult(m_v2Svk.getSvkPoints());
|
||||
}
|
||||
|
||||
void DataModel::passivModelChanged()
|
||||
{
|
||||
m_results.setPassivResult(m_passiv.getPoints());
|
||||
}
|
||||
|
||||
void DataModel::genitivModelChanged()
|
||||
{
|
||||
m_results.setGenitivResult(m_genitiv.getPoints());
|
||||
}
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "AkkusativModel.h"
|
||||
#include "DativModel.h"
|
||||
#include "V2SvkModel.h"
|
||||
#include "PassivModel.h"
|
||||
#include "GenitivModel.h"
|
||||
|
||||
#include "ResultModel.h"
|
||||
|
||||
@ -24,6 +26,8 @@ public:
|
||||
AkkusativModel m_akkusativ;
|
||||
DativModel m_dativ;
|
||||
V2SvkModel m_v2Svk;
|
||||
PassivModel m_passiv;
|
||||
GenitivModel m_genitiv;
|
||||
|
||||
ResultModel m_results;
|
||||
|
||||
@ -62,4 +66,6 @@ private slots:
|
||||
void akkusativModelChanged();
|
||||
void dativModelChanged();
|
||||
void v2SvkModelChanged();
|
||||
void passivModelChanged();
|
||||
void genitivModelChanged();
|
||||
};
|
||||
|
39
source/ResultWidget/GenitivPR.h
Normal file
39
source/ResultWidget/GenitivPR.h
Normal file
@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "PRMap.h"
|
||||
|
||||
class GenitivPR : public PRMap
|
||||
{
|
||||
public:
|
||||
GenitivPR()
|
||||
{
|
||||
// clang-format off
|
||||
m_ages = {
|
||||
{ 7, 0 },
|
||||
{ 7, 6 },
|
||||
{ 8, 0 },
|
||||
{ 9, 0 }
|
||||
};
|
||||
|
||||
m_PRs = {
|
||||
{ 0, 0, 0 },
|
||||
{ 1, 3, 0 },
|
||||
{ 2, 3, 0 },
|
||||
{ 2, 5, 1 },
|
||||
{ 7, 5, 1 },
|
||||
{ 8, 6, 1 },
|
||||
{ 14, 8, 2 },
|
||||
{ 18, 9, 4 },
|
||||
{ 21, 17, 7 },
|
||||
{ 29, 18, 8 },
|
||||
{ 38, 29, 14 },
|
||||
{ 50, 42, 23 },
|
||||
{ 66, 54, 33 },
|
||||
{ 82, 68, 51 },
|
||||
{ 90, 83, 72 },
|
||||
{ 96, 92, 87 },
|
||||
{ 100, 100, 100 }
|
||||
};
|
||||
// clang-format on
|
||||
}
|
||||
};
|
32
source/ResultWidget/PassivPR.h
Normal file
32
source/ResultWidget/PassivPR.h
Normal file
@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "PRMap.h"
|
||||
|
||||
class PassivPR : public PRMap
|
||||
{
|
||||
public:
|
||||
PassivPR()
|
||||
{
|
||||
// clang-format off
|
||||
m_ages = {
|
||||
{ 7, 0 },
|
||||
{ 8, 6 },
|
||||
{ 9, 0 }
|
||||
};
|
||||
|
||||
m_PRs = {
|
||||
{ 1, 0 },
|
||||
{ 2, 0 },
|
||||
{ 6, 2 },
|
||||
{ 9, 3 },
|
||||
{ 23, 12 },
|
||||
{ 34, 23 },
|
||||
{ 55, 41 },
|
||||
{ 71, 59 },
|
||||
{ 85, 76 },
|
||||
{ 94, 84 },
|
||||
{ 100, 100 }
|
||||
};
|
||||
// clang-format on
|
||||
}
|
||||
};
|
@ -7,6 +7,8 @@
|
||||
#include "DativPR.h"
|
||||
#include "V2PR.h"
|
||||
#include "SvkPR.h"
|
||||
#include "PassivPR.h"
|
||||
#include "GenitivPR.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@ -188,3 +190,23 @@ void ResultModel::setSvkResult(unsigned int points)
|
||||
emit dataChanged(index(0, 1), index(4, 1));
|
||||
}
|
||||
}
|
||||
|
||||
void ResultModel::setPassivResult(unsigned int points)
|
||||
{
|
||||
if (m_results[3].points() != points)
|
||||
{
|
||||
m_results[3].setPoints(points);
|
||||
m_results[3].setPR(PassivPR().lookup(m_age, points));
|
||||
emit dataChanged(index(0, 3), index(4, 3));
|
||||
}
|
||||
}
|
||||
|
||||
void ResultModel::setGenitivResult(unsigned int points)
|
||||
{
|
||||
if (m_results[7].points() != points)
|
||||
{
|
||||
m_results[7].setPoints(points);
|
||||
m_results[7].setPR(GenitivPR().lookup(m_age, points));
|
||||
emit dataChanged(index(0, 7), index(4, 7));
|
||||
}
|
||||
}
|
||||
|
@ -70,4 +70,6 @@ public:
|
||||
void setDativResult(unsigned int points);
|
||||
void setV2Result(unsigned int points);
|
||||
void setSvkResult(unsigned int points);
|
||||
void setPassivResult(unsigned int points);
|
||||
void setGenitivResult(unsigned int points);
|
||||
};
|
||||
|
@ -5,3 +5,4 @@ add_subdirectory(Genus)
|
||||
add_subdirectory(Plural)
|
||||
add_subdirectory(AkkusativDativ)
|
||||
add_subdirectory(V2Svk)
|
||||
add_subdirectory(LateSkills)
|
||||
|
37
source/SubTests/LateSkills/CMakeLists.txt
Normal file
37
source/SubTests/LateSkills/CMakeLists.txt
Normal file
@ -0,0 +1,37 @@
|
||||
cmake_minimum_required(VERSION 3.6)
|
||||
|
||||
project(LateSkills LANGUAGES CXX)
|
||||
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
qt5_wrap_ui(UI_HEADERS
|
||||
LateSkillsWidget.ui
|
||||
)
|
||||
|
||||
add_library(${PROJECT_NAME}
|
||||
LateSkillsWidget.cpp
|
||||
PassivModel.cpp
|
||||
GenitivModel.cpp
|
||||
${UI_HEADERS}
|
||||
)
|
||||
|
||||
set_target_properties(${PROJECT_NAME}
|
||||
PROPERTIES CXX_STANDARD 14
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
CheckableItem
|
||||
CheckableTest
|
||||
CheckableTestModel
|
||||
Qt5::Widgets
|
||||
)
|
10
source/SubTests/LateSkills/GenitivModel.cpp
Normal file
10
source/SubTests/LateSkills/GenitivModel.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include "GenitivModel.h"
|
||||
|
||||
GenitivModel::GenitivModel(QObject *parent)
|
||||
: CheckableTestModel(parent)
|
||||
{
|
||||
m_tests = {
|
||||
{ "Genitiv Präpositionen", { "anstelle", "außerhalb", "mithilfe" } },
|
||||
{ "Attributierung", { "Schuhe", "Zauberstab", "Hut", "Brille", "Gürtel" } },
|
||||
};
|
||||
}
|
11
source/SubTests/LateSkills/GenitivModel.h
Normal file
11
source/SubTests/LateSkills/GenitivModel.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "CheckableTestModel.h"
|
||||
|
||||
class GenitivModel : public CheckableTestModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GenitivModel(QObject *parent);
|
||||
};
|
29
source/SubTests/LateSkills/LateSkillsWidget.cpp
Normal file
29
source/SubTests/LateSkills/LateSkillsWidget.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include "LateSkillsWidget.h"
|
||||
#include "ui_LateSkillsWidget.h"
|
||||
|
||||
#include "PassivModel.h"
|
||||
#include "GenitivModel.h"
|
||||
|
||||
LateSkillsWidget::LateSkillsWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::LateSkillsWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->passivTableView->horizontalHeader()->hide();
|
||||
ui->genitivTableView->horizontalHeader()->hide();
|
||||
}
|
||||
|
||||
LateSkillsWidget::~LateSkillsWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void LateSkillsWidget::setPassivModel(PassivModel *model)
|
||||
{
|
||||
ui->passivTableView->setModel(model);
|
||||
}
|
||||
|
||||
void LateSkillsWidget::setGenitivModel(GenitivModel *model)
|
||||
{
|
||||
ui->genitivTableView->setModel(model);
|
||||
}
|
25
source/SubTests/LateSkills/LateSkillsWidget.h
Normal file
25
source/SubTests/LateSkills/LateSkillsWidget.h
Normal file
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class PassivModel;
|
||||
class GenitivModel;
|
||||
|
||||
namespace Ui {
|
||||
class LateSkillsWidget;
|
||||
};
|
||||
|
||||
class LateSkillsWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
Ui::LateSkillsWidget *ui;
|
||||
|
||||
public:
|
||||
LateSkillsWidget(QWidget *parent = nullptr);
|
||||
~LateSkillsWidget();
|
||||
|
||||
void setPassivModel(PassivModel *model);
|
||||
void setGenitivModel(GenitivModel *model);
|
||||
};
|
27
source/SubTests/LateSkills/LateSkillsWidget.ui
Normal file
27
source/SubTests/LateSkills/LateSkillsWidget.ui
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LateSkillsWidget</class>
|
||||
<widget class="QWidget" name="LateSkillsWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTableView" name="passivTableView"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableView" name="genitivTableView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
9
source/SubTests/LateSkills/PassivModel.cpp
Normal file
9
source/SubTests/LateSkills/PassivModel.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include "PassivModel.h"
|
||||
|
||||
PassivModel::PassivModel(QObject *parent)
|
||||
: CheckableTestModel(parent)
|
||||
{
|
||||
m_tests = {
|
||||
{ "Passiv", { "Elefant", "Pferde", "Bälle", "Ball", "Fleisch" } }
|
||||
};
|
||||
}
|
11
source/SubTests/LateSkills/PassivModel.h
Normal file
11
source/SubTests/LateSkills/PassivModel.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "CheckableTestModel.h"
|
||||
|
||||
class PassivModel : public CheckableTestModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PassivModel(QObject *parent);
|
||||
};
|
@ -38,6 +38,8 @@ void MainWindow::newFile()
|
||||
ui->akkusativDativWidget->setAkkusativModel(&m_dataModel->m_akkusativ);
|
||||
ui->akkusativDativWidget->setDativModel(&m_dataModel->m_dativ);
|
||||
ui->v2SvkWidget->setV2SvkModel(&m_dataModel->m_v2Svk);
|
||||
ui->lateSkillsWidget->setPassivModel(&m_dataModel->m_passiv);
|
||||
ui->lateSkillsWidget->setGenitivModel(&m_dataModel->m_genitiv);
|
||||
|
||||
ui->resultWidget->setModel(&m_dataModel->m_results);
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="testTabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="MetaDataTab">
|
||||
<attribute name="title">
|
||||
@ -70,7 +70,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="PluralTab">
|
||||
<widget class="QWidget" name="pluralTab">
|
||||
<attribute name="title">
|
||||
<string>Subtest 5: Plural</string>
|
||||
</attribute>
|
||||
@ -80,6 +80,16 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="lateSkillsTab">
|
||||
<attribute name="title">
|
||||
<string>Subtest 6: Späte Fähigkeiten (7;0-8;11)</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="LateSkillsWidget" name="lateSkillsWidget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -240,7 +250,13 @@
|
||||
<customwidget>
|
||||
<class>V2SvkWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">V2SvkWidget.h</header>
|
||||
<header>V2SvkWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LateSkillsWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">LateSkillsWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
|
Reference in New Issue
Block a user