Commit 8e11aab8db75fe2cd9adb34f615e8c481eb884bc
1 parent
4d04981e3d
Exists in
master
and in
2 other branches
파일 위치 변경
Showing
3 changed files
with
68 additions
and
2 deletions
Show diff stats
app/gui/oven_control/dirtylevel.cpp
... | ... | @@ -0,0 +1,51 @@ |
1 | +#include "dirtylevel.h" | |
2 | + | |
3 | +#include <QDateTime> | |
4 | + | |
5 | +namespace { | |
6 | +QDateTime cookStartTime; | |
7 | +qint64 cookingTime; | |
8 | +int cookingCount; | |
9 | +} | |
10 | + | |
11 | + | |
12 | +void DirtyLevel::cookStart() | |
13 | +{ | |
14 | + cookStartTime = QDateTime.currentDateTime(); | |
15 | + cookingCount++; | |
16 | +} | |
17 | + | |
18 | +void DirtyLevel::cookEnd() | |
19 | +{ | |
20 | + cookingTime += cookStartTime.secsTo(QDateTime.currentDateTime()); | |
21 | +} | |
22 | + | |
23 | +int DirtyLevel::dirty() | |
24 | +{ | |
25 | + if (cookingCount < 1) | |
26 | + return 0; | |
27 | + if (cookingTime < 1 * 3600) | |
28 | + return 1; | |
29 | + if (cookingTime < 3 * 3600) | |
30 | + return 2; | |
31 | + if (cookingTime < 5 * 3600) | |
32 | + return 3; | |
33 | + if (cookingTime < 7 * 3600) | |
34 | + return 4; | |
35 | + return 5; | |
36 | +} | |
37 | + | |
38 | +int DirtyLevel::state() | |
39 | +{ | |
40 | + if (cookingCount < 1) | |
41 | + return 0; | |
42 | + if (cookingCount < 4) | |
43 | + return 1; | |
44 | + if (cookingCount < 7) | |
45 | + return 2; | |
46 | + if (cookingCount < 10) | |
47 | + return 3; | |
48 | + if (cookingCount < 13) | |
49 | + return 4; | |
50 | + return 5; | |
51 | +} | ... | ... |
app/gui/oven_control/dirtylevel.h
app/gui/oven_control/oven_control.pro
... | ... | @@ -100,7 +100,8 @@ SOURCES += main.cpp\ |
100 | 100 | electricmodelsettingwindow.cpp \ |
101 | 101 | system.cpp \ |
102 | 102 | servicepassinputdlg.cpp \ |
103 | - backlight.cpp | |
103 | + backlight.cpp \ | |
104 | + dirtylevel.cpp | |
104 | 105 | |
105 | 106 | HEADERS += mainwindow.h \ |
106 | 107 | cook.h \ |
... | ... | @@ -190,7 +191,8 @@ HEADERS += mainwindow.h \ |
190 | 191 | electricmodelsettingwindow.h \ |
191 | 192 | system.h \ |
192 | 193 | servicepassinputdlg.h \ |
193 | - backlight.h | |
194 | + backlight.h \ | |
195 | + dirtylevel.h | |
194 | 196 | |
195 | 197 | FORMS += mainwindow.ui \ |
196 | 198 | manualcookwindow.ui \ | ... | ... |