mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: port picture code to qt-quick
This was very painful, because I had to implement rearranging the paint order of the QSGNodes. The resulting code appears quite brittle. Let's see where that brings us. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
d0c26f42d7
commit
ebf9ce6d86
22 changed files with 979 additions and 592 deletions
|
@ -377,7 +377,8 @@ static double max_gas(const plot_info &pi, double gas_pressures::*gas)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void ProfileScene::plotDive(const struct dive *dIn, int dcIn, int animSpeed, DivePlannerPointsModel *plannerModel,
|
||||
void ProfileScene::plotDive(const struct dive *dIn, int dcIn, int animSpeed, bool simplified,
|
||||
DivePlannerPointsModel *plannerModel,
|
||||
bool inPlanner, bool keepPlotInfo, bool calcMax, double zoom, double zoomedPosition)
|
||||
{
|
||||
d = dIn;
|
||||
|
@ -428,11 +429,6 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, int animSpeed, Div
|
|||
|
||||
bool hasHeartBeat = plotInfo.maxhr;
|
||||
// For mobile we might want to turn of some features that are normally shown.
|
||||
#ifdef SUBSURFACE_MOBILE
|
||||
bool simplified = true;
|
||||
#else
|
||||
bool simplified = false;
|
||||
#endif
|
||||
updateVisibility(hasHeartBeat, simplified);
|
||||
updateAxes(hasHeartBeat, simplified);
|
||||
|
||||
|
@ -570,7 +566,7 @@ void ProfileScene::draw(QPainter *painter, const QRect &pos,
|
|||
{
|
||||
QSize size = pos.size();
|
||||
resize(QSizeF(size));
|
||||
plotDive(d, dc, 0, plannerModel, inPlanner, false, true);
|
||||
plotDive(d, dc, 0, false, plannerModel, inPlanner, false, true);
|
||||
|
||||
QImage image(pos.size(), QImage::Format_ARGB32);
|
||||
image.fill(getColor(::BACKGROUND, isGrayscale));
|
||||
|
@ -616,6 +612,22 @@ int ProfileScene::timeAt(QPointF pos) const
|
|||
return lrint(timeAxis->valueAt(pos));
|
||||
}
|
||||
|
||||
std::pair<double, double> ProfileScene::minMaxTime()
|
||||
{
|
||||
return { timeAxis->minimum(), timeAxis->maximum() };
|
||||
}
|
||||
|
||||
double ProfileScene::yToScreen(double y)
|
||||
{
|
||||
auto [min, max] = profileYAxis->screenMinMax();
|
||||
return min + (max - min) * y;
|
||||
}
|
||||
|
||||
double ProfileScene::posAtTime(double time)
|
||||
{
|
||||
return timeAxis->posAtValue(time);
|
||||
}
|
||||
|
||||
std::vector<std::pair<QString, QPixmap>> ProfileScene::eventsAt(QPointF pos) const
|
||||
{
|
||||
std::vector<std::pair<QString, QPixmap>> res;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue