aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2018-03-19Cleanup: Initialize variable MainTab::lastSelectedDiveGravatar Berthold Stoeger
This variable was read before being set. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-15CHANGELOG.md: add latest map-widget changesGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-15MapWidgetContextMenu.qml: improve the action textGravatar Lubomir I. Ivanov
The first 3 actions in the map widget context menu are about the current map widget center and not about the selected dive site / marker. Avoid using the word "location" for these, use "coordinates" for the second and third entry. Suggested-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-15MapWidget.qml: try to preserve zoom when opening Google MapsGravatar Lubomir I. Ivanov
Extend openLocationInGoogleMaps() so that the current map widget zoom level is roughly mapped to the Google Maps zoom level. The two zoom scales are quite different. Google Maps uses meters directly, while the QML map uses a scale from ~1 - 21. The approximation is done via exponential regression over a small data set gathered from experiment. Add a console.log() call so that the URL is logged. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-15MapWidget.qml: use a new URL format for Google MapsGravatar Lubomir I. Ivanov
Make the map widget use a new URL format for Google Maps in openLocationInGoogleMaps(). The new URL format does not show a marker once the location is open in Google Maps as this might confuse some users. Suggested-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-14Cleanup: consistently use toUtf8() instead of toLocal8Bit()Gravatar Berthold Stoeger
These do the same, since the text-codex is set to UTF-8 on startup. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-14Cleanup: introduce copy_qstring() functionGravatar Berthold Stoeger
strdup(qPrintable(s)) and copy_string(qPrintable(s)) were such common occurrences that they seem worthy of a short helper-function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-14Cleanup: consistently use qPrintable()Gravatar Berthold Stoeger
Replace constructs of the kind s.toUtf8().data(), s.toUtf8().constData(), s.toLocal8Bit().data(), s.toLocal8Bit.constData() or qUtf8Printable(s) by qPrintable(s). This is concise, consistent and - in principle - more performant than the .data() versions. Sadly, owing to a suboptimal implementation, qPrintable(s) currently is a pessimization compared to s.toUtf8().data(). A fix is scheduled for new Qt versions: https://codereview.qt-project.org/#/c/221331/ Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-14Cleanup: constify string arguments in core/dive.cGravatar Berthold Stoeger
Make arguments to set_informational_units(), set_git_prefs(), set_userid(), dive_remove_picture() and update_event_name() "const char *" for consistency with the rest of core/dive.c. This will allow replacing toUtf8().data() with the constData() version in a subsequent commit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-14Cleanup: Set text encoding to UTF-8 for all platforms.Gravatar Berthold Stoeger
This was only done explicitly for Windows. Other platforms were implicitly supposed to be UTF-8. Suggested-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-14Subsurface-mobile: Add OSTC 2 TR as support dive computerGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-14Update translation source stringsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-13Remove now obsolete scriptGravatar Dirk Hohndel
With the removal of the transport tags from our libdivecomputer branch, we can no longer automate the table creation that way. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-13Update libdivecomputer submoduleGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-13Subsurface update for upstream libdivecomputer changesGravatar Linus Torvalds
So because I merged with upstream libdivecomputer, and it no longer does the "halfduplex emulation" thing in the IO layer, and instead does it in the only Suunto backend that needed it, that also affected our custom IO layer in subsurface. Sure, I could have left a dummy interface and left subsurface with some ugly dead code, but it's really better to just get rid of the code. So when Dirk pulls in the libdivecomputer updates from https://github.com/torvalds/libdc-for-dirk.git Subsurface-branch this patch to remove the halfduplex code in subsurface is also needed. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-03-13Treat a PSCR dive with sensors more like a CCR diveGravatar Anton Lundin
PSCR dives with o2 sensors are more like CCR dives. The math is exactly the same, its just a different diluent and a different po2. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-03-13Fix up CCR/PSCR dives with sensors values without no_o2sensorsGravatar Anton Lundin
This introduces a fixup function that walks all the samples and populates the no_o2sensors if its zero and supposed to be something else. There is a bug somewhere which Willem hit, causing this to never be set. Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-03-13Use the current dive mode instead of constantGravatar Anton Lundin
In the if case above, we already conclude its a OC dive, but its cleaner to actually pass the current mode instead of a hard coded value. This also makes the code less prune to future bugs. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-03-12Mobile: pass QString as value to registerError()Gravatar Berthold Stoeger
registerError() may be called from a different thread context. Passing the message as a const-reference may lead to a dangling reference. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-11android/build.sh: build the googlemaps pluginGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11CHANGELOG.md: add note about the map widget changesGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11cmake: update CMake to build the map components on mobileGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11subsurface-mobile-helper: register map related typesGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11main.qml: handle mapPage in pageStack.onCurrentItemChanged()Gravatar Lubomir I. Ivanov
When the slot pageStack.onCurrentItemChanged() is reached make sure that the stackView becomes non-interactive. This prevents swiping left on the map to "go back". Also, always reload the map markers when the map becomes visible. This is not optimal and instead something in the lines of: DiveList.model.onChanged() is a much better solution. Ideally the map reload should happen on dive removal, dive addition, dive edits and sync from cloud. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11main.qml: add a drawer action for the mapGravatar Lubomir I. Ivanov
This action uses the Breeze icon "map-globe.svg" and calls showMap(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11main.qml: modify showMap() to not accept locationGravatar Lubomir I. Ivanov
showMap() uses a location to open Google Maps in a browser. Make showMap() a generic function to push the mapPage on the view stack. Update the calls to this function from child widgets and pages. Also either call mapPage.centerOnLocation() or mapPage.centerOnDiveSiteUUID() depending if the caller wants the map to center on a dive site or on map coordinates. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11main.qml: create an instance of MapPageGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11mobile-resources.qrc: add the map related resources for mobileGravatar Lubomir I. Ivanov
1) QML files 2) Map widget specific icons 3) The Breeze map-globe.svg icon Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11mappage.qml: add a Kirigami page for the map widgetGravatar Lubomir I. Ivanov
The Page object has the following functionality: - reloadMap(): reload all map markers. - centerOnDiveSiteUUID(): center the map on a dive site uuid. - centerOnLocation(): the map on a latitude, longitude in decimal. - Select a dive list entry based on a marker selected on the map via diveList.setCurrentDiveListIndex() Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11mapwidget.qml: emit a signal when the marker changedGravatar Lubomir I. Ivanov
The signal to emit is selectedDivesChanged() and it accepts a list if diveIds. The 'nSelectedDives' counter is redundant. Also expose the 'map' and 'mapHelper' objects as aliases. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11divelist.qml: add the setCurrentDiveListIndex() helperGravatar Lubomir I. Ivanov
Add the setCurrentDiveListIndex() wrapper for: diveListView.currentIndex = idx wich also makes it possible to disable the scroll animation when selecting dive list indexes which are too far apart. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11qmapwidgethelper: make adjustmets for the mobile versionGravatar Lubomir I. Ivanov
The mobile version is limited as it does not support dive list selection of multiple dives and editing multiple dives. Also the dive list on mobile does not follow the same indexing as the desktop version dive list. Use the SUBSURFACE_MOBILE macro and for: - centerOnDiveSite() either deselect map markers or center on a single one (never on a rectangle like the desktop version) - selectedLocationChanged() and selectVisibleLocations() return a list of single dive ID Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11qmapwidgethelper: add centerOnDiveSiteUUID()Gravatar Lubomir I. Ivanov
centerOnDiveSiteUUID() is a helper to center the map on a dive_site UUID instead of a dive_site pointer. Make it call centerOnDiveSite(). Make both this function and reloadMapLocations() Q_INVOKABLE as these are going to be called from QML. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11qmapwidgethelper: move includes to the headerGravatar Lubomir I. Ivanov
Add the following includes in the header - <QVariant> and <QGeoCoordinate> otherwise the mobile build fails. It is unclear how the desktop build does not complain about this. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11DiveObjectHelper: add dive_site_uuid()Gravatar Lubomir I. Ivanov
The map widget on the mobile version requires that a dive object from a model has a dive_site uuid. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-11scrips/mobilecomponents.sh: fetch icon for the mapGravatar Lubomir I. Ivanov
Use one of the breeze icons for the map in the drawer on the mobile version. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-03-07Release notes for numeric format, delete cylinders and change commentGravatar Stefan Fuchs
Add two release note items and change comment in CHANGELOG.md file. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-03-06Cosmetic modifications in profile delta sample stringGravatar Stefan Fuchs
Consistently do not use a space between value and unit. Consistently do not use a space between "name:" and value. Add "/min" for SAC rate. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-03-05Cleanup: Remove hash field from picture-structureGravatar Berthold Stoeger
The hash field in the picture-structure was in principle non-operational. It was set on loading, but never actually changed. The authoritative hash comes from the filename->hash map. Therefore, make this explicit by removing the hash field from the picture structure. Instead of filling the picture structure on loading, add the hash directly to the filename->hash map. This is done in the register_hash() function, which does not overwrite old entries. I.e. the local hash has priority over the save-file. This policy might be refined in the future. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-05Cleanup: pass QString and QByteArray const-refs to qthelper functionsGravatar Berthold Stoeger
Passing of QStrings and QByteArrays was inconsistent in qthelper.cpp. Unify to passing const-references. Passing by value is no big deal, since QString and QByteArray do copy-on-write "optimization". Nevertheless, let's keep it as consistent and effective as possible. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-05Cleanup: Fold add_hash() call into learnHash() functionGravatar Berthold Stoeger
learnHash() was always called in conjunction with add_hash(). The pattern was that a local filename and a hash were connected in the hash-to-filename and the filename-to-hash maps. Then, the original picture-filename or url were registered in the filename-to-hash map. This commit changes learnHash() to take three parameters (original-filename, local-filename and hash) and do all of the above. The new code is simpler because no dummy picture struct has to be generated in DiveListView::loadImageFromURL(). The tests were extended to check for all hash<->filename associations. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-05Cleanup: Don't store hash in picture struct in learnHash()Gravatar Berthold Stoeger
learnHash() is called either on a local picture structure [DiveListView::loadImageFromURL()] or on a cloned picture structure [ImageDownloader::saveImage()]. In neither case the picture structure is passed to the frontend. Therefore, storing the new hash in the picture struct is not necessary. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-05Cleanup: Don't call learnHash() in hashPicture()Gravatar Berthold Stoeger
hashPicture() calls hashFile(), which calls add_hash(). add_hash() updates the filename-to-hash and hash-to-filename maps. Therefore, there is no point in calling learnHash() in hashPicture(), which updates the filename-to-hash map. Note that learnHash() updates the picture-struct with the new hash, but since hashPicture() works on a cloned picture-struct, which is free()d in hashPicture(), these changes are lost anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-05Cleanup: remove updateHash() functionGravatar Berthold Stoeger
updateHash() and hashPicture() did the same thing, with the exception that hashPicture() marked the dive list as changed if a hash changed. This seems like a good idea in any case, therefore always use hashPicture(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-05Cleanup: Make helper function haveHash() of static linkageGravatar Berthold Stoeger
The function is only used in the qthelper.cpp translation unit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-05core/imagedownloader.cpp: Use signal to exit eventloopGravatar Berthold Stoeger
Don't do busy-waiting. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-05core/imagedownloader.cpp: Use implicit default constructor of QImageGravatar Berthold Stoeger
No point in move-constructing from a different default constructed QImage. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-05core/imagedownloader.cpp: remove recursionGravatar Berthold Stoeger
If loading from hash failed in the saveImage() slot(!) it would recurse into loadFromUrl(), which would generate a new network reply. Very scary and a (small) wonder that it worked. Let's try to make this all more explicit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-05core/imagedownloader.cpp: Make the manager object local to load()Gravatar Berthold Stoeger
The QNetworkAccessManager is only used in the load() function. No point in it being a subobject. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-05core/imagedownloader.cpp: Simplify deletion of objectsGravatar Berthold Stoeger
1) Destroying the QNetworkManager seems like a bug: this was a subobject of ImageDonwloader. It's mysterious how this didn't crash. 2) Instead of calling deleteLater() on the reply object, simply delete it after completion. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>