Commit graph

13102 commits

Author SHA1 Message Date
Stefan Fuchs
f3c06279f1 Include stdbool.h also from prefs.h if included from C file
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-24 07:56:10 -08:00
Stefan Fuchs
bd88306722 Change prefs.show_units_table to bool
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-24 07:56:10 -08:00
Berthold Stoeger
178dcbc0c6 Fix obscure display bug in profile widget, where heat map wasn't shown
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-23 14:15:00 -08:00
Berthold Stoeger
04f38d61d7 Clean up system_default_filename()
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-22 19:22:29 +01:00
Berthold Stoeger
7a99d7e5c3 Copy default filename string when assigning to default preferences
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-22 19:22:14 +01:00
Jan Mulder
4c1a2cc8dc Update Release notes for this PR (and more)
Sneaked in 2 earlier commits solving a published issue.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-21 19:25:35 +01:00
Jan Mulder
c995069e14 Desktop UI: allow user defined cylinder as default
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-21 19:25:35 +01:00
Dirk Hohndel
32a7cde180 Disable Mention-Bot
This is too unreliable and too buggy to work be useful.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-21 08:07:37 -08:00
Berthold Stoeger
a15682ee76 Make handling of booleans consistent on the C-side of preferences
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-20 20:56:13 +01:00
Berthold Stoeger
dd8e4fae2a Make handling of booleans consistent on the C++-side of preferences
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-20 20:56:13 +01:00
Berthold Stoeger
e762fd2d41 Fix typo: successfull -> successful and succesfully -> successfully
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-20 10:01:15 +01:00
Jan Mulder
8ed53ab5a6 mobile: new Kirigami SHA
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-19 12:20:43 -08:00
Jan Mulder
fea111cb3a QML UI: QtQuick.Layouts to 1.2
And again, no visual changes.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19 12:20:43 -08:00
Jan Mulder
e9903d1835 QML UI: QtQuick.Controls to version 2.2
Tested fine without visual changes.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19 12:20:43 -08:00
Jan Mulder
f3d978b8a5 QML UI: QtQuick to 2.6
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>
2017-11-19 12:20:43 -08:00
Jan Mulder
3b5375d553 QML UI: Kirigami to 2.2
When first tested this commit, especially the dive list was looking
terrible. However, after including newer SHA's from libkirigami, and
correcting lots of spacing/margin issue, a retest of this commit shows
no strange artifact any more, and the amount of warnings in the log
output is reduced significantly. So now, it appears save to
upgrade.

Notice that main.qml still uses Kirigami 2.0. and is not updated in
this commit. With version 2.2, there is a new way of theming, that
is not (yet) compatible with our current code. Blindly upgrading to
2.2 leads to a almost black dive list, wrong button colors, and
runtime errors in the log, due to the fact the direct setting from
QML Kirigami's Theme colors is not allowed any more.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19 12:20:43 -08:00
Jan Mulder
bde7caa621 Remove dead code
While investigating Qt 5.9.2 problems, I found this unused code.
Just remove it.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-19 12:20:43 -08:00
Berthold Stoeger
24fae95070 Fix indentation
Fix an indentation issue in qt-models/diveplannermodel.cpp.
An if was indented as if it were part of an outer if.

Correct indentation confirmed by Stefan Fuchs <sfuchs@gmx.de>.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-19 00:21:45 +01:00
Berthold Stoeger
ebb8e1dc27 Trivial: fix indentation
Fix an obvious indentation bug where one line more than intended
was indented.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-19 00:21:45 +01:00
Berthold Stoeger
6ae16b87d0 Constify strings in pref.h
Make all char * pointers in pref.h const to make it clear that these
strings are not mutable. This meant adding a number of (void *) casts
in calls to free(). Apart from being the right thing to do, this commit
makes the code more consistent, as many of the strings in pref.h were
already const.

While touching core/qthelper.cpp turn three instances of (void*) into
(void *).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-18 21:57:33 +01:00
Berthold Stoeger
f8fcd65bc4 Prevent signed/unsigned comparison warning
Change an unsigned integer to a signed integer in profilewidget2.cpp,
because commit 1f8506c changed the definition of duration_t from
unsigned to signed.

Since this value represents the number of seconds since a dive started,
there is no possible chance of overflow problems.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-18 21:50:43 +01:00
Berthold Stoeger
1f651a7b83 Prevent annoying signed/unsigned comparison warning
Commit d6c013f303 introduced a cast to avoid a signed/unsigned
comparison warning for all translation units that included
core/dive.h.

Commit 1f8506ce64 then changed the definition of duration_t from
unsigned to signed, inverting the effect of d6c013f303.

Thus, revert d6c013f303 to allow compilation with -Wall without
flooding.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-18 21:50:43 +01:00
Dirk Hohndel
f034121bef build.sh: fix comparison
This prevented googlemaps from building in some circumstances.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-18 08:10:37 -08:00
Dirk Hohndel
f691593e65 Switch back to upstream uploadtool
In commit e643589233 ("Travis: setup up the desired release message
right away") we temproarily switched to my fork of uploadtool to take
advantage of a new feature that I had implemented there. This has
already been merged upstream, so let's switch back to upstream.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-18 08:05:50 -08:00
Dirk Hohndel
e643589233 Travis: setup up the desired release message right away
Instead of using the default release message and then trying to fix it up
in the after_success section of one of the builds that we test, let's just
always use the message that we want, regardless which build finishes first.

This currently requires my fork of the uploadtool - the changes have been
submitted upstream and I hope they'll get merged there so we can switch
back to the upstream version of uploadtool.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-18 16:17:40 +01:00
Dirk Hohndel
cd9805904a Travis: include the symlink in the zip of Mac .app
Don't try to follow the (recursive) symlink.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-18 16:17:40 +01:00
Stefan Fuchs
478a784792 Release notes: Cleanup, pressure graphs, VPM-B ceiling
Remove old 4.7.2 headline.
Add pressure graphs improvement.
Add VPM-B ceiling improvement.

Suggested-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-17 16:01:24 -08:00
Dirk Hohndel
46e1f5e36a Travis: update the release message
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-17 12:41:29 -08:00
Dirk Hohndel
9f1fde4794 Travis: don't edit Release info if this is a PR
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-17 12:21:13 -08:00
Jan Mulder
35194c7002 mobile: black and white backgrounds on starting
This very simple commit has a long story. See the mailing list
subject "mobile: android splash screen (and issue 513) opacity
weirdness".

There is even more. I found the following deccription on Internet:
https://falsinsoft.blogspot.nl/2017/07/qml-show-android-native-splash-screen.html
and tried to implement this with the potentially nice Qt functionality
(since 5.8) to manually get rid of the splash screen. Unfortunately,
this does not work. Notice that there are subtile differences in
the here found internet page, and the method originally implemented
in commit 04e994b575.

This fix is as mimimalistic as it can be. Just do not set black but
white for the initial background. Unfortunately, there is still
a small position change of the icon. It is known why, but solving
is left as an exercise to the reader.

Fixes: #513

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-17 15:45:45 +01:00
Berthold Stoeger
5ad6e168c6 Fix memory leaks in SettingsObjectWrapper.cpp
Free a bunch of C-style strings before assigning newly copied strings.
One case was particularly buggy:
  prefs.locale.use_system_language = copy_string(qPrintable(value));
Note that prefs.locale.use_system_language is a bool, which of course
always evaluates to true! Probably nobody noticed because a restart
is required when changing locale.

Moreover remove a few double-semicolons.
2017-11-17 15:32:38 +01:00
Berthold Stoeger
9ec7aa7fd7 Fix typo: LENGHT -> LENGTH 2017-11-17 15:29:42 +01:00
Linus Torvalds
7fa5fcfa1d Don't show cylinder pressures for other dive computers
Stefan Fuchs points out that sometimes you get cylinder duplication when
you merge dives, particularly with a planned dive.  For example, if we
had different manual pressures in the two different dives, the cylinders
will be kept separate.

But that also means that we don't want to plot the pressures from those
other cylinders that came from another dive and are now associated with
another dive computer.

Change the "seen" logic for the cylinder to ignore cylinders that are
only mentioned by other dive computers than the active one.

Reported-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-11-17 15:25:26 +01:00
Linus Torvalds
2e82a5d2ed Properly declare 'has_gaschange_event()' function
It's already used in core/gaspressures.c where it was declared
privately, and we'll have a new user in the profile code, so just
declare it in a proper header file like it should have been.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-11-17 15:25:26 +01:00
Linus Torvalds
8136c2d78b Clean up confusing code in setup_gas_sensor_pressure()
The "prev" cylinder can never be negative since commit 56c206d19f
("For more manual gas pressure details"), so remove stale code that
checks for a case that cannot happen any more.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-11-17 15:25:26 +01:00
Jan Mulder
c8a7712ea5 Show all autocompletes after entry of comma in tag list
The almost 3 year old commit e1db5f21b1 introduced the behavior
that you need to type at least 1 character for a tag to show any
autocompleted data. While this went unnoticed for years, there
is always a user that notices this changed behavior.

The solution is rather simple. Do allow the 0 lenght string
to act as seed for autocompletion instead of just returning, and
doing no autocomplete at all.

As the afore mentioned commit was explicitly meant to prevent over
active firing of the tag list autocompleter, this (simple) change
is carefully tested on this, and no adverse effects are visible.

Fixes: #605 (wrt the 1 character issue)

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-11-17 09:19:03 +01:00
Stefan Fuchs
010f5f2abc In maintab disable correct label when dive trip selected
Until now accidentally the dateLabel was disabled and the timeLabel
was enabled. Changed this the other (correct) way round.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-16 11:34:12 -08:00
Lubomir I. Ivanov
adb0adb1d2 github: update PR template with 'documentation-change'
Add a 'Documentation change' section to the PR body.
This instructs the PR submitter to edit the section
with notes for the team editing the documentation.

If a PR has such notes, a maintainer should then
apply the needs-documentation-change label, so
that the documentation team can easily filter
such PRs by label.

Suggested-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-16 11:32:58 -08:00
Anton Lundin
063aadd166 android: Add android build on travis-ci
This adds a android-apk-build which runs on travis-ci. This is using a
quite ugly trick, building in a docker container, basically just to get
a newer cmake. The cmake in trusty is way to old to work with android
builds.

A good side-effect is that this is a complete copy-paste for anyone who
would like to build android-binaries them self on Linux. All the
uglyness is hidden away in a docker container.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-11-16 10:23:00 -08:00
Anton Lundin
c92a86f898 android: Don't re-clone subsurface in android-build-wrapper.sh
Just use the source tree you where called from instead.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-11-16 10:23:00 -08:00
Anton Lundin
65b825286c android: Correct path to Qt binaries
Back in 6451adfec1, the path to the qt
binaries was changed. The current binaries are back on the old urls, so
this reverts half of 6451adfec1.

The other half is still true.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-11-16 10:23:00 -08:00
Anton Lundin
9dd87bac03 android: Remove unneeded extra argument parsing
This is handled by build.sh, which handles it correctly for running with
set -u.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-11-16 10:23:00 -08:00
Anton Lundin
f3924aea29 android: Install android sdk on a different way
This way we can auto-accept all the licenses.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-11-16 10:23:00 -08:00
Anton Lundin
3f4f160552 android: Terminate build.sh on unknown arguments
Previous code ended up in a eternal loop on unknown arguments.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-11-16 10:23:00 -08:00
Anton Lundin
f9c85fa755 android: Ensure rm exits zero
This is to comply with set -e

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-11-16 10:23:00 -08:00
Anton Lundin
cfa241036c android: Remove unset variable VERSION
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-11-16 10:23:00 -08:00
Anton Lundin
e87a9e1454 android: Increase BUILDNR with zero exit status
This increases BUILDNR in a way that keeps exit status as zero, so the
script doesn't abort due to set -e.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-11-16 10:23:00 -08:00
Anton Lundin
aa7208049f android: Allow Qt install in headless mode
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-11-16 10:23:00 -08:00
Anton Lundin
49d46255fd android: make android-build-wrapper.sh executable 2017-11-16 10:23:00 -08:00
Lubomir I. Ivanov
f34f1d41d8 ReleaseNotes: update about the new combo-box is BT dialog
from PR #809

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-16 14:39:59 +01:00