05f2a7552
김태훈
image 관리 구조 변경
|
1
2
3
4
5
6
|
#include "preheatpopup.h"
#include "ui_preheatpopup.h"
PreheatPopup::PreheatPopup(QWidget *parent, Oven *oven) :
QWidget(parent),
ui(new Ui::PreheatPopup),
|
61ba89b34
김태훈
GUI V0.1.6
|
7
8
9
|
oven(oven),
showingCurrentHumidity(false),
showingCurrentTemp(false)
|
05f2a7552
김태훈
image 관리 구조 변경
|
10
11
12
13
|
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
|
6eb13ba2e
김태훈
예열 팝업 동작 보완 및 동작 ...
|
14
|
connect(oven, SIGNAL(changed(Oven*)), SLOT(onOvenChanged()));
|
05f2a7552
김태훈
image 관리 구조 변경
|
15
|
|
61ba89b34
김태훈
GUI V0.1.6
|
16
17
18
19
20
21
22
|
showCurrentHumidityTimer.setSingleShot(true);
showCurrentHumidityTimer.setInterval(3000);
connect(&showCurrentHumidityTimer, SIGNAL(timeout()), SLOT(showCurrentHumidity()));
showCurrentTempTimer.setSingleShot(true);
showCurrentTempTimer.setInterval(3000);
connect(&showCurrentTempTimer, SIGNAL(timeout()), SLOT(showCurrentTemp()));
|
6eb13ba2e
김태훈
예열 팝업 동작 보완 및 동작 ...
|
23
24
25
|
ui->preheatGauge->setMaximum(oven->temp());
ui->preheatGauge->setMinimum(oven->currentTemp());
ui->preheatGauge->setValue(oven->currentTemp());
|
61ba89b34
김태훈
GUI V0.1.6
|
26
|
start();
|
05f2a7552
김태훈
image 관리 구조 변경
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
}
PreheatPopup::~PreheatPopup()
{
delete ui;
}
void PreheatPopup::updateView()
{
int time = oven->time();
if (time >= 3600)
ui->timeLabel->setText(QString().sprintf("%d<span style=\"font-size:11pt;\">시간</span> %02d<span style=\"font-size:11pt;\">분</span>", time / 3600, (time % 3600) / 60));
else if (time >= 60)
ui->timeLabel->setText(QString().sprintf("%d<span style=\"font-size:11pt;\">분</span> %02d<span style=\"font-size:11pt;\">초</span>", time / 60, time % 60));
else
ui->timeLabel->setText(QString().sprintf("%d<span style=\"font-size:11pt;\">초</span>", time));
|
61ba89b34
김태훈
GUI V0.1.6
|
43
|
int curInterTemp = oven->currentInterTemp();
|
05f2a7552
김태훈
image 관리 구조 변경
|
44
45
46
|
if (oven->interTempEnabled())
{
int interTemp = oven->interTemp();
|
61ba89b34
김태훈
GUI V0.1.6
|
47
|
ui->interTempLabel->setText(QString().sprintf("%d<span style=\"font-size:11pt;\">℃ / %d</span><span style=\"font-size:9pt;\">℃</span>", curInterTemp, interTemp));
|
05f2a7552
김태훈
image 관리 구조 변경
|
48
49
|
}
else
|
61ba89b34
김태훈
GUI V0.1.6
|
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
ui->interTempLabel->setText(QString().sprintf("%d<span style=\"font-size:11pt;\">℃</span>", curInterTemp));
int humidity;
if (showingCurrentHumidity)
humidity = oven->currentHumidity();
else
humidity = oven->humidity();
int temp;
if (showingCurrentTemp)
temp = oven->currentTemp();
else
temp = oven->temp();
ui->humidityLabel->setText(QString().sprintf("%d%%", humidity));
|
ecfb5801a
김태훈
디버깅 요청 사항 반영
|
65
|
ui->humidityGauge->setValue(humidity);
|
61ba89b34
김태훈
GUI V0.1.6
|
66
|
ui->heatLabel->setText(QString().sprintf("%d℃", temp));
|
ecfb5801a
김태훈
디버깅 요청 사항 반영
|
67
|
ui->heatGauge->setValue(temp);
|
6eb13ba2e
김태훈
예열 팝업 동작 보완 및 동작 ...
|
68
69
|
ui->preheatGauge->setValue(oven->currentTemp());
|
61ba89b34
김태훈
GUI V0.1.6
|
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
}
void PreheatPopup::start()
{
oven->startPreheating();
}
void PreheatPopup::stop()
{
oven->stopPreheating();
}
void PreheatPopup::showCurrentHumidity()
{
showingCurrentHumidity = true;
|
05f2a7552
김태훈
image 관리 구조 변경
|
85
|
|
61ba89b34
김태훈
GUI V0.1.6
|
86
87
88
89
90
91
92
93
|
updateView();
}
void PreheatPopup::showCurrentTemp()
{
showingCurrentTemp = true;
updateView();
|
05f2a7552
김태훈
image 관리 구조 변경
|
94
|
}
|
6eb13ba2e
김태훈
예열 팝업 동작 보완 및 동작 ...
|
95
96
97
98
99
100
101
102
103
104
|
void PreheatPopup::onOvenChanged()
{
if (oven->currentHumidity() >= oven->humidity() && oven->currentTemp() >= oven->temp())
{
stop();
close();
}
else
updateView();
}
|
05f2a7552
김태훈
image 관리 구조 변경
|
105
106
|
void PreheatPopup::on_closeButton_clicked()
{
|
61ba89b34
김태훈
GUI V0.1.6
|
107
|
stop();
|
05f2a7552
김태훈
image 관리 구조 변경
|
108
109
110
111
112
|
close();
}
void PreheatPopup::on_closeButton_2_clicked()
{
|
61ba89b34
김태훈
GUI V0.1.6
|
113
|
stop();
|
05f2a7552
김태훈
image 관리 구조 변경
|
114
115
|
close();
}
|
61ba89b34
김태훈
GUI V0.1.6
|
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
|
void PreheatPopup::on_humidityGaugeButton_pressed()
{
showCurrentHumidityTimer.start();
}
void PreheatPopup::on_humidityGaugeButton_released()
{
showCurrentHumidityTimer.stop();
showingCurrentHumidity = false;
updateView();
}
void PreheatPopup::on_heatGaugeButton_pressed()
{
showCurrentTempTimer.start();
}
void PreheatPopup::on_heatGaugeButton_released()
{
showCurrentTempTimer.stop();
showingCurrentTemp = false;
updateView();
}
|