Skip to content

Commit

Permalink
Before bounce animation remake
Browse files Browse the repository at this point in the history
  • Loading branch information
jefvel committed Mar 18, 2015
1 parent 768ba51 commit 00dc94c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,3 +2,4 @@ Makefile
bin/
*.o
moc_*
*.swp
11 changes: 8 additions & 3 deletions twmnd/widget.cpp
Expand Up @@ -126,7 +126,8 @@ void Widget::processMessageQueue()
}

if (m_animation.state() == QAbstractAnimation::Running ||
(m_animation.totalDuration() - m_animation.currentTime()) < 50) {
m_visible.isActive()){
//(m_animation.totalDuration() - m_animation.currentTime()) < 50) {
return;
}

Expand Down Expand Up @@ -396,7 +397,8 @@ void Widget::updateBounceAnimation(QVariant value)

void Widget::reverseTrigger()
{
if (m_animation.direction() == QAnimationGroup::Backward) {
if (m_animation.direction() == QAnimationGroup::Backward ||
m_messageQueue.isEmpty()) {
QTimer::singleShot(30, this, SLOT(processMessageQueue()));
return;
}
Expand All @@ -421,8 +423,10 @@ void Widget::reverseTrigger()

void Widget::reverseStart()
{
//If last message, play hide animation.
if (m_messageQueue.size() <= 1) {
if (!m_messageQueue.isEmpty()){
doneBounce();
m_messageQueue.pop_front();
}

Expand All @@ -434,7 +438,7 @@ void Widget::reverseStart()

disconnect(anim, SIGNAL(valueChanged(QVariant)), this, m_activePositionSlot.c_str());

m_animation.setDirection(QAnimationGroup::Backward);
anim->setDirection(QAnimationGroup::Backward);
anim->setEasingCurve(QEasingCurve::Type(m_settings.get("gui/out_animation").toInt()));
anim->setDuration(duration);
m_animation.setCurrentTime(duration);
Expand Down Expand Up @@ -763,6 +767,7 @@ void Widget::onNext()
m.data["manually_shown"] = boost::optional<QVariant>(true);
m_previousStack.push(m);
m_messageQueue.pop_front();
std::cout<<"Msgs left: "<<m_messageQueue.size()<<"\n";
loadDefaults();
setupFont();
setupColors();
Expand Down

0 comments on commit 00dc94c

Please sign in to comment.