From 6fbaea2a7d330dd8fcff7ae755acb4fb0a826477 Mon Sep 17 00:00:00 2001
From: victor <taehoon@falinux.com>
Date: Fri, 14 Jul 2017 11:20:12 +0900
Subject: [PATCH] =?UTF-8?q?=EC=88=98=EB=8F=99=20=EC=9A=94=EB=A6=AC=20?=
 =?UTF-8?q?=EB=8F=99=EC=9E=91=20=EB=B3=80=EA=B2=BD=20-=20=EC=9A=94?=
 =?UTF-8?q?=EB=A6=AC=20=EC=A4=91=20=EC=BF=A8=EB=8B=A4=EC=9A=B4=20=ED=8C=9D?=
 =?UTF-8?q?=EC=97=85=EC=97=90=20=EB=93=A4=EC=96=B4=EA=B0=80=EB=A9=B4=20?=
 =?UTF-8?q?=EC=9A=94=EB=A6=AC=20=EC=A4=91=EB=8B=A8=20=ED=9B=84=20=EC=BF=A8?=
 =?UTF-8?q?=EB=8B=A4=EC=9A=B4=20=EB=81=9D=EB=82=9C=20=EB=92=A4=20=EC=9A=94?=
 =?UTF-8?q?=EB=A6=AC=20=EC=9E=AC=EC=8B=9C=EC=9E=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/gui/oven_control/cooldownpopup.cpp | 14 +++++++++++---
 app/gui/oven_control/cooldownpopup.h   |  1 +
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/app/gui/oven_control/cooldownpopup.cpp b/app/gui/oven_control/cooldownpopup.cpp
index 170028b..c2fa048 100644
--- a/app/gui/oven_control/cooldownpopup.cpp
+++ b/app/gui/oven_control/cooldownpopup.cpp
@@ -10,7 +10,8 @@ CooldownPopup::CooldownPopup(QWidget *parent, Oven *oven) :
     QWidget(parent),
     ui(new Ui::CooldownPopup),
     oven(oven),
-    showingCurrentTemp(false)
+    showingCurrentTemp(false),
+    needCookStarting(false)
 {
     ui->setupUi(this);
 
@@ -37,6 +38,9 @@ CooldownPopup::CooldownPopup(QWidget *parent, Oven *oven) :
     expectingFanLevel = oven->maxFan();
     started = false;
     opened = false;
+    needCookStarting = oven->cooking();
+    if (needCookStarting)
+        oven->stopCooking();
 
     connect(oven, SIGNAL(changed(Oven*)), SLOT(updateView()));
 
@@ -71,6 +75,9 @@ CooldownPopup::CooldownPopup(QWidget *parent, Oven *oven) :
 
 CooldownPopup::~CooldownPopup()
 {
+    if (needCookStarting)
+        oven->startCooking();
+
     delete ui;
 }
 
@@ -114,6 +121,9 @@ void CooldownPopup::start()
     started = true;
     opened = false;
 
+    oven->setFan(expectingFanLevel);
+    oven->startCooldown();
+
     checkOvenTimer.start();
 
     updateView();
@@ -205,8 +215,6 @@ void CooldownPopup::checkOven()
         if (oven->door())
         {
             opened = true;
-            oven->setFan(expectingFanLevel);
-            oven->startCooldown();
         }
     }
     else
diff --git a/app/gui/oven_control/cooldownpopup.h b/app/gui/oven_control/cooldownpopup.h
index 01ce4e9..53dc073 100644
--- a/app/gui/oven_control/cooldownpopup.h
+++ b/app/gui/oven_control/cooldownpopup.h
@@ -61,6 +61,7 @@ private:
     int expectingFanLevel;
     bool started;
     bool opened;
+    bool needCookStarting;
 
     int lastDisplayedFanLevel;
     bool lastDisplayedHumidification;
-- 
2.1.4