API REVIEW: animationResult() -> currentPixmap()

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=800784
This commit is contained in:
Davide Bettio 2008-04-24 20:44:16 +00:00
parent 3a150a6f6b
commit d6995254db
3 changed files with 7 additions and 7 deletions

View File

@ -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:

View File

@ -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

View File

@ -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);