mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-07 20:03:23 +00:00
Show the profile again.
This patch re-enables a few items on the profile, most notably, the profile itself. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ed72aabde5
commit
0ad2a69c42
5 changed files with 43 additions and 20 deletions
|
@ -30,4 +30,10 @@ void moveTo(QObject* obj, qreal x, qreal y, int msecs)
|
||||||
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void moveTo(QObject* obj, const QPointF& pos, int msecs)
|
||||||
|
{
|
||||||
|
moveTo(obj, pos.x(), pos.y(), msecs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,14 @@
|
||||||
#define ANIMATIONFUNCTIONS_H
|
#define ANIMATIONFUNCTIONS_H
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
#include <QPointF>
|
||||||
|
|
||||||
class QObject;
|
class QObject;
|
||||||
|
|
||||||
namespace Animations{
|
namespace Animations{
|
||||||
void hide(QObject *obj);
|
void hide(QObject *obj);
|
||||||
void moveTo(QObject *obj, qreal x, qreal y, int msecs = 500);
|
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);
|
void animDelete(QObject *obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,16 +20,26 @@ static QPen gridPen(){
|
||||||
return pen;
|
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);
|
setMinimum(minimum);
|
||||||
setMaximum(maximum);
|
setMaximum(maximum);
|
||||||
setTickInterval(interval);
|
setTickInterval(interval);
|
||||||
setOrientation(o);
|
setOrientation(o);
|
||||||
setTickSize(tickSize);
|
setTickSize(tick_size);
|
||||||
setPos(pos);
|
setPos(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double DiveCartesianAxis::tickInterval() const
|
||||||
|
{
|
||||||
|
return interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
double DiveCartesianAxis::tickSize() const
|
||||||
|
{
|
||||||
|
return tick_size;
|
||||||
|
}
|
||||||
|
|
||||||
void DiveCartesianAxis::setMaximum(double maximum)
|
void DiveCartesianAxis::setMaximum(double maximum)
|
||||||
{
|
{
|
||||||
if (max == maximum)
|
if (max == maximum)
|
||||||
|
@ -121,9 +131,9 @@ void DiveCartesianAxis::updateTicks()
|
||||||
|
|
||||||
labels[i]->setText(textForValue(currValue));
|
labels[i]->setText(textForValue(currValue));
|
||||||
if ( orientation == LeftToRight || orientation == RightToLeft) {
|
if ( orientation == LeftToRight || orientation == RightToLeft) {
|
||||||
labels[i]->animateMoveTo(childPos, m.y1() + tickSize);
|
labels[i]->animateMoveTo(childPos, m.y1() + tick_size);
|
||||||
} else {
|
} 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 (orientation == RightToLeft || orientation == LeftToRight) {
|
||||||
if(showText){
|
if(showText){
|
||||||
label->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
|
label->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
|
||||||
label->setPos(scene()->sceneRect().width() + 10, m.y1() + tickSize); // position it outside of the scene);
|
label->setPos(scene()->sceneRect().width() + 10, m.y1() + tick_size); // position it outside of the scene);
|
||||||
label->animateMoveTo(childPos, m.y1() + tickSize);
|
label->animateMoveTo(childPos, m.y1() + tick_size);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(showText){
|
if(showText){
|
||||||
label->setAlignment(Qt::AlignVCenter| Qt::AlignLeft);
|
label->setAlignment(Qt::AlignVCenter| Qt::AlignLeft);
|
||||||
label->setPos(m.x1() - tickSize, scene()->sceneRect().height() + 10);
|
label->setPos(m.x1() - tick_size, scene()->sceneRect().height() + 10);
|
||||||
label->animateMoveTo(m.x1() - tickSize, childPos);
|
label->animateMoveTo(m.x1() - tick_size, childPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,7 +196,7 @@ QString DiveCartesianAxis::textForValue(double value)
|
||||||
|
|
||||||
void DiveCartesianAxis::setTickSize(qreal size)
|
void DiveCartesianAxis::setTickSize(qreal size)
|
||||||
{
|
{
|
||||||
tickSize = size;
|
tick_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveCartesianAxis::setTickInterval(double i)
|
void DiveCartesianAxis::setTickInterval(double i)
|
||||||
|
|
|
@ -27,6 +27,8 @@ public:
|
||||||
void setTickSize(qreal size);
|
void setTickSize(qreal size);
|
||||||
double minimum() const;
|
double minimum() const;
|
||||||
double maximum() const;
|
double maximum() const;
|
||||||
|
double tickInterval() const;
|
||||||
|
double tickSize() const;
|
||||||
qreal valueAt(const QPointF& p);
|
qreal valueAt(const QPointF& p);
|
||||||
qreal percentAt(const QPointF& p);
|
qreal percentAt(const QPointF& p);
|
||||||
qreal posAtValue(qreal value);
|
qreal posAtValue(qreal value);
|
||||||
|
@ -49,7 +51,7 @@ protected:
|
||||||
double min;
|
double min;
|
||||||
double max;
|
double max;
|
||||||
double interval;
|
double interval;
|
||||||
double tickSize;
|
double tick_size;
|
||||||
QColor textColor;
|
QColor textColor;
|
||||||
bool showTicks;
|
bool showTicks;
|
||||||
bool showText;
|
bool showText;
|
||||||
|
|
|
@ -117,8 +117,12 @@ void ProfileWidget2::setupItemOnScene()
|
||||||
background->setZValue(9999);
|
background->setZValue(9999);
|
||||||
toolTipItem->setTimeAxis(timeAxis);
|
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->setOrientation(DiveCartesianAxis::BottomToTop);
|
||||||
gasYAxis->setX(3);
|
|
||||||
gasYAxis->setTickInterval(1);
|
gasYAxis->setTickInterval(1);
|
||||||
gasYAxis->setTickSize(2);
|
gasYAxis->setTickSize(2);
|
||||||
gasYAxis->setY(70);
|
gasYAxis->setY(70);
|
||||||
|
@ -126,12 +130,10 @@ void ProfileWidget2::setupItemOnScene()
|
||||||
gasYAxis->setModel(dataModel);
|
gasYAxis->setModel(dataModel);
|
||||||
|
|
||||||
temperatureAxis->setOrientation(DiveCartesianAxis::BottomToTop);
|
temperatureAxis->setOrientation(DiveCartesianAxis::BottomToTop);
|
||||||
temperatureAxis->setX(3);
|
|
||||||
temperatureAxis->setTickSize(2);
|
temperatureAxis->setTickSize(2);
|
||||||
temperatureAxis->setTickInterval(300);
|
temperatureAxis->setTickInterval(300);
|
||||||
|
|
||||||
cylinderPressureAxis->setOrientation(DiveCartesianAxis::BottomToTop);
|
cylinderPressureAxis->setOrientation(DiveCartesianAxis::BottomToTop);
|
||||||
cylinderPressureAxis->setX(3);
|
|
||||||
cylinderPressureAxis->setTickSize(2);
|
cylinderPressureAxis->setTickSize(2);
|
||||||
cylinderPressureAxis->setTickInterval(30000);
|
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.
|
// each item, I'll mostly like to fix this in the future, but I'll keep at this for now.
|
||||||
profileYAxis->setMaximum(maxdepth);
|
profileYAxis->setMaximum(maxdepth);
|
||||||
profileYAxis->updateTicks();
|
profileYAxis->updateTicks();
|
||||||
|
|
||||||
|
qDebug() << "More profile..." << profileYAxis->minimum() << profileYAxis->maximum() << profileYAxis->tickInterval() << profileYAxis->tickSize();
|
||||||
temperatureAxis->setMinimum(pInfo.mintemp);
|
temperatureAxis->setMinimum(pInfo.mintemp);
|
||||||
temperatureAxis->setMaximum(pInfo.maxtemp);
|
temperatureAxis->setMaximum(pInfo.maxtemp);
|
||||||
timeAxis->setMaximum(maxtime);
|
timeAxis->setMaximum(maxtime);
|
||||||
|
@ -400,11 +404,11 @@ void ProfileWidget2::setEmptyState()
|
||||||
currentState = EMPTY;
|
currentState = EMPTY;
|
||||||
fixBackgroundPos();
|
fixBackgroundPos();
|
||||||
Animations::moveTo(background, background->x(), itemPos.background.on.y());
|
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);
|
toolTipItem->setVisible(false);
|
||||||
gasYAxis->setVisible(false);
|
gasYAxis->setVisible(false);
|
||||||
temperatureAxis->setVisible(false);
|
temperatureAxis->setVisible(false);
|
||||||
timeAxis->setPos(itemPos.time.pos.off);
|
Animations::moveTo(timeAxis,itemPos.time.pos.off);
|
||||||
diveProfileItem->setVisible(false);
|
diveProfileItem->setVisible(false);
|
||||||
cylinderPressureAxis->setVisible(false);
|
cylinderPressureAxis->setVisible(false);
|
||||||
temperatureItem->setVisible(false);
|
temperatureItem->setVisible(false);
|
||||||
|
@ -437,16 +441,14 @@ void ProfileWidget2::setProfileState()
|
||||||
Animations::moveTo(background, background->x(), itemPos.background.off.y(), 1500);
|
Animations::moveTo(background, background->x(), itemPos.background.off.y(), 1500);
|
||||||
toolTipItem->setVisible(true);
|
toolTipItem->setVisible(true);
|
||||||
|
|
||||||
profileYAxis->setPos(itemPos.depth.pos.on);
|
Animations::moveTo(profileYAxis,itemPos.depth.pos.on);
|
||||||
profileYAxis->setLine(itemPos.depth.expanded);
|
profileYAxis->setLine(itemPos.depth.expanded);
|
||||||
|
|
||||||
qDebug() << "ProfileAxisPos" << profileYAxis->pos() << "Line" << profileYAxis->line() << scene()->items().indexOf(profileYAxis);
|
|
||||||
// gasYAxis->setVisible(true);
|
// gasYAxis->setVisible(true);
|
||||||
// temperatureAxis->setVisible(true);
|
// temperatureAxis->setVisible(true);
|
||||||
timeAxis->setPos(itemPos.time.pos.on);
|
Animations::moveTo(timeAxis, itemPos.time.pos.on);
|
||||||
timeAxis->setLine(itemPos.time.expanded);
|
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);
|
// cylinderPressureAxis->setVisible(true);
|
||||||
// temperatureItem->setVisible(true);
|
// temperatureItem->setVisible(true);
|
||||||
// gasPressureItem->setVisible(true);
|
// gasPressureItem->setVisible(true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue