aboutsummaryrefslogtreecommitdiffstats
path: root/profile-widget/divecartesianaxis.cpp
AgeCommit message (Collapse)Author
2021-01-10profile: explicitly update gas-axisGravatar Berthold Stoeger
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-10profile: turn static into member variableGravatar Berthold Stoeger
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-10cleanup: make DiveCartesianAxis functions constGravatar Berthold Stoeger
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>
2020-12-12preferences: create global settingsChanged signalGravatar Berthold Stoeger
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>
2019-08-08Fix math in valueAtGravatar Robert C. Helling
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>
2019-07-12Profile: store animation speed in profile objectGravatar Berthold Stoeger
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>
2019-07-12Profile: add speed parameter to Animation::* functionsGravatar Berthold Stoeger
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>
2018-08-15profile-widget: remove SettingsObjectWrapper and update qPref callsGravatar jan Iversen
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>
2018-06-04Cleanup: fold core/helpers.h into core/qthelper.hGravatar Berthold Stoeger
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>
2018-05-21profile-widget: Change Q_UNUSED to no parameter nameGravatar jan Iversen
C++ permits use of parameters without name, which signals unused Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-19Profile: minor coding style issues concerning axis-ticksGravatar Berthold Stoeger
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>
2018-05-14Core: introduce new subsurface-string headerGravatar Dirk Hohndel
First small step to shrinking dive.h. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-05Use correct numeric format based on selected locale (Qt domain part)Gravatar Stefan Fuchs
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>
2018-01-10Typo: indice -> indexGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Unused code: DiveCartesianAxis::percentAt()Gravatar Jan Mulder
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10Unused code: remove DiveCartesianAxis::tickInterval() and tickSize()Gravatar Jan Mulder
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-04-29Add SPDX header to profile widgetsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-24Fix double to int truncation in C++ codeGravatar Jeremie Guichard
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>
2016-04-04Move subsurface-core to core and qt-mobile to mobile-widgetsGravatar Dirk Hohndel
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-03-08Silence warnings in DiveCartesianAxisGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-25Changed quite a few shorts to bool on the c++ implementtionGravatar Tomaz Canabrava
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>
2015-11-06Don't connect to the PreferencesDialog in Subsurface-mobileGravatar Dirk Hohndel
Just more untangling from the desktop UI. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-06This patch reverts ae709ab30ee6abGravatar Lubomir I. Ivanov
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>
2015-11-06Untagle DiveCartesianAxis from MainWindowGravatar Lubomir I. Ivanov
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-05Untangle profile from MainWindow: work around print modeGravatar Dirk Hohndel
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>
2015-11-02Preferences: Remove the old dialog and use the new oneGravatar Tomaz Canabrava
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>
2015-10-30Move Profile widget out of desktop-widgetsGravatar Tomaz Canabrava
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>