Compare commits

...

3 commits

Author SHA1 Message Date
d0f64ef440 Re-formatted all source files 2019-10-05 16:14:45 +02:00
Michael Mandl
5c6ed8191b Merge branch 'master' into develop 2019-02-17 19:50:20 +01:00
bb06f17de0 Merge branch 'master' into develop 2019-02-17 17:33:59 +01:00
77 changed files with 2443 additions and 2332 deletions

118
.clang-format Executable file
View file

@ -0,0 +1,118 @@
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: true
AfterExternBlock: false
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeComma
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: '^(BEGIN|IMPLEMENT)_.*_MAP$'
MacroBlockEnd: '^END_.*_MAP$'
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 1000000
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: false
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 4
UseTab: Never

View file

@ -9,7 +9,7 @@ Age::Age(unsigned int years, unsigned int months)
{
}
Age::Age(const QDate &birth, const QDate &reference)
Age::Age(const QDate& birth, const QDate& reference)
{
if (reference < birth)
{
@ -38,7 +38,7 @@ Age::Age(const QDate &birth, const QDate &reference)
m_months = months;
}
bool Age::operator<(const Age &cmp) const
bool Age::operator<(const Age& cmp) const
{
if (m_years == cmp.m_years)
{

View file

@ -11,9 +11,9 @@ private:
public:
Age() = default;
Age(unsigned int years, unsigned int months);
Age(const QDate &birth, const QDate &reference);
Age(const QDate& birth, const QDate& reference);
bool operator<(const Age &cmp) const;
bool operator<(const Age& cmp) const;
unsigned int years() const;
unsigned int months() const;

View file

@ -1,6 +1,6 @@
#include "CheckableItem.h"
CheckableItem::CheckableItem(const std::string &text)
CheckableItem::CheckableItem(const std::string& text)
: m_text(text)
{
}

View file

@ -13,7 +13,7 @@ private:
public:
CheckableItem() = default;
CheckableItem(const std::string &text);
CheckableItem(const std::string& text);
std::string getText() const;

View file

@ -6,7 +6,7 @@
CheckableItems::CheckableItems(std::initializer_list<std::string> itemNames)
{
for (const auto &itemName : itemNames)
for (const auto& itemName : itemNames)
{
emplace_back(itemName);
}
@ -14,7 +14,7 @@ CheckableItems::CheckableItems(std::initializer_list<std::string> itemNames)
unsigned int CheckableItems::getPoints() const
{
return std::accumulate(begin(), end(), 0, [](int base, const CheckableItem &item) {
return std::accumulate(begin(), end(), 0, [](int base, const CheckableItem& item) {
return base + item.points();
});
}

View file

@ -2,8 +2,7 @@
#include <numeric>
CheckableTest::CheckableTest(
const char *name, std::initializer_list<std::string> items)
CheckableTest::CheckableTest(const char* name, std::initializer_list<std::string> items)
: m_name(name)
, m_items(items)
{
@ -14,17 +13,17 @@ size_t CheckableTest::size() const
return m_items.size();
}
const QString &CheckableTest::name() const
const QString& CheckableTest::name() const
{
return m_name;
}
const CheckableItems &CheckableTest::items() const
const CheckableItems& CheckableTest::items() const
{
return m_items;
}
CheckableItems &CheckableTest::items()
CheckableItems& CheckableTest::items()
{
return m_items;
}

View file

@ -11,12 +11,12 @@ private:
QString m_name;
public:
CheckableTest(const char *name, std::initializer_list<std::string> items);
CheckableTest(const char* name, std::initializer_list<std::string> items);
size_t size() const;
const QString &name() const;
const CheckableItems &items() const;
CheckableItems &items();
const QString& name() const;
const CheckableItems& items() const;
CheckableItems& items();
unsigned int getPoints() const;
};

View file

@ -4,21 +4,21 @@
#include <QSize>
#include <QDebug>
CheckableTestModel::CheckableTestModel(QObject *parent)
CheckableTestModel::CheckableTestModel(QObject* parent)
: QAbstractTableModel(parent)
{
}
int CheckableTestModel::rowCount(const QModelIndex &) const
int CheckableTestModel::rowCount(const QModelIndex&) const
{
return static_cast<int>(m_tests.size());
}
int CheckableTestModel::columnCount(const QModelIndex &) const
int CheckableTestModel::columnCount(const QModelIndex&) const
{
int columnCount = 0;
for (const auto &test : m_tests)
for (const auto& test : m_tests)
{
columnCount = std::max(columnCount, static_cast<int>(test.size()));
}
@ -26,7 +26,7 @@ int CheckableTestModel::columnCount(const QModelIndex &) const
return columnCount;
}
QVariant CheckableTestModel::data(const QModelIndex &index, int role) const
QVariant CheckableTestModel::data(const QModelIndex& index, int role) const
{
if (!isValidIndex(index))
{
@ -35,7 +35,7 @@ QVariant CheckableTestModel::data(const QModelIndex &index, int role) const
try
{
auto &item = getItem(index);
auto& item = getItem(index);
switch (role)
{
@ -49,7 +49,7 @@ QVariant CheckableTestModel::data(const QModelIndex &index, int role) const
}
}
}
catch (std::runtime_error &e)
catch (std::runtime_error& e)
{
qDebug() << "CheckableTestModel::data" << index << e.what();
}
@ -57,7 +57,7 @@ QVariant CheckableTestModel::data(const QModelIndex &index, int role) const
return {};
}
Qt::ItemFlags CheckableTestModel::flags(const QModelIndex &index) const
Qt::ItemFlags CheckableTestModel::flags(const QModelIndex& index) const
{
if (isValidIndex(index))
{
@ -67,7 +67,7 @@ Qt::ItemFlags CheckableTestModel::flags(const QModelIndex &index) const
return Qt::NoItemFlags;
}
bool CheckableTestModel::setData(const QModelIndex &index, const QVariant &value, int role)
bool CheckableTestModel::setData(const QModelIndex& index, const QVariant& value, int role)
{
if (!isValidIndex(index))
{
@ -78,13 +78,13 @@ bool CheckableTestModel::setData(const QModelIndex &index, const QVariant &value
{
if (role == Qt::CheckStateRole)
{
auto &item = getItem(index);
auto& item = getItem(index);
item.setState(value.toBool());
emit dataChanged(index, index);
return true;
}
}
catch (std::runtime_error &e)
catch (std::runtime_error& e)
{
qDebug() << "CheckableTestModel::setData" << index << e.what();
}
@ -121,7 +121,7 @@ QVariant CheckableTestModel::headerData(int section, Qt::Orientation orientation
return QAbstractTableModel::headerData(section, orientation, role);
}
bool CheckableTestModel::isValidIndex(const QModelIndex &index) const
bool CheckableTestModel::isValidIndex(const QModelIndex& index) const
{
if (index.row() < m_tests.size())
{
@ -131,7 +131,7 @@ bool CheckableTestModel::isValidIndex(const QModelIndex &index) const
return false;
}
CheckableItems &CheckableTestModel::getItems(const QModelIndex &index)
CheckableItems& CheckableTestModel::getItems(const QModelIndex& index)
{
if (index.row() < m_tests.size())
{
@ -141,7 +141,7 @@ CheckableItems &CheckableTestModel::getItems(const QModelIndex &index)
throw std::runtime_error("invalid index");
}
const CheckableItems &CheckableTestModel::getItems(const QModelIndex &index) const
const CheckableItems& CheckableTestModel::getItems(const QModelIndex& index) const
{
if (index.row() < m_tests.size())
{
@ -151,9 +151,9 @@ const CheckableItems &CheckableTestModel::getItems(const QModelIndex &index) con
throw std::runtime_error("invalid index");
}
CheckableItem &CheckableTestModel::getItem(const QModelIndex &index)
CheckableItem& CheckableTestModel::getItem(const QModelIndex& index)
{
auto &items = getItems(index);
auto& items = getItems(index);
if (index.column() < items.size())
{
return items.at(index.column());
@ -162,9 +162,9 @@ CheckableItem &CheckableTestModel::getItem(const QModelIndex &index)
throw std::runtime_error("invalid index");
}
const CheckableItem &CheckableTestModel::getItem(const QModelIndex &index) const
const CheckableItem& CheckableTestModel::getItem(const QModelIndex& index) const
{
auto &items = getItems(index);
auto& items = getItems(index);
if (index.column() < items.size())
{
return items.at(index.column());
@ -177,9 +177,9 @@ unsigned int CheckableTestModel::getPoints() const
{
unsigned int points = 0;
for (const auto &test : m_tests)
for (const auto& test : m_tests)
{
for (const auto &item : test.items())
for (const auto& item : test.items())
{
points += item.points();
}

View file

@ -12,14 +12,14 @@ protected:
CheckableTests m_tests;
public:
CheckableTestModel(QObject *parent);
CheckableTestModel(QObject* parent);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const override;
@ -29,13 +29,12 @@ public:
QString getTitle() const;
protected:
virtual bool isValidIndex(const QModelIndex &index) const;
virtual bool isValidIndex(const QModelIndex& index) const;
private:
CheckableItems &getItems(const QModelIndex &index);
const CheckableItems &getItems(const QModelIndex &index) const;
CheckableItems& getItems(const QModelIndex& index);
const CheckableItems& getItems(const QModelIndex& index) const;
CheckableItem &getItem(const QModelIndex &index);
const CheckableItem &getItem(const QModelIndex &index) const;
CheckableItem& getItem(const QModelIndex& index);
const CheckableItem& getItem(const QModelIndex& index) const;
};

View file

@ -5,7 +5,7 @@
#include <sstream>
DataModel::DataModel(QObject *parent)
DataModel::DataModel(QObject* parent)
: QObject(parent)
, m_metaData(this)
, m_verbEnd(this)
@ -37,7 +37,7 @@ DataModel::DataModel(QObject *parent)
connect(&m_genitiv, &GenitivModel::dataChanged, this, &DataModel::genitivModelChanged);
}
void DataModel::write(const QString &filename) const
void DataModel::write(const QString& filename) const
{
ESGRAF48::DataModel dataModel;
@ -69,7 +69,7 @@ void DataModel::write(const QString &filename) const
}
}
void DataModel::read(const QString &filename)
void DataModel::read(const QString& filename)
{
QFile inFile(filename);
if (!inFile.open(QIODevice::ReadOnly))
@ -100,7 +100,7 @@ void DataModel::read(const QString &filename)
m_passiv.read(dataModel.lateskillspassiv());
}
void DataModel::printTo(QPrinter &printer) const
void DataModel::printTo(QPrinter& printer) const
{
QPainter painter;
painter.begin(&printer);

View file

@ -44,12 +44,12 @@ public:
ResultModel m_results;
public:
DataModel(QObject *parent);
DataModel(QObject* parent);
void write(const QString &filename) const;
void read(const QString &filename);
void write(const QString& filename) const;
void read(const QString& filename);
void printTo(QPrinter &printer) const;
void printTo(QPrinter& printer) const;
signals:
void modelChanged();

View file

@ -5,7 +5,7 @@
#include <QApplication>
#include <QCommandLineParser>
int main(int argc, char **argv)
int main(int argc, char** argv)
{
QApplication app(argc, argv);
QCoreApplication::setApplicationName(ESGRAF48_DESCRIPTION);

View file

@ -4,24 +4,24 @@
#include <sstream>
MetaDataModel::MetaDataModel(QObject *parent)
MetaDataModel::MetaDataModel(QObject* parent)
: PrintableModel(parent)
{
m_dateOfBirth = QDate::currentDate().addYears(-9);
m_dateOfTest = QDate::currentDate();
}
int MetaDataModel::rowCount(const QModelIndex &parent) const
int MetaDataModel::rowCount(const QModelIndex& parent) const
{
return 1;
}
int MetaDataModel::columnCount(const QModelIndex &parent) const
int MetaDataModel::columnCount(const QModelIndex& parent) const
{
return 6;
}
QVariant MetaDataModel::data(const QModelIndex &modelIndex, int role) const
QVariant MetaDataModel::data(const QModelIndex& modelIndex, int role) const
{
if (role == Qt::DisplayRole || role == Qt::EditRole)
{
@ -47,12 +47,12 @@ QVariant MetaDataModel::data(const QModelIndex &modelIndex, int role) const
return QVariant();
}
Qt::ItemFlags MetaDataModel::flags(const QModelIndex &modelIndex) const
Qt::ItemFlags MetaDataModel::flags(const QModelIndex& modelIndex) const
{
return QAbstractTableModel::flags(modelIndex) | Qt::ItemIsEditable;
}
bool MetaDataModel::setData(const QModelIndex &modelIndex, const QVariant &value, int role)
bool MetaDataModel::setData(const QModelIndex& modelIndex, const QVariant& value, int role)
{
if (role != Qt::EditRole)
{
@ -112,7 +112,7 @@ bool MetaDataModel::setData(const QModelIndex &modelIndex, const QVariant &value
return valueChanged;
}
void MetaDataModel::read(const ESGRAF48::MetaDataModel &model)
void MetaDataModel::read(const ESGRAF48::MetaDataModel& model)
{
setData(index(0, 0), QString::fromStdString(model.participantname()));
setData(index(0, 1), QString::fromStdString(model.instructorname()));
@ -121,7 +121,7 @@ void MetaDataModel::read(const ESGRAF48::MetaDataModel &model)
setData(index(0, 4), QString::fromStdString(model.remarks()));
}
void MetaDataModel::write(ESGRAF48::MetaDataModel &model) const
void MetaDataModel::write(ESGRAF48::MetaDataModel& model) const
{
model.set_participantname(m_participant.toStdString());
model.set_instructorname(m_instructor.toStdString());
@ -130,7 +130,7 @@ void MetaDataModel::write(ESGRAF48::MetaDataModel &model) const
model.set_remarks(m_remarks.toStdString());
}
void MetaDataModel::printTo(QPainter &painter) const
void MetaDataModel::printTo(QPainter& painter) const
{
painter.setFont(tableFont());

View file

@ -22,17 +22,17 @@ private:
QString m_remarks;
public:
MetaDataModel(QObject *parent);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
MetaDataModel(QObject* parent);
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
void read(const ESGRAF48::MetaDataModel &model);
void write(ESGRAF48::MetaDataModel &model) const;
void read(const ESGRAF48::MetaDataModel& model);
void write(ESGRAF48::MetaDataModel& model) const;
void printTo(QPainter &painter) const override;
void printTo(QPainter& painter) const override;
Age getAge() const;
};

View file

@ -6,7 +6,7 @@
#include <QDataWidgetMapper>
#include <QDebug>
MetaDataWidget::MetaDataWidget(QWidget *parent)
MetaDataWidget::MetaDataWidget(QWidget* parent)
: QWidget(parent)
, ui(new Ui::MetaDataWidget)
, m_widgetMapper(new QDataWidgetMapper(this))
@ -24,7 +24,7 @@ MetaDataWidget::~MetaDataWidget()
delete ui;
}
void MetaDataWidget::setModel(MetaDataModel *model)
void MetaDataWidget::setModel(MetaDataModel* model)
{
m_widgetMapper->setModel(model);
m_widgetMapper->addMapping(ui->participantLineEdit, 0);

View file

@ -6,7 +6,7 @@ class QDataWidgetMapper;
class MetaDataModel;
namespace Ui {
class MetaDataWidget;
class MetaDataWidget;
};
class MetaDataWidget : public QWidget
@ -14,13 +14,13 @@ class MetaDataWidget : public QWidget
Q_OBJECT
private:
Ui::MetaDataWidget *ui;
QDataWidgetMapper *m_widgetMapper;
Ui::MetaDataWidget* ui;
QDataWidgetMapper* m_widgetMapper;
public:
MetaDataWidget(QWidget *parent = nullptr);
MetaDataWidget(QWidget* parent = nullptr);
~MetaDataWidget();
void setModel(MetaDataModel *model);
void setModel(MetaDataModel* model);
void toFirst();
};

View file

@ -2,12 +2,12 @@
#include <regex>
PrintableModel::PrintableModel(QObject *parent)
PrintableModel::PrintableModel(QObject* parent)
: CheckableTestModel(parent)
{
}
void PrintableModel::printTo(QPainter &painter) const
void PrintableModel::printTo(QPainter& painter) const
{
printHeader(painter);
printTests(painter);
@ -49,7 +49,7 @@ double PrintableModel::cellWidthFactor()
return headerWidthFactor() / 2;
}
void PrintableModel::drawTextSquare(QPainter &painter, const QRectF &cell, const QString &text)
void PrintableModel::drawTextSquare(QPainter& painter, const QRectF& cell, const QString& text)
{
auto prevPen = painter.pen();
painter.setPen(tablePen());
@ -64,7 +64,7 @@ void PrintableModel::drawTextSquare(QPainter &painter, const QRectF &cell, const
painter.setPen(prevPen);
}
void PrintableModel::drawNumberSquare(QPainter &painter, double x, double y, int number)
void PrintableModel::drawNumberSquare(QPainter& painter, double x, double y, int number)
{
QRectF cell = {x, y, 0.03 * painter.device()->width(),
1.5 * painter.fontMetrics().lineSpacing()};
@ -77,13 +77,13 @@ void PrintableModel::drawNumberSquare(QPainter &painter, double x, double y, int
painter.drawLine(cell.bottomLeft(), cell.topLeft());
}
void PrintableModel::PrintableModel::drawCheckSquare(QPainter &painter, const QRectF &cell,
void PrintableModel::PrintableModel::drawCheckSquare(QPainter& painter, const QRectF& cell,
bool checked)
{
drawTextSquare(painter, cell, checked ? u8"\u2612" : u8"\u2610");
}
void PrintableModel::drawResultSquare(QPainter &painter, double y, bool rightCell,
void PrintableModel::drawResultSquare(QPainter& painter, double y, bool rightCell,
unsigned int value)
{
double pageWidth = painter.device()->width();
@ -94,7 +94,7 @@ void PrintableModel::drawResultSquare(QPainter &painter, double y, bool rightCel
drawTextSquare(painter, {x, y, cellWidth, cellHeight}, QString::number(value));
}
void PrintableModel::drawGreySquare(QPainter &painter, const QRectF &cell)
void PrintableModel::drawGreySquare(QPainter& painter, const QRectF& cell)
{
auto prevBrush = painter.brush();
auto prevPen = painter.pen();
@ -114,14 +114,14 @@ void PrintableModel::drawGreySquare(QPainter &painter, const QRectF &cell)
painter.setPen(prevPen);
}
void PrintableModel::drawHeader2(QPainter &painter, const QString &text)
void PrintableModel::drawHeader2(QPainter& painter, const QString& text)
{
painter.setFont(h2Font());
painter.drawText(0, 0, text);
painter.translate(0, 0.5 * painter.fontMetrics().lineSpacing());
}
void PrintableModel::printHeader(QPainter &painter) const
void PrintableModel::printHeader(QPainter& painter) const
{
auto title = getTitle();
if (!title.isEmpty())
@ -130,7 +130,7 @@ void PrintableModel::printHeader(QPainter &painter) const
}
}
void PrintableModel::printTests(QPainter &painter) const
void PrintableModel::printTests(QPainter& painter) const
{
painter.setFont(tableFont());
painter.setPen(tablePen());
@ -144,7 +144,7 @@ void PrintableModel::printTests(QPainter &painter) const
double x = 0;
double y = 0;
for (const auto &test : m_tests)
for (const auto& test : m_tests)
{
QString testName = QString::fromStdString(
std::regex_replace(test.name().toStdString(), std::regex("\\s"), "\n"));
@ -152,7 +152,7 @@ void PrintableModel::printTests(QPainter &painter) const
drawTextSquare(painter, {0, y, headerWidth, 2 * rowHeight}, testName);
x = headerWidth;
for (const auto &item : test.items())
for (const auto& item : test.items())
{
drawTextSquare(painter, {x, y, cellWidth, rowHeight}, item.getText().c_str());
drawCheckSquare(painter, {x, y + rowHeight, cellWidth, rowHeight}, item.isChecked());
@ -168,7 +168,7 @@ void PrintableModel::printTests(QPainter &painter) const
painter.translate(0, y + rowHeight);
}
void PrintableModel::printSummary(QPainter &painter) const
void PrintableModel::printSummary(QPainter& painter) const
{
painter.setFont(tableFont());

View file

@ -13,9 +13,9 @@ class PrintableModel : public CheckableTestModel
Q_OBJECT
public:
PrintableModel(QObject *parent);
PrintableModel(QObject* parent);
virtual void printTo(QPainter &painter) const;
virtual void printTo(QPainter& painter) const;
static QFont h1Font();
static QFont h2Font();
@ -27,16 +27,16 @@ public:
static double headerWidthFactor();
static double cellWidthFactor();
static void drawTextSquare(QPainter &painter, const QRectF &cell, const QString &text);
static void drawNumberSquare(QPainter &painter, double x, double y, int number);
static void drawCheckSquare(QPainter &painter, const QRectF &cell, bool checked);
static void drawResultSquare(QPainter &painter, double y, bool rightCell, unsigned int value);
static void drawGreySquare(QPainter &painter, const QRectF &cell);
static void drawTextSquare(QPainter& painter, const QRectF& cell, const QString& text);
static void drawNumberSquare(QPainter& painter, double x, double y, int number);
static void drawCheckSquare(QPainter& painter, const QRectF& cell, bool checked);
static void drawResultSquare(QPainter& painter, double y, bool rightCell, unsigned int value);
static void drawGreySquare(QPainter& painter, const QRectF& cell);
static void drawHeader2(QPainter &painter, const QString &text);
static void drawHeader2(QPainter& painter, const QString& text);
protected:
virtual void printHeader(QPainter &painter) const;
virtual void printTests(QPainter &painter) const;
virtual void printSummary(QPainter &painter) const;
virtual void printHeader(QPainter& painter) const;
virtual void printTests(QPainter& painter) const;
virtual void printSummary(QPainter& painter) const;
};

View file

@ -43,4 +43,3 @@ public:
// clang-format on
}
};

View file

@ -1,6 +1,6 @@
#include "PRMap.h"
unsigned int PRMap::lookup(const Age &age, const unsigned int &points)
unsigned int PRMap::lookup(const Age& age, const unsigned int& points)
{
if (points >= m_PRs.size())
{

View file

@ -10,5 +10,5 @@ protected:
std::vector<std::vector<unsigned int>> m_PRs;
public:
unsigned int lookup(const Age &age, const unsigned int &points);
unsigned int lookup(const Age& age, const unsigned int& points);
};

View file

@ -14,24 +14,24 @@
#include <QDebug>
ResultModel::ResultModel(QObject *parent)
ResultModel::ResultModel(QObject* parent)
: QAbstractTableModel(parent)
{
m_results = {{"V2", "SVK", "VE", "Passiv", "Genus", "Akkusativ", "Dativ", "Genitiv", "Plural"}};
m_results = {{"V2", "SVK", "VE", "Genus", "Akkusativ", "Dativ", "Plural", "Passiv", "Genitiv"}};
}
int ResultModel::rowCount(const QModelIndex &parent) const
int ResultModel::rowCount(const QModelIndex& parent) const
{
return 4;
}
int ResultModel::columnCount(const QModelIndex &parent) const
int ResultModel::columnCount(const QModelIndex& parent) const
{
return 9;
}
QVariant ResultModel::data(const QModelIndex &index, int role) const
QVariant ResultModel::data(const QModelIndex& index, int role) const
{
if (role == Qt::DisplayRole && index.column() < m_results.size())
{
@ -116,7 +116,7 @@ QVariant ResultModel::headerData(int section, Qt::Orientation orientation, int r
}
}
void ResultModel::setAge(const Age &age)
void ResultModel::setAge(const Age& age)
{
m_age = age;
emit dataChanged(index(1, 0), index(4, 8));
@ -212,7 +212,7 @@ void ResultModel::setGenitivResult(unsigned int points)
}
}
void ResultModel::printTo(QPainter &painter) const
void ResultModel::printTo(QPainter& painter) const
{
PrintableModel::drawHeader2(painter, "Prozentränge (PR)");
@ -239,7 +239,7 @@ void ResultModel::printTo(QPainter &painter) const
u8"\u2264 PR 16");
x += cellWidth;
for (const auto &result : m_results)
for (const auto& result : m_results)
{
PrintableModel::drawTextSquare(painter, {x, y + 0 * rowHeight, cellWidth, rowHeight},
result.name());

View file

@ -13,22 +13,22 @@ private:
size_t m_pr = 0;
public:
TestResult(const char *name)
TestResult(const char* name)
: m_name(name)
{
}
void setPoints(const size_t &points)
void setPoints(const size_t& points)
{
m_points = points;
}
void setPR(const unsigned int &pr)
void setPR(const unsigned int& pr)
{
m_pr = pr;
}
const QString &name() const
const QString& name() const
{
return m_name;
}
@ -53,18 +53,17 @@ private:
std::vector<TestResult> m_results;
public:
ResultModel(QObject *parent);
ResultModel(QObject* parent);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(
const QModelIndex &index, int role = Qt::DisplayRole) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const override;
void setAge(const Age &age);
void setAge(const Age& age);
void setPluralResult(unsigned int points);
void setGenusResult(unsigned int points);
void setVerbEndResult(unsigned int points);
@ -75,5 +74,5 @@ public:
void setPassivResult(unsigned int points);
void setGenitivResult(unsigned int points);
void printTo(QPainter &painter) const;
void printTo(QPainter& painter) const;
};

View file

@ -3,7 +3,7 @@
#include "ResultModel.h"
ResultWidget::ResultWidget(QWidget *parent)
ResultWidget::ResultWidget(QWidget* parent)
: QWidget(parent)
, ui(new Ui::ResultWidget)
{
@ -15,7 +15,7 @@ ResultWidget::~ResultWidget()
delete ui;
}
void ResultWidget::setModel(ResultModel *model)
void ResultWidget::setModel(ResultModel* model)
{
ui->resultTableView->setModel(model);
}

View file

@ -13,11 +13,11 @@ class ResultWidget : public QWidget
Q_OBJECT
private:
Ui::ResultWidget *ui;
Ui::ResultWidget* ui;
public:
ResultWidget(QWidget *parent = nullptr);
ResultWidget(QWidget* parent = nullptr);
~ResultWidget();
void setModel(ResultModel *model);
void setModel(ResultModel* model);
};

View file

@ -42,4 +42,3 @@ public:
// clang-format on
}
};

View file

@ -4,7 +4,7 @@
#include "AkkusativModel.h"
#include "DativModel.h"
AkkusativDativWidget::AkkusativDativWidget(QWidget *parent)
AkkusativDativWidget::AkkusativDativWidget(QWidget* parent)
: QWidget(parent)
, ui(new Ui::AkkusativDativWidget)
{
@ -18,12 +18,12 @@ AkkusativDativWidget::~AkkusativDativWidget()
delete ui;
}
void AkkusativDativWidget::setAkkusativModel(AkkusativModel *model)
void AkkusativDativWidget::setAkkusativModel(AkkusativModel* model)
{
ui->akkusativTableView->setModel(model);
}
void AkkusativDativWidget::setDativModel(DativModel *model)
void AkkusativDativWidget::setDativModel(DativModel* model)
{
ui->dativTableView->setModel(model);
}

View file

@ -14,12 +14,12 @@ class AkkusativDativWidget : public QWidget
Q_OBJECT
private:
Ui::AkkusativDativWidget *ui;
Ui::AkkusativDativWidget* ui;
public:
AkkusativDativWidget(QWidget *parent = nullptr);
AkkusativDativWidget(QWidget* parent = nullptr);
~AkkusativDativWidget();
void setAkkusativModel(AkkusativModel *model);
void setDativModel(DativModel *model);
void setAkkusativModel(AkkusativModel* model);
void setDativModel(DativModel* model);
};

View file

@ -1,6 +1,6 @@
#include "AkkusativModel.h"
AkkusativModel::AkkusativModel(QObject *parent)
AkkusativModel::AkkusativModel(QObject* parent)
: PrintableModel(parent)
{
m_tests = {{"Akkusativ Nominalphrase",
@ -11,11 +11,11 @@ AkkusativModel::AkkusativModel(QObject *parent)
{"Salat", "Fleisch", "Knochen", "Banane", "Apfel", "Karotte", "Honig", "Zucker"}}};
}
void AkkusativModel::read(const ESGRAF48::AkkusativModel &model)
void AkkusativModel::read(const ESGRAF48::AkkusativModel& model)
{
const auto &tiereModel = model.tiere();
const auto& tiereModel = model.tiere();
{
auto &testItems = m_tests.at(0).items();
auto& testItems = m_tests.at(0).items();
testItems[0].setState(tiereModel.tiger());
testItems[1].setState(tiereModel.katze());
@ -27,9 +27,9 @@ void AkkusativModel::read(const ESGRAF48::AkkusativModel &model)
testItems[7].setState(tiereModel.elefant());
}
const auto &versteckeModel = model.verstecke();
const auto& versteckeModel = model.verstecke();
{
auto &testItems = m_tests.at(1).items();
auto& testItems = m_tests.at(1).items();
testItems[0].setState(versteckeModel.vorhang1());
testItems[1].setState(versteckeModel.kiste1());
@ -41,9 +41,9 @@ void AkkusativModel::read(const ESGRAF48::AkkusativModel &model)
testItems[7].setState(versteckeModel.baum2());
}
const auto &futterModel = model.futter();
const auto& futterModel = model.futter();
{
auto &testItems = m_tests.at(2).items();
auto& testItems = m_tests.at(2).items();
testItems[0].setState(futterModel.salat());
testItems[1].setState(futterModel.fleisch());
@ -58,12 +58,12 @@ void AkkusativModel::read(const ESGRAF48::AkkusativModel &model)
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
}
void AkkusativModel::write(ESGRAF48::AkkusativModel &model) const
void AkkusativModel::write(ESGRAF48::AkkusativModel& model) const
{
auto *tiereModel = model.mutable_tiere();
auto* tiereModel = model.mutable_tiere();
if (tiereModel != nullptr)
{
const auto &testItems = m_tests.at(0).items();
const auto& testItems = m_tests.at(0).items();
tiereModel->set_tiger(testItems[0].isChecked());
tiereModel->set_katze(testItems[1].isChecked());
@ -75,10 +75,10 @@ void AkkusativModel::write(ESGRAF48::AkkusativModel &model) const
tiereModel->set_elefant(testItems[7].isChecked());
}
auto *versteckeModel = model.mutable_verstecke();
auto* versteckeModel = model.mutable_verstecke();
if (versteckeModel != nullptr)
{
const auto &testItems = m_tests.at(1).items();
const auto& testItems = m_tests.at(1).items();
versteckeModel->set_vorhang1(testItems[0].isChecked());
versteckeModel->set_kiste1(testItems[1].isChecked());
@ -90,10 +90,10 @@ void AkkusativModel::write(ESGRAF48::AkkusativModel &model) const
versteckeModel->set_baum2(testItems[7].isChecked());
}
auto *futterModel = model.mutable_futter();
auto* futterModel = model.mutable_futter();
if (futterModel != nullptr)
{
const auto &testItems = m_tests.at(2).items();
const auto& testItems = m_tests.at(2).items();
futterModel->set_salat(testItems[0].isChecked());
futterModel->set_fleisch(testItems[1].isChecked());
@ -106,7 +106,7 @@ void AkkusativModel::write(ESGRAF48::AkkusativModel &model) const
}
}
void AkkusativModel::printHeader(QPainter &painter) const
void AkkusativModel::printHeader(QPainter& painter) const
{
drawHeader2(painter, "Subtest 4: Akkusativ und Dativ");
}

View file

@ -8,11 +8,11 @@ class AkkusativModel : public PrintableModel
Q_OBJECT
public:
AkkusativModel(QObject *parent);
AkkusativModel(QObject* parent);
void read(const ESGRAF48::AkkusativModel &model);
void write(ESGRAF48::AkkusativModel &model) const;
void read(const ESGRAF48::AkkusativModel& model);
void write(ESGRAF48::AkkusativModel& model) const;
protected:
void printHeader(QPainter &painter) const override;
void printHeader(QPainter& painter) const override;
};

View file

@ -1,6 +1,6 @@
#include "DativModel.h"
DativModel::DativModel(QObject *parent)
DativModel::DativModel(QObject* parent)
: PrintableModel(parent)
{
m_tests = {{"Dativ Nominalphrase",
@ -11,11 +11,11 @@ DativModel::DativModel(QObject *parent)
{"Gans", "Tiger", "Hund", "Affe", "Elefant", "Pferd", "Bär", "Katze"}}};
}
void DativModel::read(const ESGRAF48::DativModel &model)
void DativModel::read(const ESGRAF48::DativModel& model)
{
const auto &tiereModel = model.tiere();
const auto& tiereModel = model.tiere();
{
auto &testItems = m_tests.at(0).items();
auto& testItems = m_tests.at(0).items();
testItems[0].setState(tiereModel.affe());
testItems[1].setState(tiereModel.gans());
@ -27,9 +27,9 @@ void DativModel::read(const ESGRAF48::DativModel &model)
testItems[7].setState(tiereModel.katze());
}
const auto &versteckeModel = model.verstecke();
const auto& versteckeModel = model.verstecke();
{
auto &testItems = m_tests.at(1).items();
auto& testItems = m_tests.at(1).items();
testItems[0].setState(versteckeModel.vorhang1());
testItems[1].setState(versteckeModel.kiste1());
@ -41,9 +41,9 @@ void DativModel::read(const ESGRAF48::DativModel &model)
testItems[7].setState(versteckeModel.baum2());
}
const auto &nomTiereModel = model.nomtiere();
const auto& nomTiereModel = model.nomtiere();
{
auto &testItems = m_tests.at(2).items();
auto& testItems = m_tests.at(2).items();
testItems[0].setState(nomTiereModel.gans());
testItems[1].setState(nomTiereModel.tiger());
@ -58,12 +58,12 @@ void DativModel::read(const ESGRAF48::DativModel &model)
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
}
void DativModel::write(ESGRAF48::DativModel &model) const
void DativModel::write(ESGRAF48::DativModel& model) const
{
auto *tiereModel = model.mutable_tiere();
auto* tiereModel = model.mutable_tiere();
if (tiereModel != nullptr)
{
const auto &testItems = m_tests.at(0).items();
const auto& testItems = m_tests.at(0).items();
tiereModel->set_affe(testItems[0].isChecked());
tiereModel->set_gans(testItems[1].isChecked());
@ -75,10 +75,10 @@ void DativModel::write(ESGRAF48::DativModel &model) const
tiereModel->set_katze(testItems[7].isChecked());
}
auto *versteckeModel = model.mutable_verstecke();
auto* versteckeModel = model.mutable_verstecke();
if (versteckeModel != nullptr)
{
const auto &testItems = m_tests.at(1).items();
const auto& testItems = m_tests.at(1).items();
versteckeModel->set_vorhang1(testItems[0].isChecked());
versteckeModel->set_kiste1(testItems[1].isChecked());
@ -90,10 +90,10 @@ void DativModel::write(ESGRAF48::DativModel &model) const
versteckeModel->set_baum2(testItems[7].isChecked());
}
auto *nomTiereModel = model.mutable_nomtiere();
auto* nomTiereModel = model.mutable_nomtiere();
if (nomTiereModel != nullptr)
{
const auto &testItems = m_tests.at(2).items();
const auto& testItems = m_tests.at(2).items();
nomTiereModel->set_gans(testItems[0].isChecked());
nomTiereModel->set_tiger(testItems[1].isChecked());
@ -106,7 +106,7 @@ void DativModel::write(ESGRAF48::DativModel &model) const
}
}
void DativModel::printHeader(QPainter &painter) const
void DativModel::printHeader(QPainter& painter) const
{
painter.translate(0, -1.5 * painter.fontMetrics().lineSpacing());
}

View file

@ -8,11 +8,11 @@ class DativModel : public PrintableModel
Q_OBJECT
public:
DativModel(QObject *parent);
DativModel(QObject* parent);
void read(const ESGRAF48::DativModel &model);
void write(ESGRAF48::DativModel &model) const;
void read(const ESGRAF48::DativModel& model);
void write(ESGRAF48::DativModel& model) const;
protected:
void printHeader(QPainter &painter) const override;
void printHeader(QPainter& painter) const override;
};

View file

@ -1,6 +1,6 @@
#include "GenusModel.h"
GenusModel::GenusModel(QObject *parent)
GenusModel::GenusModel(QObject* parent)
: PrintableModel(parent)
{
m_title = "Subtest 3: Genus";
@ -11,11 +11,11 @@ GenusModel::GenusModel(QObject *parent)
{"Zirkus", {"Kiste", "Holz", "Vorhang", "Baum"}}};
}
void GenusModel::read(const ESGRAF48::GenusModel &model)
void GenusModel::read(const ESGRAF48::GenusModel& model)
{
const auto &tiereModel = model.tiere();
const auto& tiereModel = model.tiere();
{
auto &testItems = m_tests.at(0).items();
auto& testItems = m_tests.at(0).items();
testItems[0].setState(tiereModel.tiger());
testItems[1].setState(tiereModel.baer());
@ -27,9 +27,9 @@ void GenusModel::read(const ESGRAF48::GenusModel &model)
testItems[7].setState(tiereModel.hund());
}
const auto &futterModel = model.futter();
const auto& futterModel = model.futter();
{
auto &testItems = m_tests.at(1).items();
auto& testItems = m_tests.at(1).items();
testItems[0].setState(futterModel.salat());
testItems[1].setState(futterModel.fleisch());
@ -41,9 +41,9 @@ void GenusModel::read(const ESGRAF48::GenusModel &model)
testItems[7].setState(futterModel.zucker());
}
const auto &zirkusModel = model.zirkus();
const auto& zirkusModel = model.zirkus();
{
auto &testItems = m_tests.at(2).items();
auto& testItems = m_tests.at(2).items();
testItems[0].setState(zirkusModel.kiste());
testItems[1].setState(zirkusModel.holz());
@ -54,12 +54,12 @@ void GenusModel::read(const ESGRAF48::GenusModel &model)
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
}
void GenusModel::write(ESGRAF48::GenusModel &model) const
void GenusModel::write(ESGRAF48::GenusModel& model) const
{
auto *tiereModel = model.mutable_tiere();
auto* tiereModel = model.mutable_tiere();
if (tiereModel != nullptr)
{
const auto &testItems = m_tests.at(0).items();
const auto& testItems = m_tests.at(0).items();
tiereModel->set_tiger(testItems[0].isChecked());
tiereModel->set_baer(testItems[1].isChecked());
@ -71,10 +71,10 @@ void GenusModel::write(ESGRAF48::GenusModel &model) const
tiereModel->set_hund(testItems[7].isChecked());
}
auto *futterModel = model.mutable_futter();
auto* futterModel = model.mutable_futter();
if (futterModel != nullptr)
{
const auto &testItems = m_tests.at(1).items();
const auto& testItems = m_tests.at(1).items();
futterModel->set_salat(testItems[0].isChecked());
futterModel->set_fleisch(testItems[1].isChecked());
@ -86,10 +86,10 @@ void GenusModel::write(ESGRAF48::GenusModel &model) const
futterModel->set_zucker(testItems[7].isChecked());
}
auto *zirkusModel = model.mutable_zirkus();
auto* zirkusModel = model.mutable_zirkus();
if (zirkusModel != nullptr)
{
const auto &testItems = m_tests.at(2).items();
const auto& testItems = m_tests.at(2).items();
zirkusModel->set_kiste(testItems[0].isChecked());
zirkusModel->set_holz(testItems[1].isChecked());

View file

@ -8,8 +8,8 @@ class GenusModel : public PrintableModel
Q_OBJECT
public:
GenusModel(QObject *parent);
GenusModel(QObject* parent);
void read(const ESGRAF48::GenusModel &model);
void write(ESGRAF48::GenusModel &model) const;
void read(const ESGRAF48::GenusModel& model);
void write(ESGRAF48::GenusModel& model) const;
};

View file

@ -3,7 +3,7 @@
#include "GenusModel.h"
GenusWidget::GenusWidget(QWidget *parent)
GenusWidget::GenusWidget(QWidget* parent)
: QWidget(parent)
, ui(new Ui::GenusWidget)
{
@ -17,7 +17,7 @@ GenusWidget::~GenusWidget()
delete ui;
}
void GenusWidget::setModel(GenusModel *model)
void GenusWidget::setModel(GenusModel* model)
{
ui->genusTableView->setModel(model);
}

View file

@ -13,11 +13,11 @@ class GenusWidget : public QWidget
Q_OBJECT
private:
Ui::GenusWidget *ui;
Ui::GenusWidget* ui;
public:
GenusWidget(QWidget *parent = nullptr);
GenusWidget(QWidget* parent = nullptr);
~GenusWidget();
void setModel(GenusModel *model);
void setModel(GenusModel* model);
};

View file

@ -1,6 +1,6 @@
#include "GenitivModel.h"
GenitivModel::GenitivModel(QObject *parent)
GenitivModel::GenitivModel(QObject* parent)
: LateSkillsModel(parent)
{
m_tests = {
@ -23,7 +23,7 @@ GenitivModel::GenitivModel(QObject *parent)
}
}
bool GenitivModel::setData(const QModelIndex &modelIndex, const QVariant &value, int role)
bool GenitivModel::setData(const QModelIndex& modelIndex, const QVariant& value, int role)
{
if (role == Qt::CheckStateRole && value.toBool() == true)
{
@ -42,11 +42,11 @@ bool GenitivModel::setData(const QModelIndex &modelIndex, const QVariant &value,
return CheckableTestModel::setData(modelIndex, value, role);
}
void GenitivModel::read(const ESGRAF48::LateSkillsGenitivModel &model)
void GenitivModel::read(const ESGRAF48::LateSkillsGenitivModel& model)
{
const auto &praepositionenModel = model.praepositionen();
const auto& praepositionenModel = model.praepositionen();
{
auto &testItems = m_tests.at(0).items();
auto& testItems = m_tests.at(0).items();
testItems[0].setState(praepositionenModel.anstelle1());
testItems[1].setState(praepositionenModel.anstelle2());
@ -56,9 +56,9 @@ void GenitivModel::read(const ESGRAF48::LateSkillsGenitivModel &model)
testItems[5].setState(praepositionenModel.mithilfe2());
}
const auto &attributierungModel = model.attributierung();
const auto& attributierungModel = model.attributierung();
{
auto &testItems = m_tests.at(1).items();
auto& testItems = m_tests.at(1).items();
testItems[0].setState(attributierungModel.schuhe1());
testItems[1].setState(attributierungModel.schuhe2());
@ -75,12 +75,12 @@ void GenitivModel::read(const ESGRAF48::LateSkillsGenitivModel &model)
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
}
void GenitivModel::write(ESGRAF48::LateSkillsGenitivModel &model) const
void GenitivModel::write(ESGRAF48::LateSkillsGenitivModel& model) const
{
auto *praepositionenModel = model.mutable_praepositionen();
auto* praepositionenModel = model.mutable_praepositionen();
if (praepositionenModel != nullptr)
{
const auto &testItems = m_tests.at(0).items();
const auto& testItems = m_tests.at(0).items();
praepositionenModel->set_anstelle1(testItems[0].isChecked());
praepositionenModel->set_anstelle2(testItems[1].isChecked());
@ -90,10 +90,10 @@ void GenitivModel::write(ESGRAF48::LateSkillsGenitivModel &model) const
praepositionenModel->set_mithilfe2(testItems[5].isChecked());
}
auto *attributierungModel = model.mutable_attributierung();
auto* attributierungModel = model.mutable_attributierung();
if (attributierungModel != nullptr)
{
const auto &testItems = m_tests.at(1).items();
const auto& testItems = m_tests.at(1).items();
attributierungModel->set_schuhe1(testItems[0].isChecked());
attributierungModel->set_schuhe2(testItems[1].isChecked());
@ -108,7 +108,7 @@ void GenitivModel::write(ESGRAF48::LateSkillsGenitivModel &model) const
}
}
void GenitivModel::printHeader(QPainter &painter) const
void GenitivModel::printHeader(QPainter& painter) const
{
painter.translate(0, -1.5 * painter.fontMetrics().lineSpacing());
}

View file

@ -8,13 +8,12 @@ class GenitivModel : public LateSkillsModel
Q_OBJECT
public:
GenitivModel(QObject *parent);
bool setData(const QModelIndex &index, const QVariant &value,
int role = Qt::EditRole) override;
GenitivModel(QObject* parent);
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
void read(const ESGRAF48::LateSkillsGenitivModel &model);
void write(ESGRAF48::LateSkillsGenitivModel &model) const;
void read(const ESGRAF48::LateSkillsGenitivModel& model);
void write(ESGRAF48::LateSkillsGenitivModel& model) const;
protected:
void printHeader(QPainter &painter) const override;
void printHeader(QPainter& painter) const override;
};

View file

@ -2,12 +2,12 @@
#include <regex>
LateSkillsModel::LateSkillsModel(QObject *parent)
LateSkillsModel::LateSkillsModel(QObject* parent)
: PrintableModel(parent)
{
}
void LateSkillsModel::printTests(QPainter &painter) const
void LateSkillsModel::printTests(QPainter& painter) const
{
painter.setFont(tableFont());
painter.setPen(tablePen());
@ -22,19 +22,19 @@ void LateSkillsModel::printTests(QPainter &painter) const
double x = 0;
double y = 0;
for (const auto &test : m_tests)
for (const auto& test : m_tests)
{
QString testName = QString::fromStdString(
std::regex_replace(test.name().toStdString(), std::regex("\\s"), "\n"));
drawTextSquare(painter, {0, y, headerWidth, 3 * rowHeight}, testName);
const auto &items = test.items();
const auto& items = test.items();
x = headerWidth;
for (unsigned int i = 0; i < items.size(); i += 2)
{
const auto &item = test.items().at(i);
const auto& item = test.items().at(i);
QString itemText = QString::fromStdString(item.getText()).split(" ").at(0);
drawTextSquare(painter, {x, y, cellHeaderWidth, rowHeight}, itemText);
@ -44,7 +44,7 @@ void LateSkillsModel::printTests(QPainter &painter) const
y += rowHeight;
x = headerWidth;
for (const auto &item : items)
for (const auto& item : items)
{
drawTextSquare(painter, {x, y, cellWidth, rowHeight}, QString::number(item.value()));
drawCheckSquare(painter, {x, y + rowHeight, cellWidth, rowHeight}, item.isChecked());

View file

@ -8,8 +8,8 @@ class LateSkillsModel : public PrintableModel
Q_OBJECT
public:
LateSkillsModel(QObject *parent);
LateSkillsModel(QObject* parent);
protected:
void printTests(QPainter &painter) const override;
void printTests(QPainter& painter) const override;
};

View file

@ -4,7 +4,7 @@
#include "PassivModel.h"
#include "GenitivModel.h"
LateSkillsWidget::LateSkillsWidget(QWidget *parent)
LateSkillsWidget::LateSkillsWidget(QWidget* parent)
: QWidget(parent)
, ui(new Ui::LateSkillsWidget)
{
@ -18,12 +18,12 @@ LateSkillsWidget::~LateSkillsWidget()
delete ui;
}
void LateSkillsWidget::setPassivModel(PassivModel *model)
void LateSkillsWidget::setPassivModel(PassivModel* model)
{
ui->passivTableView->setModel(model);
}
void LateSkillsWidget::setGenitivModel(GenitivModel *model)
void LateSkillsWidget::setGenitivModel(GenitivModel* model)
{
ui->genitivTableView->setModel(model);
}

View file

@ -14,12 +14,12 @@ class LateSkillsWidget : public QWidget
Q_OBJECT
private:
Ui::LateSkillsWidget *ui;
Ui::LateSkillsWidget* ui;
public:
LateSkillsWidget(QWidget *parent = nullptr);
LateSkillsWidget(QWidget* parent = nullptr);
~LateSkillsWidget();
void setPassivModel(PassivModel *model);
void setGenitivModel(GenitivModel *model);
void setPassivModel(PassivModel* model);
void setGenitivModel(GenitivModel* model);
};

View file

@ -1,6 +1,6 @@
#include "PassivModel.h"
PassivModel::PassivModel(QObject *parent)
PassivModel::PassivModel(QObject* parent)
: LateSkillsModel(parent)
{
m_tests = {{"Passiv",
@ -13,7 +13,7 @@ PassivModel::PassivModel(QObject *parent)
}
}
bool PassivModel::setData(const QModelIndex &modelIndex, const QVariant &value, int role)
bool PassivModel::setData(const QModelIndex& modelIndex, const QVariant& value, int role)
{
if (role == Qt::CheckStateRole && value.toBool() == true)
{
@ -32,9 +32,9 @@ bool PassivModel::setData(const QModelIndex &modelIndex, const QVariant &value,
return CheckableTestModel::setData(modelIndex, value, role);
}
void PassivModel::read(const ESGRAF48::LateSkillsPassivModel &model)
void PassivModel::read(const ESGRAF48::LateSkillsPassivModel& model)
{
auto &testItems = m_tests.at(0).items();
auto& testItems = m_tests.at(0).items();
testItems[0].setState(model.elefant1());
testItems[1].setState(model.elefant2());
@ -50,9 +50,9 @@ void PassivModel::read(const ESGRAF48::LateSkillsPassivModel &model)
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
}
void PassivModel::write(ESGRAF48::LateSkillsPassivModel &model) const
void PassivModel::write(ESGRAF48::LateSkillsPassivModel& model) const
{
const auto &testItems = m_tests.at(0).items();
const auto& testItems = m_tests.at(0).items();
model.set_elefant1(testItems[0].isChecked());
model.set_elefant2(testItems[1].isChecked());
@ -66,7 +66,7 @@ void PassivModel::write(ESGRAF48::LateSkillsPassivModel &model) const
model.set_fleisch2(testItems[9].isChecked());
}
void PassivModel::printHeader(QPainter &painter) const
void PassivModel::printHeader(QPainter& painter) const
{
drawHeader2(painter, "Subtest 6: Späte Fähigkeiten (7;0-8;11)");
}

View file

@ -8,12 +8,12 @@ class PassivModel : public LateSkillsModel
Q_OBJECT
public:
PassivModel(QObject *parent);
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
PassivModel(QObject* parent);
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
void read(const ESGRAF48::LateSkillsPassivModel &model);
void write(ESGRAF48::LateSkillsPassivModel &model) const;
void read(const ESGRAF48::LateSkillsPassivModel& model);
void write(ESGRAF48::LateSkillsPassivModel& model) const;
protected:
void printHeader(QPainter &painter) const override;
void printHeader(QPainter& painter) const override;
};

View file

@ -4,7 +4,7 @@
#include <regex>
PluralModel::PluralModel(QObject *parent)
PluralModel::PluralModel(QObject* parent)
: PrintableModel(parent)
{
m_title = "Subtest 5: Plural";
@ -14,9 +14,9 @@ PluralModel::PluralModel(QObject *parent)
"Korn UML+/-er/", "Nuss UML+/-e/", "Bär /-en/", "Apfel UML"}}};
}
void PluralModel::read(const ESGRAF48::PluralModel &model)
void PluralModel::read(const ESGRAF48::PluralModel& model)
{
auto &testItems = m_tests.at(0).items();
auto& testItems = m_tests.at(0).items();
testItems[0].setState(model.fisch());
testItems[1].setState(model.banane());
@ -31,9 +31,9 @@ void PluralModel::read(const ESGRAF48::PluralModel &model)
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
}
void PluralModel::write(ESGRAF48::PluralModel &model) const
void PluralModel::write(ESGRAF48::PluralModel& model) const
{
const auto &testItems = m_tests.at(0).items();
const auto& testItems = m_tests.at(0).items();
model.set_fisch(testItems[0].isChecked());
model.set_banane(testItems[1].isChecked());
@ -46,7 +46,7 @@ void PluralModel::write(ESGRAF48::PluralModel &model) const
model.set_apfel(testItems[8].isChecked());
}
void PluralModel::printTests(QPainter &painter) const
void PluralModel::printTests(QPainter& painter) const
{
painter.setFont(tableFont());
painter.setPen(tablePen());
@ -60,12 +60,12 @@ void PluralModel::printTests(QPainter &painter) const
double x = 0;
double y = 0;
for (const auto &test : m_tests)
for (const auto& test : m_tests)
{
drawTextSquare(painter, {0, y, headerWidth, 3 * rowHeight}, test.name());
x = headerWidth;
for (const auto &item : test.items())
for (const auto& item : test.items())
{
QString itemText =
QString::fromStdString(std::regex_replace(item.getText(), std::regex("\\s"), "\n"));

View file

@ -8,11 +8,11 @@ class PluralModel : public PrintableModel
Q_OBJECT
public:
PluralModel(QObject *parent);
PluralModel(QObject* parent);
void read(const ESGRAF48::PluralModel &model);
void write(ESGRAF48::PluralModel &model) const;
void read(const ESGRAF48::PluralModel& model);
void write(ESGRAF48::PluralModel& model) const;
protected:
virtual void printTests(QPainter &painter) const;
virtual void printTests(QPainter& painter) const;
};

View file

@ -3,7 +3,7 @@
#include "PluralModel.h"
PluralWidget::PluralWidget(QWidget *parent)
PluralWidget::PluralWidget(QWidget* parent)
: QWidget(parent)
, ui(new Ui::PluralWidget)
{
@ -17,7 +17,7 @@ PluralWidget::~PluralWidget()
delete ui;
}
void PluralWidget::setModel(PluralModel *model)
void PluralWidget::setModel(PluralModel* model)
{
ui->pluralTableView->setModel(model);
}

View file

@ -13,11 +13,11 @@ class PluralWidget : public QWidget
Q_OBJECT
private:
Ui::PluralWidget *ui;
Ui::PluralWidget* ui;
public:
PluralWidget(QWidget *parent = nullptr);
PluralWidget(QWidget* parent = nullptr);
~PluralWidget();
void setModel(PluralModel *model);
void setModel(PluralModel* model);
};

View file

@ -1,6 +1,6 @@
#include "OTModel.h"
OTModel::OTModel(QObject *parent)
OTModel::OTModel(QObject* parent)
: V2SvkModel(parent)
{
m_tests = {
@ -19,9 +19,9 @@ unsigned int OTModel::getV2Points() const
for (auto testIndex : {0})
{
const auto &test = m_tests.at(testIndex);
const auto& test = m_tests.at(testIndex);
for (const auto &item : test.items())
for (const auto& item : test.items())
{
if (item.isChecked())
{
@ -39,9 +39,9 @@ unsigned int OTModel::getSvkPoints() const
for (auto testIndex : {1})
{
const auto &test = m_tests.at(testIndex);
const auto& test = m_tests.at(testIndex);
for (const auto &item : test.items())
for (const auto& item : test.items())
{
if (item.isChecked())
{
@ -53,12 +53,12 @@ unsigned int OTModel::getSvkPoints() const
return points;
}
void OTModel::write(ESGRAF48::V2SvkModel &model) const
void OTModel::write(ESGRAF48::V2SvkModel& model) const
{
auto writeFourVals = [&](ESGRAF48::V2SvkModel::FourEach *modelData, int testIndex) {
auto writeFourVals = [&](ESGRAF48::V2SvkModel::FourEach* modelData, int testIndex) {
if (modelData != nullptr)
{
const auto &testItems = m_tests.at(testIndex).items();
const auto& testItems = m_tests.at(testIndex).items();
modelData->set_affe1(testItems[0].isChecked());
modelData->set_affe2(testItems[1].isChecked());
@ -79,10 +79,10 @@ void OTModel::write(ESGRAF48::V2SvkModel &model) const
writeFourVals(model.mutable_svkstamm(), 1);
}
void OTModel::read(const ESGRAF48::V2SvkModel &model)
void OTModel::read(const ESGRAF48::V2SvkModel& model)
{
auto readFourVals = [&](const ESGRAF48::V2SvkModel::FourEach &modelData, int testIndex) {
auto &testItems = m_tests.at(testIndex).items();
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());

View file

@ -8,16 +8,16 @@ class OTModel : public V2SvkModel
Q_OBJECT
public:
OTModel(QObject *parent);
OTModel(QObject* parent);
unsigned int getV2Points() const override;
unsigned int getSvkPoints() const override;
void write(ESGRAF48::V2SvkModel &model) const override;
void read(const ESGRAF48::V2SvkModel &model) override;
void write(ESGRAF48::V2SvkModel& model) const override;
void read(const ESGRAF48::V2SvkModel& model) override;
protected:
void printHeader(QPainter &) const override {};
void printHeader(QPainter&) const override{};
std::set<int> v2Tests() const override;
std::set<int> svkTests() const override;

View file

@ -1,6 +1,6 @@
#include "TPeModel.h"
TPeModel::TPeModel(QObject *parent)
TPeModel::TPeModel(QObject* parent)
: V2SvkModel(parent)
{
m_tests = {
@ -17,9 +17,9 @@ unsigned int TPeModel::getV2Points() const
for (auto testIndex : {0, 1})
{
const auto &test = m_tests.at(testIndex);
const auto& test = m_tests.at(testIndex);
for (const auto &item : test.items())
for (const auto& item : test.items())
{
if (item.isChecked())
{
@ -37,9 +37,9 @@ unsigned int TPeModel::getSvkPoints() const
for (auto testIndex : {2, 3})
{
const auto &test = m_tests.at(testIndex);
const auto& test = m_tests.at(testIndex);
for (const auto &item : test.items())
for (const auto& item : test.items())
{
if (item.isChecked())
{
@ -51,12 +51,12 @@ unsigned int TPeModel::getSvkPoints() const
return points;
}
void TPeModel::write(ESGRAF48::V2SvkModel &model) const
void TPeModel::write(ESGRAF48::V2SvkModel& model) const
{
auto writeTwoVals = [&](ESGRAF48::V2SvkModel::TwoEach *modelData, int testIndex) {
auto writeTwoVals = [&](ESGRAF48::V2SvkModel::TwoEach* modelData, int testIndex) {
if (modelData != nullptr)
{
const auto &testItems = m_tests.at(testIndex).items();
const auto& testItems = m_tests.at(testIndex).items();
modelData->set_affe1(testItems[0].isChecked());
modelData->set_affe2(testItems[1].isChecked());
@ -73,10 +73,10 @@ void TPeModel::write(ESGRAF48::V2SvkModel &model) const
writeTwoVals(model.mutable_partizip(), 3);
}
void TPeModel::read(const ESGRAF48::V2SvkModel &model)
void TPeModel::read(const ESGRAF48::V2SvkModel& model)
{
auto readTwoVals = [&](const ESGRAF48::V2SvkModel::TwoEach &modelData, int testIndex) {
auto &testItems = m_tests.at(testIndex).items();
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());

View file

@ -8,16 +8,16 @@ class TPeModel : public V2SvkModel
Q_OBJECT
public:
TPeModel(QObject *parent);
TPeModel(QObject* parent);
unsigned int getV2Points() const override;
unsigned int getSvkPoints() const override;
void write(ESGRAF48::V2SvkModel &model) const override;
void read(const ESGRAF48::V2SvkModel &model) override;
void write(ESGRAF48::V2SvkModel& model) const override;
void read(const ESGRAF48::V2SvkModel& model) override;
protected:
void printHeader(QPainter &) const override {};
void printHeader(QPainter&) const override{};
std::set<int> v2Tests() const override;
std::set<int> svkTests() const override;

View file

@ -1,6 +1,6 @@
#include "TPrModel.h"
TPrModel::TPrModel(QObject *parent)
TPrModel::TPrModel(QObject* parent)
: V2SvkModel(parent)
{
m_tests = {
@ -15,9 +15,9 @@ unsigned int TPrModel::getV2Points() const
for (auto testIndex : {0})
{
const auto &test = m_tests.at(testIndex);
const auto& test = m_tests.at(testIndex);
for (const auto &item : test.items())
for (const auto& item : test.items())
{
if (item.isChecked())
{
@ -35,9 +35,9 @@ unsigned int TPrModel::getSvkPoints() const
for (auto testIndex : {1})
{
const auto &test = m_tests.at(testIndex);
const auto& test = m_tests.at(testIndex);
for (const auto &item : test.items())
for (const auto& item : test.items())
{
if (item.isChecked())
{
@ -49,12 +49,12 @@ unsigned int TPrModel::getSvkPoints() const
return points;
}
void TPrModel::write(ESGRAF48::V2SvkModel &model) const
void TPrModel::write(ESGRAF48::V2SvkModel& model) const
{
auto writeTwoVals = [&](ESGRAF48::V2SvkModel::TwoEach *modelData, int testIndex) {
auto writeTwoVals = [&](ESGRAF48::V2SvkModel::TwoEach* modelData, int testIndex) {
if (modelData != nullptr)
{
const auto &testItems = m_tests.at(testIndex).items();
const auto& testItems = m_tests.at(testIndex).items();
modelData->set_affe1(testItems[0].isChecked());
modelData->set_affe2(testItems[1].isChecked());
@ -69,10 +69,10 @@ void TPrModel::write(ESGRAF48::V2SvkModel &model) const
writeTwoVals(model.mutable_svke1(), 1);
}
void TPrModel::read(const ESGRAF48::V2SvkModel &model)
void TPrModel::read(const ESGRAF48::V2SvkModel& model)
{
auto readTwoVals = [&](const ESGRAF48::V2SvkModel::TwoEach &modelData, int testIndex) {
auto &testItems = m_tests.at(testIndex).items();
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());

View file

@ -8,16 +8,16 @@ class TPrModel : public V2SvkModel
Q_OBJECT
public:
TPrModel(QObject *parent);
TPrModel(QObject* parent);
unsigned int getV2Points() const override;
unsigned int getSvkPoints() const override;
void write(ESGRAF48::V2SvkModel &model) const override;
void read(const ESGRAF48::V2SvkModel &model) override;
void write(ESGRAF48::V2SvkModel& model) const override;
void read(const ESGRAF48::V2SvkModel& model) override;
protected:
void printHeader(QPainter &) const override{};
void printHeader(QPainter&) const override{};
std::set<int> v2Tests() const override;
std::set<int> svkTests() const override;

View file

@ -2,12 +2,12 @@
#include <regex>
V2SvkModel::V2SvkModel(QObject *parent)
V2SvkModel::V2SvkModel(QObject* parent)
: PrintableModel(parent)
{
}
void V2SvkModel::printTests(QPainter &painter) const
void V2SvkModel::printTests(QPainter& painter) const
{
painter.setFont(tableFont());
painter.setPen(tablePen());
@ -21,7 +21,7 @@ void V2SvkModel::printTests(QPainter &painter) const
double x = 0;
double y = 0;
auto testIndex = 0;
for (const auto &test : m_tests)
for (const auto& test : m_tests)
{
double rowHeaderWidth = headerWidthFactor() * width;
double resultCellWidth = (test.size() > 8 ? 0.5 : 1) * cellWidthFactor() * width;
@ -40,9 +40,9 @@ void V2SvkModel::printTests(QPainter &painter) const
x += rowHeaderWidth;
std::vector<std::pair<std::string, unsigned int>> columnHeaders;
for (const auto &item : test.items())
for (const auto& item : test.items())
{
const auto &itemText = item.getText();
const auto& itemText = item.getText();
if (!columnHeaders.empty() && columnHeaders.back().first == itemText)
{
columnHeaders.back().second++;
@ -53,7 +53,7 @@ void V2SvkModel::printTests(QPainter &painter) const
}
}
for (const auto &columnHeader : columnHeaders)
for (const auto& columnHeader : columnHeaders)
{
double cellWidth = columnHeader.second * resultCellWidth;
drawTextSquare(painter, {x, y, cellWidth, rowHeight}, columnHeader.first.c_str());
@ -69,7 +69,7 @@ void V2SvkModel::printTests(QPainter &painter) const
}
unsigned int emptyItemsStack = 0;
for (const auto &item : test.items())
for (const auto& item : test.items())
{
if (item.getText().empty())
{
@ -79,7 +79,8 @@ void V2SvkModel::printTests(QPainter &painter) const
{
if (emptyItemsStack > 0)
{
drawGreySquare(painter, {x - emptyItemsStack * resultCellWidth, y,
drawGreySquare(painter,
{x - emptyItemsStack * resultCellWidth, y,
emptyItemsStack * resultCellWidth, rowHeight});
emptyItemsStack = 0;
}
@ -90,7 +91,8 @@ void V2SvkModel::printTests(QPainter &painter) const
}
if (emptyItemsStack > 0)
{
drawGreySquare(painter, {x - emptyItemsStack * resultCellWidth, y,
drawGreySquare(painter,
{x - emptyItemsStack * resultCellWidth, y,
emptyItemsStack * resultCellWidth, rowHeight});
emptyItemsStack = 0;
}
@ -117,7 +119,7 @@ void V2SvkModel::printTests(QPainter &painter) const
painter.translate(0, y);
}
void V2SvkModel::printSummary(QPainter &painter, unsigned int v2Points, unsigned int svkPoints)
void V2SvkModel::printSummary(QPainter& painter, unsigned int v2Points, unsigned int svkPoints)
{
painter.setFont(PrintableModel::tableFont());
painter.setPen(PrintableModel::tablePen());
@ -134,4 +136,3 @@ void V2SvkModel::printSummary(QPainter &painter, unsigned int v2Points, unsigned
painter.translate(0, 3 * height);
}

View file

@ -8,19 +8,19 @@ class V2SvkModel : public PrintableModel
Q_OBJECT
public:
V2SvkModel(QObject *parent);
V2SvkModel(QObject* parent);
virtual unsigned int getV2Points() const = 0;
virtual unsigned int getSvkPoints() const = 0;
virtual void write(ESGRAF48::V2SvkModel &model) const = 0;
virtual void read(const ESGRAF48::V2SvkModel &model) = 0;
virtual void write(ESGRAF48::V2SvkModel& model) const = 0;
virtual void read(const ESGRAF48::V2SvkModel& model) = 0;
static void printSummary(QPainter &painter, unsigned int v2Points, unsigned int svkPoints);
static void printSummary(QPainter& painter, unsigned int v2Points, unsigned int svkPoints);
protected:
void printTests(QPainter &painter) const override;
void printSummary(QPainter &painter) const override {};
void printTests(QPainter& painter) const override;
void printSummary(QPainter& painter) const override{};
virtual std::set<int> v2Tests() const = 0;
virtual std::set<int> svkTests() const = 0;

View file

@ -6,7 +6,7 @@
#include "TPrModel.h"
#include "TPeModel.h"
V2SvkWidget::V2SvkWidget(QWidget *parent)
V2SvkWidget::V2SvkWidget(QWidget* parent)
: QWidget(parent)
, ui(new Ui::V2SvkWidget)
{
@ -22,22 +22,22 @@ V2SvkWidget::~V2SvkWidget()
delete ui;
}
void V2SvkWidget::setWFModel(WFModel *model)
void V2SvkWidget::setWFModel(WFModel* model)
{
ui->wfTableView->setModel(model);
}
void V2SvkWidget::setOTModel(OTModel *model)
void V2SvkWidget::setOTModel(OTModel* model)
{
ui->otTableView->setModel(model);
}
void V2SvkWidget::setTPrModel(TPrModel *model)
void V2SvkWidget::setTPrModel(TPrModel* model)
{
ui->tprTableView->setModel(model);
}
void V2SvkWidget::setTPeModel(TPeModel *model)
void V2SvkWidget::setTPeModel(TPeModel* model)
{
ui->tpeTableView->setModel(model);
}

View file

@ -16,14 +16,14 @@ class V2SvkWidget : public QWidget
Q_OBJECT
private:
Ui::V2SvkWidget *ui;
Ui::V2SvkWidget* ui;
public:
V2SvkWidget(QWidget *parent = nullptr);
V2SvkWidget(QWidget* parent = nullptr);
~V2SvkWidget();
void setWFModel(WFModel *model);
void setOTModel(OTModel *model);
void setTPrModel(TPrModel *model);
void setTPeModel(TPeModel *model);
void setWFModel(WFModel* model);
void setOTModel(OTModel* model);
void setTPrModel(TPrModel* model);
void setTPeModel(TPeModel* model);
};

View file

@ -1,6 +1,6 @@
#include "WFModel.h"
WFModel::WFModel(QObject *parent)
WFModel::WFModel(QObject* parent)
: V2SvkModel(parent)
{
m_title = "Subtest 1: Verbzweitstellungsregel (V2) und Subjekt-Verb-Kontrollregel (SVK)";
@ -22,9 +22,9 @@ unsigned int WFModel::getV2Points() const
for (auto testIndex : {0, 1})
{
const auto &test = m_tests.at(testIndex);
const auto& test = m_tests.at(testIndex);
for (const auto &item : test.items())
for (const auto& item : test.items())
{
if (item.isChecked())
{
@ -42,9 +42,9 @@ unsigned int WFModel::getSvkPoints() const
for (auto testIndex : {2})
{
const auto &test = m_tests.at(testIndex);
const auto& test = m_tests.at(testIndex);
for (const auto &item : test.items())
for (const auto& item : test.items())
{
if (item.isChecked())
{
@ -56,7 +56,7 @@ unsigned int WFModel::getSvkPoints() const
return points;
}
bool WFModel::isValidIndex(const QModelIndex &index) const
bool WFModel::isValidIndex(const QModelIndex& index) const
{
if (index.row() == 1)
{
@ -66,12 +66,12 @@ bool WFModel::isValidIndex(const QModelIndex &index) const
return CheckableTestModel::isValidIndex(index);
}
void WFModel::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)
{
const auto &testItems = m_tests.at(testIndex).items();
const auto& testItems = m_tests.at(testIndex).items();
modelData->set_affe(testItems[1].isChecked());
modelData->set_schwein(testItems[7].isChecked());
@ -79,10 +79,10 @@ void WFModel::write(ESGRAF48::V2SvkModel &model) const
}
};
auto writeFourVals = [&](ESGRAF48::V2SvkModel::FourEach *modelData, int testIndex) {
auto writeFourVals = [&](ESGRAF48::V2SvkModel::FourEach* modelData, int testIndex) {
if (modelData != nullptr)
{
const auto &testItems = m_tests.at(testIndex).items();
const auto& testItems = m_tests.at(testIndex).items();
modelData->set_affe1(testItems[0].isChecked());
modelData->set_affe2(testItems[1].isChecked());
@ -103,18 +103,18 @@ void WFModel::write(ESGRAF48::V2SvkModel &model) const
writeOneVal(model.mutable_verbtrennung1(), 1);
}
void WFModel::read(const ESGRAF48::V2SvkModel &model)
void WFModel::read(const ESGRAF48::V2SvkModel& model)
{
auto readOneVal = [&](const ESGRAF48::V2SvkModel::OneEach &modelData, int testIndex) {
auto &testItems = m_tests.at(testIndex).items();
auto readOneVal = [&](const ESGRAF48::V2SvkModel::OneEach& modelData, int testIndex) {
auto& testItems = m_tests.at(testIndex).items();
testItems[1].setState(modelData.affe());
testItems[7].setState(modelData.schwein());
testItems[10].setState(modelData.gans());
};
auto readFourVals = [&](const ESGRAF48::V2SvkModel::FourEach &modelData, int testIndex) {
auto &testItems = m_tests.at(testIndex).items();
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());

View file

@ -8,17 +8,17 @@ class WFModel : public V2SvkModel
Q_OBJECT
public:
WFModel(QObject *parent);
WFModel(QObject* parent);
unsigned int getV2Points() const override;
unsigned int getSvkPoints() const override;
void write(ESGRAF48::V2SvkModel &model) const override;
void read(const ESGRAF48::V2SvkModel &model) override;
void write(ESGRAF48::V2SvkModel& model) const override;
void read(const ESGRAF48::V2SvkModel& model) override;
protected:
std::set<int> v2Tests() const override;
std::set<int> svkTests() const override;
bool isValidIndex(const QModelIndex &index) const override;
bool isValidIndex(const QModelIndex& index) const override;
};

View file

@ -1,6 +1,6 @@
#include "VerbEndModel.h"
VerbEndModel::VerbEndModel(QObject *parent)
VerbEndModel::VerbEndModel(QObject* parent)
: PrintableModel(parent)
{
m_title = "Subtest 2: Verbendstellungsregel (VE)";
@ -11,12 +11,12 @@ VerbEndModel::VerbEndModel(QObject *parent)
{"Zauberregel", {"Temporal", "Kausal", "Final", "Relativ", "Temporal", "Relativ"}}};
}
void VerbEndModel::write(ESGRAF48::VerbEndModel &model) const
void VerbEndModel::write(ESGRAF48::VerbEndModel& model) const
{
auto *telefonatModel = model.mutable_telefonat();
auto* telefonatModel = model.mutable_telefonat();
if (telefonatModel != nullptr)
{
const auto &testItems = m_tests.at(0).items();
const auto& testItems = m_tests.at(0).items();
telefonatModel->set_kausal1(testItems[0].isChecked());
telefonatModel->set_kausal2(testItems[1].isChecked());
@ -27,10 +27,10 @@ void VerbEndModel::write(ESGRAF48::VerbEndModel &model) const
telefonatModel->set_temporal2(testItems[6].isChecked());
}
auto *zaubertrickModel = model.mutable_zaubertrick();
auto* zaubertrickModel = model.mutable_zaubertrick();
if (zaubertrickModel != nullptr)
{
const auto &testItems = m_tests.at(1).items();
const auto& testItems = m_tests.at(1).items();
zaubertrickModel->set_relativ(testItems[0].isChecked());
zaubertrickModel->set_final1(testItems[1].isChecked());
@ -41,10 +41,10 @@ void VerbEndModel::write(ESGRAF48::VerbEndModel &model) const
zaubertrickModel->set_temporal2(testItems[6].isChecked());
}
auto *zauberregelModel = model.mutable_zauberregel();
auto* zauberregelModel = model.mutable_zauberregel();
if (zauberregelModel != nullptr)
{
const auto &testItems = m_tests.at(2).items();
const auto& testItems = m_tests.at(2).items();
zauberregelModel->set_temporal1(testItems[0].isChecked());
zauberregelModel->set_kausal(testItems[1].isChecked());
@ -55,11 +55,11 @@ void VerbEndModel::write(ESGRAF48::VerbEndModel &model) const
}
}
void VerbEndModel::read(const ESGRAF48::VerbEndModel &model)
void VerbEndModel::read(const ESGRAF48::VerbEndModel& model)
{
const auto &telefonatModel = model.telefonat();
const auto& telefonatModel = model.telefonat();
{
auto &testItems = m_tests.at(0).items();
auto& testItems = m_tests.at(0).items();
testItems[0].setState(telefonatModel.kausal1());
testItems[1].setState(telefonatModel.kausal2());
@ -70,9 +70,9 @@ void VerbEndModel::read(const ESGRAF48::VerbEndModel &model)
testItems[6].setState(telefonatModel.temporal2());
}
const auto &zaubertrickModel = model.zaubertrick();
const auto& zaubertrickModel = model.zaubertrick();
{
auto &testItems = m_tests.at(1).items();
auto& testItems = m_tests.at(1).items();
testItems[0].setState(zaubertrickModel.relativ());
testItems[1].setState(zaubertrickModel.final1());
@ -83,9 +83,9 @@ void VerbEndModel::read(const ESGRAF48::VerbEndModel &model)
testItems[6].setState(zaubertrickModel.temporal2());
}
const auto &zauberregelModel = model.zauberregel();
const auto& zauberregelModel = model.zauberregel();
{
auto &testItems = m_tests.at(2).items();
auto& testItems = m_tests.at(2).items();
testItems[0].setState(zauberregelModel.temporal1());
testItems[1].setState(zauberregelModel.kausal());
@ -107,7 +107,7 @@ unsigned int VerbEndModel::getKausalPoints() const
return points(0, 0) + points(0, 1) + points(0, 3) + points(1, 2) + points(1, 5) + points(2, 1);
}
void VerbEndModel::printSummary(QPainter &painter) const
void VerbEndModel::printSummary(QPainter& painter) const
{
painter.setFont(tableFont());

View file

@ -8,13 +8,13 @@ class VerbEndModel : public PrintableModel
Q_OBJECT
public:
VerbEndModel(QObject *parent);
VerbEndModel(QObject* parent);
void write(ESGRAF48::VerbEndModel &model) const;
void read(const ESGRAF48::VerbEndModel &model);
void write(ESGRAF48::VerbEndModel& model) const;
void read(const ESGRAF48::VerbEndModel& model);
unsigned int getKausalPoints() const;
protected:
void printSummary(QPainter &painter) const override;
void printSummary(QPainter& painter) const override;
};

View file

@ -3,7 +3,7 @@
#include "VerbEndModel.h"
VerbEndWidget::VerbEndWidget(QWidget *parent)
VerbEndWidget::VerbEndWidget(QWidget* parent)
: QWidget(parent)
, ui(new Ui::VerbEndWidget)
{
@ -17,7 +17,7 @@ VerbEndWidget::~VerbEndWidget()
delete ui;
}
void VerbEndWidget::setModel(VerbEndModel *model)
void VerbEndWidget::setModel(VerbEndModel* model)
{
ui->verbEndTableView->setModel(model);
}

View file

@ -13,11 +13,11 @@ class VerbEndWidget : public QWidget
Q_OBJECT
private:
Ui::VerbEndWidget *ui;
Ui::VerbEndWidget* ui;
public:
VerbEndWidget(QWidget *parent = nullptr);
VerbEndWidget(QWidget* parent = nullptr);
~VerbEndWidget();
void setModel(VerbEndModel *model);
void setModel(VerbEndModel* model);
};

View file

@ -19,7 +19,7 @@
#include <fstream>
MainWindow::MainWindow(QWidget *parent)
MainWindow::MainWindow(QWidget* parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
, m_dataModel(this)
@ -30,7 +30,7 @@ MainWindow::MainWindow(QWidget *parent)
newFile();
}
MainWindow::MainWindow(QWidget *parent, const QString &filename)
MainWindow::MainWindow(QWidget* parent, const QString& filename)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
, m_dataModel(this)
@ -99,14 +99,14 @@ void MainWindow::openFile()
{
openFile(filename);
}
catch (std::exception &e)
catch (std::exception& e)
{
QString errorMessage = QString("Error loading \"") + filename + "\": " + e.what();
QMessageBox::critical(this, "Error", errorMessage);
}
}
void MainWindow::openFile(const QString &filename)
void MainWindow::openFile(const QString& filename)
{
closeFile();
@ -203,18 +203,18 @@ void MainWindow::savePdf()
savePdf(saveFilenameDialog.selectedFiles().first());
}
void MainWindow::closeEvent(QCloseEvent *event)
void MainWindow::closeEvent(QCloseEvent* event)
{
closeFile();
}
void MainWindow::saveFile(const QString &filename)
void MainWindow::saveFile(const QString& filename)
{
try
{
m_dataModel.write(filename);
}
catch (std::exception &e)
catch (std::exception& e)
{
QString errorMessage = QString("Error saving \"") + filename + "\": " + e.what();
QMessageBox::critical(this, "Error", errorMessage);
@ -229,7 +229,7 @@ void MainWindow::saveFile(const QString &filename)
m_saveOnClose = false;
}
void MainWindow::savePdf(const QString &filename)
void MainWindow::savePdf(const QString& filename)
{
QPrinter printer;
printer.setOutputFormat(QPrinter::PdfFormat);

View file

@ -6,7 +6,6 @@
#include <QString>
#include <QFont>
class DataModel;
class QDataWidgetMapper;
@ -19,20 +18,20 @@ class MainWindow : public QMainWindow
Q_OBJECT
private:
Ui::MainWindow *ui;
Ui::MainWindow* ui;
DataModel m_dataModel;
QString m_filename;
bool m_saveOnClose = false;
public:
MainWindow(QWidget *parent);
MainWindow(QWidget *parent, const QString &filename);
MainWindow(QWidget* parent);
MainWindow(QWidget* parent, const QString& filename);
~MainWindow();
public slots:
void newFile();
void openFile();
void openFile(const QString &filename);
void openFile(const QString& filename);
void saveFile();
void saveFileAs();
void closeFile();
@ -42,10 +41,10 @@ public slots:
void aboutDialog();
protected:
void closeEvent(QCloseEvent *event) override;
void closeEvent(QCloseEvent* event) override;
private:
void setupUi();
void saveFile(const QString &filename);
void savePdf(const QString &filename);
void saveFile(const QString& filename);
void savePdf(const QString& filename);
};

View file

@ -4,4 +4,3 @@ TEST_CASE("Dummy")
{
REQUIRE(true == true);
}