Commit graph

21 commits

Author SHA1 Message Date
Berthold Stoeger
db726862ae profile: move axes to ProfileScene
Part of separating the static (for printing, export) and
dynamic (UI) parts of the profile. This is still quite messy
with many direct accesses from the ProfileWidget.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
01983c65c3 profile: pass fontPrintScale at construction time
Instead of intializing the text fields and then changing the
font scale via signal-rigmarole, pass down the font-scale
at construction time.

Since the fontPrintScale is only set in print mode, we also
can access it directly instead of testing for printMode.

Since the DiveTextItem is not updated using signals anymore,
the connected flag can be removed.

The commit is larger than I had hoped for, but this makes
things ultimately less brittle.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
7744fec0bf cleanup: reuse constructor of DiveCartesianAxis
The constructors of Time- and TemperatureAxis don't do anything.
In reasonable modern C++ we can simply reuse the constructor
of the base class with a "using" directive.

The point here is to simplify followup commits that will
add additional parameters to the constructors of the axes.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
d725170914 cleanup: remove DiveCartesianAxis::fontLabelScale accessor
This was only used internally - there is no point in an
accessor function. It only makes grepping more complicated.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00
Berthold Stoeger
b2b24665e7 profile: remove DiveCartesianAxis::maxChanged signal
The last listener was removed in 0104b0a915.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-06-04 08:45:32 -07:00
Berthold Stoeger
622abc5afd cleanup: strongly type DepthAxis::unitSystem
This takes an enum of units::LENGTH, therefore declare it as
such. Yes, this is kind of superfluous bike shedding, but since
we have a strongly typed language, let's use it.

On a side note, the enum should probably not be named with
all-caps.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-06-01 09:25:32 -07:00
Berthold Stoeger
04d7c9b808 cleanup: remove DiveCartesianAxis::unitSystem
This was only used by the child class DepthAxis,
where it was defined separately. An oversight?

In any case, remove the unused member.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-06-01 09:25:32 -07:00
Berthold Stoeger
dd0939b6f5 profile: explicitly update gas-axis
On each profile replot, the gas axis was implicitly reset
by calling "dataModel->emitDataChanged()", which would send
a signal recieved by the axis. To make the code less confusing
and, more importantly, make order of execution deterministic,
explicitly reset the axis.

Rename the function that resets the axis from "settingsChanged"
to "update" to reflect its usage.

Moreover, remove the "setModel()" function and pass the model
to the constructore. Make it a const reference to make clear
that it can't change during the life time of the axis.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10 15:57:39 -08:00
Berthold Stoeger
f3ac9c96c6 cleanup: unslotify DiveCartesianAxis::updateTicks
This virtual function is not used as the target of a signal
anywhere, which means that it shouldn't be a slot.

Moreover, mark the one place it is overriden as override.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10 15:57:39 -08:00
Berthold Stoeger
e61466e178 profile: turn static into member variable
When the settings change, the depth axis is redrawn
to reflect metric/imperial units. To check whether the
units changed, the old length unit is saved in a static
variable. This makes no sense and allows for only one
depth axis. Make this a normal member variable that is
initialized in the constructor.

Also remove the settingsChanged() call in the constructor,
since this is a no-op (the depth unit is unchanged).

Contains a whitespace fix.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10 15:57:39 -08:00
Berthold Stoeger
bd01e91ea3 cleanup: make DiveCartesianAxis functions const
A few DiveCartesianAxis functions that were pure accessors
were not const. Make them so. Moreover, mark a few overridden
virtual functions as such.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10 15:57:39 -08:00
Berthold Stoeger
ebb342c969 cleanup: turn protected into private members
Some profilewidget classes hat protected members which can
be made private as there is no subclassing.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-13 17:18:37 -07:00
Berthold Stoeger
df156a56c0 Cleanup: replace virtual by override where appropriate
The keyword "virtual" signalizes that the function is virtual,
i.e. the function of the derived class is called, even if the
call is on the parent class.

It is not necessary to repeat the "virtual" keyword in derived
classes. To highlight derived virtual functions, the keyword
"override" should be used instead. It results in a hard compile-
error, if no function is overridden, thus avoiding subtle bugs.

Replace "virtual" by "override" where appropriate. Moreover,
replace Q_DECL_OVERRIDE by override, since we require reasonably
recent compilers anyway. Likewise, replace /* reimp */ by
"override" for consistency and compiler support.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-31 11:02:34 +02:00
Berthold Stoeger
85ac3106e6 Typo: indice -> index
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10 21:25:02 +01:00
Jan Mulder
a88c950738 Unused code: DiveCartesianAxis::percentAt()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Jan Mulder
d88e916c1d Unused code: remove DiveCartesianAxis::tickInterval() and tickSize()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Dirk Hohndel
49d0bb8406 Add SPDX header to profile widgets
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29 13:32:55 -07:00
Dirk Hohndel
7be962bfc2 Move subsurface-core to core and qt-mobile to mobile-widgets
Having subsurface-core as a directory name really messes with
autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an
autocomplete conflict and also was inconsistent with the desktop-widget
name for the directory containing the "other" UI.

And while cleaning up the resulting change in the path name for include
files, I decided to clean up those even more to make them consistent
overall.

This could have been handled in more commits, but since this requires a
make clean before the build, it seemed more sensible to do it all in one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04 22:33:58 -07:00
Tomaz Canabrava
07606160cb Silence warnings in DiveCartesianAxis
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08 20:57:52 -08:00
Lubomir I. Ivanov
6d7eefd52d Untagle DiveCartesianAxis from MainWindow
DiveCartesianAxis and derivatives can recieve
ProfileWidget2 as an instance in their constructor.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-06 09:58:08 -08:00
Tomaz Canabrava
1d6683f3e0 Move Profile widget out of desktop-widgets
The reason for that is, even if profile widget is made with qpainter
and for that reason it should be a desktop widget, it's being used
on the mobile version because of a lack of QML plotting library that
is fast and reliable.

We discovered that it was faster just to encapsulate our Profile in
a QML class and call it directly.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Renamed from desktop-widgets/profile/divecartesianaxis.h (Browse further)