aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2014-01-11Ensure gaslist is NULL terminatedGravatar Miika Turkia
If buffer copying is restricted by the buffer size in strncpy or snprintf, the copied string is not NULL terminated. Add one to the end just to make sure. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-11Properly handle user dive merge requestsGravatar Linus Torvalds
When the user asks to merge dives in the divelist, we would always use the "try tp find matching dive computers and merge at an offset" model. That is incorrect if the intent is to actually merge two *identical* dives (with different dive computers), as opposed to merging two short dives into one longer one with a surface interval. Normally this doesn't ever trigger (the "same dive" merging will have been done automatically after downloading from the dive computer), but if the dive computer times are off, and the user fixes them, and then asks to merge dives, we should use the non-offset dive merging logic. We already have that "likely_same_dive()" function that is used to determine when downloaded dives get merged, so just use it for the user merge case too. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-11Fix app icon and title for yearly statisticsGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10Merge branch 'v4.0-branch'Gravatar Dirk Hohndel
Bring in the tag, the translations changes and edits preparing for 4.0.2 into master. This should make "git describe" on master create something reasonably sensible...
2014-01-10Add a few more Suunto eventsGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10Import tags from Suunto database fileGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10Do not plot temperatures on DM4 import if no infoGravatar Miika Turkia
If we do not have temperature readings, we do not want to plot the temperature samples either. See #415 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10Make divelist search case insensitiveGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10User manual: overlay search panelGravatar Sergey Starosek
Make search panel floating so that web view does not resize. This commit also addresses following issues: - search now wraps around document - application icon and window title are now back Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10Switch to new UserManual implementationGravatar Sergey Starosek
This enables search within user manual by pressing Ctrl-F. Esc key closes search panel. Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10Extract user manual web view into a separate classGravatar Sergey Starosek
Provide search functionality which addresses ticket #391 Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10Make Ctrl-F window shortcutGravatar Sergey Starosek
The shortcut may be used elsewhere, e.g. in user manual Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Update translationsv4.0.2Gravatar Dirk Hohndel
I'm not the author, just importing the translations from Transifex. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Remove now stale arguments to "CHANGED()" macroGravatar Linus Torvalds
We now never remove units or percentage signs, and always just compare the string data, so we should remove the hacky arguments that are no longer used. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Add and use 'string_to_fraction()' helper converter functionGravatar Linus Torvalds
This matches the pattern of unit conversion, and will allow us to remove all the code that uses the old complex "CHANGED()" macro that tries to remove units or percent signs. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Add unit-aware cylinder size string parsercGravatar Linus Torvalds
Whittling down on the string parsing that doesn't check user-specified units. Still need to handle temperatures (and will do percentages to match the pattern too), but this is getting us closer to always honoring user-specified units. With this you can say that you have a "10l" cylinder at "3000psi", and it will do the right thing (it's basically a 72 cuft cylinder in imperial measurements). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Remove now stale arguments to "CHANGED()" macroGravatar Linus Torvalds
We now never remove units or percentage signs, and always just compare the string data, so we should remove the hacky arguments that are no longer used. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Add and use 'string_to_fraction()' helper converter functionGravatar Linus Torvalds
This matches the pattern of unit conversion, and will allow us to remove all the code that uses the old complex "CHANGED()" macro that tries to remove units or percent signs. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Add unit-aware cylinder size string parsercGravatar Linus Torvalds
Whittling down on the string parsing that doesn't check user-specified units. Still need to handle temperatures (and will do percentages to match the pattern too), but this is getting us closer to always honoring user-specified units. With this you can say that you have a "10l" cylinder at "3000psi", and it will do the right thing (it's basically a 72 cuft cylinder in imperial measurements). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Prepare for Subsurface 4.0.2 releaseGravatar Dirk Hohndel
Update version numbers and add "new in 4.0.2" summary to ReleaseNotes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Add unit-aware conversion of pressure dataGravatar Linus Torvalds
This just adds (and uses) a string_to_pressure() to parse pressure units correctly when filling in cylinder pressures. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Change fake profile behaviorGravatar Dirk Hohndel
If no average depth is known the current fake profile behavior is rather unintuitive (we make up an average depth). Instead we should assume that this is a PADI style dive log and give the user a "rectangular" profile (actually, it's a trapecoid as we at least try to enforce a sane ascent / descent speed). If the dive is somewhat longer or deeper (10 min / 10 m) we even add a 3m safety stop at 5m. Added a new dives/test0b that tries to capture the typical cases to test this. Fixes #398 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Add a string_to_depth() helper function to match our string_to_weight oneGravatar Linus Torvalds
It's currently only used for the setting of the cylinder switching depth, but now that one should work with user-specified units (so you can set a max depth in feet even if you use metric, and vice versa). In the future, if we also make the unit preferences something you can pass in (with user preferences as a default argument value), we might want to use this for parsing the XML too, so that we'd honor explicit units in the XML strings. But the XML input unit preferences are not necessarily at all the same as the user preferences, so that does require us to extend the conversion functions to do possibly explicit unit preference selection. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09const'ify our strtod() helper functionsGravatar Linus Torvalds
The C library doesn't use const char pointers for legacy reasons (and because you *can* modify the string the end pointer points to), but let's do it in our internal implementation just because it's a nice guarantee to have. We actually used to have a non-const end pointer and replace a decimal comma with a decimal dot, but that was because we didn't have the fancy "allow commas" flags. So by using our own strtod_flags() function, we can now keep all the strings we parse read-only rather than modify them as we parse them. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Make 'string_to_grams()' use proper type safe typesGravatar Linus Torvalds
Make it use 'weight_t' and hide the "grams" part inside the type. That was the whole point of the weight_t type, after all. Returning a "double" was always bogus, since we internally always do integer grams (and the function actually used "rint()" to get all the rounding right anyway). As a result, it's now called "string_to_weight()". Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Write the event data to the libdivecomputer log.Gravatar Jef Driesen
For some devices, the event data contains important data that is required for parsing the dives, but which is not present in the full memory dump. Signed-off-by: Jef Driesen <jefdriesen@telenet.be> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09DownloadFromDCWidget: prevent possible leaks for log/dump filesGravatar Lubomir I. Ivanov
If the 'logfile_name' and 'dumpfile_name' were NULL we can simply strdup() them with a new value, but if there was a previous value we need to free() first. C99 6.7.8 allows us to keep said variables without the explicit NULL initialiazation. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09libdivecomputer.c: Try not to pass NULL to fopen()Gravatar Lubomir I. Ivanov
C99 7.1.4, says nothing about passing NULL to fopen(), which means that it isn't portable and there are no guaranties that the return will be a NULL pointer or that that a library implementation will not assert or SYSSEGV in the middle of the fopen() branch. libdivecomputer.c's 'dumpfile_name' and 'logfile_name' could cause problems in that regard. A possible fix for #411 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09windows.c: Fix possible assert when passing NULL to *open()Gravatar Lubomir I. Ivanov
On Win32 subsurface_fopen() can reach an assert in windows.c: utf8_to_utf16(), if NULL is passed for 'path'. Let's return NULL/-1 for some of the *open() functions in there. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Setting dive as 'current' when restoring selectionGravatar Tomaz Canabrava
Restoring the selection was not setting the selected dive as current, and thus, breaking keyboard navigation. Fixes #402 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Add CaseInsensitivity to all of the completers.Gravatar Tomaz Canabrava
Just one of the completers had Qt::CaseInsentitive set, setting for all of them. Fixes #400 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Use helper function to display mean depth with correct unitGravatar Dirk Hohndel
In commit 528d0ea0e7bd ("Print numerical value of mean depth") Miika once again forgot the three non-metric countries on this planet... :-) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Print numerical value of mean depthGravatar Miika Turkia
This will print the numerical value of mean depth to the profile graph. Fixes #405 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Fix typoGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Fix Uemis temperature conversionGravatar Dirk Hohndel
In commit 3fd39a7a87bf ("Remove some constants and use helpers instead") Anton missed the fact that the Uemis gives temperatures in the handy unit of "centi degree C". Now things work again. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Parse localized weight unitsGravatar Dirk Hohndel
We have the wonderful Qt string functions. Let's use them to make the code simpler and easier to read. Suggested-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Maintab: prevent a segfault in the 'Equipment' tabGravatar Lubomir I. Ivanov
When a dive contains no cylinders, clicking the '+' button could SIGSEGV if current_dive->dc.model is NULL. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Add unit-aware conversion of pressure dataGravatar Linus Torvalds
This just adds (and uses) a string_to_pressure() to parse pressure units correctly when filling in cylinder pressures. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Interpolated pressure should always be setGravatar Rodrigo Severo
Interpolated pressure should always be set, even it we didn't calculate a new one. In this case we should just use the last one. Signed-off-by:Rodrigo Severo <rodrigo@fabricadeideias.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08Change fake profile behaviorGravatar Dirk Hohndel
If no average depth is known the current fake profile behavior is rather unintuitive (we make up an average depth). Instead we should assume that this is a PADI style dive log and give the user a "rectangular" profile (actually, it's a trapecoid as we at least try to enforce a sane ascent / descent speed). If the dive is somewhat longer or deeper (10 min / 10 m) we even add a 3m safety stop at 5m. Added a new dives/test0b that tries to capture the typical cases to test this. Fixes #398 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08When interpolating tank pressures, don't devide by zeroGravatar Dirk Hohndel
When an interpolated segment is on the surface we get no pressure time - and try to divide by zero. (plus a small whitespace issue that slipped throught the cracks earlier) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08Reinstating SURFACE_THRESHOLD test in pressure_time functionGravatar Rodrigo Severo
The small straight parts at the end of tank pressure lines are more of a aesthetic issue, not causing real harm so it is no reason to remove the SURFACE_THRESHOLD test from pressure_time function only because of this. Also improved interpolate data debuging, rearranged get_pr_interpolate_data and removed an unused variable from get_pr_interpolate_data. No real change here, just trying to make the code clearer. [Dirk Hohndel: clean up whitespace damage from this and the previous commit] Signed-off-by: Rodrigo Severo <rodrigo@fabricadeideias.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08Discontinuity and stall on tank pressure interpolated linesGravatar Rodrigo Severo
Interpolated lines for tank pressures were presenting discontinuities (sudden drops) and stalls (horizontal lines) with certain dive profiles. The main reason seems to be that the discrete interpolation of tank pressure was adding small pressure increments that could be rounded down or up repeatedly generating cumulative rounding errors that would mean either a delay on pressure drop that would be drawn as a sudden drop or as a premature pressure drop that would result in a flat line. This patch changes the way the discrete interpolation is done, so that we don't have cumulative rounding errors distorting tank pressure lines. To calculate accumulated pressure_time values the get_pr_interpolate_data function was created. The fact that get_pr_interpolate_data transverses the beginning of the plot_info entry list for each entry that needs interpolated tank pressure isn't optimal at all. There might be a way to properly track the data necessary to interpolate tank pressures from inside the main pi->entry loop in fill_missing_tank_pressures. Unfortunately I didn't manage to do it inside fill_missing_tank_pressures so we have get_pr_interpolate_data. The SURFACE_THRESHOLD test from pressure_time function was also removed as no matter how shallow the diver is, if he is using the cylinder to breathe the cylinders tank pressure should be affected. Signed-off-by: Rodrigo Severo <rodrigo@fabricadeideias.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08Add a string_to_depth() helper function to match our string_to_weight oneGravatar Linus Torvalds
It's currently only used for the setting of the cylinder switching depth, but now that one should work with user-specified units (so you can set a max depth in feet even if you use metric, and vice versa). In the future, if we also make the unit preferences something you can pass in (with user preferences as a default argument value), we might want to use this for parsing the XML too, so that we'd honor explicit units in the XML strings. But the XML input unit preferences are not necessarily at all the same as the user preferences, so that does require us to extend the conversion functions to do possibly explicit unit preference selection. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08const'ify our strtod() helper functionsGravatar Linus Torvalds
The C library doesn't use const char pointers for legacy reasons (and because you *can* modify the string the end pointer points to), but let's do it in our internal implementation just because it's a nice guarantee to have. We actually used to have a non-const end pointer and replace a decimal comma with a decimal dot, but that was because we didn't have the fancy "allow commas" flags. So by using our own strtod_flags() function, we can now keep all the strings we parse read-only rather than modify them as we parse them. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08Make 'string_to_grams()' use proper type safe typesGravatar Linus Torvalds
Make it use 'weight_t' and hide the "grams" part inside the type. That was the whole point of the weight_t type, after all. Returning a "double" was always bogus, since we internally always do integer grams (and the function actually used "rint()" to get all the rounding right anyway). As a result, it's now called "string_to_weight()". Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08Show import dialog only when needed for CSV configGravatar Miika Turkia
We do not need any import dialog when importing normal XML based divelogs. With this they are imported directly after file selection dialog. However, when CSV files are detected in the import list, the configuration dialog is displayed and applied for them. (CSV files are detected by file extension.) Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08Write the event data to the libdivecomputer log.Gravatar Jef Driesen
For some devices, the event data contains important data that is required for parsing the dives, but which is not present in the full memory dump. Signed-off-by: Jef Driesen <jefdriesen@telenet.be> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08DownloadFromDCWidget: prevent possible leaks for log/dump filesGravatar Lubomir I. Ivanov
If the 'logfile_name' and 'dumpfile_name' were NULL we can simply strdup() them with a new value, but if there was a previous value we need to free() first. C99 6.7.8 allows us to keep said variables without the explicit NULL initialiazation. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08libdivecomputer.c: Try not to pass NULL to fopen()Gravatar Lubomir I. Ivanov
C99 7.1.4, says nothing about passing NULL to fopen(), which means that it isn't portable and there are no guaranties that the return will be a NULL pointer or that that a library implementation will not assert or SYSSEGV in the middle of the fopen() branch. libdivecomputer.c's 'dumpfile_name' and 'logfile_name' could cause problems in that regard. A possible fix for #411 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>