Blame view

app/gui/oven_control/manualcooksettingwidget.cpp 3.08 KB
f588aa273   김태훈   부가 기능 로직 추가
1
2
  #include "manualcooksettingwidget.h"
  #include "ui_manualcooksettingwidget.h"
2bfd3a050   김태훈   환경 설정 대응
3
  #include "stringer.h"
f588aa273   김태훈   부가 기능 로직 추가
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
  ManualCookSettingWidget::ManualCookSettingWidget(ManualCookSetting setting, QWidget *parent) :
      QWidget(parent),
      ui(new Ui::ManualCookSettingWidget)
  {
      ui->setupUi(this);
  
      setMode(setting.mode);
      setHumidity(setting.humidity);
      setTemp(setting.temp);
      setTime(setting.time);
      setCoreTempEnabled(setting.coreTempEnabled);
      setCoreTemp(setting.coreTemp);
      setFan(setting.fan);
  }
  
  ManualCookSettingWidget::~ManualCookSettingWidget()
  {
      delete ui;
  }
  
  void ManualCookSettingWidget::setMode(Define::Mode mode)
  {
      switch (mode)
      {
      case Define::SteamMode:
          ui->steamButton->setChecked(true);
          ui->tempSlider->setRange(30, 130);
          break;
      case Define::CombiMode:
          ui->combiButton->setChecked(true);
          ui->tempSlider->setRange(30, 300);
          break;
      case Define::DryMode:
          ui->dryheatButton->setChecked(true);
          ui->tempSlider->setRange(30, 300);
          break;
      }
  }
  
  void ManualCookSettingWidget::setHumidity(int percentage)
  {
      ui->humiditySlider->setValue(percentage);
      ui->humidityLabel->setText(QString("%1%").arg(percentage));
  }
  
  void ManualCookSettingWidget::setTemp(int celsius)
  {
      ui->tempSlider->setValue(celsius);
2bfd3a050   김태훈   환경 설정 대응
52
      ui->tempLabel->setText(Stringer::temperature(celsius, Stringer::fontSize14));
f588aa273   김태훈   부가 기능 로직 추가
53
54
55
56
57
  }
  
  void ManualCookSettingWidget::setTime(int secs)
  {
      ui->timeSlider->setValue(secs);
2bfd3a050   김태훈   환경 설정 대응
58
      ui->timeLabel->setText(Stringer::remainingTime(secs * 1000, Stringer::fontSize14));
f588aa273   김태훈   부가 기능 로직 추가
59
60
61
62
63
64
65
66
  }
  
  void ManualCookSettingWidget::setCoreTempEnabled(bool enabled)
  {
      ui->coreTempButton->setEnabled(enabled);
      ui->coreTempSlider->setEnabled(enabled);
  
      if (enabled)
2bfd3a050   김태훈   환경 설정 대응
67
          ui->coreTempLabel->setText(Stringer::temperature(ui->coreTempSlider->value(), Stringer::fontSize14));
f588aa273   김태훈   부가 기능 로직 추가
68
      else
2bfd3a050   김태훈   환경 설정 대응
69
          ui->coreTempLabel->setText(Stringer::unusedTemperature(Stringer::fontSize14));
f588aa273   김태훈   부가 기능 로직 추가
70
71
72
73
74
75
  }
  
  void ManualCookSettingWidget::setCoreTemp(int celsius)
  {
      ui->coreTempSlider->setValue(celsius);
      if (ui->coreTempSlider->isEnabled())
2bfd3a050   김태훈   환경 설정 대응
76
          ui->coreTempLabel->setText(Stringer::temperature(celsius, Stringer::fontSize14));
f588aa273   김태훈   부가 기능 로직 추가
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
  }
  
  void ManualCookSettingWidget::setFan(int level)
  {
      switch (level)
      {
      case 1:
          ui->fanButton->setStyleSheet(
                      "background-image: url(:/images/manual_button/fan_1.png)");
          break;
      case 2:
          ui->fanButton->setStyleSheet(
                      "background-image: url(:/images/manual_button/fan_2.png)");
          break;
      case 3:
          ui->fanButton->setStyleSheet(
                      "background-image: url(:/images/manual_button/fan_3.png)");
          break;
      case 4:
          ui->fanButton->setStyleSheet(
                      "background-image: url(:/images/manual_button/fan_4.png)");
          break;
      case 5:
          ui->fanButton->setStyleSheet(
                      "background-image: url(:/images/manual_button/fan_5.png)");
          break;
      default:
          ui->fanButton->setStyleSheet(
                      "background-image: url(:/images/manual_button/fan_1.png)");
          break;
      }
  }