-
Notifications
You must be signed in to change notification settings - Fork 0
/
word.cpp
73 lines (63 loc) · 1.22 KB
/
word.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
72
73
#include "word.h"
Word::Word()
{
_group = DefaultGroup;
_status = NonTest;
}
Word::Word( QString _text, int _group, int _mastered)
{
this->_text = _text;
this->_group = _group;
this->_status = _mastered;
}
bool Word::isRemembered()
{
return (_status == Word::Remembered);
}
bool Word::isForgotten()
{
return (_status == Word::Forgotten);
}
void Word::setText(const QString& t)
{
if( _text != t) {
_text = t;
}
}
void Word::setStatus( int val)
{
if( this->_status != val) {
_status = val;
}
}
void Word::setGroup( int val)
{
if( this->_group != val) {
_group = val;
}
}
void Word::setAnswer( const QString& as)
{
if( this->answer() != as) {
_answer = as;
}
}
bool Word::hasAnswer()
{
return !_answer.isEmpty();
}
QString Word::statusName( int status)
{
if( status == Word::NonTest) {
return QObject::tr("No-Test");
}
else if( status == Word::Forgotten) {
return QObject::tr("Forgotten");
}
else if( status == Word::Remembered) {
return QObject::tr("Remembered");
}
else {
return QObject::tr("Unkown");
}
}