summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-11-09Profile: switch pressure-accessing functions to indexesGravatar Berthold Stoeger
Continue with replacing pointers to struct plot_data entries by indexes. Thus the pressure data can be kept in its own array and can by dynamically sized. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-09Cleanup: comment out function that is used by commented out codeGravatar Berthold Stoeger
The ProfileWidget2::getEntryFromPos() function was only used by code that was commented out. Thus comment it out as well. Moreover, turn the accompanying FIXME comments into TODO comments to avoid a new LGTML alert. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-09Profile: change get_plot_pressure to take index instead of pointerGravatar Berthold Stoeger
The goal here is to make it possible to detach the pressure related data from the plot_info structure. Thus, the pressure related data can be allocated independently depending on the number of cylinders per dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-09Profile: Change RulerItem2 to use index instead of pointerGravatar Berthold Stoeger
To make the pressure data dynamic (size of the arrays depending on the cylinders in the dive), it has to be separated from the standard plot_data structure. To enable this, use indexes instead of pointers to plot_data elements. This commit converts the RulerItem2 to use an index. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-09Cleanup: implement proper Qt-model semantics in DivePlotData modelGravatar Berthold Stoeger
User beginResetModel()/endResetModel() pairs to reset the model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-09Undo: Make PasteState cylinders list dynamically allocatedGravatar Berthold Stoeger
Instead of using a sub-array, use a std::vector<>. This is a necessary step in removing the MAX_CYLINDERS restriction. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-09Cylinders: dynamically allocate cylinder arraysGravatar Berthold Stoeger
Dynamically allocate cylinder arrays in C code. This is a tiny step in removing the MAX_CYLINDERS limitation. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-09Cylinders: dynamically allocate cylinder arraysGravatar Berthold Stoeger
When keeping track of cylinder related data, the code was using static arrays of MAX_CYLINDERS length. If we want to use dynamically sized cylinder arrays, these have to be dynamically allocated. In C++ code, this is trivial: simply replace the C-style arrays by std::vector<>. Don't use QVector, as no reference counting or COW semantics are needed here. These are purely local and unshared arrays. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-09Core: dynamically allocate the result of get_gas_used()Gravatar Berthold Stoeger
get_gas_used() returns the volume of used gases. Currently, an array with MAX_CYLINDERS is passed in. If we want to make the number of cylinders dynamic, the function must use an arbitrarilly sized array. Therefore, return a dynamically allocated array and free it in the caller. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-08scripts: update get-deps to allow clean buildGravatar jan Iversen
libssh2 depends on openssl, therefore it is important that openssl is build before libssh2. The old get-deps would cause errors in 2 situations: 1) In a clean build, make of libssh2 would fail 2) In a normal build, where openssl changed version, make of libssh2 would depend on old build. Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-11-08Mobile: correctly update filter text and update all three modelsGravatar Dirk Hohndel
This is even harder because setActiveTrip is called from an action slot from QML. If the C++ code called from that slot causes the object to which this slot belongs to be destroyed, we get very strange crashes. The only workaround I could come up with was to update the filter asynchronously. This all seems very ugly and fragile. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: modify filter so that all models get notifiedGravatar Dirk Hohndel
When we change the filter string, we need to make sure that the collapsed model is also aware of the change. Similarly, instead of just calling resetFilter and directly changing the core data structures, we need to set the filter to the empty string which ensures that all three models get notified and the view updates correctly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: reconnect the correct model after changing filterGravatar Dirk Hohndel
This caused a blank, unusable dive list. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: consistently refer to the dive list modelGravatar Dirk Hohndel
The number of different ways we tried to refer to the model made my head spin. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: ensure there's some space between date and depth/durationGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: ensure the sort order is always setGravatar Dirk Hohndel
This shouldn't be necessary every time we replace the sort model, but it can't hurt, either (famous last words?). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: use the CollapsedDiveListSortModel for dive listGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: setup CollapsedDiveListSortModelGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: add second filter proxy model for dive listGravatar Dirk Hohndel
This one significantly reduces the number of dives that are handed to the ListView in QML. For every trip that isn't expanded (only zero or one trips are expanded at any time, so almost all the others are collapsed), send only first dive to the View to allow creation of the section. Hide the rest so we don't have all these invisible, zero height entries for the vertical dive list. A big part of this commit is moving a few functions from the DiveListSortModel to the CollapsedDiveListSortModel. Those are the ones that are needed for the trip header. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: derive the index from the dive idGravatar Dirk Hohndel
The previous code assumes that both the vertical dive list and the list of dive details which allows the horizontal swiping from dive to dive are based on the same model. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08core: reorder dive structure elements to avoid paddingGravatar Dirk Hohndel
Memory is cheap these days. Still, this was wasteful. On a 64 bit machine we went from 1620 to 1592 bytes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08core: add collapsed state to the dive data structureGravatar Dirk Hohndel
This is only used in Subsurface-mobile. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: give visual indication that we are saving divesGravatar Dirk Hohndel
Allow showing that the app is busy and showing why at the same time. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: allow message argument to showBusy functionGravatar Dirk Hohndel
When called without arguments, no message is shown. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: add UI feature tests to Developer menuGravatar Dirk Hohndel
Running Subsurface-mobile on iOS, the notification texts are sometimes very hard to read, and in some situations the busy indicator isn't showing up at all. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08iOS: fix handling of version option to build.shGravatar Dirk Hohndel
This makes it much more consistent and avoids a silly warning. Also some small README updates. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: let the user know if we can't save changesGravatar Dirk Hohndel
While the error that caused this to happen should be fixed, we should at least let the user know if things failed catastrophically and we can't figure out how to save their data. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: remember if we were able to open the local cacheGravatar Dirk Hohndel
If there is a local cache, we at least once successfully accessed the cloud, so this is a valid cloud based git tree. Without this change we run into a subtle bug: after a fresh install, or when switching users, when the cloud data is accessed the very first time, we don't remember that this was indeed loaded from the cloud. So if we then download from a dive computer or make any other changes to the dive log, we cannot save those dives to cloud storage - but we fail silently doing so. Which to the user would look that inexplicable data loss. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: remove useless attempt to prevent access to the cloudGravatar Dirk Hohndel
This code really made no sense, adding a comment to try to explain that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Mobile: drop extra argument to QStringGravatar Dirk Hohndel
Clearly a cut and paste error. Only creates a harmless warning, still... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08iOS: update Info.plist with better text and missing description keyGravatar Dirk Hohndel
The NOTICE and copyright are freeform. The new description key is required for iOS 13, but of course the redundant old key is still required for older builds... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08iOS: build the debug version of Google maps library if neededGravatar Dirk Hohndel
When trying to debug on device Xcode really wants a debug build (which is nearly unusably slow, but that's a different issue). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08iOS: explicitly disable open source SSL implementationsGravatar Dirk Hohndel
Those aren't allowed on iOS and adding these two flags removes some confusing warnings that look like errors in the build log. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08iOS: small change to storeIconGravatar Dirk Hohndel
This was updated by Xcode - just checking it in so that running Xcode doesn't cause dirty source tree. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08Profile: remove ProfileWidget2::recalcCeiling()Gravatar Berthold Stoeger
The ProfileWidget2::recalcCeiling() function is used in one place, namely when an undo-command changes the mode. It recalculates decompression data and repaints the ceilings and thus avoids a full profile-redraw. This is smart, but it becomes problematic when the dive is changed and the ceiling is recalculated before the profile is redrawn. The DivePlotDataModel then still has data from the previous dive but cylinders of the new dive are accessed. This kind of situation may arise if multiple dive fields are updated, as for example when replanning a dive. Currently, this only causes a temporary mis-calculation. When removing MAX_CYLINDERS this will lead to crashes. One might attempt to fix the whole data-dependency mess. This commit goes the cheap route and simply redraws the profile when the mode is changed. Yes, it is in a way ineffective, but we do worse things. The ProfileWidget2::recalcCeiling() thus becomes unused and is removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-03Planner: Don't accumulate rounding errors in stop durationsGravatar Robert C. Helling
When displaying segment or stop times in the planner notes, we always round to the next full minute. This can mean for example that we round down more often than rounding up with the result that the sum of the segment times does not match the total runtime and can for example lead to stops that are shown with 0min duration. With this patch, we increase the reference time of the last display only by the duration time actually shown. This way, the rounding errors don't accumulate but having rounded down previously makes rounding up the next time more propable. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-11-03Mobile: don't dereference the dive list model when it's disconnectedGravatar Dirk Hohndel
This avoids a bunch of annoying warnings. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-03Mobile: disconnect model while updating dive listGravatar Dirk Hohndel
If the dive list is connected to the model while the model is updated with the downloaded dives, sometimes the UI hangs completely. Disconnecting the model and then reconnecting it does add a fairly noticeable delay on longer dive lists, so there are tradeoffs here. Of course the obvious solution is to make reconnecting the model faster... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-03Mobile: use appendTextToLog to get timestamps in logsGravatar Dirk Hohndel
This helps tremendously when tracking down some problems. We should never use console.log. In the process this also updates a couple of the messages to be clearer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-31Planner: Add option to treat O2 as narcoticGravatar Robert C. Helling
When computing the best mix for a target depth, for helium, one can either require that the partial pressure of N2 is the same as at the target depth or the partial pressure of N2 plus O2. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-10-28Mobile: add circle around the side actionsGravatar Dirk Hohndel
That seems slightly more visually pleasing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-28Mobile: make the action button widerGravatar Dirk Hohndel
This makes it hard to fat finger the side buttons. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-28Cleanup: avoid dereferencing NULLGravatar Dirk Hohndel
We should call this function with two well defined dive_or_trip structures which means that exactly one of the two values is set in each argument. But in order to not have bugs elsewhere leed to crashes here, be more tolerant of malformed argumnts. Fixes CID 350100 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-28Cleanup: better handling of NULL dive in setCurrentDiveSiteGravatar Dirk Hohndel
We test for d being NULL so that's clearly an option we worried about, yet we already called get_dive_site_for_dive(d) which dereferences d. Found by Coverity. Fixes CID 350118 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-28Cleanup: prevent NULL dereferenceGravatar Dirk Hohndel
This should never happen based on the logic in the callers, but just to be on the safe side. Should fix CID 350128 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-28Cleanup: use helper to avoid NULL dereferenceGravatar Dirk Hohndel
We have these helper functions for exactly this purpose. Found by Coverity. Fixes CID 350129 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-28Desktop: fix dive site editingGravatar Berthold Stoeger
When clicking "done" on the dive site edit screen, the diveSite member variable was reset to nullptr in acceptChanges() at the beginning of the function. This prevented posting an undo-command as a consequence of the active widget losing focus. Reset the diveSite variable after exiting dive-site mode, which causes the active widget to lose focus. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-27Don't expose 'detach_buffer()' to membuffer usersGravatar Linus Torvalds
The native buffer of a membuffer is not NUL-terminated, so when you want to detach it and use it as a C string, you had to first do 'mb_cstring()' that adds the proper termination/ This was all documented in the header files, and all but two users did it correctly. But there were those two users, and the exported interface was unnecessarily hard to use. We do want the "just detach the raw buffer" internally in the membuffer code, but let's not make the exported interface be that hard to use. So this switches the exported interface to be 'detach_cstring()', which does that 'mb_cstring()' for you, and avoids the possibility that you'd use a non-terminated memory buffer as a C string. The old 'detach_buffer()' is now purely the internal membuffer implementation, and not used by others. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-10-27Mobile: make the GPS service icon work againGravatar Dirk Hohndel
I don't recall when this stopped working. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-27Cleanup: turn TankItem member variable into a constantGravatar Berthold Stoeger
TankItem had a "height" member variable that was never modified. Turn it into a constant, which is local to the translation unit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>