-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaTimedReminder.cpp
60 lines (48 loc) · 1.09 KB
/
maTimedReminder.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
#include "maTimedReminder.h"
CTimedReminder::CTimedReminder(QObject *parent) :
QTimer(parent),
m_nCyclesNum(0),
m_nSecondInterval(0),
m_strReminder(tr("-Nothing-"))
{
connect(this, SIGNAL(timeout()), SLOT(on_timeOut()));
}
int CTimedReminder::nInterval() const
{
return m_nSecondInterval;
}
void CTimedReminder::setInterval(int nInterval)
{
m_nSecondInterval = nInterval;
}
int CTimedReminder::nCyclesNum() const
{
return m_nCyclesNum;
}
void CTimedReminder::setNCyclesNum(int nCyclesNum)
{
m_nCyclesNum = nCyclesNum;
}
QString CTimedReminder::strReminder() const
{
return m_strReminder;
}
void CTimedReminder::setStrReminder(const QString &strReminder)
{
m_strReminder = strReminder;
}
void CTimedReminder::startReminder(int nInterval, int nCycle, const QString &strRminder)
{
m_nSecondInterval = nInterval;
m_nCyclesNum = nCycle;
m_strReminder = strRminder;
start(m_nSecondInterval * 1000);
}
void CTimedReminder::on_timeOut()
{
emit timeToRemid(m_strReminder);
m_nCyclesNum--;
if (m_nCyclesNum <= 0) {
stop();
}
}