Blame view

app/gui/oven_control/manualcooksettingwidget.cpp 3.11 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
  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;
1f7568d7e   김태훈   컴파일 경고 제거
40
41
      default:
          return;
f588aa273   김태훈   부가 기능 로직 추가
42
43
44
45
46
47
48
49
50
51
52
53
      }
  }
  
  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   김태훈   환경 설정 대응
54
      ui->tempLabel->setText(Stringer::temperature(celsius, Stringer::fontSize14));
f588aa273   김태훈   부가 기능 로직 추가
55
56
57
58
59
  }
  
  void ManualCookSettingWidget::setTime(int secs)
  {
      ui->timeSlider->setValue(secs);
2bfd3a050   김태훈   환경 설정 대응
60
      ui->timeLabel->setText(Stringer::remainingTime(secs * 1000, Stringer::fontSize14));
f588aa273   김태훈   부가 기능 로직 추가
61
62
63
64
65
66
67
68
  }
  
  void ManualCookSettingWidget::setCoreTempEnabled(bool enabled)
  {
      ui->coreTempButton->setEnabled(enabled);
      ui->coreTempSlider->setEnabled(enabled);
  
      if (enabled)
2bfd3a050   김태훈   환경 설정 대응
69
          ui->coreTempLabel->setText(Stringer::temperature(ui->coreTempSlider->value(), Stringer::fontSize14));
f588aa273   김태훈   부가 기능 로직 추가
70
      else
2bfd3a050   김태훈   환경 설정 대응
71
          ui->coreTempLabel->setText(Stringer::unusedTemperature(Stringer::fontSize14));
f588aa273   김태훈   부가 기능 로직 추가
72
73
74
75
76
77
  }
  
  void ManualCookSettingWidget::setCoreTemp(int celsius)
  {
      ui->coreTempSlider->setValue(celsius);
      if (ui->coreTempSlider->isEnabled())
2bfd3a050   김태훈   환경 설정 대응
78
          ui->coreTempLabel->setText(Stringer::temperature(celsius, Stringer::fontSize14));
f588aa273   김태훈   부가 기능 로직 추가
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
109
110
  }
  
  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;
      }
  }