-
Notifications
You must be signed in to change notification settings - Fork 1
/
player.cpp
71 lines (55 loc) · 959 Bytes
/
player.cpp
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
#include "player.h"
Player::Player(QObject *parent) : QObject(parent)
{
}
Player::Player(const QString &name, const QColor &color, QObject *parent)
: QObject(parent)
, m_name(name)
, m_color(color)
, m_score(0)
{
}
QString Player::name() const
{
return m_name;
}
QColor Player::color() const
{
return m_color;
}
int Player::score() const
{
return m_score;
}
int Player::key() const
{
return m_key;
}
void Player::setName(QString name)
{
if (m_name == name)
return;
m_name = name;
emit nameChanged(m_name);
}
void Player::setColor(QColor color)
{
if (m_color == color)
return;
m_color = color;
emit colorChanged(m_color);
}
void Player::setScore(int score)
{
if (m_score == score)
return;
m_score = score;
emit scoreChanged(m_score);
}
void Player::setKey(int key)
{
if (m_key == key)
return;
m_key = key;
emit keyChanged(m_key);
}