summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-01-25Update mobile version numberGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-23Bluetooth: don't crash if BT is turned offGravatar Dirk Hohndel
At least on a Mac we can get here without a discoveryAgent if BT is off, so don't derefence the NULL pointer in that case. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-23Update libdivecomputerGravatar Dirk Hohndel
shearwater: properly initialize the string caches Shearwater parser: add new harware model nr for Teric Merge git://github.com/libdivecomputer/libdivecomputer into Subsurface-NG Update with Jef's upstream: - add support for Cressi Goa and Cartesio - update the Shearwater PNF parser to Jef's version - misc minor fixes * git://github.com/libdivecomputer/libdivecomputer: Use the timezone setting of the dive computer Add support for the Cressi Goa and Cartesio Add an extra parameter for the initial CRC value Add support for the Ratio iDive Color series Shearwater Petrel Native Format parsing Shearwater: detect which logbook format is support Shearwater: add Teric to list of supported dive computers Shearwater: skip deleted dives Fix a potential buffer overflow Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22BLE debug: make things less verboseGravatar Dirk Hohndel
Unless run with '-v -v -v'. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22libdivecomputer: small wording change in a warningGravatar Dirk Hohndel
While in theory the DEVINFO event should give us the correct detected product, it's also possible that the code that usually detects the product gave up and returns an unknown model. Try to have the message reflect that situation more accurately. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-22Filter: extend range of allowed temperaturesGravatar Berthold Stoeger
The temperature range 0-100 was inadequate in both supported scales (Celsius and Fahrenheit). Extend the range to encompass all physically meaningful values in both scales. Use the default-values to set the minimum and maximum of the UI-fields. Thus, these values are configurable in a single place. In the future we should use a scale-independent representation (e.g. mkelvin as in the rest of the code base). But this would mean implementing a custom widget with a conversion function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-22Filter: support imperial unitsGravatar Berthold Stoeger
1) Choose the correct conversion function for comparison. 2) Add a unit suffix to the fields. 3) Update the suffixes on change of preferences. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-21Desktop, Filter UI: make date/time consistentGravatar Jan Mulder
On all (most?) places we use separate date/time fields for the time of a dive, and we follow the setting from the preferences to format those. Make the new filter widget consistent, with respect to the to and from interval. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-21Desktop, Filter UI: improve layout of rating/viz widgetsGravatar Jan Mulder
The alignment of the 2 first lines of the new filter widget looked badly aligned. Fixed by this simple change. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-21Windows/MXE: actually build HIDAPI libraryGravatar Dirk Hohndel
Otherwise Suunto EON Steel & EON Core, Scubapro G2 & Aladin Square and other, future USB HID dive computers won't be supported on Windows. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-21Android: make sure we have the correct platforms installedGravatar Dirk Hohndel
This should fix the current Travis build failures for Android. It is odd how we have ANDROID_PLATFORM and ANDROID_PLATFORMS, buf for now all I care about is that the Travis build completes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-20Import: fix erroneous flagGravatar Berthold Stoeger
In 891fcbf520f28ef6016d6171eba83c6773efca00 boolean parameters were replaced by flags. Fix an error in this commit: IMPORT_IS_DOWNLOADED should be IMPORT_PREFER_IMPORTED. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Filter: make tags, people and location filter logically-andGravatar Berthold Stoeger
If the user provides multiple tags, they probably want to search for dive with *all* of these tags. Replace the convoluted loops by std::all_of(). This makes it trivial to change logically-and to logically-or: Replace std::all_of() by std::any_of(). Reported-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Filter widget: remove superfluous space in labelGravatar Berthold Stoeger
The "Rating label" had a superfluous space at the beginning. Remove. Reported-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Filter: reinstate dive-site filter functionalityGravatar Berthold Stoeger
Commit 201f0c8f89d6d7df96fd220ea2c0d0977c9b7f20 removed the dive-site filtering. This is needed for dive-site editing: The list should only show dives at the corresponding dive-site. As opposed to the original code, only compare for the actual dive-site, not for the name of the dive-site. The reason for comparing dive-site names is unknown. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Filter: ignore unset temperaturesGravatar Berthold Stoeger
The filter treated unset air and water temperatures as 0 K, leading to many dives not being shown. Don't filter on unset temperatures. Reported-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Filter widget: make Ui class subobject of widgetGravatar Berthold Stoeger
Commit 8e81d3f10087fa7ac600dcb18cfebf27716c4209 changed a bunch of Ui classes to be subobject of the widget. For consistency do the same with the filter widget. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Desktop: Make filterWidget2 a subobject of MainWindowGravatar Berthold Stoeger
In commit b0556abdd35f96b816ba11e40bf5707abe0c3ebf, the filter-widget and the filter were connected by a direct function call. This led to a rather obscure crash on application-close with Qt 5.12. The crash is due to the Ui::MainWindow class being a sub-object of MainWindow, but the FilterWidget2 being *not* a subobject. What happens is that after calling the MainWindow destructor, the subobjects are destructed, notably the Ui class. Then the base-class destructor is called (which makes sense, as destructors are called in reverse order of constructors). But: the QObject destructor calls hide() on all still existing child-objects according to Qt's object hierarchy, notably the visible FilterWidget2. Now the FilterWidget2, on hiding, updates the MainWindow, which has already destructed all its subobjects. Crash. Prevent this crash by making FilterWidget2 a subobject of MainWindow and thus have it destructed before running the QObject destructor. Alternative ways would be: 1) Use signal/slot() instead of function calls, as these are automatically removed if an object is destroyed. 2) Make the FilterWidget2 subobject a smart-pointer. Thus, we probably wouldn't have to include the corresponding header. 3) Make the FilterWidget2 subobject a plain pointer and delete it explicitly in the constructor. Reported-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Filter: update filterData directly without copyingGravatar Berthold Stoeger
In FilterWidget2::updateFilter() a new FilterData object is generated and then copied onto the filterData member variable. Instead, modify filterData directly. This seems also more logical from a semantic point of view: Do we want to reset fields that were not set by the user? Contains trivial whitespace fix. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Filter: connect widget and filterGravatar Berthold Stoeger
In the latest version of the new filter-widget the connection between widget and filter was lost. Connect both - but use a simple function call instead of a signal, since it is not immediately obivous where the connection should be made. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Import: control process_imported_dives() by flagsGravatar Berthold Stoeger
process_imported_dives() takes four boolean parameters. Replace these by flags. This makes the function calls much more descriptive. Morover, it becomes easier to add or remove flags. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Import: don't add to new trip while downloadingGravatar Berthold Stoeger
Since process_imported_dives() can add dives to a newly generated trip, this need not be done in the downloading code. This makes data flow distinctly simpler, as no trip table and no add-new-trip flag has to be passed down to the libdivecomputer glue code. Moreover, since now the trip creation is done at the import step rather than the download step, the latest status of the "add to new trip" checkbox will be considered. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Import: add add_to_new_trip flag to process_imported_dives()Gravatar Berthold Stoeger
If this flag is set, dives that are not assigned to a trip will be assigned to a new trip. This flag is set if the user checked "add to new trip" in the download dialog of the desktop version. Currently this is a no-op as the dives will already have been added to a new trip by the downloading code. This will be removed in a subsequent commit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Dive import: fix logic of process_imported_dives()Gravatar Berthold Stoeger
The logic in process_imported_dives() was faulty: Dives are merged trip-wise in a loop. But if only autogenerated trips were supposed to be merged, the trip would not be added. Change the logic to always add the trip if it is not merged. To make the loop easier to read, factor out the merge-trip-into-existing-trips logic into a separate function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Dive download: add trip_table to device_data_tGravatar Berthold Stoeger
Since recent commits, dive-trips are not added directly to the core, but into separate trip tables (see ec37c71f5eeb7d4b0c4b8719b52583fadb0b8f4c). These commits did not finish the work for the download-from-dc case. Add an extra trip_table field to device_data_t. If trips are created (user selected "Download into new trip"), the trip will be created in that table. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Cleanup: remove unused variablesGravatar Berthold Stoeger
Commit 4d06ddd72351f7804acdaec81f0400a735581229 removed deletion of unused dive sites on save. The corresponding variables were not removed leading to compiler warnings. Remove the variables too. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-16Don't allow empty username for gitGravatar Robert C. Helling
When no real name is set in /etc/passwd the username ends up being ",,,". Git does not like that. Actually, only the part before the first comma is the name, the rest is office and phone number. We don't want those. Before we only testing for the username being a NULL pointer. Reported-by: Keith Grimes Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-01-13Planner: Add checkbox to force OC bailoutGravatar Robert C. Helling
This adds a checkbox for rebreather modes of the planner that force the ascent to be in OC mode. Before, one had to add a one minute last segment with the mode change but this is not practical when manually searching for the maximal bottom time given gas reserves. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-01-13Download: don't refresh display if thread finishedGravatar Berthold Stoeger
After the downloading finished, the mainwindow-display is reset via a signal. This is probably an artifact of old times, when downloading was done into the main dive-list. Nowadays, this seems to make little sense, as the main dive-list is not changed by download. Remove the signal. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-10Travis: OpenSUSE 42.3 / Qt5.6 build issue, use openssl and no libresslGravatar Jan Mulder
... and remove install of the default (old) libgit2 from OS. That old (0.24.0) libgit2 will be replaced by a newer anyway, so useless to install. But the real change to get this Travis build running again is using the well known openssl instead of libressl. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-10Travis: OpenSUSE 42.3 / Qt5.6, add missing curlGravatar Dirk Hohndel
The install was missing curl. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Removed upgrade to newer libgit2. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-10Build: build libgit2 from source when less than 0.26.0Gravatar Jan Mulder
We currently require a minimal version of libgit2 of 0.24.0. From issue #1926 it seems that this version is too old. So, a simple test on Linux to see the behaviour with such an old libgit2, I tried that. Interestingly, with the current version of openssl that old libgit2 version does not even compile from source (known error in libgit2). So, bump our minimal version of libgit2 to 0.26.0. That is also the version we currently use on the Travis and official builds, so well tested. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-09CHANGELOG.md updateGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Cleanup: remove explicit constructor of DiveListBaseGravatar Berthold Stoeger
DiveListBase had an explicit constructor that initialized the "firstExecution" member variable. The latter was a development- artifact that was never used. Remove the member and the constructor. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Undo: make dive-import undoableGravatar Berthold Stoeger
On desktop, replace all add_imported_dives() calls by a new undo-command. This was rather straight forward, as all the preparation work was done in previous commits. By using an undo-command, a full UI-reset can be avoided, making the UI react smoother. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Import: split process_imported_dives() functionGravatar Berthold Stoeger
Split the process_imported_dives() function in two: 1) process_imported_dives() processes the dives and generates a list of dives and trips to be added and removed. 2) add_imported_dives() calls process_imported_dives() and does the actual removal / addition of dives and trips. The goal is to split preparation and actual work, to make dive import undo-able. The code adds extra checks to never merge into the same dive twice, as this would lead to a double-free() bug. This should in principle never happen, as dives that compare equal according to is_same_dive() are merged in the imported-dives list, but perhaps in some pathologival corner-cases is_same_dive() turns out to be non-transitive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Core: don't copy dive-id on merge diveGravatar Berthold Stoeger
The installment of the divelist-undo system has made it unnecessary to adopt the uniq-id of the merged-into dive. On the contrary, we want to avoid two dives with the same dive-id in the divelist at all costs, since get_divenr() still uses the id and thus may fetch the wrong dive. Therefore, don't copy the dive-id on merge. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Import: add merge_all_trips parameter to process_imported_dives()Gravatar Berthold Stoeger
When importing log-files we generally want to merge trips. But when downloading and the user chose "generate new trip", that new trip should not be merged into existing trips. Therefore, add a "merge_all_trips" parameter to process_imported_dives(). If false only autogenerated trips [via autogroup] will be merged. In the future we might want to let the user choose if trips should be merged when importing log-files. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Import: merge dives trip-wiseGravatar Berthold Stoeger
The old way of merging log-files was not well defined: Trips were recognized as the same if and only if the first dives started at the same instant. Later dives did not matter. Change this to merge dives if they are overlapping. Moreover, on parsing and download generate trips in a separate trip-table. This will be fundamental for undo of dive-import: Firstly, we don't want to mix trips of imported and not-yet imported dives. Secondly, by merging trip-wise, we can autogroup the dives in the import-data to trips and merge these at once. This will simplify the code to decide to which trip dives should be autogrouped. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Import: add trip_table argument to DiveImportedModel::repopulate()Gravatar Berthold Stoeger
In the future we want to download trips into a distinct trip-table instead of the global trip-table to allow for undo of import. Therefore add a trip_table argument to DiveImportedModel::repopulate() and a trip_table member to DiveImportedModel. To correctly set these, add a DownloadThread::trips() function, which currently simply returns the global trip table. Finally, make "struct trip_table *" a Q_METATYPE, so that the corresponding arguments can be passed from QML. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Parser: add trip_table parameter to parsing functionsGravatar Berthold Stoeger
To allow parsing into arbitrary trip_tables, add the corresponding parameter to the parsing functions and the parser state. Currently, all callers pass the global trip_table so there should be no change in functionality. These arguments will be replaced in subsequent commits. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Core: add trip_table parameter to trip-functionsGravatar Berthold Stoeger
Currently trips are added to the global trip table. If we want to make dive-import undoable, we should be able to parse trips of a log-file into a distinct table. Therefore, add a trip_table parameter to - insert_trip() - create_and_hookup_trip_from_dive() - autogroup_dives() - unregister_trip() - remove_dive_from_trip() Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Undo commands: refactor dive-trip handlingGravatar Berthold Stoeger
Trips were added to the core with the first dive of that trip. With the recent changes that keep trips ordered by first dive, this became counter-productive. Keeping a consistent state at all times would mean resorting the trip table for every dive that is added. Instead, add all dives to a trip and *then* add the trip to the core. Change the data-structures to not register trips-to-be-added with individual dives, but keep them in a separate vector for each undo command. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Core: keep trips in table(s)Gravatar Berthold Stoeger
Currently, all trips are kept in a linked list. Replace the list by a table in analogy to dive_table. Use this to keep the trip_table sorted as suggested by dump_trip_list(). When inserting a trip into the table do that after adding the dives, to avoid warnings coming out of dump_trip_list(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Core: fix dump_trip_list() functionGravatar Berthold Stoeger
In 64e6e435f82801f4f440ef5b1caf58a91a7c9929 the trip->when field was replaced by a function. This forgot to adapt dump_trip_list(), which is only compiled if DEBUG_TRIP is defined. Fix the function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Core: macroize dive_table functionsGravatar Berthold Stoeger
Generate dive table functions by macros so that they can be reused for trip tables. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Core: Rename functions to more generic namesGravatar Berthold Stoeger
Rename - dive_get_insertion_index() -> dive_table_get_insertion_index() - unregister_dive_from_table() -> remove_from_dive_table() - get_idx_in_table() -> get_idx_in_dive_table() - sort_table() -> sort_dive_table() This will make it more straight-forward to generate these functions from macros. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Cleanup: Make add_dive_to_table local to divelist.cGravatar Berthold Stoeger
This function was not used outside of divelist.c, therefore make it local. Moreover rename it to add_to_divetable so that the name is generic and can be generated by a macro. Moreover, remove the special case idx = -1, which would determine the insertion index. Instead let the single caller who used this feature do this. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Dive list: add table parameter to autogroup_dives()Gravatar Berthold Stoeger
Currently autogroup_dives() groups all dives in the global dive list. Add a table parameter so that dives in any table can be grouped. Thus it will be possible to pre-group dives on import, which will be used for undo of import. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Core: move autogroup() into divelist.cGravatar Berthold Stoeger
After loading or importing, the caller usually called autogroup() to autogroup dives if so wished by the user. This has already led to bugs, when autogroup() was forgotten. Instead, call autogroup() directly in the process_loaded_dives() and process_imported_dives() functions. Not only does this prevent forgetting the call - it also means that autogrouping can be changed without changing every caller. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>