Open-Typer
Open source typewriting tutor program
Loading...
Searching...
No Matches
GradeCalculator.h
1/*
2 * GradeCalculator.h
3 * This file is part of Open-Typer
4 *
5 * Copyright (C) 2023 - adazem009
6 *
7 * Open-Typer is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * Open-Typer is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Open-Typer. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef GRADECALCULATOR_H
22#define GRADECALCULATOR_H
23
24#include <QObject>
25#include "ClassManager.h"
26#include "global/ISettings.h"
27#include "validator/IExerciseValidator.h"
28
30class GradeCalculator : public QObject
31{
32 Q_OBJECT
33 INJECT(ISettings, settings)
34 Q_PROPERTY(IExerciseValidator *validator READ validator WRITE setValidator NOTIFY validatorChanged)
35 Q_PROPERTY(int targetHitsPerMinute READ targetHitsPerMinute WRITE setTargetHitsPerMinute NOTIFY targetHitsPerMinuteChanged)
36 Q_PROPERTY(bool useNetHitsForGrading READ useNetHitsForGrading WRITE setUseNetHitsForGrading NOTIFY useNetHitsForGradingChanged)
37 Q_PROPERTY(ClassManager::GradingMethod gradingMethod READ gradingMethod WRITE setGradingMethod NOTIFY gradingMethodChanged)
38 Q_PROPERTY(QString grade READ grade NOTIFY gradeChanged)
39 public:
41 IExerciseValidator *validator() const;
42 void setValidator(IExerciseValidator *newValidator);
43 int targetHitsPerMinute(void) const;
44 void setTargetHitsPerMinute(int newTargetHitsPerMinute);
45 bool useNetHitsForGrading(void) const;
46 void setUseNetHitsForGrading(bool newUseNetHitsForGrading);
47 const ClassManager::GradingMethod &gradingMethod(void) const;
48 void setGradingMethod(const ClassManager::GradingMethod &newGradingMethod);
49 const QString &grade(void) const;
50
51 private:
52 IExerciseValidator *m_validator = nullptr;
53 void updateGrade(void);
54 int m_targetHitsPerMinute = 0;
55 bool m_useNetHitsForGrading = true;
56 ClassManager::GradingMethod m_gradingMethod = ClassManager::GradingMethod_Numbers;
57 QString m_grade;
58
59 signals:
60 void validatorChanged();
61 void targetHitsPerMinuteChanged();
62 void useNetHitsForGradingChanged();
63 void gradingMethodChanged();
64 void gradeChanged();
65};
66
67#endif // GRADECALCULATOR_H
The ClassManager class provides access to grading configuration of each class.
Definition ClassManager.h:36
The GradeCalculator class provides methods for grades.
Definition GradeCalculator.h:31
ClassManager::GradingMethod gradingMethod
Definition GradeCalculator.h:37
void updateGrade(void)
Definition GradeCalculator.cpp:115
bool useNetHitsForGrading
Definition GradeCalculator.h:36
int targetHitsPerMinute
Definition GradeCalculator.h:35
QString grade
Definition GradeCalculator.h:38
Definition IExerciseValidator.h:30
Definition ISettings.h:31