aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2018-05-17android-build: Remove old libgit2 special handlingGravatar Anton Lundin
And replace it with something that works on a modern cmake. The upside with using the right linker, we get the symbols resolved correctly so we don't need to regex the code. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-05-17android-build: Stop installing ant, we're using gradeGravatar Anton Lundin
Since about a year ago qt-android-cmake shifted to using gradle instead of ant, and the android sdk's stopped supporting ant to. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-05-17android-build: Simplify and correctGravatar Anton Lundin
This simplifies the code and uses correct quoting for variables. This also fixes the sha1-stampfile handling so that we don't build libdivecomputer every time. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-05-17android-build: Build googlemaps plugin same way as othersGravatar Anton Lundin
This reworks the googlemaps build to be more like the other builds, with the same pattern and way of detecting what we need to do, and when we need to rebuild it. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-05-17android-build: Use sed -i instead of home rolled variantGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-05-17android-build: Use subsurface source variableGravatar Anton Lundin
We already have a variable pointing to the source dir for subsurface, so use it. This way we can build out of tree, in any directory. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-05-17Bugfix: Saving divemode to xml and to gitGravatar Willem Ferguson
There is a space character missing in the xml generated by the present code. Insert a space character. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-17Update user manual for CCR and pSCR dive logsGravatar Willem Ferguson
Update the text pertaining to CCR and pSCR dive logs to include the changes with respect to: 1) Colour of CCR setpoint graph and pSCR OC-equivalen pO2 graph. 2) Display of bailout information on dive logs. 3) Preferences tab allowing setting pertaining to the above. This is the first of a few PRs with updates to the user manual relating to CCR and pSCR dives. Correct some typos. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-17iOS, update Info.plist.in noteGravatar jan Iversen
Info.plist is no longer generated by qmake but by build.sh, and it is more interesting to highlight the fact that it is open software Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-17mobile: fix wrong coords when saving new locationGravatar Murillo Bernardes
This one place it was not being multiplied by 1000000, as expected for degrees_t. Signed-off-by: Murillo Bernardes <mfbernardes@gmail.com>
2018-05-17Dive pictures: Don't plot pictures twice when changing current diveGravatar Berthold Stoeger
In MainWindow::current_dive_changed() first plotDive() is called, which replots all the pictures by calling plotPictures(). This is pointess, because it plots the pictures of the previous dive. Then, updateDiveInfo() is called, which resets the dive pictures and automatically replots them. Thus, switching between dives both with hundreds of pictures is way slower than necessary. Switching the plotDive() and updateDiveInfo() calls doesn't work. The reason is not 100% clear, but it doesn't make sense to plot pictures of the new dive as long as the profile still shows the old dive anyway. As a quick-fix, add a flag to plotDive(), which tells the function to clear the pictures list instead of redrawing it. Ultimately, plotDive() should probably be split in two functions. One for the callers who update the pictures themselves and one for the others. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-17Dive pictures: Fix crash on picture deleteGravatar Berthold Stoeger
The recent simplification of the close button code introduced a crash: Deletion of pictures caused an invalid memory access, because the CloseButtonItem was deleted with the parent DivePicture item. For some (not fully understood!) reason, a reference to this button was stored in the depths of Qt. Empirically, it was found out that removing the first line of the pair QGraphicsItem::mousePressEvent(event); emit clicked(); fixed the crash. It seemed therefore prudent to remove the whole questionable signal/slot mechanism and directly call the removePicture() function of the parent. Thus, the intermediate DiveButtonItem class became unnecessary and was removed, leading to a shallower class hierarchy. Unfortunately, CloseButtonItem must still be derived from QObject owing to the Q_PROPERTY machinery, which is in turn needed for animation. To make this compile on mobile, the conditional compilation of removePicture() (#ifndef SUBSURFACE_MOBILE) was removed. After all, if DivePixmapItem is used, there are pictures, so removePicture() should be functional. Conditional compilation should concern the whole class, not only this function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-16Dive pictures: don't attempt reading the same image twiceGravatar Berthold Stoeger
If loading of an image failed, we tried to see if we find a canonical filename in the cache. There's no point in rereading the picture if the canonical and the original filename are the same. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-16Dive pictures: Don't enter infinity loop on invalid picturesGravatar Berthold Stoeger
The recently committed refactoring of the dive-picture code introduced a severe bug: If an image couldn't be loaded from disk owing to an invalid file, the filename was interpreted as an url and loaded in the background. This succeeded, because the file actually exists. After download, the file would then still be invalid and the whole thing restarted, leading to an infinity loop. To fix this, do two things: 1) Don't even try to download local files. 2) If interpreting a downloaded file fails, don't try the downloading business again. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-14Mention bailout in ChangelogGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-14Planner: Add combo box for dive mode selectionGravatar Robert C. Helling
I am not really sure what I am doing here but I copied code from the gas selection. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-14Rename enum dive_comp_type to divemode_tGravatar Robert C. Helling
...as the usuage is not anymore about a computer but a momentary dive mode. Rename the end indicator as well. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-14Planner: Make use divemode for consumed gas calculationGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-14Planner: Honor last manual divemodeGravatar Robert C. Helling
Start the decompression schedule in the divemode of the last manual section. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-14Fix divemode detection in plannerGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-14Fix a bug where the bailout events are not saved correctly.Gravatar Willem Ferguson
The bailout events in the planner are not saved correctly. My oversight. This commits corrects the bug Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-14Adapt the dive planner to do bailoutGravatar Willem Ferguson
Ensure that calls to add_segment() all have a appropriate divemode for that part of the dive plan. In the case of plan(), the existing variable 'divemode' was directly passed to add_segment. For the functions interpolate_transition() and trial_ascent(), the divemode was obtained by including it in the parameter list of the function and divemode supplied by the calling function. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-14Add planner infra structure for bailoutGravatar Robert C. Helling
Add a divemode column to the planner model and a corresponding field to struct divepoint and fill it in the corresponding functions. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-14Place divemode changes in submenu of context menuGravatar Robert C. Helling
Also unify the repeated code in slots. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-05-14Fix bug for CCR dive bailoutGravatar Willem Ferguson
Under some conditions get_current_divemode() (in dive.c) returns an erroneous divemode. This happens when there are several events at the very beginning of the dive, as can happen in some CCR dive logs. This commit fixes that bug. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-14Show divemode swith options only for rebreather divesGravatar Willem Ferguson
The dive profile context menu gets rather long with three additional divome switches that can be selected. This is now changed so that the additional options are only shown when in CCR or in PSCR divemode. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-14Create divemode switches using profile context menuGravatar Willem Ferguson
Allow the manual creation of divemode switch events using the profile context menu. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-14Implement get_divemode() to find the divemode at a particular timeGravatar Willem Ferguson
Replaced a rather cumbersome function that that did the above. Upon the suggestion of Robert Helling who proposed a much shorter way, this new function replaced the previous ones. This necessitated changes to divelist.c, profile.c and plannernotes.c, as well as dive.c/h. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-14Implement get_divemode() to find the divemode at a particular timeGravatar Willem Ferguson
Replaced a rather cumbersome function that that did the above. Upon the suggestion of Robert Helling who proposed a much shorter way, this new function replaced the previous ones. This necessitated changes to divelist.c, profile.c and plannernotes.c, as well as dive.c/h. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-14Read and write divemode changes (xml and git)Gravatar Willem Ferguson
This provides for reading of divemode change events from dive logs and for writing them to dive logs. This applies to xml and git divelogs. Divemode change events have the following structure: event->name = "modechange" event->value = integer corresponding to enum dive_comp_type (dive.c), reflecting the type of divemode change (OC, CCR, PSCR, etc). In the dive log file, the event value is written as a string that corresponds to each of the enum values, e.g. <event name='modechange' divemode='OC' /> This xml is also read from the dive log file and translated to an appropriate value of event->value. The file diveeventitem.cpp was udated to reflect this new way of dealing with divemode change events. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-14Provide icons for bailout events on the dive profile.Gravatar Willem Ferguson
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-14Simplify the bailout detection functions.Gravatar Willem Ferguson
Function peek_next_divemodechange() is redundant if get_next_divemodechange() has one additional parameter. Calls to get_next_divemodechange() were updated in divelist.c, plannernotes.c and profile.c. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-14Simplify bailout events in the dive logGravatar Willem Ferguson
I removed the special event type that has been used for bailout events. Bailout events are now just bookmarks with a specific name "e.g. OC, CCR, PSCR). This removes a case where a segmentation error occurred when trying to remove a bailout event from the dive profile. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-14Implement bailout outside of the dive plannerGravatar Willem Ferguson
This is the second step for implementing bailout. The indirect calls to fill_pressures through add_segment() (in deco.c) are addressed. Bailout is now fully implemented in the dive log but not in the dive planner. 1) The parameters to add_segment() are changed to take a divemode as the second last parameter, and not a *dive. 2) Call to add_segment() in profile.c and in divelist.c are adapted. In divelist.c some calls to add_segment were left using dc-> divemode instead of possible bailout. This appears tp be the most appropriate route. 3) The functions get_divemode_from_time() and get_next_divemodechange() in dive.c have had some small changes. 4) The calls to get_segment(0 in planner.c were changed to reflect the new parameter list, but not updated to reflect bailout. This is the next step. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-14Incorporate bailout events in CCR & PSCR gas calculations.Gravatar Willem Ferguson
This is a first step to interpret bailout events. 1) The event structures have a new attribute: divemode. Currently interpreted dive modes are OC, CCR, PSCR. 2) When doing fill_pressures(), the calculation is aware of divemode. When divemode is OC (==bailout), then the appropriate calculations of gas pressures are done. 3) Two new functions get_next_divemodechange() and get_divemode_at_time() are created to find divemode changes in the events linked list and to determine the dive mode at any point during the dive. 4) fill_pressures gets a small amendment to facilitate the correct calculations, depending on divemode. The cases where fill_pressures() is used *outside the planner* are changed. The result is that, for dives with bailout, the correct gas pressures are shown on the dive profile. The deco for bailout dives is not yet correct. This is the next step. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-05-14Cloud-storage: consistently don't save empty file on desktop versionGravatar Berthold Stoeger
Make the behavior consistent: Don't save an empty file to the cloud, neither on selection of "Save to cloud" nor on "Save". The latter was not the case. It was a bit hard to trigger: Open cloud, delete all dives, save. Fixes #1228 Reported-by: Jan Iversen <jani@apache.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-14Core: don't inline rarely used functionGravatar Dirk Hohndel
This is only used by one caller and there doesn't appear to be a reason to inline it in the first place. Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-14Android: build fixGravatar Dirk Hohndel
On other OSs this compiles fine without adding this header, but Android is special... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-14Core: remove dive.h from files that don't need itGravatar Dirk Hohndel
Of course, quite a few of them indirectly get it through other header files. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-14Small whitespace cleanupGravatar Dirk Hohndel
Stumbled across this when Qt Creator re-saved the file. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-14Core: introduce new subsurface-string headerGravatar Dirk Hohndel
First small step to shrinking dive.h. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-13Dive pictures: Don't update all pictures on drag & drop to profileGravatar Berthold Stoeger
In the old code, we used to reload the whole picture list on drag & drop to the profile. Instead, only update the drag&dropped picture and repaint the profile-pictures. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13Dive pictures: refactor image downloaderGravatar Berthold Stoeger
Instead of generating one ImageDownloader object per image to be downloaded and running every image download in a separate worker thread, use one global ImageDownloader object owned by the UI thread. The images are downloaded using event based IO (as probably was the intention of the QNetworkManager class). User-visible change: after download from the internet, the thumbnail is shown without having to change dives. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13Dive pictures: Import camera iconGravatar Berthold Stoeger
Import a camera icon from the KDE breeze theme, which is licensed under the LGPL. Use this icon to display not-yet-loaded images in the photos tab and the profile. Source: https://github.com/KDE/breeze-icons Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13Dive pictures: Move thumbnail-size to Thumbnailer classGravatar Berthold Stoeger
The size of the to-be-created thumbnails was passed from DivePictureModel to Thumbnailer. This became more and more bothersome, because the size had to be stored with the request. Calling from Thumbnailer into DivePictureModel was not an option, since this is not linked to all tests. Therefore, move these functions to the Thumbnailer class. Since the maximum thumbnail size is now known to the thumbnailer, the dummy and failure images can be precalculated, which makes switching between dives faster. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13Dive pictures: Update pictures when thumbnails are readyGravatar Berthold Stoeger
Connect the thumbnailer signal to the dive picture model slot. This needs some code-reshuffling in the dive picture model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13Dive pictures: Introduce thumbnailer classGravatar Berthold Stoeger
Create a new class, which performs all thumbnailing code. This is mostly code reshuffling. Thumbnails are extracted either from a cache or thumbnail calculation is started in a worker thread. Since getHashedImage() is called from a worker thread it makes no sense to call subfunctions in yet another worker thread. Remove these calls. In contrast to the previous code, on error the background thread produces a failure image, but it is not yet shown. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13Dive pictures: replace picture struct by QStringGravatar Berthold Stoeger
In imagedownloader.cpp the only thing we need from the picture struct is the filename. Therefore, use QStrings instead of the picture struct. This simplifies memory management. Remove the clone_picture() function, which is not needed anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13Dive pictures: turn SHashedImage class into getHashedImage() functionGravatar Berthold Stoeger
SHashedImage was a subclass of QImage, which fetched the image according to the filename hashes. Turn this into a function, as this is much more idiomatic and flexible. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13Dive pictures: remove close-button optimizationGravatar Berthold Stoeger
One close-button object was used for all dive pictures. This seems like a brittle premature optimization and the pixmap is shared anyway. Make the button a subobject of the dive picture object. Change the object-hierarchy to be based on QGraphicsItem instead of QObject. The QObject here is only used as a kludge to support signals and properties (the latter are necessary for animations). Remove a comment, which does not seem to be relevant after this change. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>