Blame view

app/gui/oven_control/autocookwindow.cpp 22.1 KB
99b8066f4   김태훈   V0.1.1
1
2
  #include "autocookwindow.h"
  #include "ui_autocookwindow.h"
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
3
  #include "keepwarmpopup.h"
f588aa273   김태훈   부가 기능 로직 추가
4
5
6
  #include "cookhistory.h"
  #include "confirmpopup.h"
  #include "favoritenamepopup.h"
2bfd3a050   김태훈   환경 설정 대응
7
  #include "stringer.h"
bbd7d8f29   김태훈   버튼 음향 추가
8
  #include "soundplayer.h"
e00c6a2a9   김태훈   기능 추가 구현
9
10
11
  #include "configwindow.h"
  #include "washwindow.h"
  #include "mainwindow.h"
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
12
13
  
  AutoCookWindow::AutoCookWindow(QWidget *parent, Cook cook) :
99b8066f4   김태훈   V0.1.1
14
15
      QMainWindow(parent),
      ui(new Ui::AutoCookWindow),
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
16
      cook(cook)
99b8066f4   김태훈   V0.1.1
17
18
  {
      ui->setupUi(this);
99b8066f4   김태훈   V0.1.1
19
      ui->clockContainer->setParent(ui->upperStack);
6f96c947a   김태훈   GUI 0.1.4
20
      setAttribute(Qt::WA_DeleteOnClose);
99b8066f4   김태훈   V0.1.1
21
f588aa273   김태훈   부가 기능 로직 추가
22
23
24
25
      if (!this->cook.isLoaded())
          this->cook.load();
  
      autocook = AutoCook(this->cook);
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
26
27
28
      processSelected = false;
  
      setupUi();
99b8066f4   김태훈   V0.1.1
29
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
30
31
      Oven *oven = Oven::getInstance();
      connect(oven, SIGNAL(changed(Oven*)), SLOT(updateView()));
99b8066f4   김태훈   V0.1.1
32
33
34
35
  
      returnToCurrentStepTimer.setSingleShot(true);
      returnToCurrentStepTimer.setInterval(3000);
      connect(&returnToCurrentStepTimer, SIGNAL(timeout()), SLOT(returnToCurrentStep()));
99b8066f4   김태훈   V0.1.1
36
37
38
      showCurrentHumidityTimer.setSingleShot(true);
      showCurrentHumidityTimer.setInterval(3000);
      connect(&showCurrentHumidityTimer, SIGNAL(timeout()), SLOT(showCurrentHumidity()));
99b8066f4   김태훈   V0.1.1
39
40
41
      showCurrentTempTimer.setSingleShot(true);
      showCurrentTempTimer.setInterval(3000);
      connect(&showCurrentTempTimer, SIGNAL(timeout()), SLOT(showCurrentTemp()));
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
42
43
      connect(&checkCookTimer, SIGNAL(timeout()), SLOT(checkCook()));
      checkCookTimer.start(100);
d66d7f5b4   김태훈   GUI 버전 0.1.2
44
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
45
      connect(&checkProcessTimer, SIGNAL(timeout()), SLOT(checkProcess()));
f588aa273   김태훈   부가 기능 로직 추가
46
47
48
49
50
51
52
53
54
55
  
      AutoCookSetting setting;
      setting.type = cook.type;
      setting.root = cook.root;
      setting.name = cook.name;
  
      for (int i = 0; i < 5; i++)
          setting.configs[i] = cook.configs[i].current;
  
      CookHistory::record(setting);
2bfd3a050   김태훈   환경 설정 대응
56
bbd7d8f29   김태훈   버튼 음향 추가
57
58
      foreach (QPushButton *button, findChildren<QPushButton *>())
          connect(button, &QPushButton::pressed, SoundPlayer::playClick);
2bfd3a050   김태훈   환경 설정 대응
59
60
      connect(&updateViewTimer, SIGNAL(timeout()), SLOT(updateView()));
      updateViewTimer.start(100);
99b8066f4   김태훈   V0.1.1
61
62
63
64
65
66
67
68
69
  }
  
  AutoCookWindow::~AutoCookWindow()
  {
      delete ui;
  }
  
  void AutoCookWindow::setupUi()
  {
05f2a7552   김태훈   image 관리 구조 변경
70
71
72
      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
73
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
74
75
      ui->cookTypeIcon->setPixmap(Define::icon(cook.type));
      ui->selectCookButton->setText(cook.name);
99b8066f4   김태훈   V0.1.1
76
a366f320c   김태훈   자동 요리 후속 공정 동작 개선
77
      ui->stepIndicator->setMaximum(cook.steps.size() - 1);
99b8066f4   김태훈   V0.1.1
78
79
80
81
82
83
84
85
86
87
  
      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 관리 구조 변경
88
89
90
91
92
93
94
95
96
      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
97
98
99
      ui->openDoorAnimation->start(300);
      ui->openDoorAnimation->hide();
      ui->openDoorArrow->hide();
05f2a7552   김태훈   image 관리 구조 변경
100
101
102
103
104
105
106
107
108
      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
109
110
111
      ui->closeDoorAnimation->start(300);
      ui->closeDoorAnimation->hide();
      ui->closeDoorArrow->hide();
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
112
113
114
115
116
117
118
119
120
      lastViewCookMode = Define::InvalidMode;
      lastViewCookType = Define::Invalid;
      lastViewCoreTemp = 999;
      lastViewDoorType = Define::Invalid;
      lastViewTime = 0;
      lastViewStepIndex = -1;
      selectedStepIndex = 0;
      showingCurrentHumidity = false;
      showingCurrentTemp = false;
99b8066f4   김태훈   V0.1.1
121
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
122
      if (autocook.cook.processes.isEmpty())
99b8066f4   김태훈   V0.1.1
123
      {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
124
125
126
127
128
          ui->processTitleLabel->hide();
          ui->processTypeLabel->hide();
          ui->processButton_1->hide();
          ui->processButton_2->hide();
          ui->processButton_3->hide();
99b8066f4   김태훈   V0.1.1
129
130
131
      }
      else
      {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
132
133
134
          QString typeText;
          QSignalMapper *sm = NULL;
          for (int i = 0; i < 3; i++)
99b8066f4   김태훈   V0.1.1
135
          {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
136
137
              QPushButton *pb;
              switch (i)
99b8066f4   김태훈   V0.1.1
138
139
              {
              case 0:
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
140
                  pb = ui->processButton_1;
99b8066f4   김태훈   V0.1.1
141
142
                  break;
              case 1:
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
143
                  pb = ui->processButton_2;
99b8066f4   김태훈   V0.1.1
144
145
                  break;
              case 2:
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
146
                  pb = ui->processButton_3;
99b8066f4   김태훈   V0.1.1
147
148
                  break;
              }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
149
              if (i < autocook.cook.processes.size())
99b8066f4   김태훈   V0.1.1
150
              {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
151
152
153
154
155
156
157
158
159
160
161
                  if (sm == NULL)
                  {
                      sm = new QSignalMapper(this);
                      connect(sm, SIGNAL(mapped(int)), SLOT(startProcess(int)));
                  }
  
                  Define::Process process = autocook.cook.processes[i];
  
                  QString text = Define::name(process);
                  if (typeText.isEmpty())
                      typeText = text;
6f96c947a   김태훈   GUI 0.1.4
162
                  else
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
163
164
165
166
167
168
169
170
171
172
173
174
175
176
                      typeText += ", " + text;
  
                  QString styleSheet = QString("QPushButton { border-image: url(%1) } QPushButton:pressed { border-image: url(%2) }")
                          .arg(Define::icon(process))
                          .arg(Define::iconOverlay(process));
  
                  pb->setStyleSheet(styleSheet);
  
                  sm->setMapping(pb, (int) process);
                  connect(pb, SIGNAL(clicked()), sm, SLOT(map()));
              }
              else
              {
                  pb->hide();
99b8066f4   김태훈   V0.1.1
177
178
              }
          }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
179
          ui->processTypeLabel->setText(typeText);
99b8066f4   김태훈   V0.1.1
180
      }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
181
182
  
      ui->processContainer->hide();
f588aa273   김태훈   부가 기능 로직 추가
183
      ui->doorStepLabel->hide();
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
184
185
  
      updateView();
99b8066f4   김태훈   V0.1.1
186
  }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
187
  void AutoCookWindow::updateView()
99b8066f4   김태훈   V0.1.1
188
  {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
189
      Oven *oven = Oven::getInstance();
2bfd3a050   김태훈   환경 설정 대응
190
      if (!autocook.done())
99b8066f4   김태훈   V0.1.1
191
      {
2bfd3a050   김태훈   환경 설정 대응
192
193
          int remainingTime = qMax(0, autocook.msecs());
          ui->timeLabel->setText(Stringer::remainingTime(remainingTime));
99b8066f4   김태훈   V0.1.1
194
      }
99b8066f4   김태훈   V0.1.1
195
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
196
197
198
199
      int coreTemp = oven->currentInterTemp();
      if (coreTemp != lastViewCoreTemp)
      {
          lastViewCoreTemp = coreTemp;
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
200
          if (cook.isCoreTempValid())
2bfd3a050   김태훈   환경 설정 대응
201
              ui->interTempLabel->setText(Stringer::temperature(coreTemp, cook.coreTemp(), Stringer::fontSize14));
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
202
          else
2bfd3a050   김태훈   환경 설정 대응
203
              ui->interTempLabel->setText(Stringer::temperature(coreTemp, Stringer::fontSize14));
99b8066f4   김태훈   V0.1.1
204
      }
99b8066f4   김태훈   V0.1.1
205
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
206
      if (autocook.done())
99b8066f4   김태훈   V0.1.1
207
      {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
208
209
210
211
          if (!oven->door())
          {
              if (ui->openDoorAnimation->isHidden())
                  ui->openDoorAnimation->show();
6f96c947a   김태훈   GUI 0.1.4
212
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
213
214
215
216
217
218
219
220
221
222
              if (ui->openDoorArrow->isHidden())
                  ui->openDoorArrow->show();
  
              if (ui->closeDoorAnimation->isVisible())
                  ui->closeDoorAnimation->hide();
  
              if (ui->closeDoorArrow->isVisible())
                  ui->closeDoorArrow->hide();
          }
          else
6f96c947a   김태훈   GUI 0.1.4
223
          {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
224
225
226
227
228
229
230
231
232
233
234
              if (ui->openDoorAnimation->isVisible())
                  ui->openDoorAnimation->hide();
  
              if (ui->openDoorArrow->isVisible())
                  ui->openDoorArrow->hide();
  
              if (ui->closeDoorAnimation->isVisible())
                  ui->closeDoorAnimation->hide();
  
              if (ui->closeDoorArrow->isVisible())
                  ui->closeDoorArrow->hide();
6f96c947a   김태훈   GUI 0.1.4
235
          }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
236
237
238
  
          if (ui->processContainer->isHidden())
              ui->processContainer->show();
99b8066f4   김태훈   V0.1.1
239
      }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
240
241
242
243
      else if (autocook.isWaitingDoorOpened() && !oven->door())
      {
          if (ui->openDoorAnimation->isHidden())
              ui->openDoorAnimation->show();
99b8066f4   김태훈   V0.1.1
244
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
245
246
          if (ui->openDoorArrow->isHidden())
              ui->openDoorArrow->show();
99b8066f4   김태훈   V0.1.1
247
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
248
249
          if (ui->closeDoorAnimation->isVisible())
              ui->closeDoorAnimation->hide();
99b8066f4   김태훈   V0.1.1
250
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
251
252
          if (ui->closeDoorArrow->isVisible())
              ui->closeDoorArrow->hide();
99b8066f4   김태훈   V0.1.1
253
      }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
254
255
256
257
      else if (!autocook.isWaitingDoorOpened() && oven->door())
      {
          if (ui->openDoorAnimation->isVisible())
              ui->openDoorAnimation->hide();
99b8066f4   김태훈   V0.1.1
258
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
259
260
          if (ui->openDoorArrow->isVisible())
              ui->openDoorArrow->hide();
99b8066f4   김태훈   V0.1.1
261
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
262
263
          if (ui->closeDoorAnimation->isHidden())
              ui->closeDoorAnimation->show();
99b8066f4   김태훈   V0.1.1
264
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
265
266
267
268
269
270
271
          if (ui->closeDoorArrow->isHidden())
              ui->closeDoorArrow->show();
      }
      else
      {
          if (ui->openDoorAnimation->isVisible())
              ui->openDoorAnimation->hide();
99b8066f4   김태훈   V0.1.1
272
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
273
274
          if (ui->openDoorArrow->isVisible())
              ui->openDoorArrow->hide();
99b8066f4   김태훈   V0.1.1
275
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
276
277
          if (ui->closeDoorAnimation->isVisible())
              ui->closeDoorAnimation->hide();
99b8066f4   김태훈   V0.1.1
278
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
279
280
281
          if (ui->closeDoorArrow->isVisible())
              ui->closeDoorArrow->hide();
      }
99b8066f4   김태훈   V0.1.1
282
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
283
284
285
286
      if (autocook.cook.steps[autocook.currentStepIndex].type == Define::Preheat)
      {
          if (ui->preheatIcon->isHidden())
              ui->preheatIcon->show();
6f96c947a   김태훈   GUI 0.1.4
287
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
288
289
          if (ui->preheatLabel->isHidden())
              ui->preheatLabel->show();
6f96c947a   김태훈   GUI 0.1.4
290
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
291
292
293
294
295
296
297
298
          if (ui->preheatGauge->isHidden())
              ui->preheatGauge->show();
  
          ui->preheatGauge->setMaximum(autocook.cook.steps[autocook.currentStepIndex].temp);
          ui->preheatGauge->setMinimum(autocook.startTemp);
          ui->preheatGauge->setValue(oven->currentTemp());
      }
      else
99b8066f4   김태훈   V0.1.1
299
      {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
300
301
          if (ui->preheatIcon->isVisible())
              ui->preheatIcon->hide();
d66d7f5b4   김태훈   GUI 버전 0.1.2
302
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
303
304
          if (ui->preheatLabel->isVisible())
              ui->preheatLabel->hide();
6f96c947a   김태훈   GUI 0.1.4
305
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
306
307
          if (ui->preheatGauge->isVisible())
              ui->preheatGauge->hide();
99b8066f4   김태훈   V0.1.1
308
      }
99b8066f4   김태훈   V0.1.1
309
b13e23ee4   김태훈   자동 요리 수정
310
311
312
313
314
315
316
      if (selectedStepIndex != autocook.currentStepIndex)
      {
          if (!returnToCurrentStepTimer.isActive())
          {
              selectedStepIndex = autocook.currentStepIndex;
          }
      }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
317
      if (selectedStepIndex != lastViewStepIndex)
99b8066f4   김태훈   V0.1.1
318
      {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
319
          lastViewStepIndex = selectedStepIndex;
a366f320c   김태훈   자동 요리 후속 공정 동작 개선
320
          ui->stepIndicator->setCurrentIndex(selectedStepIndex);
d66d7f5b4   김태훈   GUI 버전 0.1.2
321
      }
99b8066f4   김태훈   V0.1.1
322
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
323
324
      CookStep showingStep = autocook.cook.steps[selectedStepIndex];
      if (Define::classify(showingStep.type) == Define::DoorClass)
99b8066f4   김태훈   V0.1.1
325
      {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
326
327
          if (ui->cookStepIcon->isVisible())
              ui->cookStepIcon->hide();
d66d7f5b4   김태훈   GUI 버전 0.1.2
328
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
          if (ui->cookStepLabel->isVisible())
              ui->cookStepLabel->hide();
  
          if (ui->cookModeIcon->isVisible())
              ui->cookModeIcon->hide();
  
          if (ui->humidityGauge->isVisible())
              ui->humidityGauge->hide();
  
          if (ui->humidityGaugeButton->isVisible())
              ui->humidityGaugeButton->hide();
  
          if (ui->humidityLabel->isVisible())
              ui->humidityLabel->hide();
  
          if (ui->heatGauge->isVisible())
              ui->heatGauge->hide();
  
          if (ui->heatGaugeButton->isVisible())
              ui->heatGaugeButton->hide();
  
          if (ui->heatLabel->isVisible())
              ui->heatLabel->hide();
  
          if (ui->doorStepLabel->isHidden())
              ui->doorStepLabel->show();
  
          if (ui->cookStepAnimation->isHidden())
              ui->cookStepAnimation->show();
  
          if (showingStep.type != lastViewDoorType)
99b8066f4   김태훈   V0.1.1
360
          {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
361
              lastViewDoorType = showingStep.type;
d66d7f5b4   김태훈   GUI 버전 0.1.2
362
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
              ui->doorStepLabel->setText(Define::name(showingStep.type));
              ui->cookStepAnimation->clear();
              switch (showingStep.type)
              {
              case Define::PutThermometer:
                  ui->doorStepLabel->setText("중심 온도계 삽입");
                  ui->cookStepAnimation->load(":/images/animation/thermometer_01.png");
                  ui->cookStepAnimation->load(":/images/animation/thermometer_02.png");
                  ui->cookStepAnimation->setGeometry((900-210)/2, 800, 210, 307);
                  ui->cookStepAnimation->start(300);
                  break;
              case Define::Load:
                  ui->doorStepLabel->setText("식재료 적재");
                  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");
                  ui->cookStepAnimation->setGeometry((900-264)/2, 800, 264, 307);
                  ui->cookStepAnimation->start(300);
                  break;
              case Define::Cut:
                  ui->doorStepLabel->setText("자르기");
                  ui->cookStepAnimation->load(":/images/animation/cut_01.png");
                  ui->cookStepAnimation->load(":/images/animation/cut_02.png");
                  ui->cookStepAnimation->load(":/images/animation/cut_03.png");
                  ui->cookStepAnimation->setGeometry((900-264)/2, 800, 264, 307);
                  ui->cookStepAnimation->start(300);
                  break;
              case Define::Pour:
                  ui->doorStepLabel->setText("물 붓기");
                  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");
                  ui->cookStepAnimation->setGeometry((900-264)/2, 800, 264, 307);
                  ui->cookStepAnimation->start(300);
                  break;
              default:
                  ui->doorStepLabel->hide();
                  ui->cookStepAnimation->hide();
99b8066f4   김태훈   V0.1.1
406
407
408
              }
          }
      }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
409
      else
6f96c947a   김태훈   GUI 0.1.4
410
      {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
          if (ui->doorStepLabel->isVisible())
              ui->doorStepLabel->hide();
  
          if (ui->cookStepAnimation->isVisible())
              ui->cookStepAnimation->hide();
  
          if (ui->cookStepIcon->isHidden())
              ui->cookStepIcon->show();
  
          if (ui->cookStepLabel->isHidden())
              ui->cookStepLabel->show();
  
          if (ui->cookModeIcon->isHidden())
              ui->cookModeIcon->show();
  
          if (ui->humidityGauge->isHidden())
              ui->humidityGauge->show();
  
          if (ui->humidityGaugeButton->isHidden())
              ui->humidityGaugeButton->show();
  
          if (ui->humidityLabel->isHidden())
              ui->humidityLabel->show();
  
          if (ui->heatGauge->isHidden())
              ui->heatGauge->show();
  
          if (ui->heatGaugeButton->isHidden())
              ui->heatGaugeButton->show();
  
          if (ui->heatLabel->isHidden())
              ui->heatLabel->show();
  
          if (showingStep.type != lastViewCookType)
6f96c947a   김태훈   GUI 0.1.4
445
          {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
446
              lastViewCookType = showingStep.type;
6f96c947a   김태훈   GUI 0.1.4
447
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
448
449
              ui->cookStepIcon->setPixmap(Define::icon(showingStep.type));
              ui->cookStepLabel->setText(Define::name(showingStep.type));
6f96c947a   김태훈   GUI 0.1.4
450
          }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
451
452
  
          if (showingStep.mode != lastViewCookMode)
6f96c947a   김태훈   GUI 0.1.4
453
          {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
454
              lastViewCookMode = showingStep.mode;
6f96c947a   김태훈   GUI 0.1.4
455
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
456
457
458
459
460
461
462
463
464
465
466
467
468
469
              switch (showingStep.mode)
              {
              case Define::SteamMode:
                  ui->cookModeIcon->setPixmap(steamModeIcon);
                  break;
              case Define::CombiMode:
                  ui->cookModeIcon->setPixmap(combiModeIcon);
                  break;
              case Define::DryMode:
                  ui->cookModeIcon->setPixmap(dryModeIcon);
                  break;
              case Define::InvalidClass:
                  ui->cookModeIcon->hide();
                  break;
6f96c947a   김태훈   GUI 0.1.4
470
471
              }
          }
d66d7f5b4   김태훈   GUI 버전 0.1.2
472
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
473
474
475
476
477
          int humidity;
          if (showingCurrentHumidity)
              humidity = oven->currentHumidity();
          else
              humidity = showingStep.humidity;
99b8066f4   김태훈   V0.1.1
478
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
479
480
481
482
          if (humidity != lastViewHumidity)
          {
              lastViewHumidity = humidity;
              ui->humidityLabel->setText(QString("%1%").arg(humidity));
ecfb5801a   김태훈   디버깅 요청 사항 반영
483
              ui->humidityGauge->setValue(humidity);
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
484
          }
99b8066f4   김태훈   V0.1.1
485
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
486
487
488
489
490
          int temp;
          if (showingCurrentTemp)
              temp = oven->currentTemp();
          else
              temp = showingStep.temp;
99b8066f4   김태훈   V0.1.1
491
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
492
493
494
          if (temp != lastViewTemp)
          {
              lastViewTemp = temp;
2bfd3a050   김태훈   환경 설정 대응
495
              ui->heatLabel->setText(Stringer::temperature(temp));
ecfb5801a   김태훈   디버깅 요청 사항 반영
496
              ui->heatGauge->setValue(temp);
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
497
          }
99b8066f4   김태훈   V0.1.1
498
499
500
501
502
      }
  }
  
  void AutoCookWindow::checkCook()
  {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
503
504
      int lastStepIndex = autocook.currentStepIndex;
      if (autocook.advance())
99b8066f4   김태훈   V0.1.1
505
      {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
506
507
508
509
510
          if (lastStepIndex != autocook.currentStepIndex)
              selectedStepIndex = autocook.currentStepIndex;
  
          if (autocook.done())
              checkCookTimer.stop();
99b8066f4   김태훈   V0.1.1
511
512
513
514
      }
  
      updateView();
  }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
515
  void AutoCookWindow::startProcess(int process)
99b8066f4   김태훈   V0.1.1
516
  {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
517
518
      if (processSelected)
          return;
99b8066f4   김태훈   V0.1.1
519
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
520
      processSelected = true;
99b8066f4   김태훈   V0.1.1
521
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
522
523
524
525
526
527
      Define::Process p = (Define::Process) process;
      switch (p)
      {
      case Define::CookAgain:
      {
          close();
99b8066f4   김태훈   V0.1.1
528
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
529
530
531
532
          AutoCookWindow *w = new AutoCookWindow(parentWidget(), cook);
          w->setWindowModality(Qt::WindowModal);
          w->showFullScreen();
          w->raise();
99b8066f4   김태훈   V0.1.1
533
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
534
535
536
537
538
          break;
      }
      case Define::MakeCrisper:
      {
          selectedProcess = (Define::Process) process;
99b8066f4   김태훈   V0.1.1
539
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
540
          CookStep &step = autocook.cook.steps[autocook.cook.steps.size() - 1];
99b8066f4   김태훈   V0.1.1
541
a366f320c   김태훈   자동 요리 후속 공정 동작 개선
542
543
544
545
546
547
548
549
550
551
552
          CookStep newStep = step;
          newStep.type = Define::MakeCrispy;
          newStep.humidity = 0;
          newStep.temp += 10;
          newStep.time = 0;
          newStep.humidification = 0;
          newStep.dehumidification = 0;
          autocook.cook.steps.append(newStep);
          autocook.currentStepIndex = autocook.cook.steps.size() - 1;
          ui->stepIndicator->setMaximum(autocook.cook.steps.size() - 1);
          returnToCurrentStep();
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
553
          Oven *oven = Oven::getInstance();
a366f320c   김태훈   자동 요리 후속 공정 동작 개선
554
          oven->setHumidity(0);
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
555
556
          oven->setTemp(step.temp + 10);
          oven->startCooking();
99b8066f4   김태훈   V0.1.1
557
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
558
559
560
561
562
563
564
          checkProcessTimer.start(100);
          break;
      }
      case Define::KeepWarm:
      {
          processSelected = false;
          selectedProcess = (Define::Process) process;
99b8066f4   김태훈   V0.1.1
565
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
566
567
568
569
570
          KeepWarmPopup *p = new KeepWarmPopup(this);
          p->showFullScreen();
          p->raise();
          break;
      }
1f7568d7e   김태훈   컴파일 경고 제거
571
572
      default:
          return;
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
573
      }
99b8066f4   김태훈   V0.1.1
574
  }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
575
  void AutoCookWindow::checkProcess()
99b8066f4   김태훈   V0.1.1
576
  {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
577
578
      if (!processSelected)
          return;
99b8066f4   김태훈   V0.1.1
579
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
580
581
582
583
584
585
      switch (selectedProcess)
      {
      case Define::MakeCrisper:
      {
          Oven *oven = Oven::getInstance();
          if (oven->currentTemp() >= oven->temp())
99b8066f4   김태훈   V0.1.1
586
          {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
587
588
              oven->stopCooking();
              checkProcessTimer.stop();
a366f320c   김태훈   자동 요리 후속 공정 동작 개선
589
              processSelected = false;
99b8066f4   김태훈   V0.1.1
590
          }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
591
592
593
594
          break;
      }
      default:
          break;
99b8066f4   김태훈   V0.1.1
595
      }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
596
597
  
      updateView();
99b8066f4   김태훈   V0.1.1
598
  }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
599
  void AutoCookWindow::returnToCurrentStep()
99b8066f4   김태훈   V0.1.1
600
  {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
601
602
603
      selectedStepIndex = autocook.currentStepIndex;
      showingDifferentStep = false;
      updateView();
99b8066f4   김태훈   V0.1.1
604
  }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
605
  void AutoCookWindow::showCurrentHumidity()
99b8066f4   김태훈   V0.1.1
606
  {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
607
608
609
      showingCurrentHumidity = true;
      updateView();
  }
99b8066f4   김태훈   V0.1.1
610
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
611
612
613
614
  void AutoCookWindow::showCurrentTemp()
  {
      showingCurrentTemp = true;
      updateView();
99b8066f4   김태훈   V0.1.1
615
  }
f588aa273   김태훈   부가 기능 로직 추가
616
617
618
619
620
621
622
623
624
625
626
  void AutoCookWindow::addFavorite()
  {
      AutoCookSetting s;
      s.type = cook.type;
      s.root = cook.root;
      for (int i = 0; i < 5; i++)
          s.configs[i] = cook.configs[i].current;
  
      FavoriteNamePopup *p = new FavoriteNamePopup(this, s);
      p->showFullScreen();
  }
e00c6a2a9   김태훈   기능 추가 구현
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
  void AutoCookWindow::jumpConfig()
  {
      Oven::getInstance()->stop();
  
      ConfigWindow *w = new ConfigWindow(MainWindow::getInstance());
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
      w->raise();
  
      MainWindow::jump(w);
  }
  
  void AutoCookWindow::jumpWash()
  {
      Oven::getInstance()->stop();
  
      WashWindow *w = new WashWindow(MainWindow::getInstance());
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
      w->raise();
  
      MainWindow::jump(w);
  }
99b8066f4   김태훈   V0.1.1
650
651
652
653
654
655
656
  void AutoCookWindow::on_humidityGaugeButton_pressed()
  {
      showCurrentHumidityTimer.start();
  }
  
  void AutoCookWindow::on_humidityGaugeButton_released()
  {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
657
658
      if (showCurrentHumidityTimer.isActive())
          showCurrentHumidityTimer.stop();
99b8066f4   김태훈   V0.1.1
659
618320ecd   김태훈   불필요한 UI 갱신 제거
660
661
662
663
664
      if (showingCurrentHumidity)
      {
          showingCurrentHumidity = false;
          updateView();
      }
99b8066f4   김태훈   V0.1.1
665
666
667
668
669
670
671
672
673
  }
  
  void AutoCookWindow::on_heatGaugeButton_pressed()
  {
      showCurrentTempTimer.start();
  }
  
  void AutoCookWindow::on_heatGaugeButton_released()
  {
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
674
675
      if (showCurrentTempTimer.isActive())
          showCurrentTempTimer.stop();
99b8066f4   김태훈   V0.1.1
676
618320ecd   김태훈   불필요한 UI 갱신 제거
677
678
679
680
681
      if (showingCurrentTemp)
      {
          showingCurrentTemp = false;
          updateView();
      }
99b8066f4   김태훈   V0.1.1
682
  }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
683
684
  void AutoCookWindow::on_showPrevStepButton_clicked()
  {
b13e23ee4   김태훈   자동 요리 수정
685
      returnToCurrentStepTimer.start();
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
686
687
688
689
690
      if (selectedStepIndex > 0)
      {
          selectedStepIndex--;
          updateView();
      }
99b8066f4   김태훈   V0.1.1
691
  }
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
692
  void AutoCookWindow::on_showNextStepButton_clicked()
99b8066f4   김태훈   V0.1.1
693
  {
b13e23ee4   김태훈   자동 요리 수정
694
      returnToCurrentStepTimer.start();
a366f320c   김태훈   자동 요리 후속 공정 동작 개선
695
      if (selectedStepIndex + 1 < autocook.cook.steps.size())
6a81d38e4   김태훈   자동 요리 관련 로직 전면 재작성
696
697
698
699
      {
          selectedStepIndex++;
          updateView();
      }
99b8066f4   김태훈   V0.1.1
700
  }
f588aa273   김태훈   부가 기능 로직 추가
701
e00c6a2a9   김태훈   기능 추가 구현
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
  void AutoCookWindow::on_backButton_clicked()
  {
      Oven::getInstance()->stop();
      close();
  }
  
  void AutoCookWindow::on_configButton_clicked()
  {
      if (autocook.done())
      {
          ConfigWindow *w = new ConfigWindow(MainWindow::getInstance());
          w->setWindowModality(Qt::WindowModal);
          w->showFullScreen();
          w->raise();
  
          MainWindow::jump(w);
      }
      else
      {
          ConfirmPopup *p = new ConfirmPopup(this, tr("요리가 중단되고 환경 설정 모드로 들어갑니다. 진행할까요?"));
          p->showFullScreen();
  
          connect(p, SIGNAL(accepted()), SLOT(jumpConfig()));
      }
  }
f588aa273   김태훈   부가 기능 로직 추가
727
728
729
730
731
732
733
734
735
736
  void AutoCookWindow::on_favoritesButton_clicked()
  {
      if (!autocook.done())
          return;
  
      ConfirmPopup *p = new ConfirmPopup(this, tr("즐겨찾기 항목에 추가하시겠습니까?"));
      p->showFullScreen();
  
      connect(p, SIGNAL(accepted()), SLOT(addFavorite()));
  }
e00c6a2a9   김태훈   기능 추가 구현
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
  
  void AutoCookWindow::on_washButton_clicked()
  {
      if (autocook.done())
      {
          WashWindow *w = new WashWindow(MainWindow::getInstance());
          w->setWindowModality(Qt::WindowModal);
          w->showFullScreen();
          w->raise();
  
          MainWindow::jump(w);
      }
      else
      {
          ConfirmPopup *p = new ConfirmPopup(this, tr("요리가 중단되고 자동 세척 모드로 들어갑니다. 진행할까요?"));
          p->showFullScreen();
  
          connect(p, SIGNAL(accepted()), SLOT(jumpWash()));
      }
  }
  
  void AutoCookWindow::on_helpButton_clicked()
  {
  
  }