8c2952457
김태훈
응용 프로그램 추가
|
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
|
#include "manualcookwindow.h"
#include "ui_manualcookwindow.h"
#include <QSignalMapper>
#include <QTimer>
#include <QtDebug>
ManualCookWindow::ManualCookWindow(QWidget *parent, Oven *oven, UdpHandler *udp) :
QMainWindow(parent),
ui(new Ui::ManualCookWindow), oven(oven), udp(udp)
{
ui->setupUi(this);
connect(oven, SIGNAL(changed(Oven*)), this, SLOT(onOvenUpdated(Oven*)));
connect(ui->steamButton, SIGNAL(clicked()), this, SIGNAL(modeButtonClicked()));
connect(ui->combiButton, SIGNAL(clicked()), this, SIGNAL(modeButtonClicked()));
connect(ui->dryheatButton, SIGNAL(clicked()), this, SIGNAL(modeButtonClicked()));
QSignalMapper *sm = new QSignalMapper(this);
sm->setMapping(ui->steamButton, (int) Oven::SteamMode);
sm->setMapping(ui->combiButton, (int) Oven::CombinationMode);
sm->setMapping(ui->dryheatButton, (int) Oven::HeatMode);
connect(ui->steamButton, SIGNAL(clicked()), sm, SLOT(map()));
connect(ui->combiButton, SIGNAL(clicked()), sm, SLOT(map()));
connect(ui->dryheatButton, SIGNAL(clicked()), sm, SLOT(map()));
connect(sm, SIGNAL(mapped(int)), this, SLOT(onModeButtonClicked(int)));
connect(ui->humiditySlider, SIGNAL(valueChanged(int)), oven, SLOT(setHumidity(int)));
connect(ui->tempSlider, SIGNAL(valueChanged(int)), oven, SLOT(setTemp(int)));
connect(ui->timeSlider, SIGNAL(valueChanged(int)), oven, SLOT(setTime(int)));
connect(ui->interTempSlider, SIGNAL(valueChanged(int)), oven, SLOT(setInterTemp(int)));
connect(ui->humiditySlider, SIGNAL(sliderMoved(int)), this, SLOT(updateLabels()));
connect(ui->tempSlider, SIGNAL(sliderMoved(int)), this, SLOT(updateLabels()));
connect(ui->timeSlider, SIGNAL(sliderMoved(int)), this, SLOT(updateLabels()));
connect(ui->interTempSlider, SIGNAL(sliderMoved(int)), this, SLOT(updateLabels()));
connect(ui->innerInterTempSlider, SIGNAL(sliderMoved(int)), this, SLOT(updateLabels()));
|
ae1095876
김태훈
중심 온도 설정 창에서 중심 온...
|
39
|
connect(ui->innerInterTempSlider, SIGNAL(valueChanged(int)), this, SLOT(updateLabels()));
|
8c2952457
김태훈
응용 프로그램 추가
|
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
QTimer *cookingTimerCheckTimer = new QTimer(this);
cookingTimerCheckTimer->setInterval(100);
connect(cookingTimerCheckTimer, SIGNAL(timeout()), this, SLOT(checkTime()));
connect(this, SIGNAL(modeButtonClicked()), cookingTimerCheckTimer, SLOT(stop()));
QTimer *cookingStartTimer = new QTimer(this);
cookingStartTimer->setSingleShot(true);
cookingStartTimer->setInterval(3000);
connect(ui->timeSlider, SIGNAL(valueChanged(int)), cookingStartTimer, SLOT(start()));
connect(ui->timeSlider, SIGNAL(valueChanged(int)), this, SLOT(updateLabels()));
connect(this, SIGNAL(modeButtonClicked()), cookingStartTimer, SLOT(stop()));
connect(cookingStartTimer, SIGNAL(timeout()), oven, SLOT(startCooking()));
connect(cookingStartTimer, SIGNAL(timeout()), cookingTimerCheckTimer, SLOT(start()));
QTimer *showCurHumTimer = new QTimer(this);
QTimer *showCurTempTimer = new QTimer(this);
showCurHumTimer->setInterval(2000);
showCurTempTimer->setInterval(2000);
connect(ui->humidityButton, SIGNAL(pressed()), showCurHumTimer, SLOT(start()));
connect(ui->humidityButton, SIGNAL(released()), showCurHumTimer, SLOT(stop()));
connect(showCurHumTimer, SIGNAL(timeout()), this, SLOT(showCurrentHumidity()));
connect(ui->humidityButton, SIGNAL(released()), this, SLOT(hideCurrentHumidity()));
connect(ui->tempButton, SIGNAL(pressed()), showCurTempTimer, SLOT(start()));
connect(ui->tempButton, SIGNAL(released()), showCurTempTimer, SLOT(stop()));
connect(showCurTempTimer, SIGNAL(timeout()), this, SLOT(showCurrentTemp()));
connect(ui->tempButton, SIGNAL(released()), this, SLOT(hideCurrentTemp()));
QSignalMapper *smStack = new QSignalMapper(this);
smStack->setMapping(ui->goFrontStackButton, 0);
smStack->setMapping(ui->goBackStackButton, 1);
connect(ui->goFrontStackButton, SIGNAL(clicked()), smStack, SLOT(map()));
connect(ui->goBackStackButton, SIGNAL(clicked()), smStack, SLOT(map()));
connect(smStack, SIGNAL(mapped(int)), ui->buttonStack, SLOT(setCurrentIndex(int)));
connect(ui->backButton, SIGNAL(clicked()), this, SLOT(hide()));
connect(ui->backButton, SIGNAL(clicked()), oven, SLOT(stop()));
connect(ui->backButton, SIGNAL(clicked()), cookingTimerCheckTimer, SLOT(stop()));
connect(ui->backButton, SIGNAL(clicked()), cookingStartTimer, SLOT(stop()));
connect(ui->backButton, SIGNAL(clicked()), showCurHumTimer, SLOT(stop()));
connect(ui->backButton, SIGNAL(clicked()), showCurTempTimer, SLOT(stop()));
connect(this, SIGNAL(cookStopRequested()), cookingStartTimer, SLOT(stop()));
ui->bodyStack->setCurrentIndex(0);
}
ManualCookWindow::~ManualCookWindow()
{
delete ui;
}
void ManualCookWindow::checkTime()
{
if (oven->cooking() && !ui->timeSlider->isSliderDown())
{
bool old = ui->timeSlider->blockSignals(true);
ui->timeSlider->setSliderPosition(oven->time());
ui->timeSlider->blockSignals(old);
updateLabels();
}
}
void ManualCookWindow::showCurrentHumidity()
{
showCurrentHumidity_ = true;
updateLabels();
}
void ManualCookWindow::hideCurrentHumidity()
{
showCurrentHumidity_ = false;
updateLabels();
}
void ManualCookWindow::showCurrentTemp()
{
showCurrentTemp_ = true;
updateLabels();
}
void ManualCookWindow::hideCurrentTemp()
{
showCurrentTemp_ = false;
updateLabels();
}
void ManualCookWindow::updateLabels()
{
QString buf;
int humidity;
if (showCurrentHumidity_)
humidity = oven->currentHumidity();
else if (ui->humiditySlider->isSliderDown())
humidity = ui->humiditySlider->sliderPosition();
else
humidity = oven->humidity();
ui->humidityLabel->setText(buf.sprintf("%d%%", humidity));
int temp;
if (showCurrentTemp_)
temp = oven->currentTemp();
else if (ui->tempSlider->isSliderDown())
temp = ui->tempSlider->sliderPosition();
else
temp = oven->temp();
ui->tempLabel->setText(buf.sprintf("%d℃", temp));
int time;
if (ui->timeSlider->isSliderDown())
time = ui->timeSlider->sliderPosition();
else
time = oven->time();
|
c598b01b2
김태훈
GUI 업데이트
|
159
160
161
162
163
164
|
if (time >= 3600)
ui->timeLabel->setText(buf.sprintf("%d시간 %02d분", time / 3600, (time % 3600) / 60));
else if (time >= 60)
ui->timeLabel->setText(buf.sprintf("%d분 %02d초", time / 60, time % 60));
else
ui->timeLabel->setText(buf.sprintf("%d초", time));
|
8c2952457
김태훈
응용 프로그램 추가
|
165
166
167
168
169
170
171
172
173
174
175
176
177
|
if (oven->interTempEnabled())
{
int interTemp;
if (ui->interTempSlider->isSliderDown())
interTemp = ui->interTempSlider->sliderPosition();
else
interTemp = oven->interTemp();
ui->interTempLabel->setText(buf.sprintf("%d℃", interTemp));
}
else
ui->interTempLabel->setText("℃");
|
ae1095876
김태훈
중심 온도 설정 창에서 중심 온...
|
178
179
180
181
182
|
int innerInterTemp = ui->innerInterTempSlider->sliderPosition();
// if (ui->innerInterTempSlider->isSliderDown())
// innerInterTemp = ui->innerInterTempSlider->sliderPosition();
// else
// innerInterTemp = oven->interTemp();
|
8c2952457
김태훈
응용 프로그램 추가
|
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
ui->innerInterTempLabel->setText(buf.sprintf("%d℃", innerInterTemp));
ui->curHumidityLabel->setText(buf.sprintf("%d", oven->currentHumidity()));
ui->targetHumidityLabel->setText(buf.sprintf("%d", oven->humidity()));
ui->curTempLabel->setText(buf.sprintf("%d", oven->currentTemp()));
ui->curInterTempLabel->setText(buf.sprintf("%d", oven->currentInterTemp()));
}
void ManualCookWindow::onModeButtonClicked(int mode)
{
oven->stop();
oven->setDefault((Oven::Mode) mode);
ui->bodyStack->setCurrentIndex(0);
}
void ManualCookWindow::onOvenUpdated(Oven *oven)
{
ui->steamIndicator->hide();
ui->combiIndicator->hide();
ui->dryheatIndicator->hide();
ui->steamLabel->setEnabled(false);
ui->combiLabel->setEnabled(false);
ui->dryheatLabel->setEnabled(false);
switch (oven->mode())
{
case Oven::HeatMode:
ui->dryheatButton->setChecked(true);
ui->dryheatIndicator->show();
ui->dryheatLabel->setEnabled(true);
break;
case Oven::SteamMode:
ui->steamButton->setChecked(true);
ui->steamIndicator->show();
ui->steamLabel->setEnabled(true);
break;
case Oven::CombinationMode:
ui->combiButton->setChecked(true);
ui->combiIndicator->show();
ui->combiLabel->setEnabled(true);
break;
default:
break;
}
bool old;
old = ui->humiditySlider->blockSignals(true);
ui->humiditySlider->setValue(oven->humidity());
|
99b8066f4
김태훈
V0.1.1
|
232
|
ui->humiditySlider->setEnabled(oven->mode() == Oven::CombinationMode);
|
8c2952457
김태훈
응용 프로그램 추가
|
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
ui->humiditySlider->blockSignals(old);
old = ui->tempSlider->blockSignals(true);
ui->tempSlider->setRange(oven->minTemp(), oven->maxTemp());
ui->tempSlider->setValue(oven->temp());
ui->tempSlider->blockSignals(old);
if (!ui->timeSlider->isSliderDown())
{
old = ui->timeSlider->blockSignals(true);
ui->timeSlider->setValue(oven->time());
ui->timeSlider->blockSignals(old);
}
// ui->interTempButton->setChecked(oven->interTempEnabled());
if (oven->interTempEnabled())
ui->interTempButton->setStyleSheet("\
QPushButton#interTempButton {\
border-image: url(:/images/images/manual/011_icon_04_ov_01.png);\
}\
QPushButton#interTempButton:pressed {\
border-image: url(:/images/images/manual/011_icon_04_ov.png);\
}");
else
ui->interTempButton->setStyleSheet("\
QPushButton#interTempButton {\
border-image: url(:/images/images/manual/011_icon_04.png);\
}\
QPushButton#interTempButton:pressed {\
border-image: url(:/images/images/manual/011_icon_04_ov.png);\
}");
old = ui->interTempSlider->blockSignals(true);
ui->interTempSlider->setEnabled(oven->interTempEnabled());
ui->interTempSlider->setRange(oven->minInterTemp(), oven->maxInterTemp());
ui->interTempSlider->setValue(oven->interTemp());
ui->interTempSlider->blockSignals(old);
old = ui->innerInterTempSlider->blockSignals(true);
ui->innerInterTempSlider->setRange(oven->minInterTemp(), oven->maxInterTemp());
ui->innerInterTempSlider->setValue(oven->interTemp());
ui->innerInterTempSlider->blockSignals(old);
|
c598b01b2
김태훈
GUI 업데이트
|
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
if (oven->cooking())
ui->runStopButton->setStyleSheet(
"border-image: url(:/images/images/manual/012_play_btn_ov_stop.png)");
else
ui->runStopButton->setStyleSheet(
"border-image: url(:/images/images/manual/012_play_btn.png)");
if (oven->preheating())
ui->preheatButton->setStyleSheet(
"border-image: url(:/images/images/manual/013_sys_icon_01_ov.png)");
else
ui->preheatButton->setStyleSheet(
"border-image: url(:/images/images/manual/013_sys_icon_01.png)");
if (oven->damper())
ui->damperButton->setStyleSheet(
"border-image: url(:/images/images/manual/013_sys_icon_02_ov.png)");
else
ui->damperButton->setStyleSheet(
"border-image: url(:/images/images/manual/013_sys_icon_02.png)");
if (oven->humidification())
ui->humidificationButton->setStyleSheet(
"border-image: url(:/images/images/manual/013_sys_icon_03_ov.png)");
else
ui->humidificationButton->setStyleSheet(
"border-image: url(:/images/images/manual/013_sys_icon_03.png)");
if (oven->cooldown())
ui->cooldownButton->setStyleSheet(
"border-image: url(:/images/images/manual/013_sys_icon_05_ov.png)");
else
ui->cooldownButton->setStyleSheet(
"border-image: url(:/images/images/manual/013_sys_icon_05.png)");
|
8c2952457
김태훈
응용 프로그램 추가
|
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
|
switch (oven->fan())
{
case 1:
ui->fanButton->setStyleSheet(
"border-image: url(:/images/images/manual/013_sys_icon_06.png)");
break;
case 2:
ui->fanButton->setStyleSheet(
"border-image: url(:/images/images/manual/013_sys_icon_06_01.png)");
break;
case 3:
ui->fanButton->setStyleSheet(
"border-image: url(:/images/images/manual/013_sys_icon_06_02.png)");
break;
case 4:
ui->fanButton->setStyleSheet(
"border-image: url(:/images/images/manual/013_sys_icon_06_03.png)");
break;
case 5:
ui->fanButton->setStyleSheet(
"border-image: url(:/images/images/manual/013_sys_icon_06_04.png)");
break;
default:
ui->fanButton->setStyleSheet(
"border-image: url(:/images/images/manual/013_sys_icon_06.png)");
break;
}
updateLabels();
}
|
c598b01b2
김태훈
GUI 업데이트
|
340
|
void ManualCookWindow::on_runStopButton_clicked()
|
8c2952457
김태훈
응용 프로그램 추가
|
341
|
{
|
c598b01b2
김태훈
GUI 업데이트
|
342
|
if (oven->cooking())
|
8c2952457
김태훈
응용 프로그램 추가
|
343
344
345
346
|
{
oven->stopCooking();
emit cookStopRequested();
}
|
c598b01b2
김태훈
GUI 업데이트
|
347
348
|
else
oven->startCooking();
|
8c2952457
김태훈
응용 프로그램 추가
|
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
|
}
void ManualCookWindow::on_fanButton_clicked()
{
int fan = oven->fan() + 1;
if (fan > oven->maxFan())
fan = oven->minFan();
oven->setFan(fan);
}
void ManualCookWindow::on_goOuterButton_clicked()
{
ui->bodyStack->setCurrentIndex(0);
}
void ManualCookWindow::on_applyButton_clicked()
{
ui->bodyStack->setCurrentIndex(0);
oven->setInterTemp(ui->innerInterTempSlider->value());
|
8c2952457
김태훈
응용 프로그램 추가
|
370
|
oven->setInterTempEnabled(true);
|
8c2952457
김태훈
응용 프로그램 추가
|
371
372
373
374
375
376
377
378
379
380
381
382
|
}
void ManualCookWindow::on_interTempButton_clicked()
{
if (oven->interTempEnabled())
oven->setInterTempEnabled(false);
else
ui->bodyStack->setCurrentIndex(1);
}
void ManualCookWindow::on_preheatButton_clicked()
{
|
c598b01b2
김태훈
GUI 업데이트
|
383
384
|
if (oven->preheating())
oven->stopPreheating();
|
8c2952457
김태훈
응용 프로그램 추가
|
385
|
else
|
c598b01b2
김태훈
GUI 업데이트
|
386
|
oven->startPreheating();
|
8c2952457
김태훈
응용 프로그램 추가
|
387
388
389
390
|
}
void ManualCookWindow::on_damperButton_clicked()
{
|
c598b01b2
김태훈
GUI 업데이트
|
391
392
|
if (oven->damper())
oven->closeDamper();
|
8c2952457
김태훈
응용 프로그램 추가
|
393
|
else
|
c598b01b2
김태훈
GUI 업데이트
|
394
|
oven->openDamper();
|
8c2952457
김태훈
응용 프로그램 추가
|
395
396
397
398
|
}
void ManualCookWindow::on_humidificationButton_clicked()
{
|
c598b01b2
김태훈
GUI 업데이트
|
399
400
|
if (oven->humidification())
oven->stopHumidification();
|
8c2952457
김태훈
응용 프로그램 추가
|
401
|
else
|
c598b01b2
김태훈
GUI 업데이트
|
402
|
oven->startHumidification();
|
8c2952457
김태훈
응용 프로그램 추가
|
403
404
405
406
|
}
void ManualCookWindow::on_repeatButton_clicked()
{
|
8c2952457
김태훈
응용 프로그램 추가
|
407
|
|
8c2952457
김태훈
응용 프로그램 추가
|
408
409
410
411
|
}
void ManualCookWindow::on_cooldownButton_clicked()
{
|
c598b01b2
김태훈
GUI 업데이트
|
412
413
|
if (oven->cooldown())
oven->stopCooldown();
|
8c2952457
김태훈
응용 프로그램 추가
|
414
|
else
|
c598b01b2
김태훈
GUI 업데이트
|
415
|
oven->startCooldown();
|
8c2952457
김태훈
응용 프로그램 추가
|
416
417
418
419
|
}
void ManualCookWindow::on_reserveButton_clicked()
{
|
8c2952457
김태훈
응용 프로그램 추가
|
420
|
|
8c2952457
김태훈
응용 프로그램 추가
|
421
422
423
424
|
}
void ManualCookWindow::on_favoritesButton_clicked()
{
|
8c2952457
김태훈
응용 프로그램 추가
|
425
|
|
8c2952457
김태훈
응용 프로그램 추가
|
426
|
}
|