aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2014-01-22 17:10:18 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-22 12:35:52 -0800
commitbc7b221498e6f07c26fd8455f9992657f0a1a162 (patch)
tree05eddc0a41efa99c4fea12dfb22efa3afb37f8db
parent4005ee2ae88000f60839ffead6cdcf07bb598cb5 (diff)
downloadsubsurface-bc7b221498e6f07c26fd8455f9992657f0a1a162.tar.gz
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>
-rw-r--r--qt-ui/profile/divecartesianaxis.cpp34
-rw-r--r--qt-ui/profile/divecartesianaxis.h13
-rw-r--r--qt-ui/profile/diveprofileitem.cpp1
-rw-r--r--qt-ui/profile/profilewidget2.cpp3
4 files changed, 42 insertions, 9 deletions
diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp
index 505b60d7e..8a1b1890d 100644
--- a/qt-ui/profile/divecartesianaxis.cpp
+++ b/qt-ui/profile/divecartesianaxis.cpp
@@ -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()
diff --git a/qt-ui/profile/divecartesianaxis.h b/qt-ui/profile/divecartesianaxis.h
index b2aecbf79..507d0349c 100644
--- a/qt-ui/profile/divecartesianaxis.h
+++ b/qt-ui/profile/divecartesianaxis.h
@@ -3,6 +3,8 @@
#include <QObject>
#include <QGraphicsLineItem>
+
+class QPropertyAnimation;
class DiveTextItem;
class DiveLineItem;
@@ -21,7 +23,6 @@ public:
void setTickInterval(double interval);
void setOrientation(Orientation orientation);
void setTickSize(qreal size);
- void updateTicks();
double minimum() const;
double maximum() const;
qreal valueAt(const QPointF& p);
@@ -31,7 +32,10 @@ public:
void setTextColor(const QColor& color);
void setShowTicks(bool show);
void setShowText(bool show);
+ void animateChangeLine(const QLineF& newLine);
int unitSystem;
+public slots:
+ void updateTicks();
signals:
void sizeChanged();
protected:
@@ -49,9 +53,14 @@ protected:
};
class DepthAxis : public DiveCartesianAxis {
+ Q_OBJECT
+public:
+ DepthAxis();
protected:
QString textForValue(double value);
QColor colorForValue(double value);
+private slots:
+ void settingsChanged();
};
class TimeAxis : public DiveCartesianAxis {
@@ -89,4 +98,4 @@ private:
qreal verticalSize;
qreal horizontalSize;
};
-#endif \ No newline at end of file
+#endif
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp
index 5ddef1e90..1c49b7eee 100644
--- a/qt-ui/profile/diveprofileitem.cpp
+++ b/qt-ui/profile/diveprofileitem.cpp
@@ -135,7 +135,6 @@ void DiveProfileItem::modelDataChanged()
pat.setColorAt(1, getColor(DEPTH_BOTTOM));
pat.setColorAt(0, getColor(DEPTH_TOP));
setBrush(QBrush(pat));
- AbstractProfilePolygonItem::preferencesChanged();
int last = -1;
for (int i = 0, count = dataModel->rowCount(); i < count; i++) {
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index fa41da9f6..9fc64a0c1 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -64,7 +64,6 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
timeAxis->setTickInterval(600); // 10 to 10 minutes?
// Default Sizes of the Items.
- profileYAxis->setLine(0, 0, 0, 90);
profileYAxis->setX(2);
profileYAxis->setTickSize(1);
gasYAxis->setLine(0, 0, 0, 20);
@@ -188,7 +187,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
profileState->assignProperty(this, "backgroundBrush", getColor(::BACKGROUND));
profileState->assignProperty(background, "y", backgroundOffCanvas);
profileState->assignProperty(profileYAxis, "x", profileYAxisOnCanvas);
- profileState->assignProperty(profileYAxis, "line", profileYAxisExpanded);
+ //profileState->assignProperty(profileYAxis, "line", profileYAxisExpanded);
profileState->assignProperty(gasYAxis, "x", 0);
profileState->assignProperty(timeAxis, "y", timeAxisOnCanvas);
profileState->assignProperty(depthController, "y", depthControllerOffCanvas);