Commit graph

1468 commits

Author SHA1 Message Date
jan Iversen
6e06550631 core/settings:: remove string functions for units
Remove string version of unit_system, duration_units, length, pressure,
temperature, vertical_speed_time, and volume, including tests and make signals
strongly typed in C++

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 09:55:26 -08:00
Dirk Hohndel
e1cd055111 code cleanup: add empty table structures
It seemed to make sense to combine all three types in one commit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10 02:37:03 +09:00
Dirk Hohndel
70cabb968c code cleanup: use explicit zero_location
Again, several different ways to achieve the same thing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10 02:37:03 +09:00
Dirk Hohndel
e1dbf65672 code cleanup: replace deprecated member function QColor::dark()
dark() and darker() appear to have the same semantics.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10 02:37:03 +09:00
Dirk Hohndel
fa4208cc18 code cleanup: remove deprecated QString::null
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10 02:37:03 +09:00
Dirk Hohndel
d2ff40deb8 code cleanup: replace deprecated setAutoCompletion() functions
It's not even clear if we need the setCaseSensitivity() call as it appears
that a case insensitive completer is the default.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10 02:37:03 +09:00
Dirk Hohndel
2feb7077f8 code cleanup: add missing initialization
While technically the initial value of this variable makes no difference as
it is set when the first dive is displayed, technically Coverity is correct.

Fixes CID 353273

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10 02:37:03 +09:00
Dirk Hohndel
1f35b005fb code cleanup: remove unused QSignalMapper
Fixes CID #353274

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10 02:37:03 +09:00
Dirk Hohndel
daedffce2e code cleanup: replace deprecated setBackgroundColor() method
Here the replacement has been around for a very long time.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10 02:37:03 +09:00
Dirk Hohndel
46441689b9 code cleanup: mark unused argument
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10 02:37:03 +09:00
Dirk Hohndel
e6210aafc5 code cleanup: initialize all elements in structure
This seems silly. I don't like that warning and would rather disable the warning.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10 02:37:03 +09:00
Dirk Hohndel
44ddb1411e code cleanup: use QElapsedTimer instead of QTime
Newer versions of Qt deprecate using QTime as a timer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10 02:37:03 +09:00
Dirk Hohndel
afd53be6f5 code cleanup: QFontMetrics::width() is deprecated
Qt5.11 introduced the suggested replacement QFontMetrics::horizontalAdvance().

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-10 02:37:03 +09:00
jan Iversen
042799eb2a desktop-widgets: add comment why last SIGNAL/SLOT is not converted
The last SIGNAL/SLOT cannot be converted due to a limitation in the
new connect() syntax, it does not "understand" default parameters.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-07 03:46:01 +09:00
jan Iversen
130fd9e8c2 desktop-widgets: replace connect() for CylindersModel.
Replace SIGNAL/SLOT in favor of new connect()

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-07 03:46:01 +09:00
jan Iversen
9a78c29b47 desktop-widgets: replace connect() with parameter double.
Replace SIGNAL() with QOverload<double>::of() to allow
new connect syntax.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-07 03:46:01 +09:00
jan Iversen
954c4c7289 desktop-widgets: convert last simple connect().
Convert the last convert() statements, that can be
converted just by changing the syntax.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-07 03:46:01 +09:00
jan Iversen
8fad93a504 desktop-widgets: correct connect for QShortcut
Replace syntax for connect of QShortcut.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-07 03:46:01 +09:00
jan Iversen
c7fe91a3f8 desktop-widgets: correct QDateTime connect()
Change connect() to new syntax for QDataTime.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-07 03:46:01 +09:00
jan Iversen
5c8c64c713 desktop-widgets: change rebreathermode to use new connect()
Replace SIGNAL/SLOT with QOverload.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-07 03:46:01 +09:00
jan Iversen
774ba759e4 desktop-widgets: change connect() for triggered(bool)
Change connect for QAction::triggered(bool) to new syntax.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06 10:34:42 +09:00
jan Iversen
ff8849a797 desktop-widgets: change connect() for valueChange(int)
Change connect for QSpinBox::valueChange(int) to new syntax.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06 10:34:42 +09:00
jan Iversen
aacac00800 desktop-widgets: change connect() for clicked/accepted/rejected
Change connect for QAbstractButton::clickedto new syntax.
Change connect for QDialogButtonBox::accepted/rejected to new syntax.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06 10:34:42 +09:00
jan Iversen
f3515ea64a desktop-widgets: remove double connect.
No need to connect ui.display_variations to the
same signal/slot twice.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06 10:34:42 +09:00
jan Iversen
7b2d746241 desktop-widgets: change connect() to new type for toogled
Change connect for QAbstractButton::toogled to new syntax.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06 10:34:42 +09:00
jan Iversen
712f7ef7f6 desktop-widgets: correct type
correct SLOT was sec_bottomsac(double), which
is not reported as an error.

correct to set_bottomsac(double)

Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06 10:34:42 +09:00
jan Iversen
c89a357e84 desktop-widgets: correct set_min_switch_duration connect.
correct SLOT was set_min_swich_duration()(int), which
is not reported as an error.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06 10:34:42 +09:00
jan Iversen
dacb331347 desktop-widgets: set_bailout -> set_dobailout
correct name mistake in connect()

Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06 10:34:42 +09:00
jan Iversen
2492b62ad4 desktop-widgets: set_verbatim_plan should go through plannerShared.
Adjust connect() to use plannerShared, avoiding parameter convert
problem.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06 10:34:42 +09:00
jan Iversen
fa72288ca2 desktop-widgets: remove use of QSignalMapper.
QSignalMapper gives a warning that it is depreciated, and the
doc. states that using a lambda function is more efficient.

Replace use of QSignalMapper.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06 10:34:42 +09:00
jan Iversen
e2d568acc1 desktop-widgets: replace QSignalMapper for set_deco_mode
QSignalMapper had a parameter convert problem, when mapping to
set_deco_mode in plannerShared.

Use lambda function in connect to avoid parameter convert problem.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2020-01-06 10:34:42 +09:00
Dirk Hohndel
254f42e396 desktop UI: only show salinity warning when DC salinity is different
There were two cases that were handled incorrectly:
- if the user hasn't entered a salinity, obviously there shouldn't be a warning
- if this is a manually entered dive, there is no salinity downloaded from a
  dive computer, so equally, no warning

Suggested-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-06 07:00:34 +09:00
Dirk Hohndel
c03731b220 desktop UI: use salinity of current DC, not first DC
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-06 07:00:34 +09:00
Dirk Hohndel
eac87f6481 desktop UI: correctly show the salinity data overwritten warning
We need to show this whenever the value in the dive (which could have been
entered by the user some other time) doesn't correspond to the value in the DC.
This, btw, will point out to the user if different DCs have different values.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-06 07:00:34 +09:00
Dirk Hohndel
1e4cc49f83 desktop UI: treat an unknown salinity as that
We were royally confused when we didn't know the salinity value (e.g., if the
dive computer didn't provide that information). We somehow treated this as the
same as wanting to use the salinity information in the dive computer. Which
makes no sense.

While cleaning this up, this also adds the textual representations of the water
types as a string list that corresponds to the enum values that we use - this
way it's easier to stay consistent.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-06 07:00:34 +09:00
Dirk Hohndel
c0bb04994b code cleanup: avoid unused argument warnings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-06 07:00:34 +09:00
Dirk Hohndel
4e7adcf96a desktop UI: remove strange sprintf calls
I'm rather upset that I never noticed this in a review. That's just not how you
print numbers.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-06 07:00:34 +09:00
willemferguson
b12d0b1840 desktop UI: small cleanups of salinity code
Added code for string translation.
Added code to improve UI on Windows.
Added some comments to make the code more understandable.
Enable salinity combobox for manually entered dives

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-06 07:00:34 +09:00
willemferguson
d2cf58e07e core: read and write the user-specified salinity
Both XML and git storage are added.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-06 07:00:34 +09:00
willemferguson
ebabbfb457 desktop UI: create the UI components for editing the salinity.
The user may modify the salinity by selecting a water type from the combobox.
The new datum does not replace the existing salinity value but is stored in a
separate variable within the dive structure. If the dc-based salinity is
overwritten, there is an exclamation mark next to the modified salinity value
to indicate that the salinity has been overwritten. The dc-derived salinity can
always be recovered by selecting the "use dc" option in the combobox.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-06 07:00:34 +09:00
willemferguson
732d5a9fbd desktop UI: add preference for making salinity editable
Create a checkbox in the Preferences: General screen that enables or disables
editing of the salinity data. This preference is saved with all the other
preferences.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-06 07:00:34 +09:00
willemferguson
88cbcf5c6e Cosmetic updates to .UI files for Preferences
This is a cosmetic update to remove some warning messages
while building a fresh subsurface. These warnings were due to
duplicate label names in the .UI files.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2019-12-27 05:42:23 +09:00
jan Iversen
d4a2c5cdee plannerShared: replace notes variables to plannerShared
Replace
    display_runtime
    display_duration
    display_transitions
    verbatim_plan
    display_variations

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 09:59:26 -08:00
jan Iversen
c976385aed desktop-widgets: replace variables to plannerShared
Use plannerShared setter to update the variables in qPref.
This will also signal the cylindermodel to calculate a new bestmix.

variables:
   bottompo2
   decopo2
   bestmixend

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 09:58:47 -08:00
jan Iversen
738ee360ba desktop-widgets: replace o2narcotic from plannerModel to plannerShared
Use plannerShared setter to update o2narcotic. This will also signal
the cylindermodel to calculate a new bestmix.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 09:58:21 -08:00
jan Iversen
413501bc61 desktop-widgets: replace variables from plannerModel to plannerShared
variables
bottomsac
decosac
problemsolvingtime
sacfactor
are not set in diveplanner.cpp, but instead
signals a slot in plannerModel.

change signals to slots in plannerShared

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:45:40 -08:00
jan Iversen
53958a50c6 desktop-widgets: replace var plannerModel -> plannerShared converted
variables
min_switch_duration
are not set in diveplanner.cpp, but instead
signals a slot in plannerModel.
and are read from plannerShared which includes a conversion

change signals to slots in plannerShared
change read from prefs. to plannerShared

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:40:08 -08:00
jan Iversen
316e56f4f7 desktop-widgets: replace vars. qPrefDivePlanner -> plannerShared
change local doo2breaks to plannerShared and update connect.

change signals to slots in plannerShared

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:39:49 -08:00
jan Iversen
5063431263 desktop-widgets: replace variables from plannerModel to plannerShared
variables
drop_stone_mode,
last_stop,
switch_at_req_stop
are not set in diveplanner.cpp, but instead
signals a slot in plannerModel.

change signals to slots in plannerShared

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:39:30 -08:00
jan Iversen
df6f01a6f6 desktop-widgets: replace vars. qPrefDivePlanner -> plannerShared
change local setBailout to plannerShared and update connect.

change signals to slots in plannerShared

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-26 08:39:05 -08:00