Blame view

app/gui/oven_control/manualcookwindow.cpp 36.8 KB
8c2952457   김태훈   응용 프로그램 추가
1
2
3
4
5
6
  #include "manualcookwindow.h"
  #include "ui_manualcookwindow.h"
  
  #include <QSignalMapper>
  #include <QTimer>
  #include <QtDebug>
10d2268c2   김태훈   V1.5.01
7
  #include <QGraphicsDropShadowEffect>
8c2952457   김태훈   응용 프로그램 추가
8
ac60b5cec   김태훈   음향 효과 일부 적용 및 소스 ...
9
  #include "soundplayer.h"
05f2a7552   김태훈   image 관리 구조 변경
10
  #include "preheatpopup.h"
cfc2fcc35   김태훈   쿨다운 팝업 추가
11
  #include "cooldownpopup.h"
f588aa273   김태훈   부가 기능 로직 추가
12
13
14
  #include "cookhistory.h"
  #include "favoritenamepopup.h"
  #include "confirmpopup.h"
2bfd3a050   김태훈   환경 설정 대응
15
16
  #include "stringer.h"
  #include "config.h"
d35b8bcdf   김태훈   수동 요리의 중심 요리 설정 화...
17
  #include "coretempsettingpopup.h"
0e279295f   김태훈   수동 요리 구현
18
19
  #include "reservetimepopup.h"
  #include "reservedtimepopup.h"
e00c6a2a9   김태훈   기능 추가 구현
20
21
22
23
  #include "mainwindow.h"
  #include "configwindow.h"
  #include "primewindow.h"
  #include "washwindow.h"
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
24
  #include "errorpopupdlg.h"
1342af7b3   김태훈   도움말 버튼 연결
25
  #include "manualviewerdlg.h"
af27778be   김태훈   HACCP 구현
26
  #include "haccp.h"
6fb8aa9a8   김태훈   수동 요리 종료 시 보온 여부 ...
27
  #include "manualcookfinishpopup.h"
05f2a7552   김태훈   image 관리 구조 변경
28
bb26a0523   김태훈   소스 코드 정리
29
  #include <QTime>
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
30
  ManualCookWindow::ManualCookWindow(QWidget *parent, Define::Mode mode) :
8c2952457   김태훈   응용 프로그램 추가
31
      QMainWindow(parent),
213c24135   김태훈   수동 요리 반복 추가
32
      ui(new Ui::ManualCookWindow),
d6955937b   김태훈   컴파일 경고 제거
33
34
      cookDone(false),
      repeat(false)
8c2952457   김태훈   응용 프로그램 추가
35
36
  {
      ui->setupUi(this);
6f96c947a   김태훈   GUI 0.1.4
37
      ui->clockContainer->setParent(ui->upperStack);
cfc2fcc35   김태훈   쿨다운 팝업 추가
38
      ui->closeDoorWidget->setParent(ui->upperStack);
6f96c947a   김태훈   GUI 0.1.4
39
      setAttribute(Qt::WA_DeleteOnClose);
3f52600cc   김태훈   소스 코드 구조 개선
40
      oven = Oven::getInstance();
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
41
a2de3cbfc   김태훈   수동 요리에 새 슬라이더 적용
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
      ui->humiditySlider->setSubPixmap(":/images/slider/humidity.png");
      ui->humiditySlider->setRange(0, 100);
      ui->humiditySlider->bigTickInterval = 50;
      ui->humiditySlider->tickInterval = 10;
  
      ui->tempSlider->setSubPixmap(":/images/slider/temp.png");
      ui->tempSlider->bigTickInterval = 50;
      ui->tempSlider->tickInterval = 10;
  
      ui->timeSlider->setSubPixmap(":/images/slider/time.png");
      ui->timeSlider->setRange(0, 342);
      ui->timeSlider->bigTicks.append(0);
      ui->timeSlider->bigTicks.append(180);
      ui->timeSlider->bigTicks.append(270);
      ui->timeSlider->bigTicks.append(342);
      ui->timeSlider->ticks.append(60);
      ui->timeSlider->ticks.append(120);
      ui->timeSlider->ticks.append(180 + 30);
      ui->timeSlider->ticks.append(180 + 60);
      ui->timeSlider->ticks.append(270 + 4 * 6);
      ui->timeSlider->ticks.append(270 + 4 * 12);
  
      ui->interTempSlider->setSubPixmap(":/images/slider/core.png");
  
      QList<int> &bigTicks = ui->interTempSlider->bigTicks;
      bigTicks.append(oven->minInterTemp());
      bigTicks.append(oven->minInterTemp() + (oven->maxInterTemp() - oven->minInterTemp()) / 2);
      bigTicks.append(oven->maxInterTemp());
  
      QList<int> &ticks = ui->interTempSlider->ticks;
      for (int i = 1; i < 3; i++)
          ticks.append(bigTicks.at(0) + i * (bigTicks.at(1) - bigTicks.at(0)) / 3);
      for (int i = 1; i < 3; i++)
          ticks.append(bigTicks.at(1) + i * (bigTicks.at(2) - bigTicks.at(1)) / 3);
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
76
77
78
79
80
81
82
83
84
      lastViewHumidity = -1;
      lastViewTemp = -1;
      lastViewTime = -1;
      lastViewInterTemp = -1;
      lastViewInterTempEnabled = !oven->interTempEnabled();
      lastViewCooking = false;
      lastViewDamper = false;
      lastViewHumidification = false;
      lastViewFan = -1;
097e5e14a   김태훈   프로그래밍 모드 세부 사항 구현
85
      lastCheckedCooking = false;
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
86
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
      Config *config = Config::getInstance();
      config_item item = config->getConfigValue(Define::config_cooking_door_monitoring);
  
      monitorLevel = item.d8.d8_0;
      if (monitorLevel > 0 && monitorLevel < 4)
      {
          monitor1.setSingleShot(true);
          monitor2.setSingleShot(true);
          monitor3.setSingleShot(true);
          monitor1.setInterval(item.d8.d8_1 * 1000);
          monitor2.setInterval(item.d8.d8_2 * 1000);
          monitor3.setInterval(item.d8.d8_3 * 1000);
          connect(&monitor1, SIGNAL(timeout()), SLOT(onMonitor1Timeout()));
          connect(&monitor2, SIGNAL(timeout()), SLOT(onMonitor2Timeout()));
          connect(&monitor3, SIGNAL(timeout()), SLOT(onMonitor3Timeout()));
      }
      else
          monitorLevel = 0;
8c2952457   김태훈   응용 프로그램 추가
105
106
      connect(ui->humiditySlider, SIGNAL(valueChanged(int)), oven, SLOT(setHumidity(int)));
      connect(ui->tempSlider, SIGNAL(valueChanged(int)), oven, SLOT(setTemp(int)));
bb26a0523   김태훈   소스 코드 정리
107
      connect(ui->timeSlider, SIGNAL(valueChanged(int)), &startCookingTimer, SLOT(start()));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
108
      connect(ui->timeSlider, SIGNAL(valueChanged(int)), this, SLOT(updateView()));
8c2952457   김태훈   응용 프로그램 추가
109
      connect(ui->interTempSlider, SIGNAL(valueChanged(int)), oven, SLOT(setInterTemp(int)));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
110
111
112
113
      connect(ui->humiditySlider, SIGNAL(sliderMoved(int)), this, SLOT(updateView()));
      connect(ui->tempSlider, SIGNAL(sliderMoved(int)), this, SLOT(updateView()));
      connect(ui->timeSlider, SIGNAL(sliderMoved(int)), this, SLOT(updateView()));
      connect(ui->interTempSlider, SIGNAL(sliderMoved(int)), this, SLOT(updateView()));
8c2952457   김태훈   응용 프로그램 추가
114
bb26a0523   김태훈   소스 코드 정리
115
      startCookingTimer.setSingleShot(true);
5228da630   김태훈   딜레이 변경
116
      startCookingTimer.setInterval(3000);
bb26a0523   김태훈   소스 코드 정리
117
118
119
      connect(&startCookingTimer, SIGNAL(timeout()), SLOT(start()));
  
      showCurrentHumidityTimer.setSingleShot(true);
5228da630   김태훈   딜레이 변경
120
      showCurrentHumidityTimer.setInterval(1000);
bb26a0523   김태훈   소스 코드 정리
121
122
123
      connect(&showCurrentHumidityTimer, SIGNAL(timeout()), SLOT(showCurrentHumidity()));
  
      showCurrentTempTimer.setSingleShot(true);
5228da630   김태훈   딜레이 변경
124
      showCurrentTempTimer.setInterval(1000);
bb26a0523   김태훈   소스 코드 정리
125
      connect(&showCurrentTempTimer, SIGNAL(timeout()), SLOT(showCurrentTemp()));
8c2952457   김태훈   응용 프로그램 추가
126
271dda4ae   김태훈   엔코더 구현
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
      focusHumidityButtonTimer.setSingleShot(true);
      focusHumidityButtonTimer.setInterval(3000);
      connect(&focusHumidityButtonTimer, SIGNAL(timeout()), SLOT(focusHumidityButton()));
  
      focusTempButtonTimer.setSingleShot(true);
      focusTempButtonTimer.setInterval(3000);
      connect(&focusTempButtonTimer, SIGNAL(timeout()), SLOT(focusTempButton()));
  
      focusTimeButtonTimer.setSingleShot(true);
      focusTimeButtonTimer.setInterval(3000);
      connect(&focusTimeButtonTimer, SIGNAL(timeout()), SLOT(focusTimeButton()));
  
      focusInterTempButtonTimer.setSingleShot(true);
      focusInterTempButtonTimer.setInterval(3000);
      connect(&focusInterTempButtonTimer, SIGNAL(timeout()), SLOT(focusInterTempButton()));
  
      connect(ui->humiditySlider, SIGNAL(sliderMoved(int)), &focusHumidityButtonTimer, SLOT(start()));
      connect(ui->tempSlider, SIGNAL(sliderMoved(int)), &focusTempButtonTimer, SLOT(start()));
      connect(ui->timeSlider, SIGNAL(sliderMoved(int)), &focusTimeButtonTimer, SLOT(start()));
      connect(ui->interTempSlider, SIGNAL(sliderMoved(int)), &focusInterTempButtonTimer, SLOT(start()));
27843914b   김태훈   중심 온도 설정에 엔코더 관련 ...
147
148
149
150
      connect(ui->humiditySlider, SIGNAL(sliderPressed()), SLOT(updateView()));
      connect(ui->tempSlider, SIGNAL(sliderPressed()), SLOT(updateView()));
      connect(ui->timeSlider, SIGNAL(sliderPressed()), SLOT(updateView()));
      connect(ui->interTempSlider, SIGNAL(sliderPressed()), SLOT(updateView()));
a2de3cbfc   김태훈   수동 요리에 새 슬라이더 적용
151
      connect(oven, SIGNAL(changed(Oven*)), this, SLOT(onOvenUpdated(Oven*)));
bb26a0523   김태훈   소스 코드 정리
152
      oven->setDefault(mode);
10d2268c2   김태훈   V1.5.01
153
      QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(this);
b3e47756e   김태훈   소스 파일 일괄 변경
154
155
      effect->setBlurRadius(12);
      effect->setOffset(4, 4);
10d2268c2   김태훈   V1.5.01
156
d6ef50b78   김태훈   요청 사항 반영
157
      ui->infoTextLabel->setAttribute(Qt::WA_TransparentForMouseEvents);
10d2268c2   김태훈   V1.5.01
158
      ui->infoTextLabel->setGraphicsEffect(effect);
d6ef50b78   김태훈   요청 사항 반영
159
      ui->infoTextLabel->hide();
10d2268c2   김태훈   V1.5.01
160
      showInfoTextTimer.setInterval(1000);
d6ef50b78   김태훈   요청 사항 반영
161
      showInfoTextTimer.setSingleShot(true);
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
162
163
      connect(&updateViewTimer, SIGNAL(timeout()), SLOT(updateView()));
      updateViewTimer.start(100);
2bfd3a050   김태훈   환경 설정 대응
164
bbd7d8f29   김태훈   버튼 음향 추가
165
      foreach (QPushButton *button, findChildren<QPushButton *>())
d75742e49   김태훈   음향 효과 개선
166
167
          if (button != ui->runStopButton)
              connect(button, &QPushButton::pressed, SoundPlayer::playClick);
d35b8bcdf   김태훈   수동 요리의 중심 요리 설정 화...
168
169
  
      QTimer::singleShot(0, this, SLOT(setupAnimation()));
271dda4ae   김태훈   엔코더 구현
170
171
  
      setFocus();
bb26a0523   김태훈   소스 코드 정리
172
  }
f588aa273   김태훈   부가 기능 로직 추가
173
174
175
176
177
178
179
180
181
182
183
184
185
186
  ManualCookWindow::ManualCookWindow(QWidget *parent, ManualCookSetting setting)
      : ManualCookWindow(parent, setting.mode)
  {
      oven->setHumidity(setting.humidity);
      oven->setTemp(setting.temp);
      oven->setTime(setting.time);
      oven->setFan(setting.fan);
      oven->setInterTempEnabled(setting.coreTempEnabled);
      oven->setInterTemp(setting.coreTemp);
  
      startCookingTimer.start();
  
      onOvenUpdated(oven);
  }
bb26a0523   김태훈   소스 코드 정리
187
188
  ManualCookWindow::~ManualCookWindow()
  {
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
189
      stop();
bb26a0523   김태훈   소스 코드 정리
190
191
      delete ui;
  }
271dda4ae   김태훈   엔코더 구현
192
193
194
195
  void ManualCookWindow::keyPressEvent(QKeyEvent *event)
  {
      switch (event->key())
      {
01249f413   김태훈   엔코더 방향 반전. 하드웨어가 변경됨
196
      case 0x01000032:    // Turn left
271dda4ae   김태훈   엔코더 구현
197
198
199
200
201
202
203
204
205
206
207
208
209
210
          onEncoderLeft();
          break;
      case 0x01000031:    // Push
          if (focusWidget() != this)
          {
              pushed = focusWidget();
  
              if (pushed == ui->humidityButton)
                  on_humidityButton_pressed();
              else if (pushed == ui->tempButton)
                  on_tempButton_pressed();
  
          }
          break;
01249f413   김태훈   엔코더 방향 반전. 하드웨어가 변경됨
211
      case 0x01000030:    // Turn right
271dda4ae   김태훈   엔코더 구현
212
213
214
215
216
217
218
219
220
          onEncoderRight();
          break;
      }
  }
  
  void ManualCookWindow::keyReleaseEvent(QKeyEvent *event)
  {
      switch (event->key())
      {
01249f413   김태훈   엔코더 방향 반전. 하드웨어가 변경됨
221
      case 0x01000032:    // Turn left
271dda4ae   김태훈   엔코더 구현
222
223
224
          onEncoderLeft();
          break;
      case 0x01000031:    // Push
ec8811c60   김태훈   엔코더 동작 개선
225
          if (pushed == ui->humidityButton)
271dda4ae   김태훈   엔코더 구현
226
              on_humidityButton_released();
ec8811c60   김태훈   엔코더 동작 개선
227
          else if (pushed == ui->tempButton)
271dda4ae   김태훈   엔코더 구현
228
229
230
231
232
233
234
              on_tempButton_released();
  
          if (focusWidget() == pushed)
              onEncoderClicked(pushed);
  
          pushed = NULL;
          break;
01249f413   김태훈   엔코더 방향 반전. 하드웨어가 변경됨
235
      case 0x01000030:    // Turn right
271dda4ae   김태훈   엔코더 구현
236
237
238
239
          onEncoderRight();
          break;
      }
  }
bb26a0523   김태훈   소스 코드 정리
240
241
  void ManualCookWindow::setupAnimation()
  {
f31d412c6   김태훈   수동 요리 기능 추가
242
243
244
245
246
247
248
249
250
251
      ui->closeDoorAnimation->load(":/images/animation/door_big_09.png");
      ui->closeDoorAnimation->load(":/images/animation/door_big_08.png");
      ui->closeDoorAnimation->load(":/images/animation/door_big_07.png");
      ui->closeDoorAnimation->load(":/images/animation/door_big_06.png");
      ui->closeDoorAnimation->load(":/images/animation/door_big_05.png");
      ui->closeDoorAnimation->load(":/images/animation/door_big_04.png");
      ui->closeDoorAnimation->load(":/images/animation/door_big_03.png");
      ui->closeDoorAnimation->load(":/images/animation/door_big_02.png");
      ui->closeDoorAnimation->load(":/images/animation/door_big_01.png");
      ui->closeDoorAnimation->start(300);
cfc2fcc35   김태훈   쿨다운 팝업 추가
252
      ui->openDoorAnimation->load(":/images/animation/door_big_01.png");
f31d412c6   김태훈   수동 요리 기능 추가
253
254
255
256
257
258
259
260
      ui->openDoorAnimation->load(":/images/animation/door_big_02.png");
      ui->openDoorAnimation->load(":/images/animation/door_big_03.png");
      ui->openDoorAnimation->load(":/images/animation/door_big_04.png");
      ui->openDoorAnimation->load(":/images/animation/door_big_05.png");
      ui->openDoorAnimation->load(":/images/animation/door_big_06.png");
      ui->openDoorAnimation->load(":/images/animation/door_big_07.png");
      ui->openDoorAnimation->load(":/images/animation/door_big_08.png");
      ui->openDoorAnimation->load(":/images/animation/door_big_09.png");
cfc2fcc35   김태훈   쿨다운 팝업 추가
261
      ui->openDoorAnimation->start(300);
8c2952457   김태훈   응용 프로그램 추가
262
  }
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
263
  void ManualCookWindow::updateView()
8c2952457   김태훈   응용 프로그램 추가
264
  {
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
265
      switch (oven->mode())
213c24135   김태훈   수동 요리 반복 추가
266
      {
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
267
      case Define::DryMode:
271dda4ae   김태훈   엔코더 구현
268
269
270
271
          if (ui->steamButton->isChecked())
              ui->steamButton->setChecked(false);
          if (ui->combiButton->isChecked())
              ui->combiButton->setChecked(false);
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
272
273
274
275
276
277
          if (!ui->dryheatButton->isChecked())
              ui->dryheatButton->setChecked(true);
          break;
      case Define::SteamMode:
          if (!ui->steamButton->isChecked())
              ui->steamButton->setChecked(true);
271dda4ae   김태훈   엔코더 구현
278
279
280
281
          if (ui->combiButton->isChecked())
              ui->combiButton->setChecked(false);
          if (ui->dryheatButton->isChecked())
              ui->dryheatButton->setChecked(false);
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
282
283
          break;
      case Define::CombiMode:
271dda4ae   김태훈   엔코더 구현
284
285
          if (ui->steamButton->isChecked())
              ui->steamButton->setChecked(false);
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
286
287
          if (!ui->combiButton->isChecked())
              ui->combiButton->setChecked(true);
271dda4ae   김태훈   엔코더 구현
288
289
          if (ui->dryheatButton->isChecked())
              ui->dryheatButton->setChecked(false);
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
290
291
292
          break;
      default:
          break;
213c24135   김태훈   수동 요리 반복 추가
293
      }
8c2952457   김태훈   응용 프로그램 추가
294
9c1ea4a13   김태훈   포커스 디자인 변경 일부 적용
295
296
297
298
      QWidget *focused = focusWidget();
      ui->humidityButton->setChecked(focused == ui->humiditySlider);
      ui->tempButton->setChecked(focused == ui->tempSlider);
      ui->timeButton->setChecked(focused == ui->timeSlider);
8c2952457   김태훈   응용 프로그램 추가
299
300
301
      int humidity;
      if (showCurrentHumidity_)
          humidity = oven->currentHumidity();
271dda4ae   김태훈   엔코더 구현
302
      else if (ui->humiditySlider->isSliderDown() || focusWidget() == ui->humiditySlider)
8c2952457   김태훈   응용 프로그램 추가
303
304
305
          humidity = ui->humiditySlider->sliderPosition();
      else
          humidity = oven->humidity();
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
306
307
308
309
310
311
312
313
314
315
316
317
      if (humidity != lastViewHumidity)
      {
          lastViewHumidity = humidity;
  
          bool old = ui->humiditySlider->blockSignals(true);
          if (ui->humiditySlider->sliderPosition() != humidity)
              ui->humiditySlider->setValue(humidity);
          ui->humiditySlider->setEnabled(oven->mode() == Define::CombiMode);
          ui->humiditySlider->blockSignals(old);
  
          ui->humidityLabel->setText(QString("%1%").arg(humidity));
      }
8c2952457   김태훈   응용 프로그램 추가
318
319
320
321
  
      int temp;
      if (showCurrentTemp_)
          temp = oven->currentTemp();
271dda4ae   김태훈   엔코더 구현
322
      else if (ui->tempSlider->isSliderDown() || focusWidget() == ui->tempSlider)
8c2952457   김태훈   응용 프로그램 추가
323
324
325
          temp = ui->tempSlider->sliderPosition();
      else
          temp = oven->temp();
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
326
327
328
      if (temp != lastViewTemp)
      {
          lastViewTemp = temp;
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
329
330
          ui->tempLabel->setText(Stringer::temperature(temp, Stringer::fontSize14));
      }
8c2952457   김태훈   응용 프로그램 추가
331
a2de3cbfc   김태훈   수동 요리에 새 슬라이더 적용
332
333
334
335
336
      bool old = ui->tempSlider->blockSignals(true);
      ui->tempSlider->setRange(oven->minTemp(), oven->maxTemp());
      if (ui->tempSlider->sliderPosition() != temp)
          ui->tempSlider->setValue(temp);
      ui->tempSlider->blockSignals(old);
271dda4ae   김태훈   엔코더 구현
337
338
339
      int msecs = oven->msecs();
      if (ui->timeSlider->isSliderMoved())
          ui->timeLabel->setText(Stringer::remainingTime(sliderToTime(ui->timeSlider->sliderPosition()) * 1000, Stringer::fontSize14));
8c2952457   김태훈   응용 프로그램 추가
340
      else
271dda4ae   김태훈   엔코더 구현
341
          ui->timeLabel->setText(Stringer::remainingTime(msecs, Stringer::fontSize14));
8c2952457   김태훈   응용 프로그램 추가
342
271dda4ae   김태훈   엔코더 구현
343
      if (focusWidget() != ui->timeSlider)
8c2952457   김태훈   응용 프로그램 추가
344
      {
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
345
          bool old = ui->timeSlider->blockSignals(true);
a2de3cbfc   김태훈   수동 요리에 새 슬라이더 적용
346
          ui->timeSlider->setSliderPosition(timeToSlider(msecs / 1000));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
347
          ui->timeSlider->blockSignals(old);
8c2952457   김태훈   응용 프로그램 추가
348
      }
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
349
      int interTemp;
271dda4ae   김태훈   엔코더 구현
350
      if (ui->interTempSlider->isSliderDown() || focusWidget() == ui->interTempSlider)
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
351
352
353
          interTemp = ui->interTempSlider->sliderPosition();
      else
          interTemp = oven->interTemp();
8c2952457   김태훈   응용 프로그램 추가
354
27843914b   김태훈   중심 온도 설정에 엔코더 관련 ...
355
356
357
358
359
360
361
362
      QString interTempButtonStyleSheet("\
  QPushButton\
  { image: url(%1); }\
  QPushButton:pressed,\
  QPushButton:focus\
  { image: url(:/images/slider_icon/011_icon_04_active.png); }\
  QPushButton:checked\
  { image: url(:/images/slider_icon/core_temp_ov.png); }");
e75b6df28   김태훈   수동 요리 화면 동작 개선
363
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
364
      bool interTempEnabled = oven->interTempEnabled();
27843914b   김태훈   중심 온도 설정에 엔코더 관련 ...
365
      if (interTempEnabled != lastViewInterTempEnabled)
8c2952457   김태훈   응용 프로그램 추가
366
      {
27843914b   김태훈   중심 온도 설정에 엔코더 관련 ...
367
          lastViewInterTempEnabled = interTempEnabled;
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
368
          if (interTempEnabled)
27843914b   김태훈   중심 온도 설정에 엔코더 관련 ...
369
              ui->interTempButton->setStyleSheet(interTempButtonStyleSheet.arg(":/images/slider_icon/core_temp_enabled.png"));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
370
          else
27843914b   김태훈   중심 온도 설정에 엔코더 관련 ...
371
              ui->interTempButton->setStyleSheet(interTempButtonStyleSheet.arg(":/images/slider_icon/core_temp.png"));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
372
      }
c598b01b2   김태훈   GUI 업데이트
373
27843914b   김태훈   중심 온도 설정에 엔코더 관련 ...
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
      ui->interTempButton->setChecked(focusWidget() == ui->interTempSlider);
  
  
      old = ui->interTempSlider->blockSignals(true);
      ui->interTempSlider->setEnabled(interTempEnabled);
      ui->interTempSlider->setSubVisible(interTempEnabled);
      ui->interTempSlider->setRange(oven->minInterTemp(), oven->maxInterTemp());
      if (ui->interTempSlider->sliderPosition() != interTemp)
          ui->interTempSlider->setValue(interTemp);
      ui->interTempSlider->blockSignals(old);
  
      if (interTempEnabled)
          ui->interTempLabel->setText(Stringer::temperature(interTemp, Stringer::fontSize14));
      else
          ui->interTempLabel->setText(Stringer::unusedTemperature(Stringer::fontSize14));
cd74cf6ed   김태훈   엔코더 관련 디자인 변경 적용
389
      ui->runStopButton->setChecked(oven->cooking());
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
390
271dda4ae   김태훈   엔코더 구현
391
      if (showFrontButtons)
8c2952457   김태훈   응용 프로그램 추가
392
      {
271dda4ae   김태훈   엔코더 구현
393
          ui->preheatButton->show();
a8e17f05f   김태훈   고객사 요청 반영
394
395
396
397
398
399
400
401
402
403
  
          if (oven->mode() == Define::DryMode)
              ui->damperButton->show();
          else
              ui->damperButton->hide();
  
          if (oven->currentTemp() < 160)
              ui->humidificationButton->show();
          else
              ui->humidificationButton->hide();
271dda4ae   김태훈   엔코더 구현
404
405
          if (oven->cooking())
              ui->repeatButton->show();
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
406
          else
271dda4ae   김태훈   엔코더 구현
407
              ui->repeatButton->hide();
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
408
271dda4ae   김태훈   엔코더 구현
409
410
411
412
413
414
          ui->cooldownButton->hide();
          ui->fanButton->hide();
          ui->reserveButton->hide();
          ui->favoriteButton->hide();
      }
      else
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
415
      {
271dda4ae   김태훈   엔코더 구현
416
417
418
419
          ui->preheatButton->hide();
          ui->damperButton->hide();
          ui->humidificationButton->hide();
          ui->repeatButton->hide();
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
420
271dda4ae   김태훈   엔코더 구현
421
422
423
424
425
426
427
          ui->cooldownButton->show();
          ui->fanButton->show();
          if (oven->cooking())
          {
              ui->reserveButton->hide();
              ui->favoriteButton->hide();
          }
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
428
          else
271dda4ae   김태훈   엔코더 구현
429
430
431
432
          {
              ui->reserveButton->show();
              ui->favoriteButton->show();
          }
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
433
      }
271dda4ae   김태훈   엔코더 구현
434
      bool damper = oven->damper();
d6ef50b78   김태훈   요청 사항 반영
435
436
437
438
439
      if (damper != ui->damperButton->isChecked())
      {
          ui->damperButton->setChecked(damper);
  
          if (damper)
10d2268c2   김태훈   V1.5.01
440
              showInfoText("ON", ":/images/manual_button/damper_open.png");
d6ef50b78   김태훈   요청 사항 반영
441
          else
10d2268c2   김태훈   V1.5.01
442
              showInfoText("OFF", ":/images/manual_button/damper_close.png");
d6ef50b78   김태훈   요청 사항 반영
443
      }
271dda4ae   김태훈   엔코더 구현
444
445
  
      bool humidification = oven->humidification();
d6ef50b78   김태훈   요청 사항 반영
446
447
448
449
450
451
      if (humidification != ui->humidificationButton->isChecked())
      {
          ui->humidificationButton->setChecked(humidification);
          qDebug() << "humidification" << humidification;
  
          if (humidification)
10d2268c2   김태훈   V1.5.01
452
              showInfoText("ON", ":/images/manual_button/side_nozzle_open.png");
d6ef50b78   김태훈   요청 사항 반영
453
          else
10d2268c2   김태훈   V1.5.01
454
              showInfoText("OFF", ":/images/manual_button/side_nozzle_close.png");
d6ef50b78   김태훈   요청 사항 반영
455
      }
271dda4ae   김태훈   엔코더 구현
456
b7ae9e830   김태훈   엔코더 관련 디자인 변경 시범 적용
457
458
459
      QString fanStyleSheet("\
  QPushButton { background-image: url(%1); }\
  QPushButton:focus { background-image: url(%2); }");
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
460
461
462
      int fan = oven->fan();
      if (fan != lastViewFan)
      {
0fbf1932c   김태훈   V1.5.0.2
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
          if (lastViewFan != -1)
          {
              switch (fan)
              {
              case 1:
                  showInfoText("1", ":/images/manual_button/fan_1.png");
                  break;
              case 2:
                  showInfoText("2", ":/images/manual_button/fan_2.png");
                  break;
              case 3:
                  showInfoText("3", ":/images/manual_button/fan_3.png");
                  break;
              case 4:
                  showInfoText("4", ":/images/manual_button/fan_4.png");
                  break;
              case 5:
                  showInfoText("5", ":/images/manual_button/fan_5.png");
                  break;
              default:
                  showInfoText("6", ":/images/manual_button/fan_6.png");
                  break;
              }
          }
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
487
488
489
490
491
          lastViewFan = fan;
  
          switch (fan)
          {
          case 1:
b7ae9e830   김태훈   엔코더 관련 디자인 변경 시범 적용
492
493
494
              ui->fanButton->setStyleSheet(fanStyleSheet
                                           .arg(":/images/manual_button/fan_1.png")
                                           .arg(":/images/manual_button/013_sys_icon_06_active.png"));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
495
496
              break;
          case 2:
b7ae9e830   김태훈   엔코더 관련 디자인 변경 시범 적용
497
498
499
              ui->fanButton->setStyleSheet(fanStyleSheet
                                           .arg(":/images/manual_button/fan_2.png")
                                           .arg(":/images/manual_button/013_sys_icon_06_01_active.png"));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
500
501
              break;
          case 3:
b7ae9e830   김태훈   엔코더 관련 디자인 변경 시범 적용
502
503
504
              ui->fanButton->setStyleSheet(fanStyleSheet
                                           .arg(":/images/manual_button/fan_3.png")
                                           .arg(":/images/manual_button/013_sys_icon_06_02_active.png"));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
505
506
              break;
          case 4:
b7ae9e830   김태훈   엔코더 관련 디자인 변경 시범 적용
507
508
509
              ui->fanButton->setStyleSheet(fanStyleSheet
                                           .arg(":/images/manual_button/fan_4.png")
                                           .arg(":/images/manual_button/013_sys_icon_06_03_active.png"));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
510
511
              break;
          case 5:
b7ae9e830   김태훈   엔코더 관련 디자인 변경 시범 적용
512
513
514
              ui->fanButton->setStyleSheet(fanStyleSheet
                                           .arg(":/images/manual_button/fan_5.png")
                                           .arg(":/images/manual_button/013_sys_icon_06_04_active.png"));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
515
516
              break;
          default:
b7ae9e830   김태훈   엔코더 관련 디자인 변경 시범 적용
517
518
519
              ui->fanButton->setStyleSheet(fanStyleSheet
                                           .arg(":/images/manual_button/fan_6.png")
                                           .arg(":/images/manual_button/013_sys_icon_06_active.png"));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
520
521
              break;
          }
8c2952457   김태훈   응용 프로그램 추가
522
      }
d6ef50b78   김태훈   요청 사항 반영
523
524
525
526
527
      if (repeat != ui->repeatButton->isChecked())
      {
          ui->repeatButton->setChecked(repeat);
  
          if (repeat)
10d2268c2   김태훈   V1.5.01
528
              showInfoText("ON", ":/images/manual_button/repeat_ov.png");
d6ef50b78   김태훈   요청 사항 반영
529
          else
10d2268c2   김태훈   V1.5.01
530
              showInfoText("OFF", ":/images/manual_button/repeat.png");
d6ef50b78   김태훈   요청 사항 반영
531
      }
07441dbd3   김태훈   엔코더 관련 디자인 변경 대비
532
347c46873   김태훈   done 시그널을 안 쓰는 줄 ...
533
      if (cookDone)
f31d412c6   김태훈   수동 요리 기능 추가
534
535
536
537
538
539
      {
          if (oven->door())
              ui->upperStack->setCurrentIndex(0); // Clock
          else
              ui->upperStack->setCurrentIndex(2); // Open Door
      }
cfc2fcc35   김태훈   쿨다운 팝업 추가
540
      else
f31d412c6   김태훈   수동 요리 기능 추가
541
542
543
544
545
546
      {
          if (oven->paused() && !oven->cooldown() && oven->door())
              ui->upperStack->setCurrentIndex(1); // Close Door
          else
              ui->upperStack->setCurrentIndex(0); // Clock
      }
d6ef50b78   김태훈   요청 사항 반영
547
548
  
      int remainingTime = showInfoTextTimer.remainingTime();
10d2268c2   김태훈   V1.5.01
549
      if (remainingTime > 0)
d6ef50b78   김태훈   요청 사항 반영
550
          ui->infoTextLabel->show();
d6ef50b78   김태훈   요청 사항 반영
551
      else
d6ef50b78   김태훈   요청 사항 반영
552
          ui->infoTextLabel->hide();
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
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
  }
  
  void ManualCookWindow::showCurrentHumidity()
  {
      showCurrentHumidity_ = true;
      updateView();
  }
  
  void ManualCookWindow::hideCurrentHumidity()
  {
      showCurrentHumidity_ = false;
      updateView();
  }
  
  void ManualCookWindow::showCurrentTemp()
  {
      showCurrentTemp_ = true;
      updateView();
  }
  
  void ManualCookWindow::hideCurrentTemp()
  {
      showCurrentTemp_ = false;
      updateView();
  }
10d2268c2   김태훈   V1.5.01
578
  void ManualCookWindow::showInfoText(QString text, QString icon)
d6ef50b78   김태훈   요청 사항 반영
579
  {
10d2268c2   김태훈   V1.5.01
580
581
582
583
584
585
  
      QString textTemplate = QString(
                  "<img src=\"%2\" />"
                  "<span> %1</span>").arg(text).arg(icon);
  
      ui->infoTextLabel->setText(textTemplate);
d6ef50b78   김태훈   요청 사항 반영
586
587
      showInfoTextTimer.start();
  }
6fb8aa9a8   김태훈   수동 요리 종료 시 보온 여부 ...
588
589
590
591
592
593
594
595
596
597
598
599
  void ManualCookWindow::startKeepWarm()
  {
      if (oven->mode() == Define::CombiMode)
          return;
  
      cookDone = false;
  
      oven->setTemp(70);
      oven->setTime(60*60);
  
      start();
  }
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
600
601
602
603
604
  void ManualCookWindow::onOvenUpdated(Oven *oven)
  {
      updateView();
  
      if (oven->interTempEnabled() && oven->currentInterTemp() >= oven->interTemp())
f31d412c6   김태훈   수동 요리 기능 추가
605
      {
347c46873   김태훈   done 시그널을 안 쓰는 줄 ...
606
          cookDone = true;
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
607
          stop();
f31d412c6   김태훈   수동 요리 기능 추가
608
      }
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
609
610
611
612
  
      if (repeat && !oven->cooking())
      {
          repeat = false;
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
613
614
615
616
617
618
          oven->setMode(repeatSetting.mode);
          oven->setHumidity(repeatSetting.humidity);
          oven->setTemp(repeatSetting.temp);
          oven->setTime(repeatSetting.time);
          oven->setInterTempEnabled(repeatSetting.coreTempEnabled);
          oven->setInterTemp(repeatSetting.coreTemp);
07441dbd3   김태훈   엔코더 관련 디자인 변경 대비
619
620
  
          updateView();
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
621
      }
347c46873   김태훈   done 시그널을 안 쓰는 줄 ...
622
623
      else if (lastCheckedCooking && !oven->cooking())
      {
097e5e14a   김태훈   프로그래밍 모드 세부 사항 구현
624
625
626
627
          if ((oven->interTempEnabled() && oven->currentInterTemp() >= oven->interTemp())
                  || oven->time() == 0)
          {
              lastCheckedCooking = oven->cooking();
347c46873   김태훈   done 시그널을 안 쓰는 줄 ...
628
              cookDone = true;
af27778be   김태훈   HACCP 구현
629
              HACCP::done();
347c46873   김태훈   done 시그널을 안 쓰는 줄 ...
630
              emit done();
6fb8aa9a8   김태훈   수동 요리 종료 시 보온 여부 ...
631
214a68f0d   김태훈   수동 요리 종료 팝업이 콤비 모...
632
              focused = focusWidget();
e973476b9   김태훈   수동 요리 종료 팝업 관련 포커...
633
214a68f0d   김태훈   수동 요리 종료 팝업이 콤비 모...
634
635
636
637
              ManualCookFinishPopup *p = new ManualCookFinishPopup(this, oven->mode() != Define::CombiMode);
              p->showFullScreen();
              connect(p, SIGNAL(keepWarm()), SLOT(startKeepWarm()));
              connect(p, SIGNAL(destroyed()), SLOT(focusAgain()));
097e5e14a   김태훈   프로그래밍 모드 세부 사항 구현
638
639
          }
      }
347c46873   김태훈   done 시그널을 안 쓰는 줄 ...
640
641
      if (cookDone && oven->door())
          cookDone = false;
f31d412c6   김태훈   수동 요리 기능 추가
642
097e5e14a   김태훈   프로그래밍 모드 세부 사항 구현
643
      lastCheckedCooking = oven->cooking();
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
  
      if (oven->paused() && oven->door())
      {
          if (monitorLevel > 0 && !monitorTriggered)
          {
              monitorTriggered = true;
              monitor1.start();
          }
      }
  
      if (monitorTriggered && !oven->door())
      {
          monitorTriggered = false;
          monitor1.stop();
          monitor2.stop();
          monitor3.stop();
      }
8c2952457   김태훈   응용 프로그램 추가
661
  }
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
662
  void ManualCookWindow::setOvenDefault(Define::Mode mode)
8c2952457   김태훈   응용 프로그램 추가
663
  {
bb26a0523   김태훈   소스 코드 정리
664
665
666
      stop();
  
      oven->setDefault(mode);
bb26a0523   김태훈   소스 코드 정리
667
668
669
670
  }
  
  void ManualCookWindow::start()
  {
bbd7d8f29   김태훈   버튼 음향 추가
671
672
      if (oven->cooking())
          return;
f588aa273   김태훈   부가 기능 로직 추가
673
674
      if (oven->time() > 0)
      {
347c46873   김태훈   done 시그널을 안 쓰는 줄 ...
675
          cookDone = false;
f31d412c6   김태훈   수동 요리 기능 추가
676
c6dd03260   김태훈   요리 시작/종료 관련 음향 효과...
677
          SoundPlayer::playStart();
f588aa273   김태훈   부가 기능 로직 추가
678
679
680
681
          if (startCookingTimer.isActive())
              startCookingTimer.stop();
  
          oven->startCooking();
f588aa273   김태훈   부가 기능 로직 추가
682
683
684
685
686
687
688
689
690
691
692
  
          ManualCookSetting s;
          s.mode = oven->mode();
          s.humidity = oven->humidity();
          s.temp = oven->temp();
          s.time = oven->time();
          s.fan = oven->fan();
          s.coreTempEnabled = oven->interTempEnabled();
          s.coreTemp = oven->interTemp();
  
          CookHistory::record(s);
af27778be   김태훈   HACCP 구현
693
          HACCP::manualStart();
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
694
695
696
697
698
699
700
701
  
          if (monitorLevel > 0 && oven->door())
          {
              monitorTriggered = true;
              monitor1.start();
          }
          else
              monitorTriggered = false;
f588aa273   김태훈   부가 기능 로직 추가
702
      }
bb26a0523   김태훈   소스 코드 정리
703
704
705
706
  }
  
  void ManualCookWindow::stop()
  {
ac60b5cec   김태훈   음향 효과 일부 적용 및 소스 ...
707
708
      if (oven->cooking())
          SoundPlayer::playStop();
bb26a0523   김태훈   소스 코드 정리
709
710
      oven->stop();
      startCookingTimer.stop();
af27778be   김태훈   HACCP 구현
711
      HACCP::done();
bb26a0523   김태훈   소스 코드 정리
712
  }
e00c6a2a9   김태훈   기능 추가 구현
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
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
762
763
  void ManualCookWindow::addFavorite()
  {
      ManualCookSetting s;
      s.mode = oven->mode();
      s.humidity = oven->humidity();
      s.temp = oven->temp();
      s.time = oven->time();
      s.fan = oven->fan();
      s.coreTempEnabled = oven->interTempEnabled();
      s.coreTemp = oven->interTemp();
  
      FavoriteNamePopup *p = new FavoriteNamePopup(this, s);
      p->showFullScreen();
  }
  
  void ManualCookWindow::jumpConfig()
  {
      stop();
  
      ConfigWindow *w = new ConfigWindow(MainWindow::getInstance());
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
      w->raise();
  
      MainWindow::jump(w);
  }
  
  void ManualCookWindow::jumpFavorites()
  {
      stop();
  
      PrimeWindow *w = new PrimeWindow(MainWindow::getInstance());
      w->setWindowModality(Qt::WindowModal);
      w->listFavorites();
      w->showFullScreen();
      w->raise();
  
      MainWindow::jump(w);
  }
  
  void ManualCookWindow::jumpWash()
  {
      stop();
  
      WashWindow *w = new WashWindow(MainWindow::getInstance());
      w->setWindowModality(Qt::WindowModal);
      w->showFullScreen();
      w->raise();
  
      MainWindow::jump(w);
  }
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
764
765
766
  void ManualCookWindow::onMonitor1Timeout()
  {
      SoundPlayer::playError1();
8a89c201e   김태훈   tr 추가
767
      ErrorPopupDlg *d = new ErrorPopupDlg(this, tr("문을 닫아주세요"), tr("조리 중 문 열림 시간 모니터링 1단계"));
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
768
769
770
771
772
773
774
775
776
      d->showFullScreen();
  
      if (monitorLevel > 1)
          monitor2.start();
  }
  
  void ManualCookWindow::onMonitor2Timeout()
  {
      SoundPlayer::playError1();
8a89c201e   김태훈   tr 추가
777
      ErrorPopupDlg *d = new ErrorPopupDlg(this, tr("문을 닫아주세요"), tr("조리 중 문 열림 시간 모니터링 2단계"));
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
778
779
780
781
782
783
784
785
786
      d->showFullScreen();
  
      if (monitorLevel > 2)
          monitor3.start();
  }
  
  void ManualCookWindow::onMonitor3Timeout()
  {
      SoundPlayer::playError1();
8a89c201e   김태훈   tr 추가
787
      ErrorPopupDlg *d = new ErrorPopupDlg(MainWindow::getInstance(), tr("문이 오래 열려있어 조리가 취소되었습니다"), tr("조리 중 문 열림 시간 모니터링 3단계"));
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
788
789
790
      d->showFullScreen();
      close();
  }
271dda4ae   김태훈   엔코더 구현
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
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
  void ManualCookWindow::onEncoderLeft()
  {
      QWidget *focused = focusWidget();
      if (focused == NULL)
          focusPreviousChild();
      else if (focused == this || focused->inherits("QPushButton"))
      {
          focusPreviousChild();
          focused = focusWidget();
  
          if (focused == ui->steamButton)
          {
              if (oven->mode() == Define::SteamMode)
                  focusPreviousChild();
          }
          else if (focused == ui->combiButton)
          {
              if (oven->mode() == Define::CombiMode)
                  focusPreviousChild();
          }
          else if (focused == ui->dryheatButton)
          {
              if (oven->mode() == Define::DryMode)
                  focusPreviousChild();
          }
      }
  }
  
  void ManualCookWindow::onEncoderRight()
  {
      QWidget *focused = focusWidget();
      if (focused == NULL)
          focusNextChild();
      else if (focused == this)
      {
          switch (oven->mode())
          {
          case Define::DryMode:
          case Define::SteamMode:
              ui->tempButton->setFocus();
              break;
          default:
              ui->humidityButton->setFocus();
          }
      }
      else if (focused->inherits("QPushButton"))
      {
          focusNextChild();
          focused = focusWidget();
  
          if (focused == ui->steamButton)
          {
              if (oven->mode() == Define::SteamMode)
                  focusNextChild();
          }
          else if (focused == ui->combiButton)
          {
              if (oven->mode() == Define::CombiMode)
                  focusNextChild();
          }
          else if (focused == ui->dryheatButton)
          {
              if (oven->mode() == Define::DryMode)
                  focusNextChild();
          }
      }
  }
  
  void ManualCookWindow::onEncoderClicked(QWidget *clicked)
  {
      QWidget *focused = clicked;
      if (focused == NULL)
          return;
  
      if (focused->inherits("QPushButton"))
      {
          QPushButton *pb = qobject_cast<QPushButton *>(focused);
          if (pb)
          {
              pb->click();
  
              if (pb == ui->steamButton || pb == ui->dryheatButton)
                  ui->tempButton->setFocus();
              else if (pb == ui->combiButton)
                  ui->humidityButton->setFocus();
          }
      }
      else if (focused->inherits("Slider"))
      {
          Slider *slider = qobject_cast<Slider *>(focused);
          if (slider)
          {
              if (slider->value() != slider->sliderPosition())
                  slider->setValue(slider->sliderPosition());
  
              if (slider == ui->humiditySlider)
                  ui->humidityButton->setFocus();
              else if (slider == ui->tempSlider)
                  ui->tempButton->setFocus();
              else if (slider == ui->timeSlider)
                  ui->timeButton->setFocus();
              else if (slider == ui->interTempSlider)
                  ui->interTempButton->setFocus();
          }
      }
  }
  
  void ManualCookWindow::focusHumidityButton()
  {
      if (focusWidget() == ui->humiditySlider)
      {
          oven->setHumidity(ui->humiditySlider->value());
          ui->humidityButton->setFocus();
      }
  }
  
  void ManualCookWindow::focusTempButton()
  {
      if (focusWidget() == ui->tempSlider)
      {
          oven->setTemp(ui->tempSlider->value());
          ui->tempButton->setFocus();
      }
  }
  
  void ManualCookWindow::focusTimeButton()
  {
      if (focusWidget() == ui->timeSlider)
      {
          if (ui->timeSlider->isSliderMoved())
              oven->setTime(sliderToTime(ui->timeSlider->value()));
          ui->timeButton->setFocus();
      }
  }
  
  void ManualCookWindow::focusInterTempButton()
  {
      if (focusWidget() == ui->interTempSlider)
      {
          oven->setInterTemp(ui->interTempSlider->value());
          ui->interTempButton->setFocus();
      }
  }
  
  void ManualCookWindow::focusAgain()
  {
      if (focused)
      {
          focused->setFocus();
          focused = NULL;
      }
  }
bb26a0523   김태훈   소스 코드 정리
943
944
  void ManualCookWindow::on_steamButton_clicked()
  {
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
945
      setOvenDefault(Define::SteamMode);
bb26a0523   김태훈   소스 코드 정리
946
947
948
949
  }
  
  void ManualCookWindow::on_combiButton_clicked()
  {
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
950
      setOvenDefault(Define::CombiMode);
bb26a0523   김태훈   소스 코드 정리
951
952
953
954
  }
  
  void ManualCookWindow::on_dryheatButton_clicked()
  {
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
955
      setOvenDefault(Define::DryMode);
bb26a0523   김태훈   소스 코드 정리
956
957
958
959
960
961
962
963
964
965
966
  }
  
  void ManualCookWindow::on_humidityButton_pressed()
  {
      showCurrentHumidityTimer.start();
  }
  
  void ManualCookWindow::on_humidityButton_released()
  {
      if (showCurrentHumidityTimer.isActive())
          showCurrentHumidityTimer.stop();
c598b01b2   김태훈   GUI 업데이트
967
      else
bb26a0523   김태훈   소스 코드 정리
968
          hideCurrentHumidity();
8c2952457   김태훈   응용 프로그램 추가
969
  }
bb26a0523   김태훈   소스 코드 정리
970
  void ManualCookWindow::on_tempButton_pressed()
8c2952457   김태훈   응용 프로그램 추가
971
  {
bb26a0523   김태훈   소스 코드 정리
972
973
      showCurrentTempTimer.start();
  }
8c2952457   김태훈   응용 프로그램 추가
974
bb26a0523   김태훈   소스 코드 정리
975
976
977
978
979
980
981
  void ManualCookWindow::on_tempButton_released()
  {
      if (showCurrentTempTimer.isActive())
          showCurrentTempTimer.stop();
      else
          hideCurrentTemp();
  }
271dda4ae   김태훈   엔코더 구현
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
  void ManualCookWindow::on_humidityButton_clicked()
  {
      ui->humiditySlider->setFocus();
  
      focusHumidityButtonTimer.start();
  }
  
  void ManualCookWindow::on_tempButton_clicked()
  {
      ui->tempSlider->setFocus();
  
      focusTempButtonTimer.start();
  }
  
  void ManualCookWindow::on_timeButton_clicked()
  {
      ui->timeSlider->setFocus();
  
      focusTimeButtonTimer.start();
  }
bb26a0523   김태훈   소스 코드 정리
1002
1003
1004
1005
1006
  void ManualCookWindow::on_interTempButton_clicked()
  {
      if (oven->interTempEnabled())
          oven->setInterTempEnabled(false);
      else
d35b8bcdf   김태훈   수동 요리의 중심 요리 설정 화...
1007
1008
1009
      {
          CoreTempSettingPopup *p = new CoreTempSettingPopup(this);
          p->show();
271dda4ae   김태훈   엔코더 구현
1010
1011
1012
  
          focused = ui->interTempButton;
          connect(p, SIGNAL(destroyed(QObject*)), SLOT(focusAgain()));
d35b8bcdf   김태훈   수동 요리의 중심 요리 설정 화...
1013
      }
8c2952457   김태훈   응용 프로그램 추가
1014
  }
bb26a0523   김태훈   소스 코드 정리
1015
  void ManualCookWindow::on_runStopButton_clicked()
8c2952457   김태훈   응용 프로그램 추가
1016
  {
bb26a0523   김태훈   소스 코드 정리
1017
      if (oven->cooking())
bb26a0523   김태훈   소스 코드 정리
1018
          stop();
cd74cf6ed   김태훈   엔코더 관련 디자인 변경 적용
1019
      else if (oven->time() > 0)
f588aa273   김태훈   부가 기능 로직 추가
1020
          start();
d75742e49   김태훈   음향 효과 개선
1021
1022
      else
          SoundPlayer::playClick();
cd74cf6ed   김태훈   엔코더 관련 디자인 변경 적용
1023
1024
  
      updateView();
bb26a0523   김태훈   소스 코드 정리
1025
1026
1027
1028
1029
1030
1031
1032
1033
  }
  
  void ManualCookWindow::on_fanButton_clicked()
  {
      int fan = oven->fan() + 1;
      if (fan > oven->maxFan())
          fan = oven->minFan();
  
      oven->setFan(fan);
8c2952457   김태훈   응용 프로그램 추가
1034
1035
1036
1037
  }
  
  void ManualCookWindow::on_preheatButton_clicked()
  {
bb26a0523   김태훈   소스 코드 정리
1038
      startCookingTimer.stop();
4fc65fb81   김태훈   GUI V0.1.6(이 버전으로...
1039
05f2a7552   김태훈   image 관리 구조 변경
1040
1041
1042
      PreheatPopup *p = new PreheatPopup(this, oven);
      p->setWindowModality(Qt::WindowModal);
      p->showFullScreen();
271dda4ae   김태훈   엔코더 구현
1043
1044
1045
  
      focused = ui->preheatButton;
      connect(p, SIGNAL(destroyed(QObject*)), SLOT(focusAgain()));
8c2952457   김태훈   응용 프로그램 추가
1046
1047
1048
1049
  }
  
  void ManualCookWindow::on_damperButton_clicked()
  {
c598b01b2   김태훈   GUI 업데이트
1050
      if (oven->damper())
d6ef50b78   김태훈   요청 사항 반영
1051
      {
c598b01b2   김태훈   GUI 업데이트
1052
          oven->closeDamper();
10d2268c2   김태훈   V1.5.01
1053
          showInfoText("OFF", ":/images/manual_button/damper_close.png");
d6ef50b78   김태훈   요청 사항 반영
1054
      }
8c2952457   김태훈   응용 프로그램 추가
1055
      else
d6ef50b78   김태훈   요청 사항 반영
1056
      {
c598b01b2   김태훈   GUI 업데이트
1057
          oven->openDamper();
10d2268c2   김태훈   V1.5.01
1058
          showInfoText("ON", ":/images/manual_button/damper_open.png");
d6ef50b78   김태훈   요청 사항 반영
1059
      }
8c2952457   김태훈   응용 프로그램 추가
1060
1061
1062
1063
  }
  
  void ManualCookWindow::on_humidificationButton_clicked()
  {
c598b01b2   김태훈   GUI 업데이트
1064
      if (oven->humidification())
d6ef50b78   김태훈   요청 사항 반영
1065
      {
c598b01b2   김태훈   GUI 업데이트
1066
          oven->stopHumidification();
10d2268c2   김태훈   V1.5.01
1067
          showInfoText("OFF", ":/images/manual_button/side_nozzle_close.png");
d6ef50b78   김태훈   요청 사항 반영
1068
      }
8c2952457   김태훈   응용 프로그램 추가
1069
      else
d6ef50b78   김태훈   요청 사항 반영
1070
      {
a8e17f05f   김태훈   고객사 요청 반영
1071
          oven->startHumidification(5);
10d2268c2   김태훈   V1.5.01
1072
          showInfoText("ON", ":/images/manual_button/side_nozzle_open.png");
d6ef50b78   김태훈   요청 사항 반영
1073
      }
8c2952457   김태훈   응용 프로그램 추가
1074
1075
1076
1077
  }
  
  void ManualCookWindow::on_repeatButton_clicked()
  {
213c24135   김태훈   수동 요리 반복 추가
1078
1079
1080
      if (repeat)
      {
          repeat = false;
10d2268c2   김태훈   V1.5.01
1081
          showInfoText("OFF", ":/images/manual_button/repeat.png");
07441dbd3   김태훈   엔코더 관련 디자인 변경 대비
1082
          updateView();
213c24135   김태훈   수동 요리 반복 추가
1083
1084
1085
1086
      }
      else
      {
          repeat = true;
10d2268c2   김태훈   V1.5.01
1087
          showInfoText("ON", ":/images/manual_button/repeat_ov.png");
07441dbd3   김태훈   엔코더 관련 디자인 변경 대비
1088
          updateView();
213c24135   김태훈   수동 요리 반복 추가
1089
1090
1091
1092
1093
1094
1095
          repeatSetting.mode = oven->mode();
          repeatSetting.humidity = oven->humidity();
          repeatSetting.temp= oven->temp();
          repeatSetting.time = oven->time();
          repeatSetting.coreTempEnabled = oven->interTempEnabled();
          repeatSetting.coreTemp = oven->interTemp();
      }
8c2952457   김태훈   응용 프로그램 추가
1096
1097
1098
1099
  }
  
  void ManualCookWindow::on_cooldownButton_clicked()
  {
bb26a0523   김태훈   소스 코드 정리
1100
      startCookingTimer.stop();
cfc2fcc35   김태훈   쿨다운 팝업 추가
1101
8d6b74605   김태훈   세척 시작 전 온도 검사 후 쿨다운
1102
      CooldownPopup *p = new CooldownPopup(this, 30);
cfc2fcc35   김태훈   쿨다운 팝업 추가
1103
1104
      p->setWindowModality(Qt::WindowModal);
      p->showFullScreen();
271dda4ae   김태훈   엔코더 구현
1105
1106
1107
  
      focused = ui->cooldownButton;
      connect(p, SIGNAL(destroyed(QObject*)), SLOT(focusAgain()));
8c2952457   김태훈   응용 프로그램 추가
1108
1109
1110
1111
  }
  
  void ManualCookWindow::on_reserveButton_clicked()
  {
0e279295f   김태훈   수동 요리 구현
1112
1113
1114
1115
1116
1117
1118
1119
      if (oven->time() > 0)
      {
          startCookingTimer.stop();
  
          ReserveTimePopup *p = new ReserveTimePopup(this);
          connect(p, SIGNAL(timeout()), SLOT(start()));
          connect(p, SIGNAL(canceled()), &startCookingTimer, SLOT(start()));
          p->showFullScreen();
271dda4ae   김태훈   엔코더 구현
1120
1121
1122
  
          focused = ui->reserveButton;
          connect(p, SIGNAL(destroyed(QObject*)), SLOT(focusAgain()));
0e279295f   김태훈   수동 요리 구현
1123
      }
8c2952457   김태훈   응용 프로그램 추가
1124
  }
213c24135   김태훈   수동 요리 반복 추가
1125
  void ManualCookWindow::on_favoriteButton_clicked()
8c2952457   김태훈   응용 프로그램 추가
1126
  {
599b9c350   고영탁   부가기능 복구
1127
1128
      if (oven->cooking())
          return;
f588aa273   김태훈   부가 기능 로직 추가
1129
599b9c350   고영탁   부가기능 복구
1130
1131
      ConfirmPopup *p = new ConfirmPopup(this, tr("즐겨찾기 항목에 추가하시겠습니까?"));
      p->showFullScreen();
8c2952457   김태훈   응용 프로그램 추가
1132
599b9c350   고영탁   부가기능 복구
1133
1134
1135
      focused = ui->favoriteButton;
      connect(p, SIGNAL(rejected()), SLOT(focusAgain()));
      connect(p, SIGNAL(accepted()), SLOT(addFavorite()));
f588aa273   김태훈   부가 기능 로직 추가
1136
599b9c350   고영탁   부가기능 복구
1137
1138
1139
1140
1141
      if (startCookingTimer.isActive())
      {
          startCookingTimer.stop();
          connect(p, SIGNAL(rejected()), &startCookingTimer, SLOT(start()));
      }
8c2952457   김태훈   응용 프로그램 추가
1142
  }
bb26a0523   김태훈   소스 코드 정리
1143
bb26a0523   김태훈   소스 코드 정리
1144
1145
  void ManualCookWindow::on_goFrontStackButton_clicked()
  {
271dda4ae   김태훈   엔코더 구현
1146
1147
1148
      showFrontButtons = !showFrontButtons;
  
      updateView();
bb26a0523   김태훈   소스 코드 정리
1149
1150
1151
1152
1153
1154
1155
  }
  
  void ManualCookWindow::on_backButton_clicked()
  {
      stop();
      close();
  }
f588aa273   김태훈   부가 기능 로직 추가
1156
e00c6a2a9   김태훈   기능 추가 구현
1157
1158
1159
1160
1161
1162
1163
1164
  void ManualCookWindow::on_configButton_clicked()
  {
      if (oven->cooking())
      {
          ConfirmPopup *p = new ConfirmPopup(this, tr("요리가 중단되고 환경 설정 모드로 들어갑니다. 진행할까요?"));
          p->showFullScreen();
  
          connect(p, SIGNAL(accepted()), SLOT(jumpConfig()));
271dda4ae   김태훈   엔코더 구현
1165
1166
1167
  
          focused = ui->configButton;
          connect(p, SIGNAL(destroyed(QObject*)), SLOT(focusAgain()));
e00c6a2a9   김태훈   기능 추가 구현
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
      }
      else
      {
          ConfigWindow *w = new ConfigWindow(MainWindow::getInstance());
          w->setWindowModality(Qt::WindowModal);
          w->showFullScreen();
          w->raise();
  
          MainWindow::jump(w);
      }
  }
  
  void ManualCookWindow::on_favoritesButton_clicked()
  {
599b9c350   고영탁   부가기능 복구
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
      if (oven->cooking())
      {
          ConfirmPopup *p = new ConfirmPopup(this, tr("요리가 중단되고 즐겨찾기 모드로 들어갑니다. 진행할까요?"));
          p->showFullScreen();
  
          connect(p, SIGNAL(accepted()), SLOT(jumpFavorites()));
  
          focused = ui->favoritesButton;
          connect(p, SIGNAL(destroyed(QObject*)), SLOT(focusAgain()));
      }
      else
      {
          PrimeWindow *w = new PrimeWindow(MainWindow::getInstance());
          w->setWindowModality(Qt::WindowModal);
          w->listFavorites();
          w->showFullScreen();
          w->raise();
  
          MainWindow::jump(w);
      }
e00c6a2a9   김태훈   기능 추가 구현
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
  }
  
  void ManualCookWindow::on_washButton_clicked()
  {
      if (oven->cooking())
      {
          ConfirmPopup *p = new ConfirmPopup(this, tr("요리가 중단되고 자동 세척 모드로 들어갑니다. 진행할까요?"));
          p->showFullScreen();
  
          connect(p, SIGNAL(accepted()), SLOT(jumpWash()));
271dda4ae   김태훈   엔코더 구현
1212
1213
1214
  
          focused = ui->washButton;
          connect(p, SIGNAL(destroyed(QObject*)), SLOT(focusAgain()));
e00c6a2a9   김태훈   기능 추가 구현
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
      }
      else
      {
          WashWindow *w = new WashWindow(MainWindow::getInstance());
          w->setWindowModality(Qt::WindowModal);
          w->showFullScreen();
          w->raise();
  
          MainWindow::jump(w);
      }
  }
  
  void ManualCookWindow::on_helpButton_clicked()
f588aa273   김태훈   부가 기능 로직 추가
1228
  {
1342af7b3   김태훈   도움말 버튼 연결
1229
1230
1231
      ManualViewerDlg* dlg = new ManualViewerDlg(this, MANUAL_COOK_PAGE);
      dlg->showFullScreen();
      dlg->raise();
f588aa273   김태훈   부가 기능 로직 추가
1232
  }
a2de3cbfc   김태훈   수동 요리에 새 슬라이더 적용
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
  
  void ManualCookWindow::on_timeSlider_valueChanged()
  {
      oven->setTime(sliderToTime(ui->timeSlider->value()));
  }
  
  int ManualCookWindow::sliderToTime(int value)
  {
      if (value <= 180)
          return value * 60;
      if (value <= 270)
          return 180 * 60 + (value - 180) * 2 * 60;
      return 360 * 60 + (value - 270) * 15 * 60;
  }
  
  int ManualCookWindow::timeToSlider(int secs)
  {
      if (secs <= 180 * 60)
271dda4ae   김태훈   엔코더 구현
1251
          return qCeil((qreal) secs / 60);
a2de3cbfc   김태훈   수동 요리에 새 슬라이더 적용
1252
      if (secs <= 360 * 60)
271dda4ae   김태훈   엔코더 구현
1253
1254
          return 180 + qCeil((qreal) (secs - 180 * 60) / 2 / 60);
      return 270 + qCeil((qreal) (secs - 360 * 60) / 15 / 60);
a2de3cbfc   김태훈   수동 요리에 새 슬라이더 적용
1255
  }