operationtimemode.cpp
4.35 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#include <QKeyEvent>
#include "operationtimemode.h"
#include "ui_operationtimemode.h"
#include "ovenstatics.h"
#include "soundplayer.h"
#include "manualviewerdlg.h"
OperationTimeMode::OperationTimeMode(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::OperationTimeMode)
{
ui->setupUi(this);
ui->clockContainer->setParent(ui->upperStack);
setAttribute(Qt::WA_DeleteOnClose);
foreach (QPushButton *button, findChildren<QPushButton *>())
connect(button, &QPushButton::pressed, SoundPlayer::playClick);
reloadUi();
}
OperationTimeMode::~OperationTimeMode()
{
delete ui;
}
void OperationTimeMode::on_backButton_clicked()
{
close();
}
void OperationTimeMode::reloadUi(void){
uint32_t timetemp;
OvenStatistics* ovs = OvenStatistics::getInstance();
QString strTemp="";
uint32_t totaltime=0;
if(ovs!=NULL){
//건열 조리 모드
timetemp = ovs->srvdata->use_log.items.cook_dry_mode;
totaltime += timetemp;
strTemp.sprintf("%d h", timetemp/3600);
ui->m_ctrlLbListTime1->setText(strTemp);
qDebug() << "Dry Cook Time : " <<timetemp;
//스팀 조리 모드
timetemp = ovs->srvdata->use_log.items.cook_steam_mode;
totaltime += timetemp;
strTemp.sprintf("%d h", timetemp/3600);
ui->m_ctrlLbListTime2->setText(strTemp);
qDebug() << "Steam Cook Time : " <<timetemp;
//콤비 조리 모드
timetemp = ovs->srvdata->use_log.items.cook_combi_mode;
totaltime += timetemp;
strTemp.sprintf("%d h", timetemp/3600);
ui->m_ctrlLbListTime3->setText(strTemp);
qDebug() << "Combi Cook Time : " <<timetemp;
//세제없이 헹굼
timetemp = ovs->srvdata->use_log.items.wash_mode_nocleanser;
totaltime += timetemp;
strTemp.sprintf("%d h", timetemp/3600);
ui->m_ctrlLbListTime4->setText(strTemp);
qDebug() << "Wash Nocleanser Time : " <<timetemp;
//간이 세척
timetemp = ovs->srvdata->use_log.items.wash_mode_simple;
totaltime += timetemp;
strTemp.sprintf("%d h", timetemp/3600);
ui->m_ctrlLbListTime5->setText(strTemp);
qDebug() << "Wash Simple Time : " <<timetemp;
//표준 세척
timetemp = ovs->srvdata->use_log.items.wash_mode_standard;
totaltime += timetemp;
strTemp.sprintf("%d h", timetemp/3600);
ui->m_ctrlLbListTime6->setText(strTemp);
qDebug() << "Wash Standard Time : " <<timetemp;
//강세척
timetemp = ovs->srvdata->use_log.items.wash_mode_strong;
totaltime += timetemp;
strTemp.sprintf("%d h", timetemp/3600);
ui->m_ctrlLbListTime7->setText(strTemp);
qDebug() << "Wash Strong Time : " <<timetemp;
//고속 세척
timetemp = ovs->srvdata->use_log.items.wash_mode_speed;
totaltime += timetemp;
strTemp.sprintf("%d h", timetemp/3600);
ui->m_ctrlLbListTime8->setText(strTemp);
qDebug() << "Wash Speed Time : " <<timetemp;
//쿨다운
timetemp = ovs->srvdata->use_log.items.cooldown_mode;
totaltime += timetemp;
strTemp.sprintf("%d h", timetemp/3600);
ui->m_ctrlLbListTime9->setText(strTemp);
qDebug() << "Cool Down Time : " <<timetemp;
//전체 작동 시간
timetemp = totaltime;
strTemp.sprintf("%d h", timetemp/3600);
ui->m_ctrlLbListTime10->setText(strTemp);
qDebug() << "Total Time : " <<timetemp;
}
}
void OperationTimeMode::keyPressEvent(QKeyEvent *event)
{
switch (event->key())
{
case 0x01000032: // Turn left
focusPreviousChild();
break;
case 0x01000031: // Push
break;
case 0x01000030: // Turn right
focusNextChild();
break;
}
}
void OperationTimeMode::keyReleaseEvent(QKeyEvent *event)
{
switch (event->key())
{
case 0x01000032: // Turn left
focusPreviousChild();
break;
case 0x01000031: // Push
{
QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
if(btn != NULL){
btn->click();
}
break;
}
case 0x01000030: // Turn right
focusNextChild();
break;
}
}
void OperationTimeMode::on_helpButton_clicked()
{
ManualViewerDlg* dlg = new ManualViewerDlg(this);
dlg->showFullScreen();
dlg->raise();
}