diff --git a/app/gui/oven_control/cooldownpopup.cpp b/app/gui/oven_control/cooldownpopup.cpp new file mode 100644 index 0000000..c0f4349 --- /dev/null +++ b/app/gui/oven_control/cooldownpopup.cpp @@ -0,0 +1,205 @@ +#include "cooldownpopup.h" +#include "ui_cooldownpopup.h" + +CooldownPopup::CooldownPopup(QWidget *parent, Oven *oven) : + QWidget(parent), + ui(new Ui::CooldownPopup), + oven(oven), + showingCurrentTemp(false) +{ + ui->setupUi(this); + + setAttribute(Qt::WA_DeleteOnClose); + + ui->openDoorAnimation->load(":/images/animation/door_big_01.png"); + ui->openDoorAnimation->load(":/images/animation/door_big_02.png"); + ui->openDoorAnimation->load(":/images/animation/door_big_03.png"); + ui->openDoorAnimation->load(":/images/animation/door_big_04.png"); + ui->openDoorAnimation->load(":/images/animation/door_big_05.png"); + ui->openDoorAnimation->load(":/images/animation/door_big_06.png"); + ui->openDoorAnimation->load(":/images/animation/door_big_07.png"); + ui->openDoorAnimation->load(":/images/animation/door_big_08.png"); + ui->openDoorAnimation->load(":/images/animation/door_big_09.png"); + ui->openDoorAnimation->start(300); + + cookingFanLevel = oven->fan(); + expectingFanLevel = oven->maxFan(); + started = false; + opened = false; + + connect(oven, SIGNAL(changed(Oven*)), SLOT(updateView())); + + cooldownStartTimer.setSingleShot(true); + cooldownStartTimer.setInterval(2000); + connect(&cooldownStartTimer, SIGNAL(timeout()), SLOT(start())); + + showCurrentTempTimer.setSingleShot(true); + showCurrentTempTimer.setInterval(2000); + connect(&showCurrentTempTimer, SIGNAL(timeout()), SLOT(showCurrentTemp())); + + checkOvenTimer.setInterval(100); + connect(&checkOvenTimer, SIGNAL(timeout()), SLOT(checkOven())); + + connect(ui->tempSlider, SIGNAL(valueChanged(int)), SLOT(updateView())); + + updateView(); + + cooldownStartTimer.start(); +} + +CooldownPopup::~CooldownPopup() +{ + delete ui; +} + +void CooldownPopup::start() +{ + started = true; + opened = false; + + checkOvenTimer.start(); + + updateView(); +} + +void CooldownPopup::stop() +{ + started = false; + + oven->stopCooldown(); + oven->setFan(cookingFanLevel); + + close(); +} + +void CooldownPopup::showCurrentTemp() +{ + showingCurrentTemp = true; + updateView(); +} + +void CooldownPopup::updateView() +{ + int temp; + if (showingCurrentTemp) + temp = oven->currentTemp(); + else + temp = ui->tempSlider->value(); + + ui->tempCurrentLabel->setText(QString("%1").arg(temp)); + + switch (expectingFanLevel) + { + case 1: + ui->fanButton->setStyleSheet("background-image: url(:/images/cooldown/fan1.png);"); + break; + case 2: + ui->fanButton->setStyleSheet("background-image: url(:/images/cooldown/fan2.png);"); + break; + case 3: + ui->fanButton->setStyleSheet("background-image: url(:/images/cooldown/fan3.png);"); + break; + case 4: + ui->fanButton->setStyleSheet("background-image: url(:/images/cooldown/fan4.png);"); + break; + case 5: + ui->fanButton->setStyleSheet("background-image: url(:/images/cooldown/fan5.png);"); + break; + } + + if (oven->humidification()) + ui->humidificationButton->setStyleSheet("background-image: url(:/images/cooldown/side_nozzle_ov.png);"); + else + ui->humidificationButton->setStyleSheet("background-image: url(:/images/cooldown/side_nozzle.png);"); + + if (started && !oven->door()) + ui->openDoorWidget->show(); + else + ui->openDoorWidget->hide(); +} + +void CooldownPopup::checkOven() +{ + updateView(); + + if (!started) + return; + + if (!opened) + { + if (oven->door()) + { + opened = true; + oven->setFan(expectingFanLevel); + oven->startCooldown(); + } + } + else + { + if (oven->currentTemp() <= ui->tempSlider->value()) + { + stop(); + } + } +} + +void CooldownPopup::on_closeButton_clicked() +{ + stop(); + close(); +} + +void CooldownPopup::on_closeButton_2_clicked() +{ + stop(); + close(); +} + +void CooldownPopup::on_tempButton_pressed() +{ + showCurrentTempTimer.start(); +} + +void CooldownPopup::on_tempButton_released() +{ + if (showCurrentTempTimer.isActive()) + showCurrentTempTimer.stop(); + + if (showingCurrentTemp) + { + showingCurrentTemp = false; + updateView(); + } +} + +void CooldownPopup::on_runButton_clicked() +{ + if (cooldownStartTimer.isActive()) + { + cooldownStartTimer.stop(); + start(); + } +} + +void CooldownPopup::on_fanButton_clicked() +{ + expectingFanLevel--; + if (expectingFanLevel < oven->minFan()) + expectingFanLevel = oven->maxFan(); + + if (oven->cooldown()) + oven->setFan(expectingFanLevel); + else + updateView(); + + if (cooldownStartTimer.isActive()) + cooldownStartTimer.start(); +} + +void CooldownPopup::on_humidificationButton_clicked() +{ + if (oven->humidification()) + oven->stopHumidification(); + else + oven->startHumidification(); +} diff --git a/app/gui/oven_control/cooldownpopup.h b/app/gui/oven_control/cooldownpopup.h new file mode 100644 index 0000000..3a56cec --- /dev/null +++ b/app/gui/oven_control/cooldownpopup.h @@ -0,0 +1,58 @@ +#ifndef COOLDOWNPOPUP_H +#define COOLDOWNPOPUP_H + +#include +#include + +#include "oven.h" + +namespace Ui { +class CooldownPopup; +} + +class CooldownPopup : public QWidget +{ + Q_OBJECT + +public: + explicit CooldownPopup(QWidget *parent = 0, Oven *oven = 0); + ~CooldownPopup(); + +private slots: + void start(); + void stop(); + void showCurrentTemp(); + void updateView(); + void checkOven(); + + void on_closeButton_clicked(); + + void on_closeButton_2_clicked(); + + void on_tempButton_pressed(); + + void on_tempButton_released(); + + void on_runButton_clicked(); + + void on_fanButton_clicked(); + + void on_humidificationButton_clicked(); + +private: + Ui::CooldownPopup *ui; + Oven *oven; + + QTimer cooldownStartTimer; + QTimer checkOvenTimer; + + bool showingCurrentTemp; + QTimer showCurrentTempTimer; + + int cookingFanLevel; + int expectingFanLevel; + bool started; + bool opened; +}; + +#endif // COOLDOWNPOPUP_H diff --git a/app/gui/oven_control/cooldownpopup.ui b/app/gui/oven_control/cooldownpopup.ui new file mode 100644 index 0000000..abbdf78 --- /dev/null +++ b/app/gui/oven_control/cooldownpopup.ui @@ -0,0 +1,445 @@ + + + CooldownPopup + + + + 0 + 0 + 900 + 1600 + + + + Form + + + #closeButton { border: none; } +#closeButton_2 { border: none; } +#background { background-image: url(:/images/background/popup/373.png); } + +QPushButton { +background-position: center; +background-repeat: no-repeat; +border: none; +} + +QPushButton[style="icon"] { background-image: url(:/images/slider_icon/background.png); } + +QSlider::groove { +background-image: url(:/images/slider/groove.png); +background-repeat: no-repeat; +background-position: center; +} + +QSlider::sub-page { +background-repeat: no-repeat; +background-position: left center; +margin: 0px 5px; +} + +QSlider[sliderColor="red"]::sub-page { +background-image: url(:/images/slider/sub_red.png); +} + +QSlider[sliderColor="yellow"]::sub-page { +background-image: url(:/images/slider/sub_yellow.png); +} + +QSlider[sliderColor="white"]::sub-page { +background-image: url(:/images/slider/sub_white.png); +} + +QSlider[sliderColor="blue"]::sub-page { +background-image: url(:/images/slider/sub_blue.png); +} + +QSlider[sliderColor="green"]::sub-page { +background-image: url(:/images/slider/sub_green.png); +} + +QSlider::handle { +background-image: url(:/images/slider/handle_big.png); +background-repeat: no-repeat; +background-position: center; +width: 23px; +height: 33px; +} + + + + + 0 + 801 + 900 + 799 + + + + + + + + + + 0 + 426 + 900 + 373 + + + + + + 30 + 50 + 140 + 140 + + + + QPushButton { image: url(:/images/slider_icon/cooldown.png); } +QPushButton::pressed { image: url(:/images/slider_icon/cooldown_ov.png); } + + + + + + icon + + + + + + 590 + 260 + 78 + 78 + + + + QPushButton { background-image: url(:/images/cooldown/run.png); } +QPushButton:pressed { background-image: url(:/images/cooldown/run_ov.png); } + + + + + + + + + 690 + 260 + 78 + 78 + + + + QPushButton { background-image: url(:/images/cooldown/fan5.png); } + + + + + + + + + 790 + 260 + 78 + 78 + + + + QPushButton { background-image: url(:/images/cooldown/side_nozzle.png); } +QPushButton:pressed { background-image: url(:/images/cooldown/side_nozzle_ov.png); } + + + + + + + + true + + + + 711 + 60 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 증가 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + true + + + + 196 + 60 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 감소 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 196 + 103 + 666 + 33 + + + + 30 + + + 300 + + + 10 + + + true + + + Qt::Horizontal + + + red + + + + + true + + + + 210 + 130 + 641 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Roboto + 16 + 75 + true + + + + 스팀 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 0 + 0 + 900 + 426 + + + + + + + + + + 0 + 0 + 900 + 426 + + + + #openDoorWidget { background-image: url(:/images/clock/background.png); } + + + + + 366 + 20 + 251 + 292 + + + + TextLabel + + + + + + 430 + 170 + 85 + 24 + + + + + + + :/images/animation/open_door_arrow.png + + + + + + + AnimatedImageBox + QLabel +
animatedimagebox.h
+
+
+ + + + +
diff --git a/app/gui/oven_control/manualcookwindow.cpp b/app/gui/oven_control/manualcookwindow.cpp index f6f8e5a..df0f6e3 100644 --- a/app/gui/oven_control/manualcookwindow.cpp +++ b/app/gui/oven_control/manualcookwindow.cpp @@ -6,6 +6,7 @@ #include #include "preheatpopup.h" +#include "cooldownpopup.h" ManualCookWindow::ManualCookWindow(QWidget *parent, Oven *oven, UdpHandler *udp) : QMainWindow(parent), @@ -14,6 +15,7 @@ ManualCookWindow::ManualCookWindow(QWidget *parent, Oven *oven, UdpHandler *udp) ui->setupUi(this); ui->clockContainer->setParent(ui->upperStack); + ui->closeDoorWidget->setParent(ui->upperStack); ui->outerStack->setParent(ui->bodyStack); ui->innerStack->setParent(ui->bodyStack); setAttribute(Qt::WA_DeleteOnClose); @@ -91,6 +93,17 @@ ManualCookWindow::ManualCookWindow(QWidget *parent, Oven *oven, UdpHandler *udp) connect(this, SIGNAL(cookStopRequested()), cookingStartTimer, SLOT(stop())); ui->bodyStack->setCurrentIndex(0); + + ui->openDoorAnimation->load(":/images/animation/door_big_09.png"); + ui->openDoorAnimation->load(":/images/animation/door_big_08.png"); + ui->openDoorAnimation->load(":/images/animation/door_big_07.png"); + ui->openDoorAnimation->load(":/images/animation/door_big_06.png"); + ui->openDoorAnimation->load(":/images/animation/door_big_05.png"); + ui->openDoorAnimation->load(":/images/animation/door_big_04.png"); + ui->openDoorAnimation->load(":/images/animation/door_big_03.png"); + ui->openDoorAnimation->load(":/images/animation/door_big_02.png"); + ui->openDoorAnimation->load(":/images/animation/door_big_01.png"); + ui->openDoorAnimation->start(300); } ManualCookWindow::~ManualCookWindow() @@ -318,6 +331,11 @@ QPushButton:pressed {\ break; } + if (oven->paused() && !oven->cooldown() && oven->door()) + ui->upperStack->setCurrentIndex(1); + else + ui->upperStack->setCurrentIndex(0); + updateLabels(); } @@ -394,10 +412,11 @@ void ManualCookWindow::on_repeatButton_clicked() void ManualCookWindow::on_cooldownButton_clicked() { - if (oven->cooldown()) - oven->stopCooldown(); - else - oven->startCooldown(); + cookingStartTimer->stop(); + + CooldownPopup *p = new CooldownPopup(this, oven); + p->setWindowModality(Qt::WindowModal); + p->showFullScreen(); } void ManualCookWindow::on_reserveButton_clicked() diff --git a/app/gui/oven_control/manualcookwindow.ui b/app/gui/oven_control/manualcookwindow.ui index faa9a06..38c5a5b 100644 --- a/app/gui/oven_control/manualcookwindow.ui +++ b/app/gui/oven_control/manualcookwindow.ui @@ -106,6 +106,43 @@ height: 33px; + + + #closeDoorWidget { background-image: url(:/images/clock/background.png); } + + + + + 366 + 20 + 251 + 292 + + + + + + + :/images/animation/door_big_02.png + + + + + + 430 + 170 + 85 + 24 + + + + + + + :/images/animation/close_door_arrow.png + + + @@ -2427,6 +2464,11 @@ QPushButton:pressed { border-image: url(:/images/manual_button/ok_ov.png); }clock.h 1 + + AnimatedImageBox + QLabel +
animatedimagebox.h
+
diff --git a/app/gui/oven_control/oven_control.pro b/app/gui/oven_control/oven_control.pro index 22b8f97..c9d339a 100644 --- a/app/gui/oven_control/oven_control.pro +++ b/app/gui/oven_control/oven_control.pro @@ -41,7 +41,8 @@ SOURCES += main.cpp\ washwindow.cpp \ washstepgauge.cpp \ preheatpopup.cpp \ - longpreheattempgauge.cpp + longpreheattempgauge.cpp \ + cooldownpopup.cpp HEADERS += mainwindow.h \ cook.h \ @@ -71,7 +72,8 @@ HEADERS += mainwindow.h \ washwindow.h \ washstepgauge.h \ preheatpopup.h \ - longpreheattempgauge.h + longpreheattempgauge.h \ + cooldownpopup.h FORMS += mainwindow.ui \ manualcookwindow.ui \ @@ -87,7 +89,8 @@ FORMS += mainwindow.ui \ autocookwindow.ui \ autocookconfigwindow.ui \ washwindow.ui \ - preheatpopup.ui + preheatpopup.ui \ + cooldownpopup.ui RESOURCES += \ resources.qrc