f588aa273
김태훈
부가 기능 로직 추가
|
1
2
|
#include "manualcooksettingwidget.h"
#include "ui_manualcooksettingwidget.h"
|
9e1f8d093
김태훈
엔코더 구현 대비 선행 수정
|
3
|
#include <QKeyEvent>
|
2bfd3a050
김태훈
환경 설정 대응
|
4
|
#include "stringer.h"
|
f588aa273
김태훈
부가 기능 로직 추가
|
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
|
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
김태훈
컴파일 경고 제거
|
41
42
|
default:
return;
|
f588aa273
김태훈
부가 기능 로직 추가
|
43
44
45
46
47
48
49
50
51
52
53
54
|
}
}
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
김태훈
환경 설정 대응
|
55
|
ui->tempLabel->setText(Stringer::temperature(celsius, Stringer::fontSize14));
|
f588aa273
김태훈
부가 기능 로직 추가
|
56
57
58
59
60
|
}
void ManualCookSettingWidget::setTime(int secs)
{
ui->timeSlider->setValue(secs);
|
2bfd3a050
김태훈
환경 설정 대응
|
61
|
ui->timeLabel->setText(Stringer::remainingTime(secs * 1000, Stringer::fontSize14));
|
f588aa273
김태훈
부가 기능 로직 추가
|
62
63
64
65
66
67
68
69
|
}
void ManualCookSettingWidget::setCoreTempEnabled(bool enabled)
{
ui->coreTempButton->setEnabled(enabled);
ui->coreTempSlider->setEnabled(enabled);
if (enabled)
|
2bfd3a050
김태훈
환경 설정 대응
|
70
|
ui->coreTempLabel->setText(Stringer::temperature(ui->coreTempSlider->value(), Stringer::fontSize14));
|
f588aa273
김태훈
부가 기능 로직 추가
|
71
|
else
|
2bfd3a050
김태훈
환경 설정 대응
|
72
|
ui->coreTempLabel->setText(Stringer::unusedTemperature(Stringer::fontSize14));
|
f588aa273
김태훈
부가 기능 로직 추가
|
73
74
75
76
77
78
|
}
void ManualCookSettingWidget::setCoreTemp(int celsius)
{
ui->coreTempSlider->setValue(celsius);
if (ui->coreTempSlider->isEnabled())
|
2bfd3a050
김태훈
환경 설정 대응
|
79
|
ui->coreTempLabel->setText(Stringer::temperature(celsius, Stringer::fontSize14));
|
f588aa273
김태훈
부가 기능 로직 추가
|
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
111
|
}
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;
}
}
|
9e1f8d093
김태훈
엔코더 구현 대비 선행 수정
|
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
void ManualCookSettingWidget::keyPressEvent(QKeyEvent *event)
{
switch (event->key())
{
case 0x01000030: // Turn left
onEncoderLeft();
break;
case 0x01000031: // Push
pushed = focusWidget();
break;
case 0x01000032: // Turn right
onEncoderRight();
break;
}
}
void ManualCookSettingWidget::keyReleaseEvent(QKeyEvent *event)
{
switch (event->key())
{
case 0x01000030: // Turn left
onEncoderLeft();
break;
case 0x01000031: // Push
if (focusWidget() == pushed)
onEncoderClicked(pushed);
pushed = NULL;
break;
case 0x01000032: // Turn right
onEncoderRight();
break;
}
}
void ManualCookSettingWidget::onEncoderLeft()
{
}
void ManualCookSettingWidget::onEncoderRight()
{
}
void ManualCookSettingWidget::onEncoderClicked(QWidget *clicked)
{
}
|