Blame view

app/gui/oven_control/manualcookwindow.cpp 32.8 KB
8c2952457   김태훈   응용 프로그램 추가
1
2
3
4
5
6
  #include "manualcookwindow.h"
  #include "ui_manualcookwindow.h"
  
  #include <QSignalMapper>
  #include <QTimer>
  #include <QtDebug>
ac60b5cec   김태훈   음향 효과 일부 적용 및 소스 ...
7
  #include "soundplayer.h"
05f2a7552   김태훈   image 관리 구조 변경
8
  #include "preheatpopup.h"
cfc2fcc35   김태훈   쿨다운 팝업 추가
9
  #include "cooldownpopup.h"
f588aa273   김태훈   부가 기능 로직 추가
10
11
12
  #include "cookhistory.h"
  #include "favoritenamepopup.h"
  #include "confirmpopup.h"
2bfd3a050   김태훈   환경 설정 대응
13
14
  #include "stringer.h"
  #include "config.h"
d35b8bcdf   김태훈   수동 요리의 중심 요리 설정 화...
15
  #include "coretempsettingpopup.h"
0e279295f   김태훈   수동 요리 구현
16
17
  #include "reservetimepopup.h"
  #include "reservedtimepopup.h"
e00c6a2a9   김태훈   기능 추가 구현
18
19
20
21
  #include "mainwindow.h"
  #include "configwindow.h"
  #include "primewindow.h"
  #include "washwindow.h"
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
22
  #include "errorpopupdlg.h"
05f2a7552   김태훈   image 관리 구조 변경
23
bb26a0523   김태훈   소스 코드 정리
24
  #include <QTime>
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
25
  ManualCookWindow::ManualCookWindow(QWidget *parent, Define::Mode mode) :
8c2952457   김태훈   응용 프로그램 추가
26
      QMainWindow(parent),
213c24135   김태훈   수동 요리 반복 추가
27
28
      ui(new Ui::ManualCookWindow),
      repeat(false)
8c2952457   김태훈   응용 프로그램 추가
29
30
  {
      ui->setupUi(this);
6f96c947a   김태훈   GUI 0.1.4
31
      ui->clockContainer->setParent(ui->upperStack);
cfc2fcc35   김태훈   쿨다운 팝업 추가
32
      ui->closeDoorWidget->setParent(ui->upperStack);
6f96c947a   김태훈   GUI 0.1.4
33
      setAttribute(Qt::WA_DeleteOnClose);
3f52600cc   김태훈   소스 코드 구조 개선
34
      oven = Oven::getInstance();
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
35
a2de3cbfc   김태훈   수동 요리에 새 슬라이더 적용
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
      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   김태훈   현재 습도/온도 값을 볼 때 슬...
70
71
72
73
74
75
76
77
78
      lastViewHumidity = -1;
      lastViewTemp = -1;
      lastViewTime = -1;
      lastViewInterTemp = -1;
      lastViewInterTempEnabled = !oven->interTempEnabled();
      lastViewCooking = false;
      lastViewDamper = false;
      lastViewHumidification = false;
      lastViewFan = -1;
097e5e14a   김태훈   프로그래밍 모드 세부 사항 구현
79
      lastCheckedCooking = false;
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
80
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
      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   김태훈   응용 프로그램 추가
99
100
      connect(ui->humiditySlider, SIGNAL(valueChanged(int)), oven, SLOT(setHumidity(int)));
      connect(ui->tempSlider, SIGNAL(valueChanged(int)), oven, SLOT(setTemp(int)));
bb26a0523   김태훈   소스 코드 정리
101
      connect(ui->timeSlider, SIGNAL(valueChanged(int)), &startCookingTimer, SLOT(start()));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
102
      connect(ui->timeSlider, SIGNAL(valueChanged(int)), this, SLOT(updateView()));
8c2952457   김태훈   응용 프로그램 추가
103
      connect(ui->interTempSlider, SIGNAL(valueChanged(int)), oven, SLOT(setInterTemp(int)));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
104
105
106
107
      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   김태훈   응용 프로그램 추가
108
bb26a0523   김태훈   소스 코드 정리
109
      startCookingTimer.setSingleShot(true);
5228da630   김태훈   딜레이 변경
110
      startCookingTimer.setInterval(3000);
bb26a0523   김태훈   소스 코드 정리
111
112
113
      connect(&startCookingTimer, SIGNAL(timeout()), SLOT(start()));
  
      showCurrentHumidityTimer.setSingleShot(true);
5228da630   김태훈   딜레이 변경
114
      showCurrentHumidityTimer.setInterval(1000);
bb26a0523   김태훈   소스 코드 정리
115
116
117
      connect(&showCurrentHumidityTimer, SIGNAL(timeout()), SLOT(showCurrentHumidity()));
  
      showCurrentTempTimer.setSingleShot(true);
5228da630   김태훈   딜레이 변경
118
      showCurrentTempTimer.setInterval(1000);
bb26a0523   김태훈   소스 코드 정리
119
      connect(&showCurrentTempTimer, SIGNAL(timeout()), SLOT(showCurrentTemp()));
8c2952457   김태훈   응용 프로그램 추가
120
271dda4ae   김태훈   엔코더 구현
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
      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   김태훈   중심 온도 설정에 엔코더 관련 ...
141
142
143
144
      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   김태훈   수동 요리에 새 슬라이더 적용
145
      connect(oven, SIGNAL(changed(Oven*)), this, SLOT(onOvenUpdated(Oven*)));
bb26a0523   김태훈   소스 코드 정리
146
      oven->setDefault(mode);
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
147
148
      connect(&updateViewTimer, SIGNAL(timeout()), SLOT(updateView()));
      updateViewTimer.start(100);
2bfd3a050   김태훈   환경 설정 대응
149
bbd7d8f29   김태훈   버튼 음향 추가
150
      foreach (QPushButton *button, findChildren<QPushButton *>())
d75742e49   김태훈   음향 효과 개선
151
152
          if (button != ui->runStopButton)
              connect(button, &QPushButton::pressed, SoundPlayer::playClick);
d35b8bcdf   김태훈   수동 요리의 중심 요리 설정 화...
153
154
  
      QTimer::singleShot(0, this, SLOT(setupAnimation()));
271dda4ae   김태훈   엔코더 구현
155
156
  
      setFocus();
bb26a0523   김태훈   소스 코드 정리
157
  }
f588aa273   김태훈   부가 기능 로직 추가
158
159
160
161
162
163
164
165
166
167
168
169
170
171
  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   김태훈   소스 코드 정리
172
173
  ManualCookWindow::~ManualCookWindow()
  {
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
174
      stop();
bb26a0523   김태훈   소스 코드 정리
175
176
      delete ui;
  }
271dda4ae   김태훈   엔코더 구현
177
178
179
180
  void ManualCookWindow::keyPressEvent(QKeyEvent *event)
  {
      switch (event->key())
      {
01249f413   김태훈   엔코더 방향 반전. 하드웨어가 변경됨
181
      case 0x01000032:    // Turn left
271dda4ae   김태훈   엔코더 구현
182
183
184
185
186
187
188
189
190
191
192
193
194
195
          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   김태훈   엔코더 방향 반전. 하드웨어가 변경됨
196
      case 0x01000030:    // Turn right
271dda4ae   김태훈   엔코더 구현
197
198
199
200
201
202
203
204
205
          onEncoderRight();
          break;
      }
  }
  
  void ManualCookWindow::keyReleaseEvent(QKeyEvent *event)
  {
      switch (event->key())
      {
01249f413   김태훈   엔코더 방향 반전. 하드웨어가 변경됨
206
      case 0x01000032:    // Turn left
271dda4ae   김태훈   엔코더 구현
207
208
209
          onEncoderLeft();
          break;
      case 0x01000031:    // Push
ec8811c60   김태훈   엔코더 동작 개선
210
          if (pushed == ui->humidityButton)
271dda4ae   김태훈   엔코더 구현
211
              on_humidityButton_released();
ec8811c60   김태훈   엔코더 동작 개선
212
          else if (pushed == ui->tempButton)
271dda4ae   김태훈   엔코더 구현
213
214
215
216
217
218
219
              on_tempButton_released();
  
          if (focusWidget() == pushed)
              onEncoderClicked(pushed);
  
          pushed = NULL;
          break;
01249f413   김태훈   엔코더 방향 반전. 하드웨어가 변경됨
220
      case 0x01000030:    // Turn right
271dda4ae   김태훈   엔코더 구현
221
222
223
224
          onEncoderRight();
          break;
      }
  }
bb26a0523   김태훈   소스 코드 정리
225
226
  void ManualCookWindow::setupAnimation()
  {
f31d412c6   김태훈   수동 요리 기능 추가
227
228
229
230
231
232
233
234
235
236
      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   김태훈   쿨다운 팝업 추가
237
      ui->openDoorAnimation->load(":/images/animation/door_big_01.png");
f31d412c6   김태훈   수동 요리 기능 추가
238
239
240
241
242
243
244
245
      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   김태훈   쿨다운 팝업 추가
246
      ui->openDoorAnimation->start(300);
8c2952457   김태훈   응용 프로그램 추가
247
  }
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
248
  void ManualCookWindow::updateView()
8c2952457   김태훈   응용 프로그램 추가
249
  {
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
250
      switch (oven->mode())
213c24135   김태훈   수동 요리 반복 추가
251
      {
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
252
      case Define::DryMode:
271dda4ae   김태훈   엔코더 구현
253
254
255
256
          if (ui->steamButton->isChecked())
              ui->steamButton->setChecked(false);
          if (ui->combiButton->isChecked())
              ui->combiButton->setChecked(false);
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
257
258
259
260
261
262
          if (!ui->dryheatButton->isChecked())
              ui->dryheatButton->setChecked(true);
          break;
      case Define::SteamMode:
          if (!ui->steamButton->isChecked())
              ui->steamButton->setChecked(true);
271dda4ae   김태훈   엔코더 구현
263
264
265
266
          if (ui->combiButton->isChecked())
              ui->combiButton->setChecked(false);
          if (ui->dryheatButton->isChecked())
              ui->dryheatButton->setChecked(false);
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
267
268
          break;
      case Define::CombiMode:
271dda4ae   김태훈   엔코더 구현
269
270
          if (ui->steamButton->isChecked())
              ui->steamButton->setChecked(false);
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
271
272
          if (!ui->combiButton->isChecked())
              ui->combiButton->setChecked(true);
271dda4ae   김태훈   엔코더 구현
273
274
          if (ui->dryheatButton->isChecked())
              ui->dryheatButton->setChecked(false);
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
275
276
277
          break;
      default:
          break;
213c24135   김태훈   수동 요리 반복 추가
278
      }
8c2952457   김태훈   응용 프로그램 추가
279
9c1ea4a13   김태훈   포커스 디자인 변경 일부 적용
280
281
282
283
      QWidget *focused = focusWidget();
      ui->humidityButton->setChecked(focused == ui->humiditySlider);
      ui->tempButton->setChecked(focused == ui->tempSlider);
      ui->timeButton->setChecked(focused == ui->timeSlider);
8c2952457   김태훈   응용 프로그램 추가
284
285
286
      int humidity;
      if (showCurrentHumidity_)
          humidity = oven->currentHumidity();
271dda4ae   김태훈   엔코더 구현
287
      else if (ui->humiditySlider->isSliderDown() || focusWidget() == ui->humiditySlider)
8c2952457   김태훈   응용 프로그램 추가
288
289
290
          humidity = ui->humiditySlider->sliderPosition();
      else
          humidity = oven->humidity();
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
291
292
293
294
295
296
297
298
299
300
301
302
      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   김태훈   응용 프로그램 추가
303
304
305
306
  
      int temp;
      if (showCurrentTemp_)
          temp = oven->currentTemp();
271dda4ae   김태훈   엔코더 구현
307
      else if (ui->tempSlider->isSliderDown() || focusWidget() == ui->tempSlider)
8c2952457   김태훈   응용 프로그램 추가
308
309
310
          temp = ui->tempSlider->sliderPosition();
      else
          temp = oven->temp();
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
311
312
313
      if (temp != lastViewTemp)
      {
          lastViewTemp = temp;
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
314
315
          ui->tempLabel->setText(Stringer::temperature(temp, Stringer::fontSize14));
      }
8c2952457   김태훈   응용 프로그램 추가
316
a2de3cbfc   김태훈   수동 요리에 새 슬라이더 적용
317
318
319
320
321
      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   김태훈   엔코더 구현
322
323
324
      int msecs = oven->msecs();
      if (ui->timeSlider->isSliderMoved())
          ui->timeLabel->setText(Stringer::remainingTime(sliderToTime(ui->timeSlider->sliderPosition()) * 1000, Stringer::fontSize14));
8c2952457   김태훈   응용 프로그램 추가
325
      else
271dda4ae   김태훈   엔코더 구현
326
          ui->timeLabel->setText(Stringer::remainingTime(msecs, Stringer::fontSize14));
8c2952457   김태훈   응용 프로그램 추가
327
271dda4ae   김태훈   엔코더 구현
328
      if (focusWidget() != ui->timeSlider)
8c2952457   김태훈   응용 프로그램 추가
329
      {
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
330
          bool old = ui->timeSlider->blockSignals(true);
a2de3cbfc   김태훈   수동 요리에 새 슬라이더 적용
331
          ui->timeSlider->setSliderPosition(timeToSlider(msecs / 1000));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
332
          ui->timeSlider->blockSignals(old);
8c2952457   김태훈   응용 프로그램 추가
333
      }
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
334
      int interTemp;
271dda4ae   김태훈   엔코더 구현
335
      if (ui->interTempSlider->isSliderDown() || focusWidget() == ui->interTempSlider)
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
336
337
338
          interTemp = ui->interTempSlider->sliderPosition();
      else
          interTemp = oven->interTemp();
8c2952457   김태훈   응용 프로그램 추가
339
27843914b   김태훈   중심 온도 설정에 엔코더 관련 ...
340
341
342
343
344
345
346
347
      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   김태훈   수동 요리 화면 동작 개선
348
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
349
      bool interTempEnabled = oven->interTempEnabled();
27843914b   김태훈   중심 온도 설정에 엔코더 관련 ...
350
      if (interTempEnabled != lastViewInterTempEnabled)
8c2952457   김태훈   응용 프로그램 추가
351
      {
27843914b   김태훈   중심 온도 설정에 엔코더 관련 ...
352
          lastViewInterTempEnabled = interTempEnabled;
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
353
          if (interTempEnabled)
27843914b   김태훈   중심 온도 설정에 엔코더 관련 ...
354
              ui->interTempButton->setStyleSheet(interTempButtonStyleSheet.arg(":/images/slider_icon/core_temp_enabled.png"));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
355
          else
27843914b   김태훈   중심 온도 설정에 엔코더 관련 ...
356
              ui->interTempButton->setStyleSheet(interTempButtonStyleSheet.arg(":/images/slider_icon/core_temp.png"));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
357
      }
c598b01b2   김태훈   GUI 업데이트
358
27843914b   김태훈   중심 온도 설정에 엔코더 관련 ...
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
      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   김태훈   엔코더 관련 디자인 변경 적용
374
      ui->runStopButton->setChecked(oven->cooking());
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
375
271dda4ae   김태훈   엔코더 구현
376
      if (showFrontButtons)
8c2952457   김태훈   응용 프로그램 추가
377
      {
271dda4ae   김태훈   엔코더 구현
378
379
380
381
382
          ui->preheatButton->show();
          ui->damperButton->show();
          ui->humidificationButton->show();
          if (oven->cooking())
              ui->repeatButton->show();
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
383
          else
271dda4ae   김태훈   엔코더 구현
384
              ui->repeatButton->hide();
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
385
271dda4ae   김태훈   엔코더 구현
386
387
388
389
390
391
          ui->cooldownButton->hide();
          ui->fanButton->hide();
          ui->reserveButton->hide();
          ui->favoriteButton->hide();
      }
      else
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
392
      {
271dda4ae   김태훈   엔코더 구현
393
394
395
396
          ui->preheatButton->hide();
          ui->damperButton->hide();
          ui->humidificationButton->hide();
          ui->repeatButton->hide();
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
397
271dda4ae   김태훈   엔코더 구현
398
399
400
401
402
403
404
          ui->cooldownButton->show();
          ui->fanButton->show();
          if (oven->cooking())
          {
              ui->reserveButton->hide();
              ui->favoriteButton->hide();
          }
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
405
          else
271dda4ae   김태훈   엔코더 구현
406
407
408
409
          {
              ui->reserveButton->show();
              ui->favoriteButton->show();
          }
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
410
      }
271dda4ae   김태훈   엔코더 구현
411
412
      bool damper = oven->damper();
      ui->damperButton->setChecked(damper);
271dda4ae   김태훈   엔코더 구현
413
414
415
  
      bool humidification = oven->humidification();
      ui->humidificationButton->setChecked(humidification);
271dda4ae   김태훈   엔코더 구현
416
b7ae9e830   김태훈   엔코더 관련 디자인 변경 시범 적용
417
418
419
      QString fanStyleSheet("\
  QPushButton { background-image: url(%1); }\
  QPushButton:focus { background-image: url(%2); }");
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
420
421
422
423
424
425
426
427
      int fan = oven->fan();
      if (fan != lastViewFan)
      {
          lastViewFan = fan;
  
          switch (fan)
          {
          case 1:
b7ae9e830   김태훈   엔코더 관련 디자인 변경 시범 적용
428
429
430
              ui->fanButton->setStyleSheet(fanStyleSheet
                                           .arg(":/images/manual_button/fan_1.png")
                                           .arg(":/images/manual_button/013_sys_icon_06_active.png"));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
431
432
              break;
          case 2:
b7ae9e830   김태훈   엔코더 관련 디자인 변경 시범 적용
433
434
435
              ui->fanButton->setStyleSheet(fanStyleSheet
                                           .arg(":/images/manual_button/fan_2.png")
                                           .arg(":/images/manual_button/013_sys_icon_06_01_active.png"));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
436
437
              break;
          case 3:
b7ae9e830   김태훈   엔코더 관련 디자인 변경 시범 적용
438
439
440
              ui->fanButton->setStyleSheet(fanStyleSheet
                                           .arg(":/images/manual_button/fan_3.png")
                                           .arg(":/images/manual_button/013_sys_icon_06_02_active.png"));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
441
442
              break;
          case 4:
b7ae9e830   김태훈   엔코더 관련 디자인 변경 시범 적용
443
444
445
              ui->fanButton->setStyleSheet(fanStyleSheet
                                           .arg(":/images/manual_button/fan_4.png")
                                           .arg(":/images/manual_button/013_sys_icon_06_03_active.png"));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
446
447
              break;
          case 5:
b7ae9e830   김태훈   엔코더 관련 디자인 변경 시범 적용
448
449
450
              ui->fanButton->setStyleSheet(fanStyleSheet
                                           .arg(":/images/manual_button/fan_5.png")
                                           .arg(":/images/manual_button/013_sys_icon_06_04_active.png"));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
451
452
              break;
          default:
b7ae9e830   김태훈   엔코더 관련 디자인 변경 시범 적용
453
454
455
              ui->fanButton->setStyleSheet(fanStyleSheet
                                           .arg(":/images/manual_button/fan_6.png")
                                           .arg(":/images/manual_button/013_sys_icon_06_active.png"));
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
456
457
              break;
          }
8c2952457   김태훈   응용 프로그램 추가
458
      }
07441dbd3   김태훈   엔코더 관련 디자인 변경 대비
459
      ui->repeatButton->setChecked(repeat);
f31d412c6   김태훈   수동 요리 기능 추가
460
461
462
463
464
465
466
      if (done)
      {
          if (oven->door())
              ui->upperStack->setCurrentIndex(0); // Clock
          else
              ui->upperStack->setCurrentIndex(2); // Open Door
      }
cfc2fcc35   김태훈   쿨다운 팝업 추가
467
      else
f31d412c6   김태훈   수동 요리 기능 추가
468
469
470
471
472
473
      {
          if (oven->paused() && !oven->cooldown() && oven->door())
              ui->upperStack->setCurrentIndex(1); // Close Door
          else
              ui->upperStack->setCurrentIndex(0); // Clock
      }
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
  }
  
  void ManualCookWindow::showCurrentHumidity()
  {
      showCurrentHumidity_ = true;
      updateView();
  }
  
  void ManualCookWindow::hideCurrentHumidity()
  {
      showCurrentHumidity_ = false;
      updateView();
  }
  
  void ManualCookWindow::showCurrentTemp()
  {
      showCurrentTemp_ = true;
      updateView();
  }
  
  void ManualCookWindow::hideCurrentTemp()
  {
      showCurrentTemp_ = false;
      updateView();
  }
  
  void ManualCookWindow::onOvenUpdated(Oven *oven)
  {
      updateView();
  
      if (oven->interTempEnabled() && oven->currentInterTemp() >= oven->interTemp())
f31d412c6   김태훈   수동 요리 기능 추가
505
506
      {
          done = true;
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
507
          stop();
f31d412c6   김태훈   수동 요리 기능 추가
508
      }
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
509
510
511
512
  
      if (repeat && !oven->cooking())
      {
          repeat = false;
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
513
514
515
516
517
518
          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   김태훈   엔코더 관련 디자인 변경 대비
519
520
  
          updateView();
7c415d2f7   김태훈   현재 습도/온도 값을 볼 때 슬...
521
      }
097e5e14a   김태훈   프로그래밍 모드 세부 사항 구현
522
523
524
525
526
      else if (lastCheckedCooking && !oven->cooking()){
          if ((oven->interTempEnabled() && oven->currentInterTemp() >= oven->interTemp())
                  || oven->time() == 0)
          {
              lastCheckedCooking = oven->cooking();
f31d412c6   김태훈   수동 요리 기능 추가
527
              done = true;
097e5e14a   김태훈   프로그래밍 모드 세부 사항 구현
528
529
          }
      }
f31d412c6   김태훈   수동 요리 기능 추가
530
531
      if (done && oven->door())
          done = false;
097e5e14a   김태훈   프로그래밍 모드 세부 사항 구현
532
      lastCheckedCooking = oven->cooking();
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
  
      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   김태훈   응용 프로그램 추가
550
  }
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
551
  void ManualCookWindow::setOvenDefault(Define::Mode mode)
8c2952457   김태훈   응용 프로그램 추가
552
  {
bb26a0523   김태훈   소스 코드 정리
553
554
555
      stop();
  
      oven->setDefault(mode);
bb26a0523   김태훈   소스 코드 정리
556
557
558
559
  }
  
  void ManualCookWindow::start()
  {
bbd7d8f29   김태훈   버튼 음향 추가
560
561
      if (oven->cooking())
          return;
f588aa273   김태훈   부가 기능 로직 추가
562
563
      if (oven->time() > 0)
      {
f31d412c6   김태훈   수동 요리 기능 추가
564
          done = false;
c6dd03260   김태훈   요리 시작/종료 관련 음향 효과...
565
          SoundPlayer::playStart();
f588aa273   김태훈   부가 기능 로직 추가
566
567
568
569
          if (startCookingTimer.isActive())
              startCookingTimer.stop();
  
          oven->startCooking();
f588aa273   김태훈   부가 기능 로직 추가
570
571
572
573
574
575
576
577
578
579
580
  
          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);
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
581
582
583
584
585
586
587
588
  
          if (monitorLevel > 0 && oven->door())
          {
              monitorTriggered = true;
              monitor1.start();
          }
          else
              monitorTriggered = false;
f588aa273   김태훈   부가 기능 로직 추가
589
      }
bb26a0523   김태훈   소스 코드 정리
590
591
592
593
  }
  
  void ManualCookWindow::stop()
  {
ac60b5cec   김태훈   음향 효과 일부 적용 및 소스 ...
594
595
      if (oven->cooking())
          SoundPlayer::playStop();
bb26a0523   김태훈   소스 코드 정리
596
597
      oven->stop();
      startCookingTimer.stop();
bb26a0523   김태훈   소스 코드 정리
598
  }
e00c6a2a9   김태훈   기능 추가 구현
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
  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   김태훈   적재 / 조리 중 문 열림 시간...
650
651
652
  void ManualCookWindow::onMonitor1Timeout()
  {
      SoundPlayer::playError1();
8a89c201e   김태훈   tr 추가
653
      ErrorPopupDlg *d = new ErrorPopupDlg(this, tr("문을 닫아주세요"), tr("조리 중 문 열림 시간 모니터링 1단계"));
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
654
655
656
657
658
659
660
661
662
      d->showFullScreen();
  
      if (monitorLevel > 1)
          monitor2.start();
  }
  
  void ManualCookWindow::onMonitor2Timeout()
  {
      SoundPlayer::playError1();
8a89c201e   김태훈   tr 추가
663
      ErrorPopupDlg *d = new ErrorPopupDlg(this, tr("문을 닫아주세요"), tr("조리 중 문 열림 시간 모니터링 2단계"));
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
664
665
666
667
668
669
670
671
672
      d->showFullScreen();
  
      if (monitorLevel > 2)
          monitor3.start();
  }
  
  void ManualCookWindow::onMonitor3Timeout()
  {
      SoundPlayer::playError1();
8a89c201e   김태훈   tr 추가
673
      ErrorPopupDlg *d = new ErrorPopupDlg(MainWindow::getInstance(), tr("문이 오래 열려있어 조리가 취소되었습니다"), tr("조리 중 문 열림 시간 모니터링 3단계"));
ea536cd1d   김태훈   적재 / 조리 중 문 열림 시간...
674
675
676
      d->showFullScreen();
      close();
  }
271dda4ae   김태훈   엔코더 구현
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
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
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
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
  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   김태훈   소스 코드 정리
829
830
  void ManualCookWindow::on_steamButton_clicked()
  {
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
831
      setOvenDefault(Define::SteamMode);
bb26a0523   김태훈   소스 코드 정리
832
833
834
835
  }
  
  void ManualCookWindow::on_combiButton_clicked()
  {
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
836
      setOvenDefault(Define::CombiMode);
bb26a0523   김태훈   소스 코드 정리
837
838
839
840
  }
  
  void ManualCookWindow::on_dryheatButton_clicked()
  {
d0cfbd177   김태훈   GUI V0.1.10 (이 버전...
841
      setOvenDefault(Define::DryMode);
bb26a0523   김태훈   소스 코드 정리
842
843
844
845
846
847
848
849
850
851
852
  }
  
  void ManualCookWindow::on_humidityButton_pressed()
  {
      showCurrentHumidityTimer.start();
  }
  
  void ManualCookWindow::on_humidityButton_released()
  {
      if (showCurrentHumidityTimer.isActive())
          showCurrentHumidityTimer.stop();
c598b01b2   김태훈   GUI 업데이트
853
      else
bb26a0523   김태훈   소스 코드 정리
854
          hideCurrentHumidity();
8c2952457   김태훈   응용 프로그램 추가
855
  }
bb26a0523   김태훈   소스 코드 정리
856
  void ManualCookWindow::on_tempButton_pressed()
8c2952457   김태훈   응용 프로그램 추가
857
  {
bb26a0523   김태훈   소스 코드 정리
858
859
      showCurrentTempTimer.start();
  }
8c2952457   김태훈   응용 프로그램 추가
860
bb26a0523   김태훈   소스 코드 정리
861
862
863
864
865
866
867
  void ManualCookWindow::on_tempButton_released()
  {
      if (showCurrentTempTimer.isActive())
          showCurrentTempTimer.stop();
      else
          hideCurrentTemp();
  }
271dda4ae   김태훈   엔코더 구현
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
  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   김태훈   소스 코드 정리
888
889
890
891
892
  void ManualCookWindow::on_interTempButton_clicked()
  {
      if (oven->interTempEnabled())
          oven->setInterTempEnabled(false);
      else
d35b8bcdf   김태훈   수동 요리의 중심 요리 설정 화...
893
894
895
      {
          CoreTempSettingPopup *p = new CoreTempSettingPopup(this);
          p->show();
271dda4ae   김태훈   엔코더 구현
896
897
898
  
          focused = ui->interTempButton;
          connect(p, SIGNAL(destroyed(QObject*)), SLOT(focusAgain()));
d35b8bcdf   김태훈   수동 요리의 중심 요리 설정 화...
899
      }
8c2952457   김태훈   응용 프로그램 추가
900
  }
bb26a0523   김태훈   소스 코드 정리
901
  void ManualCookWindow::on_runStopButton_clicked()
8c2952457   김태훈   응용 프로그램 추가
902
  {
bb26a0523   김태훈   소스 코드 정리
903
      if (oven->cooking())
bb26a0523   김태훈   소스 코드 정리
904
          stop();
cd74cf6ed   김태훈   엔코더 관련 디자인 변경 적용
905
      else if (oven->time() > 0)
f588aa273   김태훈   부가 기능 로직 추가
906
          start();
d75742e49   김태훈   음향 효과 개선
907
908
      else
          SoundPlayer::playClick();
cd74cf6ed   김태훈   엔코더 관련 디자인 변경 적용
909
910
  
      updateView();
bb26a0523   김태훈   소스 코드 정리
911
912
913
914
915
916
917
918
919
  }
  
  void ManualCookWindow::on_fanButton_clicked()
  {
      int fan = oven->fan() + 1;
      if (fan > oven->maxFan())
          fan = oven->minFan();
  
      oven->setFan(fan);
8c2952457   김태훈   응용 프로그램 추가
920
921
922
923
  }
  
  void ManualCookWindow::on_preheatButton_clicked()
  {
bb26a0523   김태훈   소스 코드 정리
924
      startCookingTimer.stop();
4fc65fb81   김태훈   GUI V0.1.6(이 버전으로...
925
05f2a7552   김태훈   image 관리 구조 변경
926
927
928
      PreheatPopup *p = new PreheatPopup(this, oven);
      p->setWindowModality(Qt::WindowModal);
      p->showFullScreen();
271dda4ae   김태훈   엔코더 구현
929
930
931
  
      focused = ui->preheatButton;
      connect(p, SIGNAL(destroyed(QObject*)), SLOT(focusAgain()));
8c2952457   김태훈   응용 프로그램 추가
932
933
934
935
  }
  
  void ManualCookWindow::on_damperButton_clicked()
  {
c598b01b2   김태훈   GUI 업데이트
936
937
      if (oven->damper())
          oven->closeDamper();
8c2952457   김태훈   응용 프로그램 추가
938
      else
c598b01b2   김태훈   GUI 업데이트
939
          oven->openDamper();
8c2952457   김태훈   응용 프로그램 추가
940
941
942
943
  }
  
  void ManualCookWindow::on_humidificationButton_clicked()
  {
c598b01b2   김태훈   GUI 업데이트
944
945
      if (oven->humidification())
          oven->stopHumidification();
8c2952457   김태훈   응용 프로그램 추가
946
      else
c598b01b2   김태훈   GUI 업데이트
947
          oven->startHumidification();
8c2952457   김태훈   응용 프로그램 추가
948
949
950
951
  }
  
  void ManualCookWindow::on_repeatButton_clicked()
  {
213c24135   김태훈   수동 요리 반복 추가
952
953
954
      if (repeat)
      {
          repeat = false;
07441dbd3   김태훈   엔코더 관련 디자인 변경 대비
955
          updateView();
213c24135   김태훈   수동 요리 반복 추가
956
957
958
959
      }
      else
      {
          repeat = true;
07441dbd3   김태훈   엔코더 관련 디자인 변경 대비
960
          updateView();
213c24135   김태훈   수동 요리 반복 추가
961
962
963
964
965
966
967
          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   김태훈   응용 프로그램 추가
968
969
970
971
  }
  
  void ManualCookWindow::on_cooldownButton_clicked()
  {
bb26a0523   김태훈   소스 코드 정리
972
      startCookingTimer.stop();
cfc2fcc35   김태훈   쿨다운 팝업 추가
973
8d6b74605   김태훈   세척 시작 전 온도 검사 후 쿨다운
974
      CooldownPopup *p = new CooldownPopup(this, 30);
cfc2fcc35   김태훈   쿨다운 팝업 추가
975
976
      p->setWindowModality(Qt::WindowModal);
      p->showFullScreen();
271dda4ae   김태훈   엔코더 구현
977
978
979
  
      focused = ui->cooldownButton;
      connect(p, SIGNAL(destroyed(QObject*)), SLOT(focusAgain()));
8c2952457   김태훈   응용 프로그램 추가
980
981
982
983
  }
  
  void ManualCookWindow::on_reserveButton_clicked()
  {
0e279295f   김태훈   수동 요리 구현
984
985
986
987
988
989
990
991
      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   김태훈   엔코더 구현
992
993
994
  
          focused = ui->reserveButton;
          connect(p, SIGNAL(destroyed(QObject*)), SLOT(focusAgain()));
0e279295f   김태훈   수동 요리 구현
995
      }
8c2952457   김태훈   응용 프로그램 추가
996
  }
213c24135   김태훈   수동 요리 반복 추가
997
  void ManualCookWindow::on_favoriteButton_clicked()
8c2952457   김태훈   응용 프로그램 추가
998
  {
599b9c350   고영탁   부가기능 복구
999
1000
      if (oven->cooking())
          return;
f588aa273   김태훈   부가 기능 로직 추가
1001
599b9c350   고영탁   부가기능 복구
1002
1003
      ConfirmPopup *p = new ConfirmPopup(this, tr("즐겨찾기 항목에 추가하시겠습니까?"));
      p->showFullScreen();
8c2952457   김태훈   응용 프로그램 추가
1004
599b9c350   고영탁   부가기능 복구
1005
1006
1007
      focused = ui->favoriteButton;
      connect(p, SIGNAL(rejected()), SLOT(focusAgain()));
      connect(p, SIGNAL(accepted()), SLOT(addFavorite()));
f588aa273   김태훈   부가 기능 로직 추가
1008
599b9c350   고영탁   부가기능 복구
1009
1010
1011
1012
1013
      if (startCookingTimer.isActive())
      {
          startCookingTimer.stop();
          connect(p, SIGNAL(rejected()), &startCookingTimer, SLOT(start()));
      }
8c2952457   김태훈   응용 프로그램 추가
1014
  }
bb26a0523   김태훈   소스 코드 정리
1015
bb26a0523   김태훈   소스 코드 정리
1016
1017
  void ManualCookWindow::on_goFrontStackButton_clicked()
  {
271dda4ae   김태훈   엔코더 구현
1018
1019
1020
      showFrontButtons = !showFrontButtons;
  
      updateView();
bb26a0523   김태훈   소스 코드 정리
1021
1022
1023
1024
1025
1026
1027
  }
  
  void ManualCookWindow::on_backButton_clicked()
  {
      stop();
      close();
  }
f588aa273   김태훈   부가 기능 로직 추가
1028
e00c6a2a9   김태훈   기능 추가 구현
1029
1030
1031
1032
1033
1034
1035
1036
  void ManualCookWindow::on_configButton_clicked()
  {
      if (oven->cooking())
      {
          ConfirmPopup *p = new ConfirmPopup(this, tr("요리가 중단되고 환경 설정 모드로 들어갑니다. 진행할까요?"));
          p->showFullScreen();
  
          connect(p, SIGNAL(accepted()), SLOT(jumpConfig()));
271dda4ae   김태훈   엔코더 구현
1037
1038
1039
  
          focused = ui->configButton;
          connect(p, SIGNAL(destroyed(QObject*)), SLOT(focusAgain()));
e00c6a2a9   김태훈   기능 추가 구현
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
      }
      else
      {
          ConfigWindow *w = new ConfigWindow(MainWindow::getInstance());
          w->setWindowModality(Qt::WindowModal);
          w->showFullScreen();
          w->raise();
  
          MainWindow::jump(w);
      }
  }
  
  void ManualCookWindow::on_favoritesButton_clicked()
  {
599b9c350   고영탁   부가기능 복구
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
      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   김태훈   기능 추가 구현
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
  }
  
  void ManualCookWindow::on_washButton_clicked()
  {
      if (oven->cooking())
      {
          ConfirmPopup *p = new ConfirmPopup(this, tr("요리가 중단되고 자동 세척 모드로 들어갑니다. 진행할까요?"));
          p->showFullScreen();
  
          connect(p, SIGNAL(accepted()), SLOT(jumpWash()));
271dda4ae   김태훈   엔코더 구현
1084
1085
1086
  
          focused = ui->washButton;
          connect(p, SIGNAL(destroyed(QObject*)), SLOT(focusAgain()));
e00c6a2a9   김태훈   기능 추가 구현
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
      }
      else
      {
          WashWindow *w = new WashWindow(MainWindow::getInstance());
          w->setWindowModality(Qt::WindowModal);
          w->showFullScreen();
          w->raise();
  
          MainWindow::jump(w);
      }
  }
  
  void ManualCookWindow::on_helpButton_clicked()
f588aa273   김태훈   부가 기능 로직 추가
1100
  {
f588aa273   김태훈   부가 기능 로직 추가
1101
f588aa273   김태훈   부가 기능 로직 추가
1102
  }
a2de3cbfc   김태훈   수동 요리에 새 슬라이더 적용
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
  
  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   김태훈   엔코더 구현
1121
          return qCeil((qreal) secs / 60);
a2de3cbfc   김태훈   수동 요리에 새 슬라이더 적용
1122
      if (secs <= 360 * 60)
271dda4ae   김태훈   엔코더 구현
1123
1124
          return 180 + qCeil((qreal) (secs - 180 * 60) / 2 / 60);
      return 270 + qCeil((qreal) (secs - 360 * 60) / 15 / 60);
a2de3cbfc   김태훈   수동 요리에 새 슬라이더 적용
1125
  }