summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2013-01-24Centralization for Kelvin and Standardization to milliKelvinGravatar Jan Schubert
This centralizes all occurrences of Kelvin to dive.h and standardizes all usages to milliKelvin. [Dirk Hohndel: renamed the constant plus minor white space cleanup] Signed-off-by: Jan Schubert <Jan.Schubert@GMX.li> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24Slight change to the parser to avoid false posititivesGravatar Dirk Hohndel
The webservice output uses 'name' as the tag for the dive location. This was added to the parser as unqualified tag and without this change test24.xml was suddenly recognized as a dive (the parser was triggering on the program 'name' attribute). Name should only be recognized as a dive location if it is indeed a child of dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24Only display temperature graph if we have temperature dataGravatar Dirk Hohndel
Commit b625332ca5ff "Display even constant temperature graph" was a little too aggressive. If we have no temperature data at all it caused us to plot a temperature line for absolute zero... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24Add test dive for constant temperatureGravatar Dirk Hohndel
Making sure that this doesn't cause divisions by zero and that the scaling and positioning doesn't get messed up by it (right now it doesn't look great). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24Display even constant temperature graphGravatar Miika Turkia
Dive profile does not display the temperature graph, if we have a constant temperature (e.g. only one reading at the start of the dive). This patch draws the temperature graph even if max and min temperatures are the same. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24Remove unused variable for unit name in statistics calculationsGravatar Dirk Hohndel
The code was incorrect - and completely unnecessary. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24Use actual min and max temperatures in statistics.Gravatar Henrik Brautaset Aronsen
The statistics page only used each dive's "watertemp" attribute, regardless of actual higher/lower temperatures in the samples. By finding the actual max/min temperatures, the statistics page utilize more "real" data, and look better even on single dives. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24Remove saving of dive computer nicnames in system configGravatar Linus Torvalds
We save the (more complete) dive computer information in the XML file with serial numbers and firmware version if we know about them, so using a complicated string in the system config was redundant and confusing. So remove that code. NOTE! Since the dive computer nicknames are now only saved if the XML file is saved, we also mark the dive list "changed" when we edit the nicknames. That way we'll be prompted to save things before exiting, even if we don't actually edit any actual dive data. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24Save all dive computer nicknames - whether used or notGravatar Linus Torvalds
We used to save dive computer information only if that dive computer was actually used in any of the dives we saved. But we can simplify the code if we just always save any dive computers we know about. And it does allow for some usage cases where you have nicknames for other peoples computers that you may not actively use, but you want to see if you end up loading multiple XML files in one go. So there's just no compelling reason to not just save all the info we have. And this will make it less painful to remove the "use system config for dive computer nicknames", because you can also use this to continue to gather dive computer info in a separate XML file if you want to. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24Store/Retrieve last entered webservice UID to/from config.Gravatar Lubomir I. Ivanov
We use subsurface_set_conf() subsurface_get_conf() to store and recall the prefered UID for the download. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24Merge branch 'webservice-import'Gravatar Dirk Hohndel
Update maxdepth / duration that have moved into the divecomputer structure. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24Fix compile error in planner.cGravatar Henrik Brautaset Aronsen
Linus seems to have been too eager in the dc refactoring: a diveplan doesn't have a divecomputer. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-23Fix setting of the dive_table.preexisting logicGravatar Linus Torvalds
The 'preexisting' value is used for downloading dives: we want to add new dives but, but then compare those new dives against the preexisting ones before we start sorting things and possibly merging them. However, the value was only updated sporadically, resulting in it having stale information in it. Which would cause problems particularly if you deleted dives, so that the preexisting value would point past the actual existing values! So just update it unconditionally in dive_list_update_dives(), which anything that changes the dive list is supposed to call in order to display the changes anyway. Also, just for safety, when removing a dive, put NULL in the last dive table location. Nobody should ever access past the end anyway (this is enforced by 'get_dive()') but there are places that access the dive list table directly, and the libdivecomputer download was one of those. No reason to leave stale dive pointers possibly around for uses like that. Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-23Fix temperature rounding issuesGravatar Linus Torvalds
Temperatures can actually be negative, which means that rounding by adding 0.5 and casting to 'int' is not correct. We could use '(int)(rint(val))' instead, but the only place we care about might as well just print out the floating point representation with a precision of two digits instead. So if you have a dive computer that gives you the precision, you might see '3.5˚C' as the temperature. Remove the helper functions that nobody uses and that get the rounding wrong anyway. Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-23Remove XML parsing special case temperature codeGravatar Linus Torvalds
We had various hacky historical artifacts in our XML parsing, partly from our legacy of parsing integer and floating point data separately (we used to recognize certain import format differences based on whether the data was in a floating point or integer format). And partly from trying to do a good job of importing crap from other dive log software. Anyway, that actually meant that we refused to parse negative numbers, and we ignored temperatures of zero because some diving log would do that for missing values. Both of these actually bit us when parsing our native XML. Of course, only crazy ice divers would ever notice. Noticed by Henrik Brautaset Aronsen. Reported-acked-and-tested-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-23Move more dive computer filled data to the divecomputer structureGravatar Linus Torvalds
This moves the fields 'duration', 'surfacetime', 'maxdepth', 'meandepth', 'airtemp', 'watertemp', 'salinity' and 'surface_pressure' to the per-divecomputer data structure. They are filled in by the dive computer, and normally not edited. NOTE! All actual *use* of this data was then changed from dive->field to dive->dc.field programmatically with a shell-script and sed, and the result then edited for details. So while the XML save and restore code has been updated, all the displaying etc will currently always just show the first dive computer entry. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-23Ensure each dive has its own copy of the location text (UEMIS importer)Gravatar Dirk Hohndel
Since multiple dives can reference the same divesite we need to do the strdup when the value gets assigned, not when it gets passed into the helper function. This also validates the location string as on my divecomputer there is an invalid divespot 0 that has a corrupted UTF8 string as location name. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-23Import and merge GPS data from the webserviceGravatar Dirk Hohndel
Dive locations marked (and named) via the companion app are downloaded from the webservice, parsed and merged with the existing dives. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-23divelist.c:icon_click_cb(): check if a GtkTreePath is foundGravatar Lubomir I. Ivanov
In icon_click_cb() we need to check if a correct GtkTreePath is found (using gtk_tree_view_get_path_at_pos()) before requesting a GtkTreeIter for it. Without this patch a bug is reproducible, where the user may click outside of the GtkTreeView entries, but still in the GtkTreeView - e.g. when only one entry is available. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-23Fix crash when applying a non-edit of nicknamesGravatar Amit Chaudhuri
As reported by Henrik, there was a crash lurking in edit_dc_nickname code. Invoking the dialog and selecting apply without changes exposed it neatly. This is a one line fix. Signed off by Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22Use proper helper functions for dive location and for_each_diveGravatar Linus Torvalds
This makes the code use the "dive_has_location()" function rather than check the longitude and latitude directly. It also uses "for_each_dive()" rather than open-coding it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22Satellite icon dietGravatar Linus Torvalds
[Dirk Hohndel: converted to png and .h] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22Fix crash when clicking on icon column in trip header entriesGravatar Dirk Hohndel
Silly oversight. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22libdivecomputer: add air temperature fixups for SuuntoGravatar Linus Torvalds
libdivecomputer doesn't actually seem to support air temperature reporting at all, but at least for Suunto dive computers the air temperature is recorded as the temperature for the first sample. So since we already have vendor-specific libdivecomputer hacks, let's just add that one as a rule. It may be that other divecomputers do this too, so this adds it as a generic concept - it's just that right now the flag for "air temperature in first sample" is only set for Suunto dive computers. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22Improve on the "prefer downloaded" dive computer modelGravatar Linus Torvalds
It used to be that when you checked the "Prefer downloaded" checkmark, we'd throw away *any* old dive computer data. That was good, because it allowed us to start from a clean slate when you had some old subsurface data with questionable dive computer data. However, it was a bit extreme, and it's really not what you want if you already have (good) dive computer data from other dive computers. So this modifies the logic a bit. Instead of throwing away all old dive computer data, the "Prefer downloaded" checkmark now means: - the newly downloaded data becomes the "primary" dive computer data (ie the first in the list) - if there was old dive computer data that *could* have been from this new dive computer (ie it didn't have model information, or it had a matching model but no device ID data), we throw that away - but any existing dive computer data from other dive computers is left. This seems to be much closer to what we really would want for a new "preferred" download. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22Fix suunto serial number confusion in libdivecomputerGravatar Linus Torvalds
libdivecomputer has started giving the Suunto serial numbers in a different format, which means that we have the same device with two different serial numbers, and then we need two different ways of turning the numerical entity into a string. Look at the number pattern to see figure out which version of the format it is that libdivecomputer is reporting, and turn it back into the original format so that we can reliably give the right string for it. This also mean sthat the device ID stays the same regardless of libdivecomputer version. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-22Add GPS icon to the location column for dive sites where we have GPS dataGravatar Dirk Hohndel
This replaces the really lame "italics text" from commit abe810ca1a29 ("Mark locations that have GPS location data attached") with a marginally less lame GPS icon.There's a reason why I am not making a living as graphics artist. But I think this is a huge step forward from what we had before... The satellite.svg file is very loosely based on a different icon that I found as public domain here http://www.clker.com/clipart-30400.html. From that I created the PNG and then that was converted into the GdkPixdata via gdk-pixbuf-csource; a rule for that was added to the Makefile but commented out as I don't know if this tool will always be available in the path. Having this icon included in the sources avoids locating yet another icon file. Better icons are certainly welcome! Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-21Add libsoup and osm-gps-map to Mac build instructions.Gravatar Henrik Brautaset Aronsen
Also force py27-pygtk to use the quartz variant, since MacPorts doesn't have variant dependency resolutions. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-20White space and coding style adjustments for gps.cGravatar Dirk Hohndel
It's just nicer this way. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-20Fix map scrollingGravatar Dirk Hohndel
The osm-gps-map default is to scroll-and-recenter around the mouse position. That is BAT SHIT CRAZY. So this implements our own scroll handling instead. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-20Mark locations that have GPS location data attachedGravatar Dirk Hohndel
This is rather lame - we simply turn the location text into italics for those dives where we have GPS location data. Underlining might be more natural, but Gtk plays games with the underline attribute if the mouse hovers over text. Ideally I would have prefered a little GPS logo next to the location text - but I couldn't figure out how to do that without writing my own cell renderer which seemed total overkill. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-20Reuse map windowsGravatar Dirk Hohndel
Instead of opening a new window / new map for every dive site we now have only two windows / maps. One for the overview of all the dive sites, the other one that is used to show the map for a specific dive site. This also switches the position preference from CENTER to MOUSE - this way it's less likely that the two map windows will be drawn exactly on top of each other. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-19Add modules file for building prerequisites on MacOS XGravatar Dirk Hohndel
This should allow the user to build osm-gps-map with jhbuild (all other required components are already build by the jhbuild default modules). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-19Add CFLAGS to build rule for webservice.oGravatar Dirk Hohndel
Otherwise it won't compile on MacOS X Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-18Improve handling for old XML files in Uemis downloaderGravatar Dirk Hohndel
In order to work in the most expected ways for people who have used a version of Subsurface that didn't store the deviceid in the divecomputer we relax the testing for when a divecomputer entry is assumed to match the current divecomputer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-18Consistently use uint32_t for deviceidGravatar Dirk Hohndel
There were a handful of places that incorrectly used signed values for the deviceid. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-18Fix potential crash with old XML filesGravatar Dirk Hohndel
A file with no divecomputer section in a dive can trigger a SEGV as cur_dc could be NULL. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-18Add libsoup to Windows installerGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-18Fixed some small issues in webservice.cGravatar Lubomir I. Ivanov
1) download_dialog_status_text() had some statements with no effect due to missing return keywords. This fixes incorrect error reporting. 2) Optimize the traversion of the response XML. Assuming that the status tag should be always under the root tag. We check if the root tag has children and enter a loop until we find a the "download" or "error" node names. If there are no children we return a parser error. 3) Clamp the number of input characters to 30 in the user id GtkEntry field. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-18Add facility to edit nicknames / remove nickname entryGravatar Amit Chaudhuri
This allows users to edit one or more nick name entries in a single session. Entries can also be removed individually. Based on mock up by Lubomir Ivanov and various conversations from Dirk. Thanks to both. [Dirk Hohndel: quite a bit of editing for coding style and whitespace] Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-17Updated the Makefile to support libsoup and include webservice.[c|h]Gravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-17Added client side communication to the Subsurface Web ServiceGravatar Lubomir I. Ivanov
A couple of new files webservice.c and webservice.h are added. webservice.h exposes two methods at the moment: - webservice_download_dialog(): this function creates the user interface for the download dialog from the web service. - webservice_request_user_xml() this function is a direct call to retrieve XML for a specific user identifier. the actual data, data length and error codes are stored in passed pointers. A menu entry is added in the Log menu: "Download From Web Service" The used backend for communication at the moment is provided by libsoup. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-17Hack Makefile, gtk-gui.c and divelist.c to allow building w/o osm-gps-mapGravatar Dirk Hohndel
While we are waiting for an autotools generated Makefile, this should allow people to build that don't have osm-gps-map. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-17Update gtk-osx-integration to version 2 of the APIGravatar Dirk Hohndel
In order to be able to work with Gtk3 introspection all the APIs had to be renamed. Instead of quartz_application... and gtk_osxapplication... all the API functions are now name gtkosx_application... This will break the build for people who haven't upgraded to the latest - but supporting both would be unspeakably ugly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-16Add GFlow/GFhigh settings in dive plannerGravatar Dirk Hohndel
The planner interactively responds to changes to the GFlow and GFhigh in the dialog and calculates an appropriate profile. If there is a previous dive within the 48 hours prior to this dive then its saturation is correctly taken into account if the gradient factors are changed - so if they are aggressively lowered it is possible to start the dive with already an existing ceiling (simply increase the surface interval to 'fix' that). Once the plan is accepted the GF values are reset to the current preferences. This can cause the ceiling in the plot to change and the deco stops to no longer match the ceiling - but that's a logical consequence of the ability to change a temporary copy of GFlow/GFhigh during the planning process and not the actual preferences (which would be counter intuitive, I think). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-16Correctly mark divelist changed after accepting dive planGravatar Dirk Hohndel
Commit 293126257b20 ("Mark divelist as changed if user accepts planned dive") had the correct commit message but an incorrect implementation. This moves the mark_divelist_changed() call into the GTK_RESPONSE_ACCEPT clause where it belongs. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-16Update dive flag image.Gravatar Henrik Brautaset Aronsen
The previous flag didn't work on Windows somehow. I guess Photoshop added some headers that GdkPixbuf didn't like. I've reconverted it with ImageMagick, which made the file less than half the size. Bonus! Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-16Only offer to show dive on map if we have location informationGravatar Linus Torvalds
This adds the "Show in map" menu entry to the divelist only if we actually have a location to show. Of course, having some way to visually see whether we have a GPS location even before we show the menu would probably be good. Maybe a marker in the "location" string or something. But in the meanwhile, at least we don't have that menu entry if we have nothing to show. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-15Show single dives in map.Gravatar Henrik Brautaset Aronsen
This adds a "Show in map" entry in the dive list context menu. It will zoom to the dive location if it exists, otherwise the full map will be displayed. I've also switched map tiles from OpenStreetMap to Google Maps just to show off that we can. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-15Clean up null pointer printout in weightsystem descriptionGravatar Salvador Cuñat
If there's no weightsystem description, as in most imported dives, print a literal "unknown" instead of null pointer or blank. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>