From 8d6b74605c6ec03508dd9e9fa130bb3aaaf85eaa Mon Sep 17 00:00:00 2001 From: victor Date: Thu, 17 Aug 2017 11:50:19 +0900 Subject: [PATCH] =?UTF-8?q?=EC=84=B8=EC=B2=99=20=EC=8B=9C=EC=9E=91=20?= =?UTF-8?q?=EC=A0=84=20=EC=98=A8=EB=8F=84=20=EA=B2=80=EC=82=AC=20=ED=9B=84?= =?UTF-8?q?=20=EC=BF=A8=EB=8B=A4=EC=9A=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/gui/oven_control/cooldownpopup.cpp | 6 +- app/gui/oven_control/cooldownpopup.h | 2 +- app/gui/oven_control/manualcookwindow.cpp | 2 +- app/gui/oven_control/washwindow.cpp | 131 ++++++++++++++++++++---------- app/gui/oven_control/washwindow.h | 6 +- 5 files changed, 97 insertions(+), 50 deletions(-) diff --git a/app/gui/oven_control/cooldownpopup.cpp b/app/gui/oven_control/cooldownpopup.cpp index c2fa048..ffca7b8 100644 --- a/app/gui/oven_control/cooldownpopup.cpp +++ b/app/gui/oven_control/cooldownpopup.cpp @@ -6,10 +6,9 @@ #include "soundplayer.h" #include "stringer.h" -CooldownPopup::CooldownPopup(QWidget *parent, Oven *oven) : +CooldownPopup::CooldownPopup(QWidget *parent, int target) : QWidget(parent), ui(new Ui::CooldownPopup), - oven(oven), showingCurrentTemp(false), needCookStarting(false) { @@ -17,6 +16,8 @@ CooldownPopup::CooldownPopup(QWidget *parent, Oven *oven) : setAttribute(Qt::WA_DeleteOnClose); + oven = Oven::getInstance(); + lastDisplayedFanLevel = -1; lastDisplayedHumidification = !oven->humidification(); @@ -33,6 +34,7 @@ CooldownPopup::CooldownPopup(QWidget *parent, Oven *oven) : ui->tempSlider->setSubPixmap(":/images/slider/sub_red.png"); ui->tempSlider->setRange(30, 300); + ui->tempSlider->setValue(target); cookingFanLevel = oven->fan(); expectingFanLevel = oven->maxFan(); diff --git a/app/gui/oven_control/cooldownpopup.h b/app/gui/oven_control/cooldownpopup.h index 53dc073..431d3d5 100644 --- a/app/gui/oven_control/cooldownpopup.h +++ b/app/gui/oven_control/cooldownpopup.h @@ -15,7 +15,7 @@ class CooldownPopup : public QWidget Q_OBJECT public: - explicit CooldownPopup(QWidget *parent = 0, Oven *oven = 0); + explicit CooldownPopup(QWidget *parent = 0, int target = 30); ~CooldownPopup(); protected: diff --git a/app/gui/oven_control/manualcookwindow.cpp b/app/gui/oven_control/manualcookwindow.cpp index ca7d63f..93a3ea3 100644 --- a/app/gui/oven_control/manualcookwindow.cpp +++ b/app/gui/oven_control/manualcookwindow.cpp @@ -988,7 +988,7 @@ void ManualCookWindow::on_cooldownButton_clicked() { startCookingTimer.stop(); - CooldownPopup *p = new CooldownPopup(this, oven); + CooldownPopup *p = new CooldownPopup(this, 30); p->setWindowModality(Qt::WindowModal); p->showFullScreen(); diff --git a/app/gui/oven_control/washwindow.cpp b/app/gui/oven_control/washwindow.cpp index 8419066..f55687e 100644 --- a/app/gui/oven_control/washwindow.cpp +++ b/app/gui/oven_control/washwindow.cpp @@ -9,6 +9,7 @@ #include "configwindow.h" #include "mainwindow.h" #include "ovenstatics.h" +#include "cooldownpopup.h" WashWindow::WashWindow(QWidget *parent) : QMainWindow(parent), @@ -134,21 +135,48 @@ void WashWindow::start(int type) if (type < 1 || type > 5) return; - state = OpenDoor; - this->type = type; - returnToClockTimer.stop(); + if (udp->getData().curr_heat > 60) + { + state = CoolDown; - ui->animation->clear(); - ui->animation->load(":/images/animation/pull_01.png"); - ui->animation->load(":/images/animation/pull_02.png"); - ui->animation->load(":/images/animation/pull_03.png"); - ui->animation->load(":/images/animation/pull_04.png"); - ui->animation->show(); - ui->animation->start(300); + CooldownPopup *p = new CooldownPopup(this, 60); + p->setWindowModality(Qt::WindowModal); + p->showFullScreen(); + + connect(p, SIGNAL(destroyed(QObject*)), SLOT(resume())); + } + else + { + state = OpenDoor; - udp->set(TG_OVEN_MODE, 2); + returnToClockTimer.stop(); + + ui->animation->clear(); + ui->animation->load(":/images/animation/pull_01.png"); + ui->animation->load(":/images/animation/pull_02.png"); + ui->animation->load(":/images/animation/pull_03.png"); + ui->animation->load(":/images/animation/pull_04.png"); + ui->animation->show(); + ui->animation->start(300); + + udp->set(TG_OVEN_MODE, 2); + } +} + +void WashWindow::resume() +{ + if (udp->getData().door_state) + { + state = CloseDoor; + showCloseDoor(); + } + else + { + state = Request; + request(); + } } void WashWindow::stop() @@ -220,6 +248,48 @@ void WashWindow::updateView() } } +void WashWindow::showCloseDoor() +{ + ui->animation->clear(); + ui->animation->load(":/images/animation/door_big_09.png"); + ui->animation->load(":/images/animation/door_big_08.png"); + ui->animation->load(":/images/animation/door_big_07.png"); + ui->animation->load(":/images/animation/door_big_06.png"); + ui->animation->load(":/images/animation/door_big_05.png"); + ui->animation->load(":/images/animation/door_big_04.png"); + ui->animation->load(":/images/animation/door_big_03.png"); + ui->animation->load(":/images/animation/door_big_02.png"); + ui->animation->load(":/images/animation/door_big_01.png"); + ui->animation->start(300); + ui->closeDoorArrow->show(); +} + +void WashWindow::request() +{ + udp->set(TG_CLEAN_TYPE, type); + udp->turnOn(TG_CLEANING); + + OvenStatistics::getInstance()->setWashState(true); + + SoundPlayer::playStart(); + + ui->closeDoorArrow->hide(); + ui->animation->clear(); + ui->animation->load(":/images/animation/wash_01.png"); + ui->animation->load(":/images/animation/wash_02.png"); + ui->animation->load(":/images/animation/wash_03.png"); + ui->animation->load(":/images/animation/wash_04.png"); + ui->animation->start(300); + + ui->washStepGauge->setValue(0); + ui->titleLabel->setText(tr("기기의 내부를 세척 중입니다")); + ui->descLabel->setText(tr("완료될 때까지 문을 열지 마세요.\n제품 내부의 자동 세척 기능을 실행 중입니다.")); + ui->washStepTypeLabel->setText(""); + ui->washStepCountLabel->setText(""); + + ui->upperStack->setCurrentIndex(1); +} + void WashWindow::onChanged() { if (state == Idle) @@ -228,51 +298,20 @@ void WashWindow::onChanged() switch (state) { case Idle: + case CoolDown: return; case OpenDoor: if (udp->getData().door_state) { state = CloseDoor; - - ui->animation->clear(); - ui->animation->load(":/images/animation/door_big_09.png"); - ui->animation->load(":/images/animation/door_big_08.png"); - ui->animation->load(":/images/animation/door_big_07.png"); - ui->animation->load(":/images/animation/door_big_06.png"); - ui->animation->load(":/images/animation/door_big_05.png"); - ui->animation->load(":/images/animation/door_big_04.png"); - ui->animation->load(":/images/animation/door_big_03.png"); - ui->animation->load(":/images/animation/door_big_02.png"); - ui->animation->load(":/images/animation/door_big_01.png"); - ui->closeDoorArrow->show(); + showCloseDoor(); } break; case CloseDoor: if (!udp->getData().door_state) { state = Request; - - SoundPlayer::playStart(); - - ui->closeDoorArrow->hide(); - ui->animation->clear(); - - ui->animation->load(":/images/animation/wash_01.png"); - ui->animation->load(":/images/animation/wash_02.png"); - ui->animation->load(":/images/animation/wash_03.png"); - ui->animation->load(":/images/animation/wash_04.png"); - ui->washStepGauge->setValue(0); - ui->titleLabel->setText(tr("기기의 내부를 세척 중입니다")); - ui->descLabel->setText(tr("완료될 때까지 문을 열지 마세요.\n제품 내부의 자동 세척 기능을 실행 중입니다.")); - ui->washStepTypeLabel->setText(""); - ui->washStepCountLabel->setText(""); - - ui->upperStack->setCurrentIndex(1); - - udp->set(TG_CLEAN_TYPE, type); - udp->turnOn(TG_CLEANING); - - OvenStatistics::getInstance()->setWashState(true); + request(); } break; case Request: @@ -371,6 +410,7 @@ void WashWindow::on_backButton_clicked() case Running: stop(); break; + case CoolDown: case Stopping: case RequestClean: case RunningClean: @@ -398,6 +438,7 @@ void WashWindow::on_configButton_clicked() case Running: stop(); break; + case CoolDown: case Stopping: case RequestClean: case RunningClean: diff --git a/app/gui/oven_control/washwindow.h b/app/gui/oven_control/washwindow.h index 4b7a667..d62d4ff 100644 --- a/app/gui/oven_control/washwindow.h +++ b/app/gui/oven_control/washwindow.h @@ -24,11 +24,15 @@ protected: private slots: void start(int type); + void resume(); void stop(); void returnToClock(); void updateGauge(); void updateView(); + void showCloseDoor(); + void request(); + void onChanged(); void on_backButton_clicked(); @@ -40,7 +44,7 @@ private: UdpHandler *udp; enum State { - Idle, OpenDoor, CloseDoor, Request, Running, Stopping, + Idle, CoolDown, OpenDoor, CloseDoor, Request, Running, Stopping, RequestClean, RunningClean } state = Idle; -- 2.1.4