Commit c36fa2b96f6121d96b093aae26c31bf6c1a769f5

Authored by 김태훈
1 parent 3606eb85f1
Exists in master and in 2 other branches fhd, fhd-demo

세척 시작 명령 순서 변경, 세척 중 문 열림 시 문 닫음 애니메이션 출력

app/gui/oven_control/washwindow.cpp
@@ -153,15 +153,7 @@ void WashWindow::start(int type) @@ -153,15 +153,7 @@ void WashWindow::start(int type)
153 153
154 returnToClockTimer.stop(); 154 returnToClockTimer.stop();
155 155
156 - ui->animation->clear();  
157 - ui->animation->load(":/images/animation/pull_01.png");  
158 - ui->animation->load(":/images/animation/pull_02.png");  
159 - ui->animation->load(":/images/animation/pull_03.png");  
160 - ui->animation->load(":/images/animation/pull_04.png");  
161 - ui->animation->show();  
162 - ui->animation->start(300);  
163 -  
164 - udp->set(TG_OVEN_MODE, 2); 156 + showOpenDoor();
165 } 157 }
166 } 158 }
167 159
@@ -246,10 +238,67 @@ void WashWindow::updateView() @@ -246,10 +238,67 @@ void WashWindow::updateView()
246 break; 238 break;
247 } 239 }
248 } 240 }
  241 +
  242 + switch (state)
  243 + {
  244 + case Idle:
  245 + case CoolDown:
  246 + showIdle();
  247 + break;
  248 + case OpenDoor:
  249 + if (udp->getData().door_state == 0)
  250 + showOpenDoor();
  251 + break;
  252 + case CloseDoor:
  253 + case Request:
  254 + case Running:
  255 + case Stopping:
  256 + case RequestClean:
  257 + case RunningClean:
  258 + if (udp->getData().door_state != 0)
  259 + showCloseDoor();
  260 + else
  261 + showWash();
  262 + break;
  263 + }
  264 +}
  265 +
  266 +void WashWindow::showIdle()
  267 +{
  268 + if (animationState == Stopped)
  269 + return;
  270 +
  271 + animationState = Stopped;
  272 +
  273 + ui->animation->stop();
  274 + ui->animation->clear();
  275 + ui->animation->load(":/images/animation/wash_04.png");
  276 +}
  277 +
  278 +void WashWindow::showOpenDoor()
  279 +{
  280 + if (animationState == ShowingOpenDoor)
  281 + return;
  282 +
  283 + animationState = ShowingOpenDoor;
  284 +
  285 + ui->animation->clear();
  286 + ui->animation->load(":/images/animation/pull_01.png");
  287 + ui->animation->load(":/images/animation/pull_02.png");
  288 + ui->animation->load(":/images/animation/pull_03.png");
  289 + ui->animation->load(":/images/animation/pull_04.png");
  290 + ui->animation->show();
  291 + ui->animation->start(300);
  292 + ui->closeDoorArrow->hide();
249 } 293 }
250 294
251 void WashWindow::showCloseDoor() 295 void WashWindow::showCloseDoor()
252 { 296 {
  297 + if (animationState == ShowingCloseDoor)
  298 + return;
  299 +
  300 + animationState = ShowingCloseDoor;
  301 +
253 ui->animation->clear(); 302 ui->animation->clear();
254 ui->animation->load(":/images/animation/door_big_09.png"); 303 ui->animation->load(":/images/animation/door_big_09.png");
255 ui->animation->load(":/images/animation/door_big_08.png"); 304 ui->animation->load(":/images/animation/door_big_08.png");
@@ -260,26 +309,39 @@ void WashWindow::showCloseDoor() @@ -260,26 +309,39 @@ void WashWindow::showCloseDoor()
260 ui->animation->load(":/images/animation/door_big_03.png"); 309 ui->animation->load(":/images/animation/door_big_03.png");
261 ui->animation->load(":/images/animation/door_big_02.png"); 310 ui->animation->load(":/images/animation/door_big_02.png");
262 ui->animation->load(":/images/animation/door_big_01.png"); 311 ui->animation->load(":/images/animation/door_big_01.png");
  312 + ui->animation->show();
263 ui->animation->start(300); 313 ui->animation->start(300);
264 ui->closeDoorArrow->show(); 314 ui->closeDoorArrow->show();
265 } 315 }
266 316
267 -void WashWindow::request() 317 +void WashWindow::showWash()
268 { 318 {
269 - udp->set(TG_CLEAN_TYPE, type);  
270 - udp->turnOn(TG_CLEANING);  
271 -  
272 - OvenStatistics::getInstance()->setWashState(true); 319 + if (animationState == ShowingWash)
  320 + return;
273 321
274 - SoundPlayer::playStart(); 322 + animationState = ShowingWash;
275 323
276 - ui->closeDoorArrow->hide();  
277 ui->animation->clear(); 324 ui->animation->clear();
278 ui->animation->load(":/images/animation/wash_01.png"); 325 ui->animation->load(":/images/animation/wash_01.png");
279 ui->animation->load(":/images/animation/wash_02.png"); 326 ui->animation->load(":/images/animation/wash_02.png");
280 ui->animation->load(":/images/animation/wash_03.png"); 327 ui->animation->load(":/images/animation/wash_03.png");
281 ui->animation->load(":/images/animation/wash_04.png"); 328 ui->animation->load(":/images/animation/wash_04.png");
  329 + ui->animation->show();
282 ui->animation->start(300); 330 ui->animation->start(300);
  331 + ui->closeDoorArrow->hide();
  332 +}
  333 +
  334 +void WashWindow::request()
  335 +{
  336 + udp->set(TG_OVEN_MODE, 2);
  337 + udp->set(TG_CLEAN_TYPE, type);
  338 + udp->turnOn(TG_CLEANING);
  339 +
  340 + OvenStatistics::getInstance()->setWashState(true);
  341 +
  342 + SoundPlayer::playStart();
  343 +
  344 + showWash();
283 345
284 ui->washStepGauge->setValue(0); 346 ui->washStepGauge->setValue(0);
285 ui->titleLabel->setText(tr("기기의 내부를 세척 중입니다")); 347 ui->titleLabel->setText(tr("기기의 내부를 세척 중입니다"));
app/gui/oven_control/washwindow.h
@@ -30,7 +30,10 @@ private slots: @@ -30,7 +30,10 @@ private slots:
30 void updateGauge(); 30 void updateGauge();
31 void updateView(); 31 void updateView();
32 32
  33 + void showIdle();
  34 + void showOpenDoor();
33 void showCloseDoor(); 35 void showCloseDoor();
  36 + void showWash();
34 void request(); 37 void request();
35 38
36 void onChanged(); 39 void onChanged();
@@ -48,6 +51,10 @@ private: @@ -48,6 +51,10 @@ private:
48 RequestClean, RunningClean 51 RequestClean, RunningClean
49 } state = Idle; 52 } state = Idle;
50 53
  54 + enum AnimationState {
  55 + Stopped, ShowingOpenDoor, ShowingCloseDoor, ShowingWash
  56 + } animationState = Stopped;
  57 +
51 bool selected; 58 bool selected;
52 bool opened; 59 bool opened;
53 bool started; 60 bool started;