Make precedence of && over || explicit.
Explicitly convert between char * and unsigned char *.
Don't assign potentially negative return code to an unsigend variable.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In commit 22bfc49 an explicit cast to (char *) was introduced to silence
some compiler warnings, but an (unsigned char *) is needed if related
values are expected to be greater than 127 or we will get the usual
weirdnesses.
Just introduce such variable and use it where needed.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While looking for the icons so luisa could create svg
versions of them, I found out a few things that are not
used anymore.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This way we can selectively turn off Facebook support.
And turning off both Facebook support and support for the user manual
allows us to not rely on QWebKit which once again allows debugging
Subsurface with valgrind on Arch Linux.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With these values I reproduce the runtimes from the UI.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch increases the verbosity level for QtBluetooth API
and add some extra logs for custom serial Bluetooth open method.
The scope of this patch is only for testing.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Create a custom Bluetooth serial communication using the QTBluetooth
API and use it when the Bluetooth download mode is enabled.
First try to connect on RFCOMM channel 1 because this is the default
RFCOMM channel of SPP service for most devices. If this doesn't work
try again on RFCOMM channel number 5 because it could be a Petrel2 device.
Add a fake open function for the custom implementation. This is
used when the selected device is HW OSTC 2N and the Bluetooth
mode is activated, then fake the open call of the serial device.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Implement a dialog which can be used for remote Bluetooth devices
selection and to control the local Bluetooth device.
Functionalities of the widget:
- expose information about the local BT device
- scan for remote BT devices
- pair/unpair with a remote BT device
- turn on/off the local BT device
- logging
- save the selected BT device
The selection dialog is created when the bluetoothMode checkbox
is enabled.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The checkbox will be used to enable the Bluetooth
downloading mode. The button will be used to create
a dialog selection where the user will be able to
scan and select remote devices.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The changed introduced in d880040d breaks mobile builds by not correctly
linking with QtQuick. This change fixes that by fixing the incorrect line
in CMakeLists.txt so that the correct QtQuick headers will be found.
Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
At least my compiler warns about ! binding stronger than == and
thus comparing a bool to an int. I guess this is what was meant.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For the proper calculation, we need to take salinity and surface pressure
into account (rather than depth = bar * 10 - 10)
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is the main area to edit the templates inside Subsurface.
Whenever the user edits a template the edited template is saved in
custom.html and custom.html is considered the selected printing
template.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
-Remove unneeded parameter to member variable
-Check if template_options struct is valid
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Add:
-custom.html template
-custom template to print_options struct
-options to the options dialog
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Add special data attribute 'data-numberofdives' in the template <body> with
the number of dives per page.
This is standard HTML5 specification so it won't corrupt the template file.
Any template that will be used for printing must contain this attribute to
assure correct output.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Template styles must refere to Grantlee fields to be replaced with
user selected settings.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Add template_options to Grantlee lookup section and export the struct
fields.
-font: is the font type used, must be selcted from 5 different types.
-font-size: is a user selection from 9 - 18 then it is scaled to a range
from 1 to 2 of the displaying view port.
-color-palette: is the colors used in the template, all used colors must be
referenced from here.(not yet implemented)
-line-spacing: is the distance between two consecutive lines in the dive
notes text.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The template_options struct needs to be passed to TemplateLayout
constructor.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
TemplateOptions struct must be saved to QSettings after the window
is closed, also it must be recalled when initializing the window.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The template_options struct holds the settings variables in the code.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Edit button should open TemplateEdit dialog.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The TemplateEdit class works to customize the tempalate before printing,
User can select the font-size, font-type, color-palette, linespacing
and editing the template HTML code.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Show warning message before proceeding to print 'Table' or
'Statistics' print layout. This should be used during the
development phase only.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
As we use a responsive layout, every UI element must be relative
to its parent and its size must be a ratio of the view port to
prevent them from displaying outside their containing parents.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
We can have color printouts only if the printer supports color
prints, the user selected 'print in colors' from the print dialog and
the default printer settings (Operating system wise) is to print in
colors, Otherwise the prints will be in greyscale.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Use setFontPrintScale() to change the font scale of the dive profile as a ratio of
the full resolution, font = (pageWidth * dpi) / fontvalue
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
User can choose either to print all dives or print selected dives only.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Add preview dialog that shows the printer contents before printing.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This sets up a standard dive scenario (30 minutes at 260ft/79m, EAN36 and
Oxygen as deco gases, last stop at 20ft/6m) and calls the planner to set
up a dive plan given certain standard gases.
Instead of trying to verify the complete plans it checks that we switch to
the deco gases at the right depth and the complete duration of the dive
matches our expectation.
The test intentionally fails right now for imperial as we have the wrong
switch depth for Oxygen. See how useful tests are?
On the downside, the test does NOT produce the same plan as Subsurface
when I try to create a consistent setup for both - and I have not been
able to figure out why. There must be some other parameters that I'm not
setting, but I haven't identified them, yet. It's very small differences,
for example in the metric case the stops at 21m, 9m, and 6m are each one
minute shorter in the test than it what Subsurface calculates.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When using feet as depth unit, deco stop levels should be at 10 ft rather
than 3 m increments.
For shallow stops, rounding means the difference is not apparent. However,
with stops deeper than 30 feet, using 3 m increments leads stops at 39ft,
49ft, ..., 98ft, etc.
Apart from making plans look messy, the old behaviour makes it harder to
benchmark the planner against published profiles in imperial units.
This revised patch uses the help macro M_OR_FT(6, 20) to set the last stop
at the correct depth.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Read and use the last_stop preference in the plan function.
Read the plan notes preferences and set variables (plan_verbatim,
plan_display_runtime, plan_display_duration, and plan_display_transitions)
in the add_plan_to_notes function. Don't read the preferences and set
variables otherwise. Both plan and add_plan_to_notes functions are called
on data change.
Previous behaviour was:
- Set variables on declaration
- Reset variables in plan function (even variables that only relate to
planner notes output)
- Changing a preference triggered set_xxx function which sets variable,
then plan function, which sets variable again.
Apart from being inefficient, the previous behaviour made it difficult to
track down where and when variables were set.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- Qt4 is no longer supported
- Make the Kubuntu comments more generic
- Mention command to add user to dialout group
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Update the install instructions when compiling Subsurface from source on
Ubuntu/Kubuntu machines.
Signed-off-by: Pedro Neves <nevesdiver@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added keeping bottom dive state and every deco's time, so we can
run multiple deco simulations with different gradients until they
converge to some optimal value.
Some improvements on the deco time calculation may be needed.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
It improves (increases) gradients for all the compartments,
so more free gas can be created in the divers body. Next gradients
will converge, so the volume won't exceed the safe limit, indicated
by the crit_volume_lambda parameter.
Function takes time of the last deco in seconds.
Requires vpmb_start_gradient() to be run before.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Add call of initial calculation of critical radius and start gradient,
so the VPM could work.
Currently without CVA, so the gradient isn't improved.
Only one iteration is run.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Check during the trial_ascent() if existing pressure gradient is
smaller than previously calculated max gradient. If not, ascent
is impossible from the vpm-b's point of view.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Calculate the max difference between tissue saturation and ambient
pressure that can be accepted during the ascent.
Partial results are kept for later improving in next CVA iterations
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
Removed recreational mode from ui and pref and replaced it with
new deco_mode enum.
Added radio button ui selection.
Set default deco_mode to Buehlmann algorithm.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
This function calculates the size of nuclei at the end of deco,
then simulates their regeneration, to the moment before the deco.
This is redundant as nuclear regeneration is a very slow process.
Function should be called with time in seconds, just before the ascent.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
According to mathematica
In[4]:= f[x_] := x^3 - b x^2 - c
In[18]:= Solve[f[x] == 0, x]
Out[18]= {{x ->
1/3 (b + (
2^(1/3) b^2)/(2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(
1/3) + (2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(1/3)/
2^(1/3))}, {x ->
b/3 - ((1 + I Sqrt[3]) b^2)/(
3 2^(2/3) (2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(
1/3)) - ((1 - I Sqrt[3]) (2 b^3 + 27 c +
3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(1/3))/(6 2^(1/3))}, {x ->
b/3 - ((1 - I Sqrt[3]) b^2)/(
3 2^(2/3) (2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(
1/3)) - ((1 + I Sqrt[3]) (2 b^3 + 27 c +
3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(1/3))/(6 2^(1/3))}}
For the values of b and c encounterd in the algorithm, the first solution is in fact the
only real one that we are after. So we can use this solution instead of doing a binary
search for the root of the cubic.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>