Code cleanup: removed bogus animation functions

All animations are now on the Animations namespace, which resulted in a
bit of code cleanup, which is nice.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-07-11 19:13:01 -03:00 committed by Dirk Hohndel
parent 2171b981ac
commit e18f4dfdee
7 changed files with 11 additions and 34 deletions

View file

@ -173,9 +173,9 @@ void DiveCartesianAxis::updateTicks(color_indice_t color)
labels[i]->setText(textForValue(currValueText));
if (orientation == LeftToRight || orientation == RightToLeft) {
labels[i]->animateMoveTo(childPos, m.y1() + tick_size);
Animations::moveTo(labels[i],childPos, m.y1() + tick_size);
} else {
labels[i]->animateMoveTo(m.x1() - tick_size, childPos);
Animations::moveTo(labels[i],m.x1() - tick_size, childPos);
}
}
@ -185,9 +185,9 @@ void DiveCartesianAxis::updateTicks(color_indice_t color)
begin - i * stepSize;
if (orientation == LeftToRight || orientation == RightToLeft) {
lines[i]->animateMoveTo(childPos, m.y1());
Animations::moveTo(lines[i],childPos, m.y1());
} else {
lines[i]->animateMoveTo(m.x1(), childPos);
Animations::moveTo(lines[i],m.x1(), childPos);
}
}
@ -208,11 +208,11 @@ void DiveCartesianAxis::updateTicks(color_indice_t color)
if (orientation == RightToLeft || orientation == LeftToRight) {
label->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
label->setPos(scene()->sceneRect().width() + 10, m.y1() + tick_size); // position it outside of the scene);
label->animateMoveTo(childPos, m.y1() + tick_size);
Animations::moveTo(label,childPos, m.y1() + tick_size);
} else {
label->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
label->setPos(m.x1() - tick_size, scene()->sceneRect().height() + 10);
label->animateMoveTo(m.x1() - tick_size, childPos);
Animations::moveTo(label,m.x1() - tick_size, childPos);
}
}
@ -235,13 +235,13 @@ void DiveCartesianAxis::updateTicks(color_indice_t color)
if (orientation == RightToLeft || orientation == LeftToRight) {
line->setLine(0, -line_size, 0, 0);
line->setPos(scene()->sceneRect().width() + 10, m.y1()); // position it outside of the scene);
line->animateMoveTo(childPos, m.y1());
Animations::moveTo(line,childPos, m.y1());
} else {
QPointF p1 = mapFromScene(3, 0);
QPointF p2 = mapFromScene(line_size, 0);
line->setLine(p1.x(), 0, p2.x(), 0);
line->setPos(m.x1(), scene()->sceneRect().height() + 10);
line->animateMoveTo(m.x1(), childPos);
Animations::moveTo(line,m.x1(), childPos);
}
}

View file

@ -5,13 +5,3 @@
DiveLineItem::DiveLineItem(QGraphicsItem *parent) : QGraphicsLineItem(parent)
{
}
void DiveLineItem::animatedHide()
{
Animations::hide(this);
}
void DiveLineItem::animateMoveTo(qreal x, qreal y)
{
Animations::moveTo(this, x, y);
}

View file

@ -10,8 +10,6 @@ class DiveLineItem : public QObject, public QGraphicsLineItem {
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
public:
DiveLineItem(QGraphicsItem *parent = 0);
void animatedHide();
void animateMoveTo(qreal x, qreal y);
};
#endif // DIVELINEITEM_H

View file

@ -4,6 +4,7 @@
#include "graphicsview-common.h"
#include "divetextitem.h"
#include "profilewidget2.h"
#include "animationfunctions.h"
#include "profile.h"
#include "dive.h"
#include "preferences.h"
@ -666,7 +667,7 @@ void MeanDepthLine::setAxis(DiveCartesianAxis *a)
void MeanDepthLine::axisLineChanged()
{
DiveCartesianAxis *axis = qobject_cast<DiveCartesianAxis *>(sender());
animateMoveTo(x(), axis->posAtValue(meanDepth));
Animations::moveTo(this, x(), axis->posAtValue(meanDepth));
}
void PartialPressureGasItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)

View file

@ -94,13 +94,3 @@ void DiveTextItem::updateText()
textItem->setBrush(brush);
textItem->setPen(Qt::NoPen);
}
void DiveTextItem::animatedHide()
{
Animations::hide(this);
}
void DiveTextItem::animateMoveTo(qreal x, qreal y)
{
Animations::moveTo(this, x, y);
}

View file

@ -17,8 +17,6 @@ public:
void setAlignment(int alignFlags);
void setScale(double newscale);
void setBrush(const QBrush &brush);
void animatedHide();
void animateMoveTo(qreal x, qreal y);
const QString &text();
private:

View file

@ -490,7 +490,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
meanDepth->setVisible(false);
meanDepth->setMeanDepth(pInfo.meandepth);
meanDepth->setLine(0, 0, timeAxis->posAtValue(displayed_dive.duration.seconds), 0);
meanDepth->animateMoveTo(3, profileYAxis->posAtValue(pInfo.meandepth));
Animations::moveTo(meanDepth,3, profileYAxis->posAtValue(pInfo.meandepth));
dataModel->emitDataChanged();
// The event items are a bit special since we don't know how many events are going to