aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
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>
2019-01-09build system: try harder to checkout the right versionGravatar Dirk Hohndel
And actually fail a build if that doesn't work. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-08Filter for logged/planned divesGravatar Robert C. Helling
Add filter for dives having a planned dive computer or a logged dive computer. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-01-08Helper function to determined planned divesGravatar Robert C. Helling
... to reduce code duplication. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-01-07Dive list: split DiveTripModel into distinct models (tree and list)Gravatar Berthold Stoeger
The DiveTripModel was used to represent both, trip and list views. Thus many functions had conditionals checking for the current mode and both modes had to be represented by the same data structure. Instead, split the model in two and derive them from a base class, which implements common functions and defines an interface. The model can be switched by a call to resetModel(), which invalidates any pointer obtained by instance(). This is quite surprising behavior. To handle it, straighten out the control flow: DiveListView --> MultiFilterSortModel --> DiveTripModelBase Before, DiveListView accessed DiveTripModelBase directly. A goal of this commit is to enable usage of the same model by mobile and desktop. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-07Cleanup: Remove MultiFilterSortModel::modelGravatar Berthold Stoeger
The source-model was cached in MultiFilterSortModel. For simplicity, remove that and simply access via DiveTripModel::instance(). There is only one instance where the cached model was used: when comparing items for sorting. Thus, in indirection is added in a "hot" path. Nevertheless, this will dwarf against the cost of string comparison. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-07Dive sites: don't delete unused dive sites on saveGravatar Berthold Stoeger
Unused dive sites were deleted on save. This clashed with the undo system in the following scenario: 1) Delete single-use dive site. 2) Save (dive site deleted) 3) Undo (reference to freed dive site) Therefore, as a quick-fix, keep the referenced dive site around. Note that this also means that empty dive sites must not be deleted, as it might refer to a dive in the undo system. Instead only clear references to empty dive sites in the global dive table. Factor this functionality out, as it was common to the XML and git savers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-07Merge branch 'shearwater_cloud' of https://github.com/mturkia/subsurfaceGravatar Dirk Hohndel
2019-01-07Build: remove --skip-googlemaps build optionGravatar Jan Mulder
The scripts/build.sh script has an option --skip-googlemaps. Introduced in 2017 at a moment the Travis Mac build failed on this. Interestingly, when Mac building of the maps plugin was possible again (commit 79e3f69f488df) the --skip-googlemaps stayed. Obviously, this hack was never intended to be used for anything else then getting it passed Travis on some point in time for a specific Mac build. So, remove this option. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-03Use state structure for sample rate infoGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2019-01-02update year to 2019 in about screensGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2019-01-02desktop/preferences: rename the default file groupGravatar Lubomir I. Ivanov
The original name was just "Dives" which is not descriptive enough. Use "Default file". Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2019-01-01Shearwater Cloud mentioned in changelogGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2019-01-01Use correct value for PO2Gravatar Miika Turkia
averagePPO2 appears to be correct value instead of currentPPO2SetPoint. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-12-31Desktop: change preferences dialog name to 'Preferences'Gravatar Dirk Hohndel
Fixes #1912 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-12-31Grab correct setpoint on Shearwater cloud importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-12-30Describy configuring copy-paste on mobileGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>