summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2018-11-18Dive list: update position of trip if data changedGravatar Berthold Stoeger
If the date of a dive changed, it might be necessary to reorder the trips, as the date of the trip changed. Although this seems like an odd usecase, move the trip if necessary, for consistency's sake. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18Core: remove "when" field of struct dive_tripGravatar Berthold Stoeger
The when field gives the time of the first dive. Instead of keeping this field in sync, replace it by a function that determines the time of the first dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18Coding style: fix indentation in addDivesToTrip()Gravatar Berthold Stoeger
addDivesToTrip() had one level of indentation too much owing to a copy-and-paste error. Remove. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18Dive list: move sort-functionality into coreGravatar Berthold Stoeger
To make sorting more controlled, move all sorting functions into the core. For this, introduce a "dive_or_trip" structure, which represents a top-level item. Adapt the DiveTripModel accordingly. There are now three sorting functions: 1) dive_less_than 2) trip_less_than 3) dive_or_trip_less_than These should be used by all sorting code. By moving them to a single place, the mess can hopefully be cleaned up. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18Dive list: keep dives-in-trip list ordered after shift-timesGravatar Berthold Stoeger
On shift-times, the list of dives in a trip may become disordered. Reestablish order with sort_table(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18Dive list: implement trip_less_than functionGravatar Berthold Stoeger
As a step towards proper sorting, introduce a trip_less_than() function in core. It simply sorts by the first dive, which should be unique as dives may belong to only one trip. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18Dive list: replace dive-list of trips by a tableGravatar Berthold Stoeger
The dives of each trip were kept in a list. Replace this by a struct dive_table. This will make it significantly easier to keep the dives of a trip in sorted state. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18Core: add add_dive_to_table() functionGravatar Berthold Stoeger
Up to now, dives were added to the global dive table with add_single_dive(). Split out the funtionality to add a dive to an arbitrary dive in the add_dive_to_table_function(). The difference compared to record_dive_to_table is that dives are added at a specific position or the sort-criterion given by dive_less_than(). This will allow to use a dive tabe for trips instead of a linked list. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18Core: unify insert_trip() and insert_trip_dont_merge()Gravatar Berthold Stoeger
There were two versions of the insert_trip() function: one would merge trips if a trip with the same date already existed, the other wouldn't. The latter was introduced with the dive-list undo work. The problem is that the "date" of a trip (i.e. the first dive) seems ill-defined as this is a volatile value. Moreover in the context of making dive-import undoable this is a very dangerous notion, as the caller needs control over when the dives are added to a trip. Therefore, unify these two functions and never merge trips. The decision on merging dives now has to made by the caller. This will be implemented in a future commit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-18Fix Cressi interface ftdi opening bugGravatar Daniel Krupp
The Cressi specific PID was not used when serial_ftdi_open_device tried to open the device. Reported-by: Daniel Krupp Signed-off-by: Daniel Krupp <daniel.krupp@gmail.com>
2018-11-18Mobile: visual indication for copy and paste operationsGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18Mobile manual: section about copy-pasteGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18Add symlink for Documentation/mobile-imagesGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18Changleog entry for mobile copy-pasteGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18Mark cache invalid to get data savedGravatar Miika Turkia
Seems that we need to invalidate the cache to get the modifications actually saved. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18delete-copy-paste buttons layed out properlyGravatar Miika Turkia
Now these buttons are finally shown with long press and seem to be working more-or-less as intended. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18Verify that copy is doneGravatar Miika Turkia
Naturally the paste button should be disabled, if this is the case, but it still makes sense to do this check. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-18Support for copy-pasting specific fields on mobileGravatar Miika Turkia
Initial implementation/prototype of copy-paste support for Subsurface-mobile. The UI part is really lacking; right now the copy button is initially visible and paste is achieved by long press on a dive and clicking the paste button when it appears. Delete is currently not possible at all, as I just failed to layout the buttons properly using QML. It just sounds so simple, to put all the copy-paste-delete buttons next to each other... The data to be copied is currently hard-coded. A dialog to choose inteded fields would be nice, but it'll take quite a bit effort to get used to QML enough to be able to hack something together. Anyway, this seems to work, even though the UI is not always reflecting the paste without switching dives (when testing on laptop). Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-11-16Dive list: use dive trip time as additional sort criterionGravatar Berthold Stoeger
The DiveTripModel places dives after trips in chronologically ascending mode if the dive and the trip start at the same instant. But in the core the sort order was undefined. This could lead to a discrepancy. Therefore, implement the same sort-criterion in the core code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-16Dive list: invert sort-direction to reflect coreGravatar Berthold Stoeger
Traditionally, the DiveTripModel has its data sorted in opposite direction to the core-data (chronologically descending vs. ascending). This bring a number of subtle problems. For example, when filling the model, trips are filled according to the *last* dive, whereas later insertion points are according to the ->when value from the core, which depends on the *first* dive. As a start of fixing these subtleties, change the sort direction to reflect the core-data. Ideally, this should lead to a removal of the redundant data-representation. Since the model is now sorted in ascending order, sorting has to be enabled in the DiveListView constructor to reflect the default-descending order. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-16More accurate CNS calculations (following comments on github)Gravatar willemferguson
Update table of maximum oxygen exposure durations, used in CNS calulations. This table shows the official NOAA maximum O2 exposure limits (in seconds) for different PO2 values. It also gives slope values for linear interpolation for intermediate PO2 values between the tabulated PO2 values in the 1st column. Top & bottom rows are inserted that are not in the NOAA table: (1) For PO2 > 1.6 the same slope value as between 1.5 & 1.6 is used. This exptrapolation for PO2 > 1.6 likely gives an underestimate above 1.6 but is better than the value for PO2=1.6 (45 min). (2) The NOAA table only tabulates values for PO2 >= 0.6. Since O2-uptake occurs down to PO2=0.5, the same slope is used as for 0.7 > PO2 > 0.6. This gives a conservative estimate for 0.6 > PO2 > 0.5. To preserve the integer structure of the table, all slopes are given as slope*10: divide by 10 to get the valid slope. The columns below are: po2 (mbar), Maximum Single Exposure (seconds), single_slope, Maximum 24 hour Exposure (seconds), 24h_slope */ Then update Calculations of the CNS for a single dive - this only takes the first divecomputer into account. The previous version of the code did a table lookup and used the max O2 exposure for the next-higher PO2 category. This gave a shorter max O2 exposure time and a higher CNS contribution for a specific dive segment, resulting in a slightly conservative value of CNS, often some 2 - 3 % too high. This code does an interpolation for PO2 values inbetween PO2 entries in the lookup table and therefore results in a more accurate maximum O2 exposure time for that PO2. The maximum O2 exposure duration for each segment is also calculated based on the mean depth of the two samples (start & end) that define each segment. The CNS contribution of each segment is found by dividing the time duration of the segment by its maximum exposure duration. The contributions of all segments of the dive are summed to get the total CNS% value. This is a partial implementation of the proposals in Erik Baker's document "Oxygen Toxicity Calculations" */ Overall, this PR does not radically alter the existing CNS calculation, it only makes it more accurate and more consistent by doing interpolation and by using mean segment depth to find PO2. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2018-11-16Dive list: correctly translate trip dateGravatar Berthold Stoeger
Adapt get_trip_date_string() to use the same logic as get_dive_date_string(): Use the static "loc" object to translate date. Before, the trip date was shown in C locale. Reported-by: Philippe Massart <philippe@philmassart.net> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-15Update README and ReleaseNotes for 4.8.4v4.8.4Gravatar Dirk Hohndel
Trim back CHANGELOG Add entry for recent fix for multiple dive master in mobile. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-15Latest translationsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-15Update list of supported dive computersGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-15Update libdivecomputerGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-15Mobile: Allow multiple divemastersGravatar Jocke
While not something that many will use, editing a dive on Subsurface-mobile should not result in data loss. This makes the divemaster field behave in the same way as the buddy field with regards to multiple entries. Fixes #1853 Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-14MXE: respect an MXE build type already definedGravatar Dirk Hohndel
And use that to have our Travis build still work with the existing MXE build container as well as the even older, pre-compiled MXE binaries used in the windows build. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-14MXE: add missing Qt5PositioningQuick.dllGravatar Dirk Hohndel
Without this the map won't load. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-13MXE: switch to i686-w64-mingw32.shared.posix.dw2Gravatar Dirk Hohndel
This allows us to build QtWebKit again. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-13Android: pick the correct C++ runtimeGravatar Dirk Hohndel
Yet another fallout of the switch to the NDK toolchain. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-13Android: build for android-16Gravatar Dirk Hohndel
That's the minimum platform that we have used for a while now, corresponding to Android 4.1 and newer (i.e., quite ancient). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-13Android: find Qt cmake modulesGravatar Dirk Hohndel
With a recent change to the qt-android-cmake project we are now using the toolchain file bundled with the NDK, and that forces all cmake modules to be part of the NDK tree - which breaks the way we find our Qt installation. This is a hack to work around this as it undoes this setting, which I'm sure is well intentioned to prevent host system issues in this cross build scenario. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-13Android: explicitly build with gccGravatar Dirk Hohndel
Our Android build currently fails with clang. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-13Android: qt-android-cmake no longer ships a toolchain fileGravatar Dirk Hohndel
Instead use the one that comes as part of the NDK. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-12Latest translationsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-12Coding style: remove stray ';'Gravatar Berthold Stoeger
There was a stray semi-colon on the beginning of a line in DiveObjectHelper.cpp. Remove it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-12Cleanup: remove unsused flags in struct dive_tripGravatar Berthold Stoeger
Usage of the flags expanded, selected and fixup was removed some time ago. Remove the flags too. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-05Latest translationsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-05Dive list: let sort arrows reflect sort order for NR and DATEGravatar Berthold Stoeger
The old code always sorted by "ascending" by default. But because users typically want their new dives top, "ascending" was defined for NR and DATE, such that it is actually descending. Turn these around and intitialize these two fields as default-descending. This is possible using the Qt::InitialSortOrderRole role in DiveTripModel::headerData(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-05Dive list: remove sortColumn and currentOrder membersGravatar Berthold Stoeger
Since the QHeaderView of DiveListView is now the authority over sort-column and sort-order, it makes little sense to keep these as member variables. That would only risk inconsistencies. Remove them and query the QHeaderView instead. We still need to keep track of currentLayout, as we have to detect if it changes to change the underlying model from tree to list or vice-versa. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-05Dive list: split reload() in reload() and setSortOrder()Gravatar Berthold Stoeger
The DiveListView code had a very fundamental problem with its header: Each had its own idea of who is responsible for sorting. Since we can't easily change QHeaderView, accept QHeaderView as the authority on sort-column and order. To make this possible, split the reload() function in two distinct functions: - reload() reloads the model and sorts according to the current sort criterion. - setSortOrder() tells the header to display a certain sort criterion. If this is a new criterion, it will then emit a signal. In this signal, resort according to that criterion. Thus, the actual sorting code has to be moved from the headerClicked() to a new sortIndicatorChanged() slot. Morover, the sorting of the QHeaderView has to be used. Reported-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-05Documentation: update and merge french manualsGravatar Guillaume GARDET
Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
2018-11-04Dive list: use proper comparison when comparing dive to tripGravatar Berthold Stoeger
The DiveTripModels are sorted in *reverse* chronological order. Therefore, when comparing a dive against a trip, the dive has to be inserted if the dive has a *later* date. Change the comparison accordingly. Reported-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-04Undo: fix addition of multiple divesGravatar Berthold Stoeger
The generic addInBatches() function is used to add batches of contiguous sets of dives to the dive-list models. The loop searching for the end of the batch used the wrong index and would therefore not properly cut the batches. Fix this. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-02Dive list: invert default sort order for sort by date / numberGravatar Berthold Stoeger
Commit 6dc1d239f81f16133d5954bd2b21ffa0c2dcc755 introduced a well-defined sort order in the case of equal contents. It changed the code for sorting by date to simply use the order of the source model. BUT: The source-model was already sorted in descending order on date. Thus setting the default order on descening by date, the data was then presented as *ascending* by date. Change this back to descending by always using default-ascending in the filter model. Ultimately, the source model should simply reflect the ordering of the core-data (ascending on date), but such a change is too invasive shortly before release. Reported-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-01CHANGELOG.md: add entry about experimental BTLE supportGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-11-01user-manual: add notes about state of BTLE on WindowsGravatar Lubomir I. Ivanov
Add an "important" message that the support is experimental and that the latest version of Windows 10 and drivers is needed. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-11-01Core: use British translations in South AfricaGravatar Dirk Hohndel
For unrecognized locales we use en_US by default. It makes much more sense for South Africa to use en_GB. Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-01Update translationsGravatar Dirk Hohndel
Pull current translations from Transifex and add the new numerus cases to the en_US 'translation'. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>