Open-Typer
Open source typewriting tutor program
Loading...
Searching...
No Matches
Class.h
1/*
2 * Class.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 CLASS_H
22#define CLASS_H
23
24#include <QObject>
25#include <QMap>
26
32class Q_DECL_EXPORT Class : public QObject
33{
34 Q_OBJECT
35 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
36 Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged)
37 Q_PROPERTY(int targetHitsPerMinute READ targetHitsPerMinute WRITE setTargetHitsPerMinute NOTIFY targetHitsPerMinuteChanged)
38 Q_PROPERTY(QMap<int, int> gradeConfig READ gradeConfig NOTIFY gradeConfigChanged)
39
40 public:
41 Class(QObject *parent = nullptr);
42
43 const QString &name(void) const;
44 void setName(const QString &newName);
45
46 const QString &description(void) const;
47 void setDescription(const QString &newDescription);
48
49 int targetHitsPerMinute(void) const;
50 void setTargetHitsPerMinute(int newTargetHitsPerMinute);
51
52 const QMap<int, int> &gradeConfig(void) const;
53
54 Q_INVOKABLE int targetHitsForMonth(int month);
55 Q_INVOKABLE void setTargetHitsForMonth(int month, int targetHits);
56
57 private:
58 QString m_name;
59 QString m_description;
60 int m_targetHitsPerMinute = 0;
61 QMap<int, int> m_gradeConfig;
62
63 signals:
64 void modified();
65 void nameChanged();
66 void gradeConfigChanged();
67 void descriptionChanged();
68 void targetHitsPerMinuteChanged();
69};
70
71#endif // CLASS_H
The Class class encapsulates a class in grading configuration.
Definition Class.h:33