aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2016-03-02gas model: split up gas compressibility into a file of its ownGravatar Linus Torvalds
The gas compressibility is such a specialized thing that I really prefer having it separate. This keeps Robert's Redlich-Kwong equation as-is, but let's experiment with other models soon... Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02QML UI: show notification when cloud is accessedGravatar Dirk Hohndel
And hide the notification either after 5 seconds or once we are done. This requires an extension to the Kirigami components that isn't upstream, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02QML UI: new property to tell the UI that we are accessing cloud storageGravatar Dirk Hohndel
This can then be used to give the user visual feedback (instead of them just thinking the app is hung). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02QML UI: resolve confusion about dive list model orderingGravatar Dirk Hohndel
Oops, I forgot to take the sort model on top of the model into account. Now everything should stay consistent - ListView order when accessed from QML, but internal order when accessing the underlying array. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02QML UI: update profile when editing duration of manually added diveGravatar Dirk Hohndel
We need to make sure that a new fake DC is created after the duration was changed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02QML UI: update the correct dive in the model when committing a changeGravatar Dirk Hohndel
When manually adding a dive and moving it in the dive list (by editing it's start time) we could create a situation where the dive list internally was correct, but the dive list model on screen showed an incorrect dive list with the new dive in two different spots. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02QML UI: create a chronological dive list when manually adding diveGravatar Dirk Hohndel
The dive list might contain dives in the future, don't add the new dive to then end but instead add it at the correct spot in the list Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02QML UI: after adding a dive, jump to it in the listGravatar Dirk Hohndel
Don't do the slow motion scrolling through the list if we previously showed a different dive in the list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02Add helper functions to identify the position of a dive in the dive listGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-29templatelayout.cpp: fix potential issue in preprocessTemplate()Gravatar Lubomir I. Ivanov
The function preprocessTemplate(), did not account well for indexes in Grantlee variables, such as: dive.weight# (where # is the index) dive.cylinder# To solve the issue the list (QList<QPair<QString, QString> >) for variables to be replaced is populated will all possible indexes: 0 - MAX_WEIGHTSYSTEM for weights 0 - MAX_CYLINDERS for cylinders Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-29QML UI: implement undeleteGravatar Dirk Hohndel
This code is very similar to the undo code in the desktop UI, but untangling that from the desktop seemed massive overkill; we don't have lists of dives to delete and undelete here - so this is actually much simpler and easier to maintain (I hope). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-29QML UI: present an undo dialog after deleteGravatar Dirk Hohndel
The dialog gives the user 3 seconds to undo the delete and then disappears without any user interaction. This isn't hooked up, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-29This computes the compressibility of the gas depending on the mixture.Gravatar Robert C. Helling
As it turns out, the van der Waals equation gives results that are numerically not really useful, so we use the Redlich Kwong equation which is, according to Wikipedia, much more accurate, which can be confirmed given the empirical values for air. As opposed to the previous approach with a look-up table, this takes into account the actual gasmix. This always assumes the gas to be at 20 degrees Centigrade. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-29user-manual.txt: mention some more Grantlee variablesGravatar Lubomir I. Ivanov
With the recent refactoring of the DiveHelperObject class, some more Q_PROPERTIES were added and can be used with the Grantlee engine. We expose some of the additions to the user via the manual. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-29DiveHelperObject: add the weightList and cylinderList propertiesGravatar Lubomir I. Ivanov
"weights" and "cylinders" are QStringList Q_PROPERTIES, and Grantlee should be able to render them, but it doesn't. To be able to print the whole list of weights and cylinders we introduce two new QString properties "weightList" and "cylinderList". The variable replacement in the previous patch deals with the conversation of the user side HTML, e.g.: USER -> INTERNAL "{{ dive.weights }} -> {{ dive.weightList }}" "{{ dive.cylinders }} -> {{ dive.cylinderList }}" Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-29templatelayout.cpp: add a HTML preprocessor stageGravatar Lubomir I. Ivanov
The current Grantlee template loading scheme does not allow a preprocessing layer. With the recent DiveObjectHelper changes the layer is required if we don't want to add a set of dummy methods and Q_PROPERTIES which will only inflate the DiveObjectHelper class. Use the already present helper readTemplate() to load the raw HTML template and pass it to a static function which does some variable replacement to accomudate DiveObjectHelper. This change is done for the sake of not breaking the Grantlee HTML variables on the user side! Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-28QML UI: small adjustment to DiveDetailsViewGravatar Dirk Hohndel
This reduces the margin to use more of the available space and also makes the first column slightly wider so the word "Cylinder" isn't broken on a Nexus 6p. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-28QML UI: ensure that after a dive edit the profile is redrawnGravatar Dirk Hohndel
Normally this is triggered when the DiveDetailsView component is completed, but since QML isn't recreating this component unless we switch to a dive a couple of spots in the dive list away from this one, we wouldn't get any changes in the data reflected in the profile. But since this now redraws the same dive that potentially was drawn last, we need to make sure we call plotDive() with force=true. I also suspect that this could help with the strange bug that sometimes we show a blank profile after certain edits. See #1013 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-28QML UI: we no longer use the return value of commitChanges()Gravatar Dirk Hohndel
So make it a void function. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-28If salinity is not density, add density of fresh waterGravatar Robert C. Helling
There was a reported case of an import of a dive that gave a salinity of 35g/l. This is an actual salinity (an amount of salt in the water) but for subsurface the salinity is actually the density of the water. So for too small values of the salinity add the density of fresh water. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-25gas pressures: use an actual compressibility table for airGravatar Linus Torvalds
We could in theory make this dependent on the gasmix, but for now let's just assume (incorrectly) that everything we breathe acts like air. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-25Show both the nominal and "real" size for an imperial cylinderGravatar Linus Torvalds
This is questionable, but perhaps useful. When showing imperial cylinder sizes, show both the nominal value (with no compensation for compressibility of the gas) and the "actual" amount of gas the cylinder contains. So an AL80 will show as a size of "80 (77)cuft", because while 80 is the nominal size, the actual amount of gas that will fit is just 77 cuft. [Dirk Hohndel: adjusted to take translation of the unit into account] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-25Don't use "get_volume_string()" for cylinder size stringGravatar Linus Torvalds
We had two totally different usage cases for "get_volume_string()": one that did the obvious "show this volume as a string", and one that tried to show a cylinder size. The function used a magic third argument (the working pressure of the cylinder) to distinguish between the two cases, but it still got it wrong. A metric cylinder doesn't necessarily have a working pressure at all, and the size is a wet size in liters. We'd pass in zero as the working pressure, and if the volume units were set to cubic feet, the logic in "get_volume_string()" would happily convert the metric wet size into the wet size in cubic feet. But that's completely wrong. An imperial cylinder size simply isn't a wet size. If you don't have a working pressure, you cannot convert the cylinder size to cubic feet. End of story. So instead of having "get_volume_string()" have magical behavior depending on working pressure, and getting it wrong anyway, just make get_volume_string do a pure volume conversion, and create a whole new function for showing the size of a cylinder. Now, if the cylinder doesn't have a working pressure, we just show the metric size, even if the user had asked for cubic feet. [Dirk Hohndel: added call to translation functions for the units] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-25gas pressures: do not use gas compressibility for cylinder namingGravatar Linus Torvalds
This actually didn't make a difference for the common case, since our simplified gas compressibility model had a compressibility factor of 1.0 up to 200 bar, and increased smoothly from there. As a result, the common 2400 and 3000 psi workpressures didn't really see an effect from this. Not taking compressibility into account does kind of make sense for cylinder naming, since the cylinder may be used for different gases with very different compressibility characteristics. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-25gas pressures: do some initial cleanupGravatar Linus Torvalds
This marks "surface_volume_multiplier()" static in preparation for changing it to use an actual honest-to-goodness compressibility estimation. Without that, it wasn't obvious that the function wasn't used in other random places. Also, remove the "wet_volume()" function. It was unused, but more importantly, it was wrong. Yes, it was the inverse of "gas_volume()", but when you calculate wet volumes from the imperial sizes, you don't actually use the "real" gas volume, you use the idealized one. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-25Initialize the random number generatorGravatar Miika Turkia
We use random numbers for file names, both temporary filename when creating a zip for divelogs.de upload and for filename on form data for facebook upload. This does not require for true randomness but we still want these to not be constant on each run of Subsurface. Thus we need to initialize the random number generator. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-25Use full precision on weight system on XSLT transformsGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-24Correctly round total weight displayedGravatar Dirk Hohndel
The code was wrong (and in the case of metric display for weights >= 20kg, spectacularly wrong) in more or less all cases. Rounding. It's good for the sole. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-23QML UI: add context menu to delete diveGravatar Dirk Hohndel
This allows the user to delete the currently shown dive. This action takes effect right away, no confirmation, it gets right away written to the local git cache. One idea for an undo operation here could be to simply reset the git tree to HEAD^ and reload. Not elegant, but would work. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-23Add helper to delete dive from QMLGravatar Dirk Hohndel
Once again we make this save the changes to the local cache without being prompted. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-23Divelogs.de import: encode + character on passwordGravatar Miika Turkia
Upload seems to work as is... Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-21pressure interpolation: incrementally update interpolation dataGravatar Linus Torvalds
Instead of re-calculating all the interpolation data for each plot entry (which means that we have a quadratic algorithm that walks over all the plot-info points for each plot-info point), we can just update it incrementally within any particular interpolation segment. The previous cleanups made the code sane enough to understand, and makes it trivial to see how you don't have to recalculate the full thing. This gets rid of the O(n**2) algorithm, and it instead becomes O(n*m) where 'n' is the number of plot entries, and 'm' is the number of gas segments (which is usually a much smaller numer, typically "1"). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-21pressure interpolation: further code simplificationGravatar Linus Torvalds
With the two bigger simplications, this just re-organizes the code to do the "interpolate.pressure_time" update that is shared among all the "after segment start" cases in just one place. That leaves the get_pr_interpolate_data() much simpler, and makes it much clearer what it actually does. In particular, it becomes very obvious that "interpolate.pressure_time" is constant for one particular segment (it's the total pressure time), and that "interpolate.acc_pressure_time" is the one that gets updated for every entry. The next step is to only call this for the first entry, and then update just the "acc_pressure_time" in the caller. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-21pressure interpolation: simplify codeGravatar Linus Torvalds
Getting rid of the pointless always-zero pressure now makes it obvious how some of the remaining code can just be removed too: there is no point in re-initializing the pressure_time entries to zero at the segment start, because they started out zero and we just checked that we don't do anything to them before we hit the segment start. Similarly, now that the silly pressure testing is gone, it is obvious that the code for "i < cur" and "i == curr" cases is identical, and the two cases can just be collapsed. Signed-off-by: Linus Torvalds <torvalds@ linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-21pressure interpolation: get rid of pointless and confusing codeGravatar Linus Torvalds
In the function fill_missing_tank_pressures(), we only ever call get_pr_interpolate_data() if "pressure" is zero. So passing it in as an argument, and then testing whether it is zero or not, is just totally pointless, and only obfuscates things. This whole thing seems to be due to people editing the code over time, with the tests becoming superfluous as the code around it changed, and nobody looking at whether it actually made sense any more. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20QML UI: further validation in the C++ codeGravatar Dirk Hohndel
Don't allow negative depth or depth beyond 500m. Additional checks that the gas mix is possible (even thought QML code SHOULD only allow valid combinations). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20QML UI: make unit matching case insensitiveGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20QML UI: only allow valid gas mixesGravatar Dirk Hohndel
The input is restricted to EAN100 EANxx (with 'x' one of 0..9) AIR xx/xx (with 'x' one of 0..9) xxx (with 'x' one of 0..9 and the number <= 100) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20QML UI: don't allow negative duration or depthGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20Add option to allocate the samples in fake_dc()Gravatar Dirk Hohndel
We (ab)use fake_dc() to create a pleasing profile for a manually added dive. Based on it's intended use, fake_dc() simply handed back a dc structure that pointed at staticly allocated samples - that's obviously (now that I think about it) going to blow up in my face if I edit a manually added dive more than once. So now we have an option for fake_dc() to actually allocate the samples - this way the rest of the code can treat these samples as we would treat samples created any other way. We can free them and replace them with a new set. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20After freeing the samples, clear the pointerGravatar Dirk Hohndel
Otherwise we might end up trying to free them a second time. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-20QML UI: fix recreation of profile after dive editGravatar Dirk Hohndel
We only need to deal with this if the dive changed. And in that case, if we calculate a new fake DC, we need to clear out the meandepth as otherwise the algorithm will try to match both max and mean depth. Since the user potentially changed the max depth that could have very odd consequences. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-15QML UI: no longer change unit preferences when parsing editsGravatar Dirk Hohndel
When the user explicitly sets the units when editing or adding dives, we used to change the display preferences. This was changed for some but not all fields in commit 6252d0cd3bda ("While parsing weight and pressure we should not change the users settings") Now we do this consistently for all inputs. Also, when editing the depth of a manually added dive, we now throw away the samples (as those are certain to be inconsistent). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-15Clean up conversion helpersGravatar Dirk Hohndel
- coding style (ugh - I should have fixed that when I first committed them) - remove redundant variables - add similar code to the length and temperature helpers Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-15QML UI: better text when no profile is shown for a diveGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-14QML UI: don't show an odd profile for zero duration diveGravatar Dirk Hohndel
A dive with zero duration creates an odd profile that is 2min 30seconds long and looks just weird. Instead, simply show a text that there is on profile shown for such a dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-14Add dive property to easily test if there isn't an actual diveGravatar Dirk Hohndel
Right now this just tests for zero duration, but maybe this should also return true for positive duration and max depth of 0. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-14Remove debug outputGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-14Grab pressures from samples if requiredGravatar Miika Turkia
If cylinder does not have start and end pressures assigned, attempt to grab them from the samples instead. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-14Test cylinder usage properlyGravatar Miika Turkia
It is better to use the proper function to test if cylinder is in use than just checking the description. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>