2f6b55128
김태훈
다중 요리 구현
|
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
|
#include "interruptibletime.h"
InterruptibleTime::InterruptibleTime(QObject *parent) : QObject(parent)
{
elapsed_ = -1;
}
int InterruptibleTime::elapsed()
{
if (isNull())
return -1;
if (time.isValid())
return elapsed_ + time.elapsed();
return elapsed_;
}
bool InterruptibleTime::isValid()
{
return elapsed_ != -1;
}
bool InterruptibleTime::isNull()
{
return elapsed_ == -1;
}
void InterruptibleTime::start()
{
elapsed_ = 0;
time.start();
}
void InterruptibleTime::pause()
{
if (isNull())
return;
elapsed_ += time.elapsed();
time = QTime();
}
void InterruptibleTime::resume()
{
if (isNull())
return;
time.start();
}
int InterruptibleTime::restart()
{
if (isNull())
return -1;
int t = elapsed();
elapsed_ = 0;
time.start();
return t;
}
|