Commit graph

8868 commits

Author SHA1 Message Date
Dirk Hohndel
e03b553e80 Make created dive site uuid deterministic
Having random uuids seemed like a good idea, but there are several
situations where they really cause problems. One is merging dive file
imports from V2 logfiles. Another is testing such imports.

Instead of making the uuid random we now hash the name and add the
timestamp of the first dive associated with this dive site to the hash
(first in this context is "first encountered" with no guarantee that it is
the chronologically first). This way V2 imports create deterministic uuids
but uuid conflicts are still extremely unlikely, even if the user has
multiple dive sites with the same name.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:43:48 -07:00
Dirk Hohndel
6eed3155e6 Add simple test for git storage
This just makes sure that writing data to git storage and reading it back
gives you the same result. Without the fixed generation of initial dive
site UUIDs this fails.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:43:41 -07:00
Dirk Hohndel
eb205c1b09 Cloud storage: be more verbose if asked to be verbose
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:43:36 -07:00
Dirk Hohndel
f177b2ec53 Cloud storage: try to brute force your way around merge issues
This seems to do the right thing in several cases that I tested, but I'm
worried if it might end up causing us data loss in other cases. This needs
a TON of testing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:43:32 -07:00
Dirk Hohndel
70c38de3a1 Cloud storage: be very strict about renames
Because of the structure of some of our files git too easily assumed that
they were renames and that confused the merge algorithm.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:43:27 -07:00
Dirk Hohndel
a45c5f1acf When building against libgit2 v0.23 or newer we can assume API23
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:43:22 -07:00
Dirk Hohndel
471af6c2fd Cloud storage: clean up after the merge
Make sure the branch is pointing at the merge commit, etc.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:43:16 -07:00
Dirk Hohndel
f5eb0e2bbb Cloud storage: move git merge into its own function
Just to keep things more readable.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:43:11 -07:00
Dirk Hohndel
4c31c01139 Cloud storage: better error message for dirty state
Tell us WHAT is wrong with the state.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:43:01 -07:00
Dirk Hohndel
2f540b56a8 Merge branch 'custom-print' of github.com:neolit123/subsurface 2015-08-23 07:38:11 -07:00
Robert C. Helling
fbce8a0378 Add a test for the VPM-B mode of the planner
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-23 07:30:33 -07:00
Robert C. Helling
41349c29dd Prepare global state of VPM-B when starting to plan
Otherwise, the results of the calculations tend to be rather
random and irreproducible...

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-23 07:30:23 -07:00
Robert C. Helling
cb375623f9 dump_tissues() should be available regardless of macro settings
this does not increas binary size increadably but is usefull
when trying to figure out what the planner is doing.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-23 07:29:46 -07:00
Robert C. Helling
120d09181d Comment meaning of preference variables
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-23 07:28:52 -07:00
Robert C. Helling
7bfc8bc1fe Show tissue ceilings in tenth of m/ft
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-23 07:28:06 -07:00
Robert C. Helling
8909dbbfd3 Simplified Boyle's law correction and new cubic root
This uses a bit of algebra to simplify the formula for Boyle's law
correction and introduces another algebraic cubic root solver that
can also deal with negative discriminants thanks to a trigonometric
formula from Wikipedia.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-23 07:22:12 -07:00
Rick Walsh
634e698664 VPM-B: Calculate first_stop_pressure before starting ascent
The Boyle's law compensation depends on first_stop_pressure.  To produce
profiles similar to other VPM-B implementations, we should calculate it as the
ceiling before starting the ascent.

Commit 159c9eb2c1, Compare ceiling to next stop
rather than try to ascent for VPM-B, changed (VPM-B) to consider the current
ceiling rather than an incremental ascent between one stop level and the next.
However, the initial ascent generally steps through several stop levels, so
first_stop_pressure was still not calculated as the ceiling prior to commencing
the calculated ascent.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-23 07:21:17 -07:00
Joakim Bygdell
898ea6acb5 Recmode: Disable gas switch options
Gas switch is not part of recreational mode, so disable the switch options.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-23 07:20:48 -07:00
Joakim Bygdell
d969cacfe2 Indent "Conservatism level"
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-23 07:20:39 -07:00
Dirk Hohndel
b8575221b1 Cloud storage: use merge options to avoid conflicts
In many cases Subsurface will do something "reasonable" if we have
conflicting edits and then try to merge. GIT_MERGE_FILE_FAVOR_UNION means
that both edits will be added to the final file and then Subsurface should
quietly take one or the other - this will need quite a bit of testing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-22 17:52:31 -07:00
Dirk Hohndel
fe0864be60 Cloud storage: merge local and remote changes if there is no conflict
We still punt if there are any conflicts (which are likely to occur if we
have touched dive sites in both changes). But in my testing at least for
fairly simple, non-conflicting changes this works and creates a correctly
merged tree.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-22 17:52:31 -07:00
Gehad elrobey
cc86479475 Printing: replace usage of std::ceil()
std::ceil() in printer.cpp throws errors when compiled with mingw, so
replace all std::ceil calls with qCeil().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:39:08 +03:00
Gehad elrobey
f45fdc8660 Printing: disable template editing for statistics templates
Editing statistics templates is not supported now, as there is no
custom template for statistics printing, so disable the template
edit area.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:37:48 +03:00
Gehad elrobey
b6d3735204 Printing: enable UI elements that now can be used
The new statistics code, enable the editing of colors, font, and other
template options.

This patch enables the UI elements for these features.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:36:58 +03:00
Gehad elrobey
69f2921ffa Printing: use the same code for both statistics and divelist print
- use the same generic code for both types of templates
- check for the printing type before generating the template
- remove unused printStatistics() method

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:36:19 +03:00
Gehad elrobey
4553155cf3 Printing: add a statistics template
Add a statistics template to the templates directory.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:36:10 +03:00
Gehad elrobey
b0e84e7e2b Printing: generate a Grantlee statistics template
As there are two types of templates, Grantlee need to support both.

This commit adds the support to generating a statistics HTML code from
a statistics template.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:35:51 +03:00
Gehad elrobey
70e8862efc Printing: export a statistics data structure to the Grantlee backend
Add a YearInfo class which represents a year statistics. Export the
class to the Grantlee backend, also export all it's members to the
printing backend.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:34:48 +03:00
Gehad elrobey
6a692495c0 Printing: add statistics templates to the dialog
Show the existing templates based on the print type selected
by the user.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:34:34 +03:00
Gehad elrobey
77c81b299b Printing: read statistics templates from the "statistics" path
Now there are two types of templates, dive list and statistics.
We need to support reading both types of templates.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:34:06 +03:00
Gehad elrobey
c516421bc2 Printing: check the print type in the preview section
Preview output should be identical to the actual printing code, so
call the flow rendering method for all flow templates.

Also don't create new pages while rendering a one page preview, just
exit after the first page is full.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:33:36 +03:00
Gehad elrobey
13febc1eee Printing: fix uninialized border width
In flow rendering the border width is not initialized which causes
huge borders that blocks the page while previewing.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:33:26 +03:00
Gehad elrobey
20c22596f0 Printing: update the user-manual
Add printing description to the user-manual, also add appendix F
which describes how to write a custom template for Subsurface.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:33:07 +03:00
Gehad elrobey
afc697e797 Printing: refactor printing code
This section of the code is called only while rendering a flow layout
template, so move it to the flow layout function.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:32:53 +03:00
Gehad elrobey
4a988aa868 Printing: update user-manual images
Add updated user-manual images, with the new dialog UI.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:32:44 +03:00
Gehad elrobey
90852e114c Printing: fix typo in template name
Template names was capitalized, so change the file name to
"Custom.html" instead of "custom.html"

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:32:28 +03:00
Gehad elrobey
b19d07c61c Printing: fix the six dives per page layout
Add container with height 100% which contains the six dives, so dives
don't overflow the page.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:32:17 +03:00
Gehad elrobey
67bfa9f968 Printing: use older Qt methods when calculating the ceil
Better portability for < Qt5.3.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-22 18:30:32 +03:00
Dirk Hohndel
ccd2cb2502 Continue to separate logic code from UI code
We don't want to call into the MainWindow from C code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-22 07:05:13 -07:00
Dirk Hohndel
e86fd45efd Cmake: fix cross compiling on Windows
Cmake has a bug that causes the moc process not being handed the necessary
defines for the architecture we are building for.

Also we were missing a library to make the BT implementation on Windows
work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-21 10:16:06 -07:00
Robert C. Helling
3437666010 Display error messages in planner
After a replot, check if there is an error message to display.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-21 10:16:06 -07:00
Dirk Hohndel
c7d8e72607 Use our pressure type to avoid bar / mbar confusion
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-21 10:16:06 -07:00
Robert C. Helling
652f7e9864 Don't do computationally expensive Boyle compensation when not using VPM-B
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-21 09:28:04 -07:00
Robert C. Helling
d9b4f2b7e3 Don't do Boyle compensation when still on first stop
There is nothing to compensate but we would hit a 0/0 numerical
instability there.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-21 09:27:53 -07:00
Tomaz Canabrava
0f096d0e53 Save Properties for each State of the mainWindow
Each state can have the same widgets but with different
properties - currently I'm using "enabled" : true and false
for the DiveSiteEdit, it looks like a big amount of code
for such a small thing but it was the cleaner way that
I tougth of doing.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-21 07:37:15 -07:00
Dirk Hohndel
307df53bb4 Updates to the ReleaseNotes
Including a quick note about the two known issues on Macs.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 23:14:54 -07:00
Venkatesh Shukla
eb31b3b075 Open subsurface on attaching divecomputer
Added USB usage permissions in manifest.
Also added various FTDI based USB devices in xml/device_filter.xml. When any
device matching the VID and PID provided in the device_filter.xml is attached,
subsurface application is opened automatically. Also, the USB permissions are
granted to the application. This simplifies the USB file generation approach.

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 23:01:15 -07:00
Anton Lundin
8d73e4f81c Connect up serial_ftdi custom serial
This connects the serial_ftdi implementation to subsurface, and builds
libftdi1 for the android builds.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:59:54 -07:00
Anton Lundin
e2c98def26 Turn serial_ftdi.c into a custom_serial
This cleans up serial_ftdi.c from being a libdivecomputer source and
making it into a subsurface custom_serial.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:59:49 -07:00
Anton Lundin
3104508247 Re-indent and style up serial ftdi
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:59:42 -07:00