API REVIEW: animationResult() -> currentPixmap()
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=800784
This commit is contained in:
parent
3a150a6f6b
commit
d6995254db
10
phase.cpp
10
phase.cpp
@ -445,28 +445,28 @@ void Phase::setInitialPixmap(AnimId id, const QPixmap &pixmap)
|
||||
QMap<AnimId, ElementAnimationState*>::iterator it = d->animatedElements.find(id);
|
||||
|
||||
if (it == d->animatedElements.end()) {
|
||||
kDebug() << "Phase::setAnimationPixmap(" << id << ") found no entry for it!";
|
||||
kDebug() << "Phase::setInitialPixmap(" << id << ") found no entry for it!";
|
||||
return;
|
||||
}
|
||||
|
||||
it.value()->pixmap = pixmap;
|
||||
}
|
||||
|
||||
QPixmap Phase::animationResult(AnimId id)
|
||||
QPixmap Phase::currentPixmap(AnimId id)
|
||||
{
|
||||
QMap<AnimId, ElementAnimationState*>::const_iterator it = d->animatedElements.find(id);
|
||||
|
||||
if (it == d->animatedElements.constEnd()) {
|
||||
//kDebug() << "Phase::animationResult(" << id << ") found no entry for it!";
|
||||
//kDebug() << "Phase::currentPixmap(" << id << ") found no entry for it!";
|
||||
return QPixmap();
|
||||
}
|
||||
|
||||
ElementAnimationState* state = it.value();
|
||||
qreal progress = state->frames;
|
||||
//kDebug() << "Phase::animationResult(" << id << " at " << progress;
|
||||
//kDebug() << "Phase::currentPixmap(" << id << " at " << progress;
|
||||
progress = state->currentFrame / progress;
|
||||
progress = qMin(qreal(1.0), qMax(qreal(0.0), progress));
|
||||
//kDebug() << "Phase::animationResult(" << id << " at " << progress;
|
||||
//kDebug() << "Phase::currentPixmap(" << id << " at " << progress;
|
||||
|
||||
switch (state->animation) {
|
||||
case ElementAppear:
|
||||
|
2
phase.h
2
phase.h
@ -114,7 +114,7 @@ public:
|
||||
Q_INVOKABLE AnimId animateElement(QGraphicsItem *obj, ElementAnimation);
|
||||
Q_INVOKABLE void stopElementAnimation(AnimId id);
|
||||
Q_INVOKABLE void setInitialPixmap(AnimId id, const QPixmap &pixmap);
|
||||
Q_INVOKABLE QPixmap animationResult(AnimId id);
|
||||
Q_INVOKABLE QPixmap currentPixmap(AnimId id);
|
||||
|
||||
/**
|
||||
* Can be used to query if there are other animations happening. This way
|
||||
|
@ -247,7 +247,7 @@ void IconAction::paint(QPainter *painter) const
|
||||
return;
|
||||
}
|
||||
|
||||
QPixmap animPixmap = Phase::self()->animationResult(m_animationId);
|
||||
QPixmap animPixmap = Phase::self()->currentPixmap(m_animationId);
|
||||
|
||||
if (m_visible && animPixmap.isNull()) {
|
||||
painter->drawPixmap(m_rect.toRect(), m_pixmap);
|
||||
|
Loading…
Reference in New Issue
Block a user