diff options
-rw-r--r-- | pref.h | 2 | ||||
-rw-r--r-- | qt-ui/printlayout.cpp | 7 | ||||
-rw-r--r-- | qt-ui/profile/animationfunctions.cpp | 42 | ||||
-rw-r--r-- | qt-ui/profile/divecartesianaxis.cpp | 1 | ||||
-rw-r--r-- | qt-ui/profile/divetextitem.cpp | 2 | ||||
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 1 |
6 files changed, 36 insertions, 19 deletions
@@ -35,7 +35,7 @@ struct preferences { short calcndltts; short gflow; short gfhigh; - short animation; + bool animation; bool gf_low_at_maxdepth; short display_invalid_dives; short unit_system; diff --git a/qt-ui/printlayout.cpp b/qt-ui/printlayout.cpp index a23b8e3a8..8327105ba 100644 --- a/qt-ui/printlayout.cpp +++ b/qt-ui/printlayout.cpp @@ -120,10 +120,15 @@ int PrintLayout::estimateTotalDives() const void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn) { int i, row = 0, col = 0, printed = 0, total = estimateTotalDives(); + bool animationOriginal = prefs.animation; + struct dive *dive; if (!total) return; + // disable animations on the profile: + prefs.animation = false; + // setup a painter QPainter painter; painter.begin(printer); @@ -205,6 +210,8 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn) profile->resize(originalSize); // we need to force a redraw of the profile so it switches back from print mode profile->plotDive(0, true); + // re-enable animations + prefs.animation = animationOriginal; } /* we create a table that has a fixed height, but can stretch to fit certain width */ diff --git a/qt-ui/profile/animationfunctions.cpp b/qt-ui/profile/animationfunctions.cpp index c680e11a5..9f3aa8366 100644 --- a/qt-ui/profile/animationfunctions.cpp +++ b/qt-ui/profile/animationfunctions.cpp @@ -8,19 +8,27 @@ namespace Animations { void hide(QObject *obj) { - QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity"); - animation->setStartValue(1); - animation->setEndValue(0); - animation->start(QAbstractAnimation::DeleteWhenStopped); + if (prefs.animation != 0) { + QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity"); + animation->setStartValue(1); + animation->setEndValue(0); + animation->start(QAbstractAnimation::DeleteWhenStopped); + } else { + obj->setProperty("opacity", 0); + } } void animDelete(QObject *obj) { - QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity"); - obj->connect(animation, SIGNAL(finished()), SLOT(deleteLater())); - animation->setStartValue(1); - animation->setEndValue(0); - animation->start(QAbstractAnimation::DeleteWhenStopped); + if (prefs.animation != 0) { + QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity"); + obj->connect(animation, SIGNAL(finished()), SLOT(deleteLater())); + animation->setStartValue(1); + animation->setEndValue(0); + animation->start(QAbstractAnimation::DeleteWhenStopped); + } else { + obj->setProperty("opacity", 0); + } } void moveTo(QObject *obj, qreal x, qreal y) @@ -38,12 +46,16 @@ namespace Animations { void scaleTo(QObject *obj, qreal scale) { - QPropertyAnimation *animation = new QPropertyAnimation(obj, "scale"); - animation->setDuration(prefs.animation); - animation->setStartValue(obj->property("scale").toReal()); - animation->setEndValue(QVariant::fromValue(scale)); - animation->setEasingCurve(QEasingCurve::InCubic); - animation->start(QAbstractAnimation::DeleteWhenStopped); + if (prefs.animation != 0) { + QPropertyAnimation *animation = new QPropertyAnimation(obj, "scale"); + animation->setDuration(prefs.animation); + animation->setStartValue(obj->property("scale").toReal()); + animation->setEndValue(QVariant::fromValue(scale)); + animation->setEasingCurve(QEasingCurve::InCubic); + animation->start(QAbstractAnimation::DeleteWhenStopped); + } else { + obj->setProperty("scale", QVariant::fromValue(scale)); + } } void moveTo(QObject *obj, const QPointF &pos) diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp index 0d1d5357d..4053ee1cd 100644 --- a/qt-ui/profile/divecartesianaxis.cpp +++ b/qt-ui/profile/divecartesianaxis.cpp @@ -201,7 +201,6 @@ void DiveCartesianAxis::updateTicks(color_indice_t color) } DiveTextItem *label = new DiveTextItem(this); label->setText(textForValue(currValueText)); - label->setBrush(QBrush(textColor)); label->setBrush(colorForValue(currValueText)); label->setScale(fontLabelScale()); label->setZValue(1); diff --git a/qt-ui/profile/divetextitem.cpp b/qt-ui/profile/divetextitem.cpp index 4d8687626..c2ba2efc4 100644 --- a/qt-ui/profile/divetextitem.cpp +++ b/qt-ui/profile/divetextitem.cpp @@ -66,7 +66,7 @@ void DiveTextItem::updateText() fnt.setPixelSize(size); } else { size = fnt.pointSizeF(); - size *= scale * MainWindow::instance()->graphics()->getFontPrintScale();; + size *= scale * MainWindow::instance()->graphics()->getFontPrintScale(); fnt.setPointSizeF(size); } QFontMetrics fm(fnt); diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index e40a73235..59e6cb17b 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -382,7 +382,6 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) return; } } - //END // special handling for the first time we display things int animSpeedBackup = -1; |