Commit graph

4448 commits

Author SHA1 Message Date
Tomaz Canabrava
ac9a23ef3b Remove the old profile from the main screen of Subsurface
This patch partially removes the code for the old profile from
Subsurface. It removes the use of the old profile on the mainwindow,
but keeping the code in the tree for now.

A bit of code-cleanup also entered this commit because I had to change
every instance of the code that used the old profile.

Now to the real code-cleanup

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07 08:54:20 -08:00
Tomaz Canabrava
6dec4b0556 Fix a crash on changing dives when the ruler is used.
The ruler is a weird beast - it has two child objects that access the
parent to call another function, that call the child functions.

When I updated the plot_info I didn't take that into consideration, what
happened is that when I set the parent's plot_info, the children's
plot_info are still invalid, but the update method is called anyhow.

This patch updates all plot_info's before calling anything else.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07 08:53:14 -08:00
Tomaz Canabrava
8034106219 Fix compilation with libgit2 0.20
Linus was wrong - the change to the API happened after 0.20 was released.
So libgit2 0.20 still needs the fix.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07 08:51:20 -08:00
Dirk Hohndel
211ff0e63b Fix theoretical uninitialized read
We should never read cur_pr[cyl] if cyl isn't used during a dive - but for
cylinders that are used cur_pr[cyl] is initialized. But just to catch
errors elsewhere, let's not leave cur_pr[cyl] uninitialized.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-06 16:16:10 -08:00
Dirk Hohndel
8ab1fa3983 Fix memory leak when parsing a dive fails
We had all these repetitive calls to dc_parser_destroy but didn't free the
already allocated dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-06 15:36:46 -08:00
Dirk Hohndel
b51dd0a84b Prevent another file descriptor leak
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-06 15:08:27 -08:00
Linus Torvalds
689fe36030 Initial implementation of git save format
This saves the dive data into a git object repository instead of a
single XML file.

We create a git object tree with each dive as a separate file,
hierarchically by trip and date.

NOTE 1: This largely duplicates the XML saving code, because trying to
share it seemed just too painful: the logic is very similar, but the
details of the actual strings end up differing sufficiently that there
are tons of trivial differences.

The git save format is line-based with minimal quoting, while XML quotes
everything with either "<..\>" or using single quotes around attributes.

NOTE 2: You currently need a dummy "file" to save to, which points to
the real save location: the git repository and branch to be used.  We
should make this a config thing, but for testing, do something like
this:

	echo git /home/torvalds/scuba:linus > git-test

to create that git information file, and when you use "Save To" and
specify "git-test" as the file to save to, subsurface will use the new
git save logic to save to the branch "linus" in the repository found at
"/home/torvalds/scuba".

NOTE 3: The git save format uses just the git object directory, it does
*not* check out the result in any git working tree or index.  So after
you do a save, you can do

     git log -p linus

to see what actually happened in that branch, but it will not affect any
actual checked-out state in the repository.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-06 14:52:03 -08:00
Dirk Hohndel
c64227efe0 Fix real memory leak
We can't keep the cache around (even though it's tempting) as the next
iteration might change the start time of the planned dive or other
parameters which would make the cached data invalid.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-06 14:26:33 -08:00
Dirk Hohndel
3e8e005aa3 Deal with theoretical memory leaks
This is rather academic, but it will make Coverity happy.
If we start running out of memory we should make sure we don't leak any
more memory.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-06 14:19:42 -08:00
Dirk Hohndel
20d9cf19d7 Don't leak file descriptor in the error case
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-06 14:11:59 -08:00
Cristian Ionescu-Idbohrn
4e94da46fd Make it executable and remove magic whitespace on shebang line.
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-06 07:08:00 -08:00
Dirk Hohndel
c365103029 Mark ignored error return as intentional
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-05 18:55:42 -08:00
Dirk Hohndel
4f4fff3917 Null terminate buffer at the correct spot
fread tells us how many bytes it read.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-05 18:55:41 -08:00
Dirk Hohndel
e1a1c218c4 Uemis downloader: don't ignore return values from fs operations
In most cases the existing code might have done the right thing, but some
of the hard to reproduce errors might actually stem from the fact that we
have intermittend fs errors. Maybe this addresses things?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-05 18:54:39 -08:00
Dirk Hohndel
1b103c5c69 Another small tweak to whitespace tool
clang-format doesn't appear to reindent multi line #define statements
correctly - so this hopefully will clean those up.

The included whitespace corrections to the code should stay in place when
using the updated tool.

This includes cleaning up some multi-line comments that were messed up the
last time around as well as a few other minor changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-05 13:02:23 -08:00
Gopichand Paturi
13a2f14be0 Add new terms which can be a useful reference
Terms added are Trimix, Nitrox, Heliox and TC.

Signed-off-by: Gopichand Paturi <gopichandpaturi@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-05 12:14:26 -08:00
Giuseppe 'ferdy' Miceli
7b1a797518 Add alternate instructions for building on MacOSX using MacPorts
This modifies the INSTALL file to offer MacPorts based instructions.

Signed-off-by: Giuseppe 'ferdy' Miceli <ferdy@ferdy.it>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-04 13:25:19 -08:00
Willem Ferguson
480280937a Changes to icons in profile panel
- Replace dustbin icon.
- Replace NDL/TTS tool tip with "Show NDL / TTS"
- Create tool tip for scale icon: "Rescale depth axis"

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-04 12:59:17 -08:00
Willem Ferguson
8518348304 Reorganise buttons in profile panel
- Move the buttons of the profile window around to have more sane positions.
- All the buttons affecting the ceiling(s) are now grouped together.
- All the buttons affecting the Information Box are now grouped together.
- The previous icon for "Show calculated ceiling" has been reassigned to
  "Show all tissues"
- A new stand-in button hav been included for "Show calculated ceiling"

Signed-off-by: Willem Ferguson <willem@willem-Precision-M4700.(none)>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-04 07:54:52 -08:00
Dirk Hohndel
2513410132 Fix possibly uninitialized value
I'm not sure about this one. It's possible that there's something
happening behind the scenes that I don't understand. But let's just
initialize this to 0 and be sure.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 22:21:33 -08:00
Dirk Hohndel
f693bbd7a0 Don't use error after free
We need to reset the error pointer to NULL for this to work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 22:11:24 -08:00
Dirk Hohndel
396106e307 Don't use negative gas index
This shouldn't happen, but in case we run out of gases we shouldn't use
the negative gas index (which is the error return of get_gas_idx()) for
the array. Let's fall back to the (incorrect) first gas.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 21:54:52 -08:00
Dirk Hohndel
d24d2288f3 Remove pointless assignments
tissue_tolerance wasn't used after it was assigned.
type was overwritten after it was assigned.
serial was overwritten after the last /= 100.
event is assigned in the for loop.
clear isn't used after the assignment

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 21:40:56 -08:00
Thiago Macieira
99b8e85d73 Update the README file part about commit messages
Link to the official home of the developer certificate of origin and
clarify some details about commit messages, as discussed on the mailing
list.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 13:59:51 -08:00
Andrey Zhdanov
64b7a3b85f Depth widget minor UX improvement
Decrease depth by tapping left part of widget. Icon is showing "up" (i.e. closer to surface).
Increase depth by tapping right part of widget. Icon is showing "down" (i.e. deeper).

Fixes #354

Signed-off-by: Andrey Zhdanov <andrjufka@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 13:33:03 -08:00
Dirk Hohndel
7c535452f9 Whitespace cleanup
Minor change to the perl postprocessing script and resulting changes to
the affected source files.

This deals with two issues:
- "foreach"-like structures were not always treated correctly
- some longer calculations that ended on "+ constant" were reformatted in
  a rather unatractive manner

In one source file (divelist.c) I ended up adding braces to the sources...
trying to cascade the indentation further down without having the block
there seemed a lot more trouble than it's worth.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 13:29:22 -08:00
g1g19
917ce5aff5 Fix gps parsing
The argument index used to pull in the translated hemisphere letters was
incorrect.

Fixes #418

Signed-off-by: Gopichand Paturi <gopichandpaturi@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 09:56:02 -08:00
Giuseppe 'ferdy' Miceli
9b0817596d Correct another typo
Non-stop Dive Limit (or No Deco Limit) abbreviation is not NTL but NDL

Signed-off-by: Giuseppe 'ferdy' Miceli <ferdy@ferdy.it>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 09:43:07 -08:00
Giuseppe 'ferdy' Miceli
3b1b01b293 Correct typo in partial pressure abbreviations
Partial pressures abbreviations should have capitalized chemical element
symbols  e.g. pn2 -> pN2

Signed-off-by: Giuseppe 'ferdy' Miceli <ferdy@ferdy.it>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 09:40:51 -08:00
Giuseppe 'ferdy' Miceli
efac343206 Add .DS_Store files to .gitignore
Signed-off-by: Giuseppe 'ferdy' Miceli <ferdy@ferdy.it>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 09:36:06 -08:00
Dirk Hohndel
c4f49d5075 Equivalent Air Density Depth was mislabeled
In commit c84ef319a2 ("Create a toolbox on the left side of the new
profile") Tomaz invented a new TLA: EED.

No one noticed. Oops.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 09:22:22 -08:00
Dirk Hohndel
b0c16eda64 Created latest source strings for translations
And pushed them to transifex

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 07:42:34 -08:00
Anton Lundin
909cfe7135 Set the prefs-value alongside the button status
Previous code just set the button-"status" based on what we stored on
the settings. This sets the corresponding value in our prefs-struct.

This fixes the same issue as in 63f7f3, without the side effect of
magically hiding the mean depth line.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-02 13:42:07 -08:00
Miika Turkia
b7940dec5c XSLT to export dive log in CSV
This implements divelog export into CSV format. This currently supports
only metric units and lacks user interface.

See #434

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-02 12:04:15 -08:00
Anton Lundin
3df506b081 Spelling fix, Its called Ndl
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-02 11:16:38 -08:00
Dirk Hohndel
92da9c7f7c Strip incorrect iCCP profiles from new icons
simply run
convert <name>.png -strip <name>.png

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-02 11:08:58 -08:00
Andrey Zhdanov
3be1358b46 Icons for new profile
Existing dummy icons are replaced with new ones for:
- o2 graph
- n2 graph
- He graph
- MOD
- EAD, EED, END
- DC reported ceiling
- calculated ceiling
- calculated ceiling in 3m increments
- SAC
- ruler

Fixes #446

Signed-off-by: Andrey Zhdanov <andrjufka@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-02 10:53:30 -08:00
Dirk Hohndel
d29d0e7a5d Revert "Switch profile button events, clicked to toggled"
This reverts commit 63f7f37e46.

For odd reasons this appears to make the mean depth line disappear. This
will require some further analysis, but for now I'll just revert it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-02 10:37:07 -08:00
Gopichand Paturi
9b07acbee8 Add Units to mean depth value
Fixes #445

Signed-off-by: Gopichand Paturi <gopichandpaturi@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-02 08:16:29 -08:00
Nicu Badescu
b3c0f8938d Fix negative value for depths in Information Box
The get_depth_units function was expecting an unsigned int as a first parameter.
When it received a negative integer, the function made a cast to an unsigned int,
resulting in a very big number.

Signed-off-by: Nicu Badescu <badescunicu@yahoo.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-28 16:32:01 -08:00
Joshua Wambua
a8bce0bb9f Fix minor spelling error in CodingStyle
Fixes a minor spelling error in the CodingStyle file.

Signed-off-by: Joshua Wambua <joshua@megvel.me.ke>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-28 07:57:09 -08:00
Joshua Wambua
9cd3d61c11 Remove failed parses from recent files menu
This patch will remove all files that fail to parse from the recent
files menu.

Signed-off-by: Joshua Wambua <joshua@megvel.me.ke>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-28 07:51:41 -08:00
Dirk Hohndel
76e6420f6b Massive automated whitespace cleanup
I know everyone will hate it.
Go ahead. Complain. Call me names.
At least now things are consistent and reproducible.
If you want changes, have your complaint come with a patch to
scripts/whitespace.pl so that we can automate it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 20:09:57 -08:00
Tomaz Canabrava
006265d7a0 Try to fix the font issue on the ruler.
This changes the ruler a bit, I hope nobody gets offended by it. :)

The main issue is that the scene is now 100x100 pixels wide, so the font
was *really* huge. and setting itemIgnoresTransformations on the ruler
broke a lot of stuff.

I removed the code that painted the text and created a QGraphics TextItem
for that - that will hold the text for the ruler.

Then I played with the view to get the correct angle of the line, that was
in scene coordinates and thus, could not be used directly on the item that
had ignore transformation changes.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 18:57:48 -08:00
Anton Lundin
63f7f37e46 Switch profile button events, clicked to toggled
This is needed so the underlaying struct preferences prefs, will be
updated when we set the buttons to there previous state after we
loaded the settings.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 18:55:54 -08:00
Anton Lundin
619d4acb6f Remove old leftover header
This got merged into a common divelogimportdialog.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 18:55:38 -08:00
Anton Lundin
5bbe931b6c Add some notes about vim settings for our style
Basic vim settings to mostly follow our coding style.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 18:55:17 -08:00
Anton Lundin
a6024f50d8 Remove old icon files
This was leftovers from the Gtk days, no longer in use.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 18:52:44 -08:00
Dirk Hohndel
7695a50b4d Remove the old Gtk translation infrastructure
Long overdue

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 12:06:50 -08:00
Tomaz Canabrava
a4d0f7bdb3 New profile: Make the ruler work. (caution, fonts are BIIIG )
This patch makes the ruler work again, the problem is that the fonts are
*terribly* big, I'll fix that on the next commit.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 12:03:59 -08:00