summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2017-11-25Hand planner variables to profileGravatar Robert C. Helling
Pass the planner state struct to the profile computation so it can use deco_time and first ceiling to display VPM-B ceiling. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-11-25Localize global planner stateGravatar Robert C. Helling
For UI responsiveness, we need to be able to run the planner in the background. This needs the planner state to be localized (and we need to pass a pointer around). In order to not let too many lines overrun (and to save typing in the future) I have renamed instances of struct deco_state to ds. Yes this should have gone to a separate commit but I accidentally commit --amend'ed it. Computing of planner variations is temporarily disabled. Unlock the planner when returning early So we don't deadlock in add dive and recreational mode (which use the planner without actually planning). Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-11-25Run variations calculation in backgroundGravatar Robert C. Helling
but there are still side effects and thus it crashes. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-11-25Add logic parentheses to make compiler happyGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-11-25Update Subsurface-mobile version numberGravatar Dirk Hohndel
Should have done that right after the release. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-25Merge branch 'print' of https://github.com/neolit123/subsurfaceGravatar Dirk Hohndel
2017-11-25Update filters on refreshDisplay and remember old selecttionsGravatar Berthold Stoeger
Update the filters if the list of dives is updated by calling MultiFilterSortModel::instance()->myInvalidate(); This had the side effect of clearing all selections. Thus, in the repopulate() methods of the FilterModels, check those entries that were checked previously. Since all the filter models use the same code, introduce a base class FilterModelBase. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-25Replace bool * array by std::vector<char> in MultiFilterInterfaceGravatar Berthold Stoeger
This replaces a dynamically allocated array of bool by std::vector<char>. 1) This makes the code shorter and less error prone, because memory management has not to be done by hand. 2) It fixes a bug in the old code: memset(checkState, false, list.count()) is wrong, because bool is not guaranteed to be the same size as char! Two notes: 1) QMap<>, QVector<>, etc. are used numerous times in the code, so this doesn't introduce a new C++ concept. Here, the std:: version is used, because there is no need for reference counting, COW semantics, etc. 2) std::vector<char> is used instead of std::vector<bool>, because the latter does a pessimization where a bitfield is used! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-25LocationFilter: use equality instead of substring comparisonGravatar Berthold Stoeger
The location filter used a substring comparison, which had the side effect that dives with the location "Test 1" were shown when filtering for "Test 12". Moreover, avoid a deep copy of the location list. This is done by looping over one item less than rowCount() instead of removing the last item. While doing this, remove an unnecessary if-statement. This commit partially fixes #675. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-25Fix crash when dives have no dive siteGravatar Dirk Hohndel
get_dive_site_by_uuid() returns a NULL pointer in that case. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-25Release notes.Gravatar Jan Mulder
Autocomplete dive site name for mobile. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-25mobile: get GPS data from dive site nameGravatar Jan Mulder
When the user entered a dive site using autocompletion, it is a known site, of which we might have a GPS location already. Just fill the known site coordinates. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-25mobile: autocomplete location namesGravatar Jan Mulder
Add the capability to select the location name from a list, constructed from the known dive sites in the logbook. Fixes: #546 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-25Only call autogroup when it's enabledGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-25Fix ownership issues in preferences codeGravatar Berthold Stoeger
Each preferences object owns its string members. In three cases, pointers were copied instead of strings, leading to (in the best case) dangling pointers if the user edited values: 1) In the GET_TXT macro in core/prefs-macros.h 2) In the PreferencesDialog::defaultsRequested() method 3) In main() of the mobile version This patch fixes these issues, by using copy_string() or copy_prefs() as appropriate. The only reason that the old code didn't crash regularly is that the default_prefs object was only used at startup and defaultsRequested() is (at the moment?) dead code. This patch also aligns the backslashes in core/pref.h and fixes a typo. The declaration of copy_prefs() is moved to the core/prefs.h header. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-25Cleanup: remove unused extern declarationGravatar Berthold Stoeger
Removes the extern declaration of edit_dive, which wasn't defined anywhere. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-24Travis: Mac: enable googlemaps againGravatar Dirk Hohndel
This should work now. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-24Travis: Mac build prevent error out when not using libcurl/libssh2Gravatar Dirk Hohndel
This shouldn't be needed anymore since the Homebrew libgit2 is not linked against libcurl and libssh2. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-24build.sh: remove googlemaps .qmake.conf hackGravatar Dirk Hohndel
This needed to be fixed in googlemaps instead. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-24build.sh: don't use sed -iGravatar Dirk Hohndel
I can't seem to find a way to make this work on both Linux and Mac. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-24Fix build without BT supportGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-24Travis: try to make sure failing builds failGravatar Dirk Hohndel
In some situations Travis CI doesn't seem to notice that a build failed and give us a green check mark even though the build didn't succeed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-24build.sh: only modify googlemaps .qmake.conf on MacGravatar Dirk Hohndel
This otherwise causes a failure on Linux builds. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-24printing: add release note about the recent template changesGravatar Lubomir I. Ivanov
refs #847 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-24printing: update the coping of bundled templatesGravatar Lubomir I. Ivanov
This update includes: - Instead of copyPath() use a new specialized function: copy_bundled_templates() - The new function supports overwriting of templates in the user path, but only if a template file is read-only - If the file is RW create a backup of the file in the form of: <file-name>-User.html - Collect backup files and store them in a QStringList which is then shown in a QMessageBox from MainWindow to notifying the user about the backup This change allows moving the maintenance of the bundled templates back to the application developers and contributors as currently the only one who can edit the templates in the user path was the user. Suggested-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-24printing: only load *.html files in the UIGravatar Lubomir I. Ivanov
The function find_all_templates() thus far handled all files in the user template directory. This patch makes it so that only files with the .html extension are loaded. Also remove brackets for single lined `if` statement. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-24printing: detect a 'statistics' template when editingGravatar Lubomir I. Ivanov
Prefix the path for 'statistics' templates when detecting if a template is read-only. Import / Export for statistic templates is not supported. So the user has to manually copy and chown a '/statistics' templates. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-24printing: handle overwriting in import / exportGravatar Lubomir I. Ivanov
Show an error message if trying to: 1) Import over an existing read-only template with the same name 2) Export to a read-only file with the same name 3) Delete a read-only template Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-24printing: make sure that exported templates are .htmlGravatar Lubomir I. Ivanov
Thus far the exported template did not had the .html extension. This patch makes sure that the extension is always added to the file if missing. Also handle the case where the user used ".htm" and replace that with ".html". Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-24printing: store the last import / export templateGravatar Lubomir I. Ivanov
Store the last template file name which the user imported / exported and then try to pre-select it in the combo box. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-24printing: improve messaging in printoptions.cppGravatar Lubomir I. Ivanov
1) on_deleteButton_clicked() show a proper message box with icon title and also quote the file name. 2) When exporting a file, make sure that the destination is not read-only even if the source is. 3) Do not allow editing of read-only templates (e.g. the bundled ones). Instruct the user to Export first. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-24printing: minor improvements to import / exportGravatar Lubomir I. Ivanov
1) Always open the user path on Import / Export 2) Update the list after Export, as the user might have exported to the user path Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-24printing: add set_bundled_templates_as_read_only()Gravatar Lubomir I. Ivanov
Add the function set_bundled_templates_as_read_only() in templatelayout.cpp/h. The function is used to mark the bundled template files as read-only in the user folder. It is called in mainwindow.cpp, after the files are copied from the bundle. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-24printing: delete `One Dive Simple.html` and cleanupGravatar Lubomir I. Ivanov
The previous commit by Willem introduced a new HTML template file which is not needed, as it was decided to override the default `One Dive.html`. This patch also include small cleanup in the new version of `One Dive.html`. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-24PATCH: Update the single-dive per page print templateGravatar Willem Ferguson
1) Place the dive profile below the synoptic info for the dive. 2) Re-arrange the synoptic info items. 3) In the synoptic info, replace air temperature info with gas and cylinder info. 4) If any items among the the synoptic data take more than one line, the the alignment of cells in the synoptic info table is maintained. In the previous version this caused a ragged bottom edge of the synoptic info table. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2017-11-24Include stdbool.h also from prefs.h if included from C fileGravatar Stefan Fuchs
Currently not mandatory in our code because we never include prefs.h from a C file today but for the future this could avoid confusion. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-24Change prefs.show_units_table to boolGravatar Stefan Fuchs
Bool is the correct choice for this option. int was used before because it was not clear to me how and if I can use bool in this C file. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-23Fix obscure display bug in profile widget, where heat map wasn't shownGravatar Berthold Stoeger
Fixes an obscure bug, which happened under very specific circumstances. Precodition: fresh program start and neither of the partial pressure graphs, nor the heat maps are shown. User clicks on heat map icon. Bug: The heat map is not shown at the bottom of the graph. The fix consists in replacing two percentageAxis->setLine() calls by precentageAxis->animateChangeLine() calls. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-22Clean up system_default_filename()Gravatar Berthold Stoeger
In the old implementation there were two static C-style strings, filename and path, which were initialized to NULL and filled on first call of the function (i.e. singletons). There is no sense in having two static variables indicating whether this function was called previously. Moreover, there is no point in remembering filename accross function calls, because it is not used once path is set to a non-NULL value. Therefore, make the filename variable non-static and calculate it only on first invocation (as indicated by a NULL path). Moreover, free() the filename variable after its use to fix a memory leak of the old code. The windows code is slightly different in that the temporary filename is not dynamically allocated. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-22Copy default filename string when assigning to default preferencesGravatar Berthold Stoeger
This tries to remove subtle ownership issues. When copying preferences structures, the default filename is copied. But the default preferences struct simply takes a pointer to a global string which is free()d in main(). Now, this is not strictly a bug because the free()ing of preferences resources is not implemented. Yet, let's try to make this consistent. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-21Update Release notes for this PR (and more)Gravatar Jan Mulder
Sneaked in 2 earlier commits solving a published issue. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-21Desktop UI: allow user defined cylinder as defaultGravatar Jan Mulder
Currently, it was only possible to use a hard-coded default cylinder in the preferences. At the same time, the user is allowed to add own cylinders to a dive (by just typing in a new name and cylinder properties). These own cylinders could not be selected in the preferences, requiring the user to manually add this every dive. Not sure the reason for all this was intentional, or just an overlooked aspect in the implementation. It appeared that the selection list in the UI was constructed before any logbook was parsed, so at that moment, there are only hard-coded cylinders. The fix is simple. Refresh the UI of the preferences just before it is shown. While opening the logbook, a new list of cylinders, including the own cylinders is constructed, so the UI is refreshed to that. While a simple change, there is a use case that might be considered strange. Open a logbook, choose new logbook, and change the default cylinder preference to an own (from the previously opened logbook). Do not add a dive with the new (own) cylinder and save this logbook. Reopen this new logbook, and see that the default cylinder in the preferences is empty. This is logical, as the list of own possible cylinders is constructed from the (new) logbook, that has no dive with that specific own cylinder. I consider this acceptable behavior, as it can be also be used to copy own cylinders to a new logbook. Fixes: #821 Proposed-by: Davide DB <dbdavide@gmail.com> Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-21Disable Mention-BotGravatar Dirk Hohndel
This is too unreliable and too buggy to work be useful. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-20Make handling of booleans consistent on the C-side of preferencesGravatar Berthold Stoeger
Boolean settings were declared in pref.h randomly as bools and shorts. Since the code relied anyway on bool being well-defined and identical on the C- and C++-sides, turn all of them into bools. They use less space and express intent more clearly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-20Make handling of booleans consistent on the C++-side of preferencesGravatar Berthold Stoeger
In general, the C++-side of the preferences code consistently uses the bool data type for boolean settings. There are five exceptions, which use short instead: showPo2 showPn2 showPhe saveUserIdLocal displayInvalidDives This patch attempts to make the code more consistent by turning these into bools as well. Tests showed that writing as short and reading as bool is handled gracefully by the Qt variant code. Therefore, an upgrade should not cause user-visible changes to their settings. As a bonus, two extern declarations of the set_save_userid_local() function, which is not defined anywhere, were removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-20Fix typo: successfull -> successful and succesfully -> successfullyGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-19mobile: new Kirigami SHAGravatar Jan Mulder
Notice this is not the current master. Do not go there right now. Kirigami SHA f8ee631aac787b60 introduces a failing load of our main.qml (tested with both Kirigami 2.0 and 2.2). This SHA is safe. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19QML UI: QtQuick.Layouts to 1.2Gravatar Jan Mulder
And again, no visual changes. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19QML UI: QtQuick.Controls to version 2.2Gravatar Jan Mulder
Tested fine without visual changes. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19QML UI: QtQuick to 2.6Gravatar Jan Mulder
Upgrade QtQuick to 2.6. Seeing a small artifact in the application header, lets see what happens when upgrading more includes. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>