Changeset View
Changeset View
Standalone View
Standalone View
effects/slidingpopups/slidingpopups.cpp
Show First 20 Lines • Show All 382 Lines • ▼ Show 20 Line(s) | 375 | { | |||
---|---|---|---|---|---|
383 | 383 | | |||
384 | auto dataIt = m_animationsData.constFind(w); | 384 | auto dataIt = m_animationsData.constFind(w); | ||
385 | if (dataIt == m_animationsData.constEnd()) { | 385 | if (dataIt == m_animationsData.constEnd()) { | ||
386 | return; | 386 | return; | ||
387 | } | 387 | } | ||
388 | 388 | | |||
389 | Animation &animation = m_animations[w]; | 389 | Animation &animation = m_animations[w]; | ||
390 | animation.kind = AnimationKind::In; | 390 | animation.kind = AnimationKind::In; | ||
391 | animation.timeLine.reset(); | | |||
392 | animation.timeLine.setDirection(TimeLine::Forward); | 391 | animation.timeLine.setDirection(TimeLine::Forward); | ||
393 | animation.timeLine.setDuration((*dataIt).slideInDuration); | 392 | animation.timeLine.setDuration((*dataIt).slideInDuration); | ||
394 | animation.timeLine.setEasingCurve(QEasingCurve::InOutSine); | 393 | animation.timeLine.setEasingCurve(QEasingCurve::InOutSine); | ||
395 | 394 | | |||
395 | // If the opposite animation (Out) was active and it had shorter duration, | ||||
396 | // at this point, the timeline can end up in the "done" state. Thus, we have | ||||
397 | // to reset it. | ||||
398 | if (animation.timeLine.done()) { | ||||
399 | animation.timeLine.reset(); | ||||
400 | } | ||||
401 | | ||||
396 | w->setData(WindowAddedGrabRole, QVariant::fromValue(static_cast<void*>(this))); | 402 | w->setData(WindowAddedGrabRole, QVariant::fromValue(static_cast<void*>(this))); | ||
397 | w->setData(WindowForceBackgroundContrastRole, QVariant(true)); | 403 | w->setData(WindowForceBackgroundContrastRole, QVariant(true)); | ||
398 | w->setData(WindowForceBlurRole, QVariant(true)); | 404 | w->setData(WindowForceBlurRole, QVariant(true)); | ||
399 | 405 | | |||
400 | w->addRepaintFull(); | 406 | w->addRepaintFull(); | ||
401 | } | 407 | } | ||
402 | 408 | | |||
403 | void SlidingPopupsEffect::slideOut(EffectWindow *w) | 409 | void SlidingPopupsEffect::slideOut(EffectWindow *w) | ||
Show All 12 Lines | 410 | { | |||
416 | } | 422 | } | ||
417 | 423 | | |||
418 | if (w->isDeleted()) { | 424 | if (w->isDeleted()) { | ||
419 | w->refWindow(); | 425 | w->refWindow(); | ||
420 | } | 426 | } | ||
421 | 427 | | |||
422 | Animation &animation = m_animations[w]; | 428 | Animation &animation = m_animations[w]; | ||
423 | animation.kind = AnimationKind::Out; | 429 | animation.kind = AnimationKind::Out; | ||
424 | animation.timeLine.reset(); | | |||
425 | animation.timeLine.setDirection(TimeLine::Backward); | 430 | animation.timeLine.setDirection(TimeLine::Backward); | ||
426 | animation.timeLine.setDuration((*dataIt).slideOutDuration); | 431 | animation.timeLine.setDuration((*dataIt).slideOutDuration); | ||
427 | animation.timeLine.setEasingCurve(QEasingCurve::InOutSine); | 432 | animation.timeLine.setEasingCurve(QEasingCurve::InOutSine); | ||
428 | 433 | | |||
434 | // If the opposite animation (In) was active and it had shorter duration, | ||||
435 | // at this point, the timeline can end up in the "done" state. Thus, we have | ||||
436 | // to reset it. | ||||
437 | if (animation.timeLine.done()) { | ||||
438 | animation.timeLine.reset(); | ||||
439 | } | ||||
440 | | ||||
429 | w->setData(WindowClosedGrabRole, QVariant::fromValue(static_cast<void*>(this))); | 441 | w->setData(WindowClosedGrabRole, QVariant::fromValue(static_cast<void*>(this))); | ||
430 | w->setData(WindowForceBackgroundContrastRole, QVariant(true)); | 442 | w->setData(WindowForceBackgroundContrastRole, QVariant(true)); | ||
431 | w->setData(WindowForceBlurRole, QVariant(true)); | 443 | w->setData(WindowForceBlurRole, QVariant(true)); | ||
432 | 444 | | |||
433 | w->addRepaintFull(); | 445 | w->addRepaintFull(); | ||
434 | } | 446 | } | ||
435 | 447 | | |||
436 | bool SlidingPopupsEffect::isActive() const | 448 | bool SlidingPopupsEffect::isActive() const | ||
437 | { | 449 | { | ||
438 | return !m_animations.isEmpty(); | 450 | return !m_animations.isEmpty(); | ||
439 | } | 451 | } | ||
440 | 452 | | |||
441 | } // namespace | 453 | } // namespace |