#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시간 %02d", time / 3600, (time % 3600) / 60)); else if (time >= 60) ui->timeLabel->setText(QString().sprintf("%d %02d", time / 60, time % 60)); else ui->timeLabel->setText(QString().sprintf("%d", time)); if (oven->interTempEnabled()) { int interTemp = oven->interTemp(); ui->interTempLabel->setText(QString().sprintf("%d", interTemp)); } else ui->interTempLabel->setText(""); } void PreheatPopup::on_closeButton_clicked() { close(); } void PreheatPopup::on_closeButton_2_clicked() { close(); }