Commit c36fa2b96f6121d96b093aae26c31bf6c1a769f5
1 parent
3606eb85f1
Exists in
master
and in
2 other branches
세척 시작 명령 순서 변경, 세척 중 문 열림 시 문 닫음 애니메이션 출력
Showing
2 changed files
with
85 additions
and
16 deletions
Show diff stats
app/gui/oven_control/washwindow.cpp
| ... | ... | @@ -153,15 +153,7 @@ void WashWindow::start(int type) |
| 153 | 153 | |
| 154 | 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 | 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 | 295 | void WashWindow::showCloseDoor() |
| 252 | 296 | { |
| 297 | + if (animationState == ShowingCloseDoor) | |
| 298 | + return; | |
| 299 | + | |
| 300 | + animationState = ShowingCloseDoor; | |
| 301 | + | |
| 253 | 302 | ui->animation->clear(); |
| 254 | 303 | ui->animation->load(":/images/animation/door_big_09.png"); |
| 255 | 304 | ui->animation->load(":/images/animation/door_big_08.png"); |
| ... | ... | @@ -260,26 +309,39 @@ void WashWindow::showCloseDoor() |
| 260 | 309 | ui->animation->load(":/images/animation/door_big_03.png"); |
| 261 | 310 | ui->animation->load(":/images/animation/door_big_02.png"); |
| 262 | 311 | ui->animation->load(":/images/animation/door_big_01.png"); |
| 312 | + ui->animation->show(); | |
| 263 | 313 | ui->animation->start(300); |
| 264 | 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 | 324 | ui->animation->clear(); |
| 278 | 325 | ui->animation->load(":/images/animation/wash_01.png"); |
| 279 | 326 | ui->animation->load(":/images/animation/wash_02.png"); |
| 280 | 327 | ui->animation->load(":/images/animation/wash_03.png"); |
| 281 | 328 | ui->animation->load(":/images/animation/wash_04.png"); |
| 329 | + ui->animation->show(); | |
| 282 | 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 | 346 | ui->washStepGauge->setValue(0); |
| 285 | 347 | ui->titleLabel->setText(tr("기기의 내부를 세척 중입니다")); | ... | ... |
app/gui/oven_control/washwindow.h
| ... | ... | @@ -30,7 +30,10 @@ private slots: |
| 30 | 30 | void updateGauge(); |
| 31 | 31 | void updateView(); |
| 32 | 32 | |
| 33 | + void showIdle(); | |
| 34 | + void showOpenDoor(); | |
| 33 | 35 | void showCloseDoor(); |
| 36 | + void showWash(); | |
| 34 | 37 | void request(); |
| 35 | 38 | |
| 36 | 39 | void onChanged(); |
| ... | ... | @@ -48,6 +51,10 @@ private: |
| 48 | 51 | RequestClean, RunningClean |
| 49 | 52 | } state = Idle; |
| 50 | 53 | |
| 54 | + enum AnimationState { | |
| 55 | + Stopped, ShowingOpenDoor, ShowingCloseDoor, ShowingWash | |
| 56 | + } animationState = Stopped; | |
| 57 | + | |
| 51 | 58 | bool selected; |
| 52 | 59 | bool opened; |
| 53 | 60 | bool started; | ... | ... |