Prepare for plotting partial pressures in the new profile

This patch makes the cartesian axis of the profile depth shrink and
(together with it) the Profile Depth and the grid lines. There will
probabla bey a lot of things that didn't have their correct position
fixed, so I'll fix them in the later commits.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-01-22 17:10:18 -02:00 committed by Dirk Hohndel
parent 4005ee2ae8
commit bc7b221498
4 changed files with 42 additions and 9 deletions

View file

@ -2,13 +2,13 @@
#include "divelineitem.h"
#include "divetextitem.h"
#include "helpers.h"
#include "preferences.h"
#include <QPen>
#include <QGraphicsScene>
#include <QDebug>
#include <QPropertyAnimation>
#include <QGraphicsView>
#include <QStyleOption>
#include <QSettings>
static QPen gridPen(){
QPen pen;
@ -140,6 +140,13 @@ void DiveCartesianAxis::updateTicks()
}
}
void DiveCartesianAxis::animateChangeLine(const QLineF& newLine)
{
setLine(newLine);
updateTicks();
sizeChanged();
}
void DiveCartesianAxis::setShowText(bool show)
{
showText = show;
@ -243,6 +250,25 @@ QColor DepthAxis::colorForValue(double value)
return QColor(Qt::red);
}
DepthAxis::DepthAxis()
{
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
settingsChanged(); // force the correct size of the line.
}
void DepthAxis::settingsChanged()
{
QSettings s;
s.beginGroup("TecDetails");
bool ppGraph = s.value("phegraph").toBool() || s.value("po2graph").toBool() || s.value("pn2graph").toBool();
if (ppGraph) {
animateChangeLine(QLineF(0,2,0,60));
} else {
animateChangeLine(QLineF(0,2,0,98));
}
}
QColor TimeAxis::colorForValue(double value)
{
Q_UNUSED(value);
@ -278,7 +304,7 @@ void DiveCartesianPlane::setBottomAxis(DiveCartesianAxis* axis)
QLineF DiveCartesianPlane::horizontalLine() const
{
return (bottomAxis) ? bottomAxis->line() : QLineF() ;
return (bottomAxis) ? bottomAxis->line() : QLineF();
}
void DiveCartesianPlane::setHorizontalLine(QLineF line)
@ -299,7 +325,7 @@ void DiveCartesianPlane::setVerticalLine(QLineF line)
QLineF DiveCartesianPlane::verticalLine() const
{
return (leftAxis) ? leftAxis->line() : QLineF() ;
return (leftAxis) ? leftAxis->line() : QLineF();
}
void DiveCartesianPlane::setup()