Blame view

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