aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/profile')
-rw-r--r--qt-ui/profile/animationfunctions.cpp6
-rw-r--r--qt-ui/profile/animationfunctions.h3
-rw-r--r--qt-ui/profile/divecartesianaxis.cpp28
-rw-r--r--qt-ui/profile/divecartesianaxis.h4
-rw-r--r--qt-ui/profile/profilewidget2.cpp22
5 files changed, 43 insertions, 20 deletions
diff --git a/qt-ui/profile/animationfunctions.cpp b/qt-ui/profile/animationfunctions.cpp
index 917be3858..103af8787 100644
--- a/qt-ui/profile/animationfunctions.cpp
+++ b/qt-ui/profile/animationfunctions.cpp
@@ -30,4 +30,10 @@ void moveTo(QObject* obj, qreal x, qreal y, int msecs)
animation->start(QAbstractAnimation::DeleteWhenStopped);
}
+void moveTo(QObject* obj, const QPointF& pos, int msecs)
+{
+ moveTo(obj, pos.x(), pos.y(), msecs);
+}
+
+
}
diff --git a/qt-ui/profile/animationfunctions.h b/qt-ui/profile/animationfunctions.h
index d5f900cb3..958e53c03 100644
--- a/qt-ui/profile/animationfunctions.h
+++ b/qt-ui/profile/animationfunctions.h
@@ -2,11 +2,14 @@
#define ANIMATIONFUNCTIONS_H
#include <QtGlobal>
+#include <QPointF>
+
class QObject;
namespace Animations{
void hide(QObject *obj);
void moveTo(QObject *obj, qreal x, qreal y, int msecs = 500);
+ void moveTo(QObject *obj, const QPointF& pos, int msecs = 500);
void animDelete(QObject *obj);
};
diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp
index f2438a207..190a2f799 100644
--- a/qt-ui/profile/divecartesianaxis.cpp
+++ b/qt-ui/profile/divecartesianaxis.cpp
@@ -20,16 +20,26 @@ static QPen gridPen(){
return pen;
}
-void DiveCartesianAxis::setup(double minimum, double maximum, double interval, DiveCartesianAxis::Orientation o, qreal tickSize, const QPointF& pos)
+void DiveCartesianAxis::setup(double minimum, double maximum, double interval, DiveCartesianAxis::Orientation o, qreal tick_size, const QPointF& pos)
{
setMinimum(minimum);
setMaximum(maximum);
setTickInterval(interval);
setOrientation(o);
- setTickSize(tickSize);
+ setTickSize(tick_size);
setPos(pos);
}
+double DiveCartesianAxis::tickInterval() const
+{
+ return interval;
+}
+
+double DiveCartesianAxis::tickSize() const
+{
+ return tick_size;
+}
+
void DiveCartesianAxis::setMaximum(double maximum)
{
if (max == maximum)
@@ -121,9 +131,9 @@ void DiveCartesianAxis::updateTicks()
labels[i]->setText(textForValue(currValue));
if ( orientation == LeftToRight || orientation == RightToLeft) {
- labels[i]->animateMoveTo(childPos, m.y1() + tickSize);
+ labels[i]->animateMoveTo(childPos, m.y1() + tick_size);
} else {
- labels[i]->animateMoveTo(m.x1() - tickSize, childPos);
+ labels[i]->animateMoveTo(m.x1() - tick_size, childPos);
}
}
@@ -147,14 +157,14 @@ void DiveCartesianAxis::updateTicks()
if (orientation == RightToLeft || orientation == LeftToRight) {
if(showText){
label->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
- label->setPos(scene()->sceneRect().width() + 10, m.y1() + tickSize); // position it outside of the scene);
- label->animateMoveTo(childPos, m.y1() + tickSize);
+ label->setPos(scene()->sceneRect().width() + 10, m.y1() + tick_size); // position it outside of the scene);
+ label->animateMoveTo(childPos, m.y1() + tick_size);
}
} else {
if(showText){
label->setAlignment(Qt::AlignVCenter| Qt::AlignLeft);
- label->setPos(m.x1() - tickSize, scene()->sceneRect().height() + 10);
- label->animateMoveTo(m.x1() - tickSize, childPos);
+ label->setPos(m.x1() - tick_size, scene()->sceneRect().height() + 10);
+ label->animateMoveTo(m.x1() - tick_size, childPos);
}
}
}
@@ -186,7 +196,7 @@ QString DiveCartesianAxis::textForValue(double value)
void DiveCartesianAxis::setTickSize(qreal size)
{
- tickSize = size;
+ tick_size = size;
}
void DiveCartesianAxis::setTickInterval(double i)
diff --git a/qt-ui/profile/divecartesianaxis.h b/qt-ui/profile/divecartesianaxis.h
index 00bd9ecc3..a6e94e548 100644
--- a/qt-ui/profile/divecartesianaxis.h
+++ b/qt-ui/profile/divecartesianaxis.h
@@ -27,6 +27,8 @@ public:
void setTickSize(qreal size);
double minimum() const;
double maximum() const;
+ double tickInterval() const;
+ double tickSize() const;
qreal valueAt(const QPointF& p);
qreal percentAt(const QPointF& p);
qreal posAtValue(qreal value);
@@ -49,7 +51,7 @@ protected:
double min;
double max;
double interval;
- double tickSize;
+ double tick_size;
QColor textColor;
bool showTicks;
bool showText;
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index a3b649cd0..14a7c3a28 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -117,8 +117,12 @@ void ProfileWidget2::setupItemOnScene()
background->setZValue(9999);
toolTipItem->setTimeAxis(timeAxis);
+ profileYAxis->setOrientation(DiveCartesianAxis::TopToBottom);
+ profileYAxis->setMinimum(0);
+ profileYAxis->setTickInterval(M_OR_FT(10,30));
+ profileYAxis->setTickSize(2);
+
gasYAxis->setOrientation(DiveCartesianAxis::BottomToTop);
- gasYAxis->setX(3);
gasYAxis->setTickInterval(1);
gasYAxis->setTickSize(2);
gasYAxis->setY(70);
@@ -126,12 +130,10 @@ void ProfileWidget2::setupItemOnScene()
gasYAxis->setModel(dataModel);
temperatureAxis->setOrientation(DiveCartesianAxis::BottomToTop);
- temperatureAxis->setX(3);
temperatureAxis->setTickSize(2);
temperatureAxis->setTickInterval(300);
cylinderPressureAxis->setOrientation(DiveCartesianAxis::BottomToTop);
- cylinderPressureAxis->setX(3);
cylinderPressureAxis->setTickSize(2);
cylinderPressureAxis->setTickInterval(30000);
@@ -265,6 +267,8 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
// each item, I'll mostly like to fix this in the future, but I'll keep at this for now.
profileYAxis->setMaximum(maxdepth);
profileYAxis->updateTicks();
+
+ qDebug() << "More profile..." << profileYAxis->minimum() << profileYAxis->maximum() << profileYAxis->tickInterval() << profileYAxis->tickSize();
temperatureAxis->setMinimum(pInfo.mintemp);
temperatureAxis->setMaximum(pInfo.maxtemp);
timeAxis->setMaximum(maxtime);
@@ -400,11 +404,11 @@ void ProfileWidget2::setEmptyState()
currentState = EMPTY;
fixBackgroundPos();
Animations::moveTo(background, background->x(), itemPos.background.on.y());
- profileYAxis->setPos(itemPos.depth.pos.off);
+ Animations::moveTo(profileYAxis, itemPos.depth.pos.off);
toolTipItem->setVisible(false);
gasYAxis->setVisible(false);
temperatureAxis->setVisible(false);
- timeAxis->setPos(itemPos.time.pos.off);
+ Animations::moveTo(timeAxis,itemPos.time.pos.off);
diveProfileItem->setVisible(false);
cylinderPressureAxis->setVisible(false);
temperatureItem->setVisible(false);
@@ -437,16 +441,14 @@ void ProfileWidget2::setProfileState()
Animations::moveTo(background, background->x(), itemPos.background.off.y(), 1500);
toolTipItem->setVisible(true);
- profileYAxis->setPos(itemPos.depth.pos.on);
+ Animations::moveTo(profileYAxis,itemPos.depth.pos.on);
profileYAxis->setLine(itemPos.depth.expanded);
- qDebug() << "ProfileAxisPos" << profileYAxis->pos() << "Line" << profileYAxis->line() << scene()->items().indexOf(profileYAxis);
// gasYAxis->setVisible(true);
// temperatureAxis->setVisible(true);
- timeAxis->setPos(itemPos.time.pos.on);
+ Animations::moveTo(timeAxis, itemPos.time.pos.on);
timeAxis->setLine(itemPos.time.expanded);
- qDebug() << "timeAxisPos" << timeAxis->pos() << "Line" << timeAxis->line() << scene()->items().indexOf(timeAxis);
-// diveProfileItem->setVisible(true);
+ diveProfileItem->setVisible(true);
// cylinderPressureAxis->setVisible(true);
// temperatureItem->setVisible(true);
// gasPressureItem->setVisible(true);