-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatus.cpp
More file actions
140 lines (123 loc) · 3.15 KB
/
status.cpp
File metadata and controls
140 lines (123 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#include "status.h"
Status::Status(QObject *parent)
: QObject(parent),
m_username(""),
m_title("Code Peasant"),
m_points(0),
m_algorithmMastery(0),
m_problemSolving(0),
m_concentration(0),
m_knowledge(0),
m_stamina(0),
m_arrayMastery(0),
m_vectorMastery(0),
m_classesMastery(0),
m_pointersMastery(0) {}
// Destructor
Status::~Status() {}
// Getters and Setters
QString Status::username() const { return m_username; }
void Status::setUsername(const QString &username) {
if (m_username != username) {
m_username = username;
emit usernameChanged();
}
}
QString Status::title() const { return m_title; }
void Status::setTitle(const QString &title) {
if (m_title != title) {
m_title = title;
emit titleChanged();
}
}
int Status::points() const { return m_points; }
void Status::setPoints(int points) {
if (m_points != points) {
m_points = points;
emit pointsChanged();
}
}
// General Stats Getters
int Status::algorithmMastery() const { return m_algorithmMastery; }
int Status::problemSolving() const { return m_problemSolving; }
int Status::concentration() const { return m_concentration; }
int Status::knowledge() const { return m_knowledge; }
int Status::stamina() const { return m_stamina; }
// Technical Stats Getters
int Status::arrayMastery() const { return m_arrayMastery; }
int Status::vectorMastery() const { return m_vectorMastery; }
int Status::classesMastery() const { return m_classesMastery; }
int Status::pointersMastery() const { return m_pointersMastery; }
// Increment Functions
void Status::incrementAlgorithmMastery() {
if (m_points > 0) {
m_algorithmMastery++;
m_points--;
emit statsChanged();
emit pointsChanged();
}
}
void Status::incrementProblemSolving() {
if (m_points > 0) {
m_problemSolving++;
m_points--;
emit statsChanged();
emit pointsChanged();
}
}
void Status::incrementConcentration() {
if (m_points > 0) {
m_concentration++;
m_points--;
emit statsChanged();
emit pointsChanged();
}
}
void Status::incrementKnowledge() {
if (m_points > 0) {
m_knowledge++;
m_points--;
emit statsChanged();
emit pointsChanged();
}
}
void Status::incrementStamina() {
if (m_points > 0) {
m_stamina++;
m_points--;
emit statsChanged();
emit pointsChanged();
}
}
void Status::incrementArrayMastery() {
if (m_points > 0) {
m_arrayMastery++;
m_points--;
emit statsChanged();
emit pointsChanged();
}
}
void Status::incrementVectorMastery() {
if (m_points > 0) {
m_vectorMastery++;
m_points--;
emit statsChanged();
emit pointsChanged();
}
}
void Status::incrementClassesMastery() {
if (m_points > 0) {
m_classesMastery++;
m_points--;
emit statsChanged();
emit pointsChanged();
}
}
void Status::incrementPointersMastery() {
if (m_points > 0) {
m_pointersMastery++;
m_points--;
emit statsChanged();
emit pointsChanged();
}
}