99b8066f4
김태훈
V0.1.1
|
1
2
3
4
5
6
7
8
9
|
#include "autocookwindow.h"
#include "ui_autocookwindow.h"
AutoCookWindow::AutoCookWindow(QWidget *parent, Oven *oven, AbstractCook *cook) :
QMainWindow(parent),
ui(new Ui::AutoCookWindow),
oven(oven),
cook(cook),
started(false),
|
6f96c947a
김태훈
GUI 0.1.4
|
10
|
done(false),
|
99b8066f4
김태훈
V0.1.1
|
11
12
13
|
selectedStepIndex(0)
{
ui->setupUi(this);
|
99b8066f4
김태훈
V0.1.1
|
14
|
ui->clockContainer->setParent(ui->upperStack);
|
6f96c947a
김태훈
GUI 0.1.4
|
15
|
setAttribute(Qt::WA_DeleteOnClose);
|
99b8066f4
김태훈
V0.1.1
|
16
17
18
19
20
21
|
connect(oven, SIGNAL(changed(Oven*)), SLOT(onOvenUpdated()));
oven->setDefault(Oven::CombinationMode);
lastHumidity = oven->currentHumidity();
lastTemp = oven->currentTemp();
|
6f96c947a
김태훈
GUI 0.1.4
|
22
|
lastDoorView = Cook::Invalid;
|
99b8066f4
김태훈
V0.1.1
|
23
24
25
26
27
|
QTimer *cookStartTimer = new QTimer(this);
cookStartTimer->setSingleShot(true);
cookStartTimer->setInterval(3000);
connect(cookStartTimer, SIGNAL(timeout()), SLOT(start()));
|
99b8066f4
김태훈
V0.1.1
|
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
|
connect(ui->configButton_1, SIGNAL(pressed()), SIGNAL(stopCookStartTimer()));
connect(ui->configButton_2, SIGNAL(pressed()), SIGNAL(stopCookStartTimer()));
connect(ui->configButton_3, SIGNAL(pressed()), SIGNAL(stopCookStartTimer()));
connect(ui->configButton_4, SIGNAL(pressed()), SIGNAL(stopCookStartTimer()));
connect(ui->configButton_5, SIGNAL(pressed()), SIGNAL(stopCookStartTimer()));
connect(ui->configButton_1, SIGNAL(released()), SIGNAL(startCookStartTimer()));
connect(ui->configButton_2, SIGNAL(released()), SIGNAL(startCookStartTimer()));
connect(ui->configButton_3, SIGNAL(released()), SIGNAL(startCookStartTimer()));
connect(ui->configButton_4, SIGNAL(released()), SIGNAL(startCookStartTimer()));
connect(ui->configButton_5, SIGNAL(released()), SIGNAL(startCookStartTimer()));
connect(ui->configSlider_1, SIGNAL(sliderPressed()), SIGNAL(stopCookStartTimer()));
connect(ui->configSlider_2, SIGNAL(sliderPressed()), SIGNAL(stopCookStartTimer()));
connect(ui->configSlider_3, SIGNAL(sliderPressed()), SIGNAL(stopCookStartTimer()));
connect(ui->configSlider_4, SIGNAL(sliderPressed()), SIGNAL(stopCookStartTimer()));
connect(ui->configSlider_5, SIGNAL(sliderPressed()), SIGNAL(stopCookStartTimer()));
connect(ui->configSlider_1, SIGNAL(actionTriggered(int)), SIGNAL(startCookStartTimer()));
connect(ui->configSlider_2, SIGNAL(actionTriggered(int)), SIGNAL(startCookStartTimer()));
connect(ui->configSlider_3, SIGNAL(actionTriggered(int)), SIGNAL(startCookStartTimer()));
connect(ui->configSlider_4, SIGNAL(actionTriggered(int)), SIGNAL(startCookStartTimer()));
connect(ui->configSlider_5, SIGNAL(actionTriggered(int)), SIGNAL(startCookStartTimer()));
connect(this, SIGNAL(stopCookStartTimer()), cookStartTimer, SLOT(stop()));
connect(this, SIGNAL(startCookStartTimer()), cookStartTimer, SLOT(start()));
connect(ui->configSlider_1, SIGNAL(valueChanged(int)), SLOT(onConfigChanged()));
connect(ui->configSlider_2, SIGNAL(valueChanged(int)), SLOT(onConfigChanged()));
connect(ui->configSlider_3, SIGNAL(valueChanged(int)), SLOT(onConfigChanged()));
connect(ui->configSlider_4, SIGNAL(valueChanged(int)), SLOT(onConfigChanged()));
connect(ui->configSlider_5, SIGNAL(valueChanged(int)), SLOT(onConfigChanged()));
connect(ui->configSlider_1, SIGNAL(sliderMoved(int)), SLOT(updateView()));
connect(ui->configSlider_2, SIGNAL(sliderMoved(int)), SLOT(updateView()));
connect(ui->configSlider_3, SIGNAL(sliderMoved(int)), SLOT(updateView()));
connect(ui->configSlider_4, SIGNAL(sliderMoved(int)), SLOT(updateView()));
connect(ui->configSlider_5, SIGNAL(sliderMoved(int)), SLOT(updateView()));
connect(ui->configSlider_1, SIGNAL(valueChanged(int)), SLOT(updateView()));
connect(ui->configSlider_2, SIGNAL(valueChanged(int)), SLOT(updateView()));
connect(ui->configSlider_3, SIGNAL(valueChanged(int)), SLOT(updateView()));
connect(ui->configSlider_4, SIGNAL(valueChanged(int)), SLOT(updateView()));
connect(ui->configSlider_5, SIGNAL(valueChanged(int)), SLOT(updateView()));
checkCookTimer.setInterval(1000);
connect(&checkCookTimer, SIGNAL(timeout()), SLOT(checkCook()));
returnToCurrentStepTimer.setSingleShot(true);
returnToCurrentStepTimer.setInterval(3000);
connect(&returnToCurrentStepTimer, SIGNAL(timeout()), SLOT(returnToCurrentStep()));
showingCurrentHumidity = false;
showCurrentHumidityTimer.setSingleShot(true);
showCurrentHumidityTimer.setInterval(3000);
connect(&showCurrentHumidityTimer, SIGNAL(timeout()), SLOT(showCurrentHumidity()));
showingCurrentTemp = false;
showCurrentTempTimer.setSingleShot(true);
showCurrentTempTimer.setInterval(3000);
connect(&showCurrentTempTimer, SIGNAL(timeout()), SLOT(showCurrentTemp()));
setupUi();
|
d66d7f5b4
김태훈
GUI 버전 0.1.2
|
91
92
|
cookStartTimer->start();
|
99b8066f4
김태훈
V0.1.1
|
93
94
95
96
97
|
}
AutoCookWindow::~AutoCookWindow()
{
delete ui;
|
6f96c947a
김태훈
GUI 0.1.4
|
98
99
|
delete cook;
|
99b8066f4
김태훈
V0.1.1
|
100
101
102
103
|
}
void AutoCookWindow::setupUi()
{
|
05f2a7552
김태훈
image 관리 구조 변경
|
104
105
106
107
108
|
bulletPixmap.load(":/images/symbol/step_bullet.png");
selectedBulletPixmap.load(":/images/symbol/selected_step_bullet.png");
steamModeIcon.load(":/images/cook_mode/small_steam.png");
dryModeIcon.load(":/images/cook_mode/small_dryheat.png");
combiModeIcon.load(":/images/cook_mode/small_combi.png");
|
6f96c947a
김태훈
GUI 0.1.4
|
109
|
|
99b8066f4
김태훈
V0.1.1
|
110
111
112
113
114
115
116
117
118
119
120
|
QString cookTypeIcon = Cook::icon(cook->type());
ui->cookTypeIcon_1->setPixmap(cookTypeIcon);
ui->cookTypeIcon_2->setPixmap(cookTypeIcon);
QString name = cook->name();
ui->selectCookButton_1->setText(name);
ui->selectCookButton_2->setText(name);
for (int idx = 0; idx < 5; idx++)
{
QPushButton *icon;
|
99b8066f4
김태훈
V0.1.1
|
121
122
123
124
125
126
127
128
129
|
QLabel *minLabel;
QLabel *maxLabel;
QLabel *currentLabel;
QSlider *slider;
switch (idx)
{
case 0:
icon = ui->configButton_1;
|
99b8066f4
김태훈
V0.1.1
|
130
131
132
133
134
135
136
|
minLabel = ui->configMinLabel_1;
maxLabel = ui->configMaxLabel_1;
currentLabel = ui->configCurrentLabel_1;
slider = ui->configSlider_1;
break;
case 1:
icon = ui->configButton_2;
|
99b8066f4
김태훈
V0.1.1
|
137
138
139
140
141
142
143
|
minLabel = ui->configMinLabel_2;
maxLabel = ui->configMaxLabel_2;
currentLabel = ui->configCurrentLabel_2;
slider = ui->configSlider_2;
break;
case 2:
icon = ui->configButton_3;
|
99b8066f4
김태훈
V0.1.1
|
144
145
146
147
148
149
150
|
minLabel = ui->configMinLabel_3;
maxLabel = ui->configMaxLabel_3;
currentLabel = ui->configCurrentLabel_3;
slider = ui->configSlider_3;
break;
case 3:
icon = ui->configButton_4;
|
99b8066f4
김태훈
V0.1.1
|
151
152
153
154
155
156
157
|
minLabel = ui->configMinLabel_4;
maxLabel = ui->configMaxLabel_4;
currentLabel = ui->configCurrentLabel_4;
slider = ui->configSlider_4;
break;
case 4:
icon = ui->configButton_5;
|
99b8066f4
김태훈
V0.1.1
|
158
159
160
161
162
163
164
165
166
167
168
|
minLabel = ui->configMinLabel_5;
maxLabel = ui->configMaxLabel_5;
currentLabel = ui->configCurrentLabel_5;
slider = ui->configSlider_5;
break;
}
AbstractCookConfig *config = cook->configurations[idx];
if (config != NULL)
{
icon->show();
|
05f2a7552
김태훈
image 관리 구조 변경
|
169
|
icon->setStyleSheet("QPushButton { image: url("
|
99b8066f4
김태훈
V0.1.1
|
170
|
+ config->icon()
|
05f2a7552
김태훈
image 관리 구조 변경
|
171
|
+ ") } QPushButton::pressed { image: url("
|
99b8066f4
김태훈
V0.1.1
|
172
173
|
+ config->overlayIcon()
+ ") }");
|
99b8066f4
김태훈
V0.1.1
|
174
175
176
177
178
179
180
181
182
183
184
185
186
|
minLabel->show();
minLabel->setText(config->minLabel());
maxLabel->show();
maxLabel->setText(config->maxLabel());
currentLabel->show();
slider->show();
slider->blockSignals(true);
slider->setMinimum(1);
slider->setMaximum(config->count());
slider->setValue(config->current());
slider->blockSignals(false);
|
6f96c947a
김태훈
GUI 0.1.4
|
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
switch (config->type())
{
case Cook::Time:
slider->setProperty("sliderColor", QString("white"));
break;
case Cook::BurnDegree:
slider->setProperty("sliderColor", QString("yellow"));
break;
case Cook::Brightness:
slider->setProperty("sliderColor", QString("red"));
break;
default:
slider->setProperty("sliderColor", QString("blue"));
break;
}
slider->style()->unpolish(slider);
slider->style()->polish(slider);
slider->update();
|
99b8066f4
김태훈
V0.1.1
|
206
207
208
209
|
}
else
{
icon->hide();
|
99b8066f4
김태훈
V0.1.1
|
210
211
212
213
214
215
216
217
218
|
minLabel->hide();
maxLabel->hide();
currentLabel->hide();
slider->hide();
}
}
if (cook->interTempEnabled())
{
|
99b8066f4
김태훈
V0.1.1
|
219
220
|
ui->configButton_4->show();
ui->configButton_4->setStyleSheet(
|
05f2a7552
김태훈
image 관리 구조 변경
|
221
222
223
224
|
QString("QPushButton { image: url(")
+ ":/images/slider_icon/core_temp_enabled.png"
+ ") } QPushButton::pressed { image: url("
+ ":/images/slider_icon/core_temp_ov.png"
|
99b8066f4
김태훈
V0.1.1
|
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
+ ") }"
);
ui->configMinLabel_4->hide();
ui->configMaxLabel_4->hide();
ui->configCurrentLabel_4->hide();
ui->configSlider_4->hide();
interTempEnabled = true;
}
int offsetX = (900 - (cook->stepCount() * 19 * 2 - 19)) / 2;
int offsetY = 1150;
for (int idx = 0; idx < cook->stepCount(); idx++)
{
QLabel *bullet = new QLabel(ui->cookPage);
bullet->setPixmap(bulletPixmap);
bullet->setGeometry(offsetX + 19 * 2 * idx, offsetY, 19, 19);
bullets.append(bullet);
}
ui->cookStepAnimation->start(300);
ui->humidityGauge->setMinimum(0);
ui->humidityGauge->setMaximum(100);
ui->humidityGauge->setValue(0);
ui->heatGauge->setMinimum(30);
ui->heatGauge->setMaximum(300);
ui->heatGauge->setValue(30);
|
05f2a7552
김태훈
image 관리 구조 변경
|
254
255
256
257
258
259
260
261
262
|
ui->openDoorAnimation->load(":/images/animation/door_01.png");
ui->openDoorAnimation->load(":/images/animation/door_02.png");
ui->openDoorAnimation->load(":/images/animation/door_03.png");
ui->openDoorAnimation->load(":/images/animation/door_04.png");
ui->openDoorAnimation->load(":/images/animation/door_05.png");
ui->openDoorAnimation->load(":/images/animation/door_06.png");
ui->openDoorAnimation->load(":/images/animation/door_07.png");
ui->openDoorAnimation->load(":/images/animation/door_08.png");
ui->openDoorAnimation->load(":/images/animation/door_09.png");
|
6f96c947a
김태훈
GUI 0.1.4
|
263
264
265
|
ui->openDoorAnimation->start(300);
ui->openDoorAnimation->hide();
ui->openDoorArrow->hide();
|
05f2a7552
김태훈
image 관리 구조 변경
|
266
267
268
269
270
271
272
273
274
|
ui->closeDoorAnimation->load(":/images/animation/door_09.png");
ui->closeDoorAnimation->load(":/images/animation/door_08.png");
ui->closeDoorAnimation->load(":/images/animation/door_07.png");
ui->closeDoorAnimation->load(":/images/animation/door_06.png");
ui->closeDoorAnimation->load(":/images/animation/door_05.png");
ui->closeDoorAnimation->load(":/images/animation/door_04.png");
ui->closeDoorAnimation->load(":/images/animation/door_03.png");
ui->closeDoorAnimation->load(":/images/animation/door_02.png");
ui->closeDoorAnimation->load(":/images/animation/door_01.png");
|
6f96c947a
김태훈
GUI 0.1.4
|
275
276
277
|
ui->closeDoorAnimation->start(300);
ui->closeDoorAnimation->hide();
ui->closeDoorArrow->hide();
|
99b8066f4
김태훈
V0.1.1
|
278
279
280
281
282
|
updateView();
}
void AutoCookWindow::updateView()
{
|
6f96c947a
김태훈
GUI 0.1.4
|
283
|
// qDebug() << "updateView";
|
99b8066f4
김태훈
V0.1.1
|
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
|
if (started)
{
ui->stackedWidget->setCurrentIndex(1);
for (int idx = 0; idx < bullets.length(); idx++)
{
QLabel *bullet = bullets.at(idx);
if (idx == selectedStepIndex)
bullet->setPixmap(selectedBulletPixmap);
else
bullet->setPixmap(bulletPixmap);
}
viewStep(cook->step(selectedStepIndex));
int time = oven->time();
if (time >= 3600)
|
6f96c947a
김태훈
GUI 0.1.4
|
301
|
ui->timeLabel->setText(QString().sprintf("%d<span style=\"font-size:11pt;\">시간</span> %02d<span style=\"font-size:11pt;\">분</span>", time / 3600, (time % 3600) / 60));
|
99b8066f4
김태훈
V0.1.1
|
302
|
else if (time >= 60)
|
6f96c947a
김태훈
GUI 0.1.4
|
303
|
ui->timeLabel->setText(QString().sprintf("%d<span style=\"font-size:11pt;\">분</span> %02d<span style=\"font-size:11pt;\">초</span>", time / 60, time % 60));
|
99b8066f4
김태훈
V0.1.1
|
304
|
else
|
6f96c947a
김태훈
GUI 0.1.4
|
305
|
ui->timeLabel->setText(QString().sprintf("%d<span style=\"font-size:11pt;\">초</span>", time));
|
99b8066f4
김태훈
V0.1.1
|
306
307
|
int curInterTemp = oven->currentInterTemp();
|
6f96c947a
김태훈
GUI 0.1.4
|
308
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
340
341
342
|
if (interTempEnabled)
{
int interTemp = oven->interTemp();
ui->interTempLabel->setText(QString().sprintf("%d<span style=\"font-size:11pt;\">℃ / %d</span><span style=\"font-size:9pt;\">℃</span>", curInterTemp, interTemp));
}
else
ui->interTempLabel->setText(QString().sprintf("%d<span style=\"font-size:11pt;\">℃</span>", curInterTemp));
if (!done)
{
if (oven->door())
{
ui->closeDoorAnimation->show();
ui->closeDoorArrow->show();
ui->openDoorAnimation->hide();
ui->openDoorArrow->hide();
}
else
{
ui->closeDoorAnimation->hide();
ui->closeDoorArrow->hide();
Cook::Step step = cook->currentStep();
if (Cook::classify(step.type) == Cook::DoorClass)
{
ui->openDoorAnimation->show();
ui->openDoorArrow->show();
}
else
{
ui->openDoorAnimation->hide();
ui->openDoorArrow->hide();
}
}
}
|
99b8066f4
김태훈
V0.1.1
|
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
|
}
else
{
ui->stackedWidget->setCurrentIndex(0);
for (int idx = 0; idx < 5; idx++)
{
AbstractCookConfig *config = cook->configurations[idx];
if (config == NULL)
continue;
QLabel *l;
QSlider *s;
switch (idx)
{
case 0:
l = ui->configCurrentLabel_1;
s = ui->configSlider_1;
break;
case 1:
l = ui->configCurrentLabel_2;
s = ui->configSlider_2;
break;
case 2:
l = ui->configCurrentLabel_3;
s = ui->configSlider_3;
break;
case 3:
l = ui->configCurrentLabel_4;
s = ui->configSlider_4;
break;
case 4:
l = ui->configCurrentLabel_5;
s = ui->configSlider_5;
break;
}
|
6f96c947a
김태훈
GUI 0.1.4
|
379
380
|
int time = cook->time();
int interTemp = cook->interTemp();
|
99b8066f4
김태훈
V0.1.1
|
381
382
|
switch (config->type())
{
|
6f96c947a
김태훈
GUI 0.1.4
|
383
384
385
386
387
388
389
390
391
392
393
|
case Cook::Time:
if (time >= 3600)
l->setText(QString().sprintf("%d<span style=\"font-size:11pt;\">시간</span> %02d<span style=\"font-size:11pt;\">분</span>", time / 3600, (time % 3600) / 60));
else if (time >= 60)
l->setText(QString().sprintf("%d<span style=\"font-size:11pt;\">분</span> %02d<span style=\"font-size:11pt;\">초</span>", time / 60, time % 60));
else
l->setText(QString().sprintf("%d<span style=\"font-size:11pt;\">초</span>", time));
break;
case Cook::BurnDegree:
l->setText(QString().sprintf("%d<span style=\"font-size:11pt;\">℃</span>", interTemp));
break;
|
99b8066f4
김태훈
V0.1.1
|
394
|
default:
|
6f96c947a
김태훈
GUI 0.1.4
|
395
|
l->setText(QString().sprintf("%d<span style=\"font-size:11pt;\">/%d</span>", config->current(), config->count()));
|
99b8066f4
김태훈
V0.1.1
|
396
397
398
399
400
401
402
|
break;
}
}
if (interTempEnabled)
{
ui->configButton_4->setStyleSheet(
|
05f2a7552
김태훈
image 관리 구조 변경
|
403
404
405
406
|
QString("QPushButton { image: url(")
+ ":/images/slider_icon/core_temp_enabled.png"
+ ") } QPushButton::pressed { image: url("
+ ":/images/slider_icon/core_temp_ov.png"
|
99b8066f4
김태훈
V0.1.1
|
407
408
409
410
411
|
+ ") }");
}
else
{
ui->configButton_4->setStyleSheet(
|
05f2a7552
김태훈
image 관리 구조 변경
|
412
413
414
415
|
QString("QPushButton { image: url(")
+ ":/images/slider_icon/core_temp.png"
+ ") } QPushButton::pressed { image: url("
+ ":/images/slider_icon/core_temp_ov.png"
|
99b8066f4
김태훈
V0.1.1
|
416
417
418
419
420
421
422
|
+ ") }");
}
}
}
void AutoCookWindow::viewStep(Cook::Step step)
{
|
6f96c947a
김태훈
GUI 0.1.4
|
423
|
// qDebug() << "viewStep" << step.type;
|
99b8066f4
김태훈
V0.1.1
|
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
|
switch (Cook::classify(step.type))
{
case Cook::PreheatClass:
viewPreheatStep(step);
break;
case Cook::DoorClass:
viewDoorStep(step);
break;
case Cook::CookClass:
viewCookStep(step);
break;
default:
break;
}
}
void AutoCookWindow::viewPreheatStep(Cook::Step step)
{
ui->cookStepIcon->show();
|
05f2a7552
김태훈
image 관리 구조 변경
|
443
|
ui->cookStepIcon->setPixmap(QPixmap(":/images/cook_step_type/sys_icon_05.png"));
|
99b8066f4
김태훈
V0.1.1
|
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
|
ui->cookStepLabel->show();
ui->cookStepLabel->setText("예열");
ui->doorStepLabel->hide();
ui->cookStepAnimation->hide();
ui->humidityGauge->show();
ui->humidityGauge->setValue(step.humidity);
ui->humidityLabel->show();
if (showingCurrentHumidity)
ui->humidityLabel->setText(QString().sprintf("%d%%", oven->currentHumidity()));
else
ui->humidityLabel->setText(QString().sprintf("%d%%", step.humidity));
ui->heatGauge->show();
ui->heatGauge->setValue(step.temp);
ui->heatLabel->show();
if (showingCurrentTemp)
ui->heatLabel->setText(QString().sprintf("%d℃", oven->currentTemp()));
else
ui->heatLabel->setText(QString().sprintf("%d℃", step.temp));
ui->cookModeIcon->show();
switch (step.mode)
{
case Cook::SteamMode:
ui->cookModeIcon->setPixmap(steamModeIcon);
break;
case Cook::DryMode:
ui->cookModeIcon->setPixmap(dryModeIcon);
break;
case Cook::CombiMode:
ui->cookModeIcon->setPixmap(combiModeIcon);
break;
}
}
void AutoCookWindow::viewDoorStep(Cook::Step step)
{
|
6f96c947a
김태훈
GUI 0.1.4
|
482
|
// qDebug() << "viewDoorStep";
|
99b8066f4
김태훈
V0.1.1
|
483
484
485
486
|
ui->cookStepLabel->hide();
ui->cookStepIcon->hide();
ui->doorStepLabel->show();
ui->cookStepAnimation->show();
|
99b8066f4
김태훈
V0.1.1
|
487
488
489
490
491
492
|
ui->humidityGauge->hide();
ui->humidityLabel->hide();
ui->heatGauge->hide();
ui->heatLabel->hide();
ui->cookModeIcon->hide();
|
6f96c947a
김태훈
GUI 0.1.4
|
493
|
if (lastDoorView != step.type)
|
99b8066f4
김태훈
V0.1.1
|
494
|
{
|
6f96c947a
김태훈
GUI 0.1.4
|
495
496
497
498
499
500
501
502
|
lastDoorView = step.type;
qDebug() << "clearStepAnimation";
ui->cookStepAnimation->clear();
switch (step.type)
{
case Cook::PutThermometer:
ui->doorStepLabel->setText("중심 온도계 삽입");
|
05f2a7552
김태훈
image 관리 구조 변경
|
503
504
|
ui->cookStepAnimation->load(":/images/animation/thermometer_01.png");
ui->cookStepAnimation->load(":/images/animation/thermometer_02.png");
|
6f96c947a
김태훈
GUI 0.1.4
|
505
506
507
508
|
ui->cookStepAnimation->setGeometry((900-210)/2, 800, 210, 307);
break;
case Cook::Load:
ui->doorStepLabel->setText("식재료 적재");
|
05f2a7552
김태훈
image 관리 구조 변경
|
509
510
511
512
513
514
515
|
ui->cookStepAnimation->load(":/images/animation/load_01.png");
ui->cookStepAnimation->load(":/images/animation/load_02.png");
ui->cookStepAnimation->load(":/images/animation/load_03.png");
ui->cookStepAnimation->load(":/images/animation/load_04.png");
ui->cookStepAnimation->load(":/images/animation/load_03.png");
ui->cookStepAnimation->load(":/images/animation/load_02.png");
ui->cookStepAnimation->load(":/images/animation/load_01.png");
|
6f96c947a
김태훈
GUI 0.1.4
|
516
517
518
519
|
ui->cookStepAnimation->setGeometry((900-264)/2, 800, 264, 307);
break;
case Cook::Cut:
ui->doorStepLabel->setText("자르기");
|
05f2a7552
김태훈
image 관리 구조 변경
|
520
521
522
|
ui->cookStepAnimation->load(":/images/animation/cut_01.png");
ui->cookStepAnimation->load(":/images/animation/cut_02.png");
ui->cookStepAnimation->load(":/images/animation/cut_03.png");
|
6f96c947a
김태훈
GUI 0.1.4
|
523
524
525
526
|
ui->cookStepAnimation->setGeometry((900-264)/2, 800, 264, 307);
break;
case Cook::Pour:
ui->doorStepLabel->setText("물 붓기");
|
05f2a7552
김태훈
image 관리 구조 변경
|
527
528
529
530
|
ui->cookStepAnimation->load(":/images/animation/pour_01.png");
ui->cookStepAnimation->load(":/images/animation/pour_02.png");
ui->cookStepAnimation->load(":/images/animation/pour_03.png");
ui->cookStepAnimation->load(":/images/animation/pour_04.png");
|
6f96c947a
김태훈
GUI 0.1.4
|
531
532
533
534
535
|
ui->cookStepAnimation->setGeometry((900-264)/2, 800, 264, 307);
break;
default:
ui->doorStepLabel->hide();
}
|
99b8066f4
김태훈
V0.1.1
|
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
|
}
}
void AutoCookWindow::viewCookStep(Cook::Step step)
{
ui->cookStepLabel->show();
ui->cookStepIcon->show();
ui->doorStepLabel->hide();
ui->cookStepAnimation->hide();
ui->humidityGauge->show();
ui->humidityGauge->setValue(step.humidity);
ui->humidityLabel->show();
if (showingCurrentHumidity)
ui->humidityLabel->setText(QString().sprintf("%d%%", oven->currentHumidity()));
else
ui->humidityLabel->setText(QString().sprintf("%d%%", step.humidity));
ui->heatGauge->show();
ui->heatGauge->setValue(step.temp);
ui->heatLabel->show();
if (showingCurrentTemp)
ui->heatLabel->setText(QString().sprintf("%d℃", oven->currentTemp()));
else
ui->heatLabel->setText(QString().sprintf("%d℃", step.temp));
ui->cookModeIcon->show();
switch (step.mode)
{
case Cook::SteamMode:
ui->cookModeIcon->setPixmap(steamModeIcon);
break;
case Cook::DryMode:
ui->cookModeIcon->setPixmap(dryModeIcon);
break;
case Cook::CombiMode:
ui->cookModeIcon->setPixmap(combiModeIcon);
break;
}
ui->cookStepLabel->setText(Cook::name(step.type));
ui->cookStepIcon->setPixmap(QPixmap(Cook::icon(step.type)));
}
void AutoCookWindow::doPreheatStep(Cook::Step step)
{
// oven->setHumidity(step.humidity);
oven->setHumidity(0);
oven->setTemp(step.temp);
oven->startPreheating();
lastHumidity = oven->currentHumidity();
lastTemp = oven->currentTemp();
|
6f96c947a
김태훈
GUI 0.1.4
|
589
590
591
592
593
594
595
|
ui->preheatIcon->show();
ui->preheatLabel->show();
ui->preheatGauge->show();
ui->preheatGauge->setMaximum(step.temp);
ui->preheatGauge->setMinimum(lastTemp);
ui->preheatGauge->setValue(lastTemp);
|
99b8066f4
김태훈
V0.1.1
|
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
|
}
void AutoCookWindow::doDoorStep(Cook::Step /*step*/)
{
opened = false;
}
void AutoCookWindow::doCookStep(Cook::Step step)
{
// oven->setHumidity(step.humidity);
oven->setHumidity(0);
oven->setTemp(step.temp);
oven->startCooking();
lastHumidity = oven->currentHumidity();
lastTemp = oven->currentTemp();
}
static bool checkReached(int target, int last, int current)
{
|
d66d7f5b4
김태훈
GUI 버전 0.1.2
|
616
617
618
|
qDebug() << "checkReached" << target << last << current;
return ((target >= last) && (target <= current))
|| ((target <= last) && (target >= current));
|
99b8066f4
김태훈
V0.1.1
|
619
620
621
622
|
}
void AutoCookWindow::checkPreheatStep(Cook::Step step)
{
|
6f96c947a
김태훈
GUI 0.1.4
|
623
624
625
|
int curTemp = oven->currentTemp();
ui->preheatGauge->setValue(curTemp);
|
05f2a7552
김태훈
image 관리 구조 변경
|
626
627
|
if (checkReached(step.humidity, lastHumidity, oven->currentHumidity())
&& checkReached(step.temp, lastTemp, curTemp))
|
99b8066f4
김태훈
V0.1.1
|
628
|
{
|
d66d7f5b4
김태훈
GUI 버전 0.1.2
|
629
630
|
if (selectedStepIndex == cook->currentStepIndex())
selectedStepIndex = cook->currentStepIndex() + 1;
|
6f96c947a
김태훈
GUI 0.1.4
|
631
632
633
|
ui->preheatIcon->hide();
ui->preheatLabel->hide();
ui->preheatGauge->hide();
|
99b8066f4
김태훈
V0.1.1
|
634
635
636
637
638
639
640
|
cook->setCurrentStepIndex(cook->currentStepIndex() + 1);
doStep();
}
}
void AutoCookWindow::checkDoorStep(Cook::Step /*step*/)
{
|
6f96c947a
김태훈
GUI 0.1.4
|
641
|
// qDebug() << "checkDoorStep" << opened << oven->door();
|
d66d7f5b4
김태훈
GUI 버전 0.1.2
|
642
|
if (opened)
|
99b8066f4
김태훈
V0.1.1
|
643
|
{
|
d66d7f5b4
김태훈
GUI 버전 0.1.2
|
644
645
646
647
648
649
650
651
652
653
654
655
656
|
if (!oven->door())
{
if (selectedStepIndex == cook->currentStepIndex())
selectedStepIndex = cook->currentStepIndex() + 1;
cook->setCurrentStepIndex(cook->currentStepIndex() + 1);
doStep();
}
}
else
{
if (oven->door())
opened = true;
|
99b8066f4
김태훈
V0.1.1
|
657
|
}
|
99b8066f4
김태훈
V0.1.1
|
658
659
660
661
662
663
|
}
void AutoCookWindow::checkCookStep(Cook::Step step)
{
if (cook->currentStepIndex() + 1 < cook->stepCount())
{
|
05f2a7552
김태훈
image 관리 구조 변경
|
664
665
|
if (checkReached(step.humidity, lastHumidity, oven->currentHumidity())
&& checkReached(step.temp, lastTemp, oven->currentTemp()))
|
99b8066f4
김태훈
V0.1.1
|
666
|
{
|
d66d7f5b4
김태훈
GUI 버전 0.1.2
|
667
668
|
if (selectedStepIndex == cook->currentStepIndex())
selectedStepIndex = cook->currentStepIndex() + 1;
|
99b8066f4
김태훈
V0.1.1
|
669
670
671
672
673
|
cook->setCurrentStepIndex(cook->currentStepIndex() + 1);
doStep();
}
else if (interTempEnabled)
{
|
05f2a7552
김태훈
image 관리 구조 변경
|
674
|
if (cook->interTemp() <= oven->currentInterTemp())
|
99b8066f4
김태훈
V0.1.1
|
675
|
{
|
d66d7f5b4
김태훈
GUI 버전 0.1.2
|
676
677
|
if (selectedStepIndex == cook->currentStepIndex())
selectedStepIndex = cook->stepCount() - 1;
|
99b8066f4
김태훈
V0.1.1
|
678
679
680
681
682
|
cook->setCurrentStepIndex(cook->stepCount() - 1);
doStep();
}
}
}
|
6f96c947a
김태훈
GUI 0.1.4
|
683
684
685
686
687
688
689
690
|
else /*if current step == last step*/
{
if (done)
{
}
else
{
|
05f2a7552
김태훈
image 관리 구조 변경
|
691
|
if ((interTempEnabled && cook->interTemp() <= oven->currentInterTemp())
|
6f96c947a
김태훈
GUI 0.1.4
|
692
693
694
695
696
697
698
699
700
701
702
703
|
|| oven->time() == 0)
{
done = true;
ui->openDoorAnimation->show();
ui->openDoorArrow->show();
ui->closeDoorAnimation->hide();
ui->closeDoorArrow->hide();
oven->setTime(0);
}
}
}
|
99b8066f4
김태훈
V0.1.1
|
704
705
706
707
|
}
void AutoCookWindow::start()
{
|
d66d7f5b4
김태훈
GUI 버전 0.1.2
|
708
|
qDebug() << "start";
|
99b8066f4
김태훈
V0.1.1
|
709
710
|
started = true;
oven->setTime(cook->time());
|
99b8066f4
김태훈
V0.1.1
|
711
|
oven->setInterTemp(cook->interTemp());
|
6f96c947a
김태훈
GUI 0.1.4
|
712
|
oven->setInterTempEnabled(interTempEnabled);
|
99b8066f4
김태훈
V0.1.1
|
713
714
715
716
717
718
719
720
721
|
doStep();
checkCookTimer.start();
updateView();
}
void AutoCookWindow::stop()
{
|
d66d7f5b4
김태훈
GUI 버전 0.1.2
|
722
|
qDebug() << "stop";
|
99b8066f4
김태훈
V0.1.1
|
723
724
725
726
727
728
729
730
|
oven->stop();
checkCookTimer.stop();
updateView();
}
void AutoCookWindow::doStep()
{
|
d66d7f5b4
김태훈
GUI 버전 0.1.2
|
731
|
qDebug() << "doStep";
|
99b8066f4
김태훈
V0.1.1
|
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
|
Cook::Step step = cook->currentStep();
switch (Cook::classify(step.type))
{
case Cook::PreheatClass:
doPreheatStep(step);
break;
case Cook::DoorClass:
doDoorStep(step);
break;
case Cook::CookClass:
doCookStep(step);
break;
default:
break;
}
}
void AutoCookWindow::checkCook()
{
|
6f96c947a
김태훈
GUI 0.1.4
|
751
|
// qDebug() << "checkCook";
|
99b8066f4
김태훈
V0.1.1
|
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
|
Cook::Step step = cook->currentStep();
switch (Cook::classify(step.type))
{
case Cook::PreheatClass:
checkPreheatStep(step);
break;
case Cook::DoorClass:
checkDoorStep(step);
break;
case Cook::CookClass:
checkCookStep(step);
break;
default:
qDebug() << "Checking Invalid Cook";
}
updateView();
}
void AutoCookWindow::onOvenUpdated()
{
updateView();
qDebug() << "onOvenUpdated()";
}
void AutoCookWindow::on_showPrevStepButton_clicked()
{
if (selectedStepIndex > 0)
selectedStepIndex--;
updateView();
returnToCurrentStepTimer.start();
}
void AutoCookWindow::on_showNextStepButton_clicked()
{
if (selectedStepIndex + 1 < cook->stepCount())
selectedStepIndex++;
updateView();
returnToCurrentStepTimer.start();
}
void AutoCookWindow::returnToCurrentStep()
{
selectedStepIndex = cook->currentStepIndex();
updateView();
}
void AutoCookWindow::onConfigChanged()
{
for (int idx = 0; idx < 5; idx++)
{
AbstractCookConfig *config = cook->configurations[idx];
if (config == NULL)
continue;
QSlider *slider;
switch (idx)
{
case 0:
slider = ui->configSlider_1;
break;
case 1:
slider = ui->configSlider_2;
break;
case 2:
slider = ui->configSlider_3;
break;
case 3:
slider = ui->configSlider_4;
break;
case 4:
slider = ui->configSlider_5;
break;
}
config->setCurrent(slider->value());
}
}
void AutoCookWindow::on_backButton_clicked()
{
stop();
close();
}
void AutoCookWindow::on_configButton_4_clicked()
{
if (cook->interTempEnabled())
{
interTempEnabled = !interTempEnabled;
updateView();
}
}
void AutoCookWindow::on_humidityGaugeButton_pressed()
{
showCurrentHumidityTimer.start();
}
void AutoCookWindow::on_humidityGaugeButton_released()
{
showCurrentHumidityTimer.stop();
showingCurrentHumidity = false;
updateView();
}
void AutoCookWindow::on_heatGaugeButton_pressed()
{
showCurrentTempTimer.start();
}
void AutoCookWindow::on_heatGaugeButton_released()
{
showCurrentTempTimer.stop();
showingCurrentTemp = false;
updateView();
}
void AutoCookWindow::showCurrentHumidity()
{
showingCurrentHumidity = true;
updateView();
}
void AutoCookWindow::showCurrentTemp()
{
showingCurrentTemp = true;
updateView();
}
|