aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2012-06-11updated/corrected commentGravatar Maximilian Güntner
Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2012-06-11added "Zoom" button and improved scalingGravatar Maximilian Güntner
It should be possible to have a certain limit where we stop zooming so that short dives are visible as such at first glance. Therefore a "Zoom" button has been added to the "Log" menu along with a shortcut (Ctrl + "0"). The user can now zoom/unzoom the plot and is still able to quickly distinguish short dives from normal ones when browsing the log. Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2012-06-09fixed indentationGravatar Maximilian Güntner
Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2012-06-09use increments that make sense for 600 secondsGravatar Maximilian Güntner
599/12 = 50, no need to use 5*60. Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2012-06-08Plot shorter (apnea) dives with a reasonable scaleGravatar Maximilian Güntner
The time marker increments have also been changed to better values. Also, display more time information for short dives. Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2012-05-29Save dive computer device name.Gravatar Terrance Stanfield
It is really annoying to have to type the device name each time you need to import a dive from your computer, if you are not using the default device name. This will save the device name in the configuration file and matches the logic currently used to save the dive computer name in the configuration file. Signed-off-by: Terrance Stanfield <t@hollowcranium.com>
2012-05-12Allow overriding the default xslt pathGravatar Linus Torvalds
It's very annoying to have to do "make install" to test a new xslt file, just because the default xslt path has the standard install path as the first entry. At the same time, we do want to default to just using the standard install location first. So to allow both testing, and having a nice sane default, just add support for a SUBSURFACE_XSLT_PATH environment variable that overrides the default one if it exists. So then you can just do SUBSURFACE_XSLT_PATH=xslt ./subsurface to run subsurface from inside the git tree itself, using the current files in the git xslt subdirectory. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-12Suunto SDE conversion: add boat name to notes if it existsGravatar Linus Torvalds
This is, I think, the last piece of relevant information that I can find in Szymon's SDE file. Which is not to mean that we get all the conversions right, or that we handle the more complex cases (still no multi-cylinder import, for example). But it should be much better than it used to be. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-12Suunto SDE updates, take 178: add weight and visibility infoGravatar Linus Torvalds
This converts the weight information into subsurface weights, and also adds visibility info (if it exists) into the notes for the dive. More fall-out from me looking at the nasty suunto xml files, now that I have a few that actually have some info that isn't just from the computer download. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-12Fix more Suunto SDM xml conversion problemsGravatar Linus Torvalds
Looking at the XML of the two dives Szymon Kosecki sent out to the subsurface list, I notice that our cylinder size conversion was wrong. It looks like CYLINDERUNITS is what determines whether the cylinder size is in metric (0) or imperial (1) units. Of course, if you gave a cylinder size in cuft and didn't give a working pressure, subsurface will just ignore the size as the random crap it is. We *could* default to a working pressure of 3000 psi, of course. This also picks up the CYLINDERDESCRIPTION value, although neither of Szymon's dives actually had any description. I need more SDE xml files to figure out how multi-cylinder dives look etc, but I think this gets most *simple* SDE files converted almost correctly now. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-11Fix dive notes import from Suundo SDMGravatar Linus Torvalds
The xslt translation didn't add the <notes> tag for the notes, so while it did select the notes from the SDM file, that never made it into the subsurface notes. Also added weather info to the notes, mainly as an example. There are probably other things we could do, but this fixes at least the trivial test-case from Szymon Kosecki. Reported-by: Szymon Kosecki <skosecki@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-07Fix subsurface.desktop category entryGravatar Khalid El Fathi
This desktop entry lists a category that is not one of the registered Main or Additional Categories in the FreeDesktop specification. Refer to http://standards.freedesktop.org/menu-spec/1.0/apa.html for details. Signed-off-by: Khalid El Fathi <khalid@elfathi.fr> Acked-By: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-07Fix subsurface manpage - missing description and parsing problemGravatar Khalid El Fathi
It's missing a brief description. The "NAME" section is parsed by lexgrog and used to generate a database that's queried by commands like apropos and whatis. Replacement a hyphen by a minus sign. Signed-off-by: Khalid El Fathi <khalid@elfathi.fr> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-05set subsurface_flush_conf() to no-op in wondows.cGravatar Lubomir I. Ivanov
flushing the entire registry is not required on windows. simply closing the registry key when done would suffice. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-03divecomputer importing: show the date of the currently importing diveGravatar Linus Torvalds
I'm hoping most other dive computers are quicker to import from than the Suunto I have, but mine can take minutes to import all the dives. Sure, we have that nice progress bar, so it shows that it's doing something, but it's not really showing *what* it is doing. So instead of showing just "Parsing dive X", let's show the date of the dive. That way, when it takes two minutes to import all the dives, at least you can see "oh, it's going back to the dives of last year" and it then feels like you have some good reason for the delay. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-02Show dive import text updates in the progress barGravatar Linus Torvalds
Instead of using printf() to print the string updates ("Parsing sample data" etc), introduce a function to show those strings in the graphical progress bar itself. Subsurface hasn't been a text-mode application in a long time ;) This partially fixes the second todo entry from commit b0ba22a06879 ("Show dive import error messages in the import dialog") and generally makes for a more helpful import - at least for the largely error-free cases. Sadly, the messages that really come from within libdivecomputer itself (like "suunto_vyper2.c:193: Failed to receive the answer.") when things go really wrong are not caught. libdivecomputer does have a notion of a logfile (set with "message_set_logfile()"), but that ends up being really inconvenient. Maybe we could use some pipe setup or something. Oh well. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-02Change the Dive computer import button from "Ok" to "Retry" on errorGravatar Linus Torvalds
This was a todo item in commit b0ba22a06879 ("Show dive import error messages in the import dialog") which made the import dialog able to retry the import on errors. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-02Move the "Import" function from the File menu to the Log menuGravatar Linus Torvalds
Sure, you can import a file too, but it really makes more sense to have the actions related to importing new logs under "Log", I think. I don't think of it as a file operation. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-02Show dive import error messages in the import dialogGravatar Linus Torvalds
.. not in the main window. And leave the import dialog open, so that you can either try doing it again, or cancel. This makes it much easier to re-try a failed dive import, and actually makes the failure more obvious too. Todo: - make the "Ok" button change to "Retry" when an error happens - try to see if we can catch the actual status update messages from libdivecomputer and show them too in the import dialog. Right now they are printed out to stderr by the library. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-02Remember the default dive computer settingGravatar Linus Torvalds
Always having to re-select the same dive computer got really annoying when I had trouble importing the dives. Let's not force the user to do that, since we could just remember the last dive computer used, and default to that one. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-02Don't close config file when changing preferencesGravatar Linus Torvalds
On Linux and MacOS the subsurface_close_conf() doesn't really close the config file (it flushes writes on MacOS), but on Windows it does actually close the registry hkey. Which is bad, if you change the settings multiple times - we assume that the config file is open the whole time. So add a "subsurface_flush_conf()" function, and call *that* when changing configuration parameters. And call the close function only at the very end. Alternatively, maybe we should just open the config file separately every time. I don't much care, maybe somebody else does. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-02Make subsurface compile with current libdivecomputer git treeGravatar Linus Torvalds
libdivecomputer has the absolute worst interfaces to any library *ever*, and randomly changes those crappy interfaces when it adds support for new dive computers. It would have been much better if the interface was just a "open this device" with a device descriptor structure pointer, so that when Jef adds support for new devices, the old descriptors still stay around and work the same way - there's just a new descriptor structure that you *can* use if you want. Along with a data structure to name the devices and their descriptors, this would actually mean that users could just support pretty much any random device that LD supports. But no, that's not how libdivecomputer works. It has random enums and crazy different ad-hoc interfaces for different dive computers. Or, like in this case, crazy different ad-hoc interfaces for the *same*old* dive computer. Right now, for example, the support for the new Heinrichs Weikamp "Frog" computer added a flag to the interface for the old OSTC_2 support. Breaking any libdivecomputer users even if you didn't need Frog support. And is there a version number in the header files to check for? Yes, there's a version number. But no, it's not useful, since it doesn't actually change with the interface changes. This time, Jef actually did change the version number (from 0.1.0 to 0.2.0) as part of new development version, but there's no reason to believe that it will change in the future as the interfaces change - it never has before. So it's actually safer - and easier to understand - to check for the existence of the new header file inclusion mechanism. A new version of libdivecomputer that supports the HW Frog computer will include the "ostc_frog.h" header file when you include the libdivecomputer device.h file, and that will result in HW_FROG_H being defined. So we can check whether libdivecomputer has the new interface and supports the Frog by doing an "#ifdef HW_FROG_H" hack. Ugh. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-04-24Make sure to update dive info when it is editedGravatar Linus Torvalds
We used to not properly update the dive info until we switched to another dive when we edited it. This should fix it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-04-23Fix edit callback for weight systemGravatar Dirk Hohndel
Linus found this embarrassing bug: double clicking on a weight system in order to edit it launched the edit function for the first cylinder instead. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-04-02Renumber dives when deleting a diveGravatar Linus Torvalds
... but only do it if the numbering of subsequent dives was consecutive to begin with. Note that we do accept unnumbered dives (and will stop the sequence check if we find one), but in order to renumber dives on delete, we require that starting with the dive we delete, the subsequent numbered dives have to be a nice incrementing series. If that is the case, then we fix up that numbering as we delete the dive. Put another way: if the dive numbering was an incrementing sequence before the delete, then it will be a sane incrementing sequence after it too. But if you had missing dives before the delete, we will turn the delete into just another missing dive. The basic rule is that we never renumber any dives unless that renumbering is "obviously correct". It's better to leave old numbers as-is (and expect that the user is going to do an explicit re-numbering operation) than it is to change dive numbers in a sequence that we don't understand. I do suspect that we should possibly check the dive number "backwards" too, but this doesn't do that. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-04-02Add the ugliest 'delete dive' model everGravatar Linus Torvalds
This interface works the same way the "edit dive" menu item does: it's a text entry meny item on the dive text entries (ie buddy/divemaster/notes sections). Except you pick the "Delete" entry rather than the "Edit" entry. It kind of works, but it really is a pretty horrible interface. I'll need to add a top-level dive menu entry for just deleting all selected dives instead. And it would be good to be able to get a drop-down menu from the divelist instead of having to do it from the dive text entries, which is just insane. But that requires gtk work. I'm not quite ready to get back into that. Thus the "exact same insane interface as the explicit 'Edit' mode". Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-04-01Fix reference tank information for LP steel tanks.Gravatar Linus Torvalds
Commit f9bb3f79106b ("Clean up reference tank information table") had cleaned up the tank info list so that you could sanely do tanks in liters and with a working pressure in bar. But the LP steel cylinders had somehow missed out on the ".psi =" part of the equation, and as a result, what was supposed to be their working pressure instead ended up being interpreted as their size in milli-liters. Oops. Fix that, and also make the standard tank info filling code actually verify the sanity of the reference tank table, so that if this happens again, it will complain loudly instead of using nonsensical values. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-03-29Fix broken average SAC calculationGravatar Miika Turkia
old_sac_time was always 0 when calculating average air consumption. Thus the results were incorrect. Move the counter to stats_t structure as suggested by Linus. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-03-25Added support for Mares Darwin, M1, M2, ... from latest libdivecomputer.Gravatar Björn Spruck
Only M1 has been tested. Darwin Air will most likely not work as an additional model flag seems to be needed. This is not foreseen in current GUI.
2012-03-23Merge branch 'weight' of git://subsurface.hohndel.org/subsurfaceGravatar Linus Torvalds
Pull weight management from Dirk Hohndel: "This is the fifth or sixth version of this code, I'm begining to lose track. I still struggle with the balance between code duplication and unnecessary indirectness and complexity. Maybe I'm just not finding the right level of abstraction. Maybe I'm just trying too hard. The code here is reasonably well tested. Works for me :-) It can import DivingLog xml files with weight systems and correctly parses those. It obviously can read and write weight systems in its own file format. It adds a KG/lbs unit default (and correctly stores that). The thing I still worry about is the code in equipment.c. You'll see that I tried to abstract things in a way that weight systems and cylinders share quite a bit of code - but there's more very similar code that isn't shared as my attempts to do so turned into ugly and hard to read code. It always felt like trying to write C++ in C..." * 'weight' of git://subsurface.hohndel.org/subsurface: Add weight system tracking Fix up some trivial conflicts due to various renaming of globals and simplification in function interfaces.
2012-03-24Add weight system trackingGravatar Dirk Hohndel
- supports multiple weight systems per dive - supports multiple weight system types - supports import of weight as tracked by DivingLog Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-03-22user-manual: fix a few annoying typosGravatar Miklos Vajna
Signed-off-by: Miklos Vajna <vmiklos@vmiklos.hu>
2012-03-16Show statistics of selected divesGravatar Miika Turkia
If at least 2 dives are selected, show statistics of these dives on Overall Stats. Otherwise, show the statistics of all dives. Temperature is also added to the shown statistics. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Minor change to avoid adding statistics.h (moved the global variable and external function declaration to display-gtk.h). Another minor change to the text displayed for the "Stats" notebook page. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-01-27Cochran: fix up dive data descramblingGravatar Linus Torvalds
This seems to do the dive data descrambling right for both files I have access to. Except it uses a hardcoded (different) offset for the two. I have yet to figure out how to automatically detect the offset itself properly, so you have to compile for the right file. I'll figure it out, but I'm committing this as a reasonable point in the process. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-27Fix up Cochran dive header decoding offsetGravatar Linus Torvalds
It turns out the odd "different CAN files have different header offsets" came from the fact that the decode block was different lengths, and I had not picked the correct place to start - and instead had found two different places that were at different offsets due to the decode block length differences. This fixes that up, and it looks like the dive header is correctly descrambled (but what the data *means* is unclear, although there is now an ASCII date and time visible, so at least one part of it is pretty obvious). The actual dive data unscrambling is still different for the two test-files I have to play with, I do not know why. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-27cochran: do a partial header de-scrambleGravatar Linus Torvalds
This descrambles at least parts of the header data. Some of it has the same pattern of data 4kB apart, it may be that there is a dive hiding in there too (ie what I currently call a "header" may in fact be a header _plus_ a dive). But the 4kB thing may well be an artifact of the crazy scrambling code itself. Who knows what kind of chunking the Cochran Analyst "encryption" uses. As with the dive data, there seems to be some offset differences between different CAN files. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-27cochran: do the full de-scramble for one caseGravatar Linus Torvalds
So this descrambles all the dives in *one* of my cochran test files. I still don't know what the dive data *means*, but it's not a random jumble of bytes any more: there are very clear patterns. However, the magic offsets that work for that particular CAN file are not generic, because they don't work for another. So there is some magic dynamic decoding that I don't know about. There is probably more decode information in the initial decode block, over and beyond just the scrambling bytes. (The scrambling array is 234 bytes starting at 0x40001, but the first actual *dive* data starts at 0x45e03, so there's tons of unknown stuff in the file even outside the dives themselves) Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-27Make cochran debug output a bit easier to use directlyGravatar Linus Torvalds
Just do the hex-dump in the program, and print all the results to standard output. Avoid the need to do 'od' by hand etc to see what happens when you play with the decoder. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-27Add some initial cochran CAN file parsingGravatar Linus Torvalds
It's broken, and currently only writes out a debug output file per dive. I'm not sure I'll ever really be able to decode the mess that is the Cochran ANalyst stuff, but I have a few test files, along with separate depth info from a couple of the dives in question, so in case this ever works I can at least validate it to some degree. The file format is definitely very intentionally obscured, though. Annoying. It's not like the Cochran software is actually all that good (it's really quite a horribly nasty Windows-only app, I'm told). Cochran Analyst is very much not the reason why people would buy those computers. So Cochran making their computers harder to use with other software is just stupid. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-27Import: always open and read the file before checking the filename extensionGravatar Linus Torvalds
Most of the parsers will want the content in memory, so keep them simple. The fact that the Suunto parser uses "libzip" that has to re-open the file is annoying and causes us to re-open the file etc. But it's the odd man out, so don't design the "open_by_filename()" function around it. Pretty much everybody else will want to avoid having to cook up their own IO routines. Also, when reading the file, NUL-terminate the buffer. This allows us to just treat text files as large strings if we want to, and doesn't matter for binary files (we still pass in the length explicitly). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-27Fix typo ('suundo' instead of 'suunto')Gravatar Linus Torvalds
I apparently was so congested that it affected my typing too when I wrote that, and then copy-paste meant that the use and declaration matched despite the misspelling. Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-26Add "native" Suunto SDE zip file readingGravatar Linus Torvalds
You need to have libzip-devel installed, and pkg-config needs to know about it for the build to pick up on it. On at least Fedora, a simple "yum install libzip-devel" will make things work, although you may need to force a rebuild of subsurface too (the "file.o" file in particular - the Makefile doesn't track system dependencies). Then, you can just do subsurface my-dives.SDE to read the data directly from the SDE file. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-26Split up file reading from 'parse-xml.c' into 'file.c'Gravatar Linus Torvalds
We're going to eventually import non-xml files too, so let's begin splitting the logic up. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-17Merge branch 'info-split' of git://git.hohndel.org/subsurfaceGravatar Linus Torvalds
* 'info-split' of git://git.hohndel.org/subsurface: Add statistics for longest, shortest, and shallowest dive Create separate single dive and total stats pages Separate out single dive statistics and total statistics
2012-01-15Link with libm for 'pow()'Gravatar Cristian Ionescu-Idbohrn
Solves suddenly revealed linking error: divelist.c:400: error: undefined reference to 'pow' Signed-off-by: Cristian Ionescu-Idbohrn <cii@axis.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-15Add statistics for longest, shortest, and shallowest diveGravatar Dirk Hohndel
I don't really like calling the shallowest dive "min depth", but all other texts that I could come up with that were reasonably short weren't any better... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-01-15Create separate single dive and total stats pagesGravatar Dirk Hohndel
No additional statistics added, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-01-15Separate out single dive statistics and total statisticsGravatar Dirk Hohndel
Right now this just changes the infrastructure - nothing outside of statistics.c is modified. This is simply in preparation to split out the single dive info and the total dive statistics in the future (as we are creating more info and more stats and they will overflow the screen area available - so this will turn into two notebook tabs). This commit does not change any functionality. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-01-05Avoiding some potentially confusing name space clashesGravatar Dirk Hohndel
We have local variables or function arguments with the same names as function static variables (or in one case, function arguments). While all the current code was correct, it could potentially cause confusion when chasing bugs or reviewing patches. This should make things clearer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-01-05More removal of unused argumentsGravatar Dirk Hohndel
Just trying to clean up the code a bit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>