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>
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>
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>
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>
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>
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>
So far, the PreferencesDialog emitted a settingsChanged signal.
This meant that models that listened to that signal had to
conditionally compile out the code for mobile or the connection
had to be made in MainWindow.
Instead, introduce a global signal that does this and move
the connects to the listeners to remove inter-dependencies.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
DiveCartesianAxis::valueAt() is supposed to be the inverse of
posAtValue(). This fixes the math such that inverted
orientations are correctly taken care of.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
When exporting dive pictures we don't want animations. Therefore,
store the animation speed in the profile object to avoid nasty
hacks with the preferences.
This actually removes such a hack. Pictures and tooltips for now
still use the values stored in the preferences, because their
animations happen only on user-interactions.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
For now always use the preferences value, so that this is a
no-op. This is a preparation for storing the speed in the
profile widget.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
remove use of SettingsObjectWrapper::
remove include of SettingsObjectWrapper.h
use qPrefFoo:: for setters and getters
replace prefs.foo with qPrefXYZ::foo() where feasible
(this expands to the same code, but gives us more control
over the variable).
Signed-off-by: Jan Iversen <jani@apache.org>
helpers.h included qthelper.h and all functions declared in helpers.h
were defined in qthelper.h. Therefore fold the former into the latter,
since the split seems completely arbitrary.
While doing so, change the return-type of get_dc_nichname from
"const QString" to "QString".
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
1) Fix the English of a comment.
2) Remove a number of int-to-double compares:
Make "steps" an integer variable (the number of steps).
Rename the old double "steps" variable to "stepsInRange". This gives
a non-integer number of steps and is necessary to calculate the
correct step size
3) Replace a "x = x/y" by a "x /= y" construct.
4) Remove an unnecessary if clause.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This changes the numeric format of many values printed to the UI to
reflect the correct numeric format of the selected locale:
- dot or comma as decimal separator
- comma or dot as thousands separator
In the Qt domain the `L` flag is used case specific mostly
in qthelper.cpp.
Then the helper functions get_xxx_string() are used more consistently.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Wfloat-conversion enabled for C++ part of the code
Fix warnings raised by the flag using lrint
Original issue reported on the mailing list:
The ascent/descent rates are sometimes not what is expected.
E.g. setting the ascent rate to 10m/min results in an actual
ascent rate of 9m/min.
This is due to truncating the ascent rate preference,
then effectively rounding up the time to reach each stop to 2s intervals.
The result being that setting the ascent rate to 10m/min
results in 20s to ascend 3m (9m/min), when it should be exactly 18s.
Reported-by: John Smith <noseygit@hotmail.com>
Reported-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
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>
The shorts where being used on the preferences since a long
while and we cannot just simply change them to bool since this
could break the preferences files, so work around that by
changing them to booleans, since it's the correct type for a
true / false answer.
Also, move some plot curves to the new settings style
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
things like:
potentially, for every item interested in 'printMode'
can clutter the profile-widget stack a lot.
instead the items should be aware of the profile widget
instance and not MainWindow.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
Since we don't support printing in subsurface-mobile this solves the
problem at hand - but it doesn't do what we really want which is to
untangle the Profile from the MainWindow.
Partial credit.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The new preferences dialog still needs a bit of fine tuning
but should already work.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>