preheatpopup.cpp
1.36 KB
1
2
3
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
#include "preheatpopup.h"
#include "ui_preheatpopup.h"
PreheatPopup::PreheatPopup(QWidget *parent, Oven *oven) :
QWidget(parent),
ui(new Ui::PreheatPopup),
oven(oven)
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
connect(oven, SIGNAL(changed(Oven*)), SLOT(updateView()));
oven->startPreheating();
}
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));
if (oven->interTempEnabled())
{
int interTemp = oven->interTemp();
ui->interTempLabel->setText(QString().sprintf("%d<span style=\"font-size:11pt;\">℃</span>", interTemp));
}
else
ui->interTempLabel->setText("<span style=\"font-size:11pt;\">℃</span>");
}
void PreheatPopup::on_closeButton_clicked()
{
close();
}
void PreheatPopup::on_closeButton_2_clicked()
{
close();
}