Commit graph

9 commits

Author SHA1 Message Date
Berthold Stoeger
8046a05e95 profile: merge plotDive() into draw() call
Rendering resets the size, which now recalculates the axes.
Therefore, plotDive() must be called. The callers were doing
the opposite: call plotDive() first, then draw().

To make it easier for the callers, present a single interface
that handles these subtleties.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
51dc5113c2 profile: for printing/mobile access ProfileScene directly
Instead of using the interactive ProfileWidget2, just
use the ProfileScene to render the profile for printing,
export and mobile. One layer (QWidget) less.

This removes all the kludges for handling DPR on mobile.
Thus, the rendering will now be off and have to be fixed
by redoing the scaling code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
e844b8dcad profile: move creation of mobile profile-widget into function
The current way of handling the "print scale factor" is
complex: The text fields are added and later resized via
signals. Things could be simplified by just redoing the
chart when changing the scale factor.

Moreover, in the future we will want to adapt the size of the
axes depending on the size of the texts.

As a first step, factor out the creation of the profile-widget.
This can then be used to recreate the profile when changing
the scale factor.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Dirk Hohndel
a3e0d1ceb4 mobile/profile: listen to dive changes and redraw profile
If a dive changes, we should simply redraw the profile. This could be
improved by checking for the fields that might impact the profile at
all, but this is definitely a step in the right direction.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-21 13:12:37 -08:00
Dirk Hohndel
6629d046b7 mobile/profile: adjust offsets when scaling
If the user is scaling out again we need to make sure that our offsets
are adjusted so that we always show a subset of the profile and not
'empty space' outside of it. Instead of reimplementing the offset logic,
let's just trigger another paint() call.
This requires a trampoline function because of different signal and slot
signatures.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-25 09:28:05 -07:00
Dirk Hohndel
51100cb20e mobile/profile: add x/y offsets to widget
This will allow us to pan the profile around in the QML UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-18 07:34:46 -08:00
Dirk Hohndel
f277b525c3 mobile/profile: create updateProfile method
This allows us to trigger an update even if the dive displayed stays the same.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-18 07:34:46 -08:00
Berthold Stoeger
19b8c9a33a Cleanup: Turn QMLProfile::diveId from QString to int
This property is used to render the profile of a given dive.
Weirdly, even though the diveId is an integer, it was stored
as a string. It is not clear why that is the case. Therefore,
turn into the more natural int and avoid unnecessary conversion.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-24 06:16:39 +09:00
jan Iversen
aab8f0dcf6 profile: make profile self contained
move qmlprofile.* to profile dir, to keep all parts of the
widget in one place.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-09 17:16:53 +02:00
Renamed from mobile-widgets/qmlprofile.h (Browse further)