summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-05-20Core: let count_divecomputers() operate on an arbitrary diveGravatar Berthold Stoeger
Currently, count_divecomputers only works on the current_dive. Instead, let it take a pointer to an arbitrary dive. This is in preparation for being smarter in the undo code concerning which dive computer to show on deletion. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-20Cleanup: rename clone_dive() to move_dive()Gravatar Berthold Stoeger
This function clones a dive and clear out the old dive. This corresponds to move semantics. Name the function accordingly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-20Cleanup: fix a few comments and debug messagesGravatar Berthold Stoeger
This is just minor fixes that are not user-visible: Fix a few erroneous comments and a debug message. These are copy & paste mistakes and mistakes introduced during code- refactoring. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-20Undo: make "delete dive computer" undoableGravatar Berthold Stoeger
Simply reuse the code for "move dive computer" by creating a DiveComputerBase base class. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-20Undo: make "move dive computer to front" undoableGravatar Berthold Stoeger
Instead of the elegant solution that just modifies the dive, keep two copies and add either the old or the new copy. This is primitive, but it trivially keeps the dives in the right order. The order might change on renumbering the dive computers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-19Travis: move storage to a cheaper serviceGravatar Dirk Hohndel
It's surprising how much money this ended up costing... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-19Travis: build Mac against macOS 10.12Gravatar Dirk Hohndel
This way the Subsurface.app.zip should run on all versions of macOS that Qt supports. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-19Travis: build macOS test against Qt 5.12.3Gravatar Dirk Hohndel
The .app.zip should once again run on any Mac (ignoring the security issue of unsigned binaries). The Qt binaries in that archive include the jpeg and png libraries that were missing in the Qt 5.11.1 binaries we used until now. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-19[user-manual_es] Update spanish translation to 563137fcdGravatar Salvador Cuñat
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2019-05-18Travis: remove old Windows buildGravatar Dirk Hohndel
The container build should now handle all we need. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-18windows-container: remove useless tarball downloadGravatar Salvador Cuñat
0.9 docker image includes static libraries to build mdbtools so there is no need for an aditional tarball. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-18docker-mxe: Fix tee command line for static buildGravatar Salvador Cuñat
Add -a parameter to tee to avoid overwriting build.log when building static libraries for smtk2ssrf Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-18docker-mxe: Make Dockerfile reusableGravatar Salvador Cuñat
Passing an argument on the docker build command line avoids the need to modify the Dockerfile for each image build. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-18Build static glib under mxeGravatar Salvador Cuñat
mdbtools only builds static under mxe. This should add static build of glib to the container with the mxe libraries. [Dirk Hohndel: merged with latest version of Dockerfile] Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-18Travis: use version 0.9 of the MXE build containerGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-18MXE Docker build: clean up DockerfileGravatar Dirk Hohndel
Instead of trying to do it all in one step rely on --squash to do its job. Don't try to be so aggressive in removing things, it saves very little space and caused builds to fail. This results in version 0.9 of the MXE build container Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-17Undo: properly reference-count dive sitesGravatar Berthold Stoeger
Recently, the undo code was changed to consider dive sites. The undo code uses a DiveToAdd structure, which was extended by the dive site to which the dive should be added. The split and merge commands were not adapted and therefore the dive counts of the dive sites were wrong after split and merge. Fix this by properly setting the dive site field and removing the reference in the dive structure (in the split case, the merge case already cleared the reference). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-17Core: consider dive computers when sorting divesGravatar Berthold Stoeger
When splitting out dive computers, the dives were sorted in an arbitrary way (according to an internal id), since all data are identical. Therefore, consider the dive-computer model names when sorting dives. Equal dives are now sorted alphabetically by model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-17Undo: sort list of dives to add and deleteGravatar Berthold Stoeger
In 5729f93e1f512aa9e68b0e01743152aaee2b7c12, the dive addition / deletion code was simplified in that indexes were calculated on the fly. This made it, in principle, possible to pass in dives in any order. But there was a small oversight: the recipients of the dives-added and dives-deleted signals expect the dives to be sorted as in the core list. Only then will the lists be consistent. Therefore, sort the lists before adding / deleting dives. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-17Implement height-to-pressure functions in plannerGravatar willemferguson
The units.h file has two functions to convert atm pressure to mbar and also to convert mbar to atm pressure. Implement these two functions in the planner. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2019-05-17Add support for the new Suunto D5Gravatar Linus Torvalds
This is just a trivial update to recognize the BT name, and a libdivecomputer submodule update to get the updates to libdivecomputer to recognize the new USB IDs etc. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-05-15Cleanup: small coding style fixesGravatar Dirk Hohndel
And addressing a cut and paste error in a comment. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-15Convert the atmospheric pressure in the Information Tab to an editable fieldGravatar willemferguson
The Information tab shows the atmospheric pressure. Make this value editable and also ensure that changes to it are undo-able. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2019-05-12Mainwindow: simplify application-state codeGravatar Berthold Stoeger
The way the application state would enable/disable widgets was very "dynamic". A property-list would be generated and put in a set of arrays. Very hard to figure out what is going on. Replace these property-list by flags and explicit old-fashioned boolean expressions. Join the two arrays (widget- and property-lists) into an array of a unified data structure. Replace the macro that sets the widgets by a simple static function. Factor out the four loops that added widgets to the quadrants into a simple static function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-12Turn application state into enumGravatar Berthold Stoeger
The application state was encoded in a QByteArray. Thus, there was no compile-time checking. Typos would lead to silent failures. Turn the application state into an enum. Use the enum-class construct, so that the values don't polute the global namespace. Moreover, this makes them strongly typed, i.e. they don't auto-convert to integers. A disadvantage is that the enums now have to be cast to int explicitly when used to index an array. Replace two hash-maps in MainWindow to arrays of fixed sizes. Move the application-state details into their own files. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-12Core: consider dive-number on sortingGravatar Berthold Stoeger
A user reports a problem when dives have the same time but different numbers. The dives appear sorted randomly (effectively they are sorted by an internal unique-id). Try to sort by number for dives at the same date in this case. Fixes #2086 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-12Cleanup: remove UTF8 macrosGravatar Berthold Stoeger
At some places we use UTF8 string literals. Therefore, we effectively only support UTF8 build systems. We might just as well remove all the other UTF_* macros and use direct string literals. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Dive site: Add button to display all dive sitesGravatar Berthold Stoeger
On the main dive tab, add a button that opens the dive-site selection widget showing all dive sites. This is done by setting the "temporary dive site name" to the empty string. Thus no dive sites are filtered and the "add new dive site" entries are not shown. Moreover, the text is selected. The user can therefore immediately start typing to activate the filter or enter the name of a new dive site. The idea is that after downloading dives with GPS information the user can select one of the close dive sites. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Cleanup: simplify DiveLocationLineEdit::showPopup()Gravatar Berthold Stoeger
DiveLocationLineEdit::showPopup() called the functions - fixPopupPosition() - proxy->invalidate() - proxy->sort(LocationInformationModel::NAME) - view->show() All these calls are redundant, as they are already performed by setTemporaryDiveSiteName(). Remove them. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Dive site: show distance to current dive using extra dataGravatar Berthold Stoeger
Currently, in the dive-site selection widget the distance to the dive site of the current dive is shown. Instead, use the recently introduced dive_get_gps_location() function. Thus, the actual GPS coordinates extracted by libdivecomputer are used. The function is only called when the current dive changes and the location is stored in the item delegate. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Dive site: sort by distance to current diveGravatar Berthold Stoeger
When presenting the list of dive sites on the dive-info tab, sort the dive sites by distance to the current dive. The idea is that when the user wants to select a dive site, close dive sites should be prioritized. The location of the dive is determined with the dive_get_gps_location() function introduced in the previous commit. This actual GPS data get precedence over the currently set dive site for that dive. On change of dive, the current location is updated in the DiveLocationFilterProxyModel so that a potentially expensive search for GPS data is not repeated for every comparison. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Dive site: create new dive site at location from GPS dataGravatar Berthold Stoeger
Some dive computers save GPS data. Currently, this is stored by libdivecomputer in an "extra field". When generating a new dive site for a dive try to use this data to place the dive site. To do so, create a "dive_get_gps_location()" function. This function can be extended later to use e.g. event. When creating a dive site, use the result of this function over a potential pre-existing dive site. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Cleanup: remove for_each_gps_location macroGravatar Berthold Stoeger
This macro had no users. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Cleanup: move parse_location() declaration into header fileGravatar Berthold Stoeger
The parse_location() function was used in three places. In two of them, the declaration was in the translation unit. Instead, move the declaration into a header file, to avoid duplication and the possibility of inconsistencies. The "units.h" header was chosen as this is where location_t is defined. Moreover, make the string argument to parse_location() "const char *", so that it can be used on non-owned buffers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Cleanup: construct MapWidgetHelper::pluginObject()Gravatar Berthold Stoeger
Instead of multiple string-concatenations, create the string object from a single string literal. Yes, this is a mostly pointless "optimization". But it saves a few bytes. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: automatically update names on the mapGravatar Berthold Stoeger
Currently, dive site names are only updated on full reload. Instead hook directly into the corresponding signal in the MapLocationModel to set the name. Also to the coordinates directly there instead of going via the MapWidgetHelper. In the MapWidgetHelper, just center on the changed dive site. Hook into the signal directly there and remove the slot from the MapWidget. This makes the whole call-chain at least one call shorter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: ignore dive sites without location in centerOnSelectedDiveSite()Gravatar Berthold Stoeger
Don't zoom onto (0,0) for selected dive sites that have no location. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: in edit mode place no-gps dive sites at center of mapGravatar Berthold Stoeger
Move the code to add the first selected dive site from MapWidgetHelper::enterEditMode() to MapLocationModel::reload(). Thus, the list of sites is built only at one place. For this it is necessary to pass a pointer to the map, so that new dive sites can be added at the center of the map. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: construct list of dive sites from dive site tableGravatar Berthold Stoeger
Instead of looping over the dive table and extract dive sites, loop over the dive site table. This makes it possible to show dive sites that have no dive associated with them. But we have to create to functions that check whether a dive site has any shown dives or has any selected dives. Moreover, change the code to add near dive sites of the same name if in edit mode. Other wise (erroneously added?) dive sites with the same name cannot be moved on the map. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Filter: prevent selection-change notifications in filter invalidationGravatar Berthold Stoeger
Invalidating the filter can cause numerous selection-change notifications. These cause a full UI reload. Therefore, go into "command" mode that was implemented for the undo commands. Then, all selection-changes are considered as "programmatical" and ignored. At the end of filter invalidation, a filter-finished signal causes a proper reload anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: remove skipReload logic in mapwidget.cppGravatar Berthold Stoeger
There used to be a flag to avoid reloading of the map. Since this is not used anymore, remove it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: don't recalculate selected dive sitesGravatar Berthold Stoeger
In MapWidgetHelper::centerOnSelectedDiveSite() the selected dive sites were recalculated. Simply use the ones we already know are selected. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Filter: don't reload when dive sites are set to the same valueGravatar Berthold Stoeger
When switching between the dive-site-table to the dive-site-edit tabs, the filter would be set to a dive site. Usually, this would be the same dive site as before. Nevertheless, this caused a full map-reload. Detect if the dive-sites to be filtered are the same and turn this operation into a no-op. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Filter: add reference counting for dive-site modeGravatar Berthold Stoeger
The dive-site-edit and dive-site-table tabs both put the filter into a special dive-site mode. When switching between both, it could happen that the one got its show befor the other got its hide event. Thus, the first would start dive-site filtering and the second stop it. Now the app was not in filter mode even though it should. To solve this problem, add reference counting for the filter's dive-site mode. In both tabs call the enter/exit functions on show/hide. In the dive-site-table tab, when the selection changes, use a set function that doesn't modify the reference count. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: in dive-site-edit mode, select those maps we filter forGravatar Berthold Stoeger
When dive sites are edited, we shouldn't highlight the sites of the current dive, but the currently edited site(s). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: make edit mode depend on dive-site-filteringGravatar Berthold Stoeger
Since the dive-site-filter is active either on the dive-site-edit page or the dive-site-list page, use that as the flag for dive-site-edit mode. Moreover, when the filter is reset, the MapWidgetHelper::reloadMapLocations() function is called, so we can use that place to enter/exit edit mode. This makes it easier to keep everything consistent. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: remove dead codeGravatar Berthold Stoeger
When entering map-edit mode and the dive site existed, its coordinates were extracted but never used. Remove that useless if-branch. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Selection: automatically unselect old selection in selectDives()Gravatar Berthold Stoeger
DiveListView::selectDives() would only select new dives but not clear the old selection. Thus, callers would have to clear the selection first. That would lead to two selection-changed signals. Move the unselectDives() call into DiveListView::selectDives(). The DiveListView has an internal flag to prevent double signals. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: remove MapWidget::centerOnSelectedDiveSiteGravatar Berthold Stoeger
This was only used locally and only a stub for calling MapWidgetHelper::centerOnSelectedDiveSite. Call the latter directly instead. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: reload on selection change directlyGravatar Berthold Stoeger
When changing the dive selection, we have to reload the map to show the correctly highlighted flags. Do this directly by hooking into the DiveListNotifier::divesChanged signal instead of indirectly via the MainTab. Moreover, on reload center on the highlighted dive sites. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>