Commit graph

15984 commits

Author SHA1 Message Date
Berthold Stoeger
4706b0f11a Planner: remove planner disclaimer from old notes
There used to be code to remove the old planner notes when replanning
a dive. It used a global variable and seemed rather brittle. Moreover,
the place that set the global variable was inadvertently removed.
Therefore has been effectively dead code.

Reimplement the functionality, but be more robust by considering
that the deco-type may have changed: Split the translated disclaimer
string in two parts, before and after the "%s" place-holder.
Search for these two parts. Remove the disclaimer and everything
after the disclaimer.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-10 21:31:21 +02:00
Dirk Hohndel
8ac48a96c7 More translation updates
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-08 23:41:19 -07:00
Dirk Hohndel
15869731e1 Prepare for 4.9.3 release
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-08 07:07:30 -07:00
Dirk Hohndel
ead7a5d64d Latest translations
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-08 07:04:13 -07:00
Linus Torvalds
d4bcd7bf40 Update libdivecomputer to latest version
This just merges with Jef's branch, which should hopefully fix the Mares
BLUELINK Pro connection issues.  Knock wood - I can no longer test it
due to lack of hardware.

It also improves on the Ratio iDive cylinder pressure transmitter support.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-09-07 12:33:45 -07:00
Berthold Stoeger
e3cd0891d3 Dive site: close dive site edit widget when dive site is deleted
The application could be crashed by
1) Create dive site
2) Edit dive site
3) Undo until dive site is removed
4) Continue editing now non-existing dive site

Therefore, hook into the dive-site-deleted signal and if the
currently edited dive site is deleted, close the widget.

When closing the widget, make sure that the potentially
dangling pointer is reset to zero so that there is no
other potential use-after-free bug.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-07 08:28:29 -07:00
Berthold Stoeger
4479ccf8f3 Cleanup: remove unused MapWidget::repopulateLabels() function
There is the alternative MapWidget::reload() function, which
centers on the selected dive-site.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
ca484c5029 Map: remove MapWidget::repopulateLabels() call
For historic reasons MapWidget::repopulateLabels() was called
in LocationInformationWidget::acceptChanges(). This should not
be necessary anymore, as this is done when entering/exiting
dive-site-mode.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
856fc357bc Map: remove unnecessary MapLocationModel::repopulateLabels() calls
The LocationInformationWidget repopulated the map labels if the name
or location of a site changed. This is unnecessary because the
MapLocationModel catches these signals itself. Remove these calls.

As an added bonus, calling repopulateLabels() in QML context leads
to crashes later on. Therefore this should fix at least one
crash condition when dragging a flag on the map while the
dive-site-edit-tab is shown.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
7d2fe2b7c6 Cleanup: remove redundant Roles:: qualifier in maplocationmodel.cpp
"Roles" is a C-style enum (i.e. not C++-style enum class). Since that
means that the names spill into the outer namespace, the names
themselves are prefixed with "Role". Nevertheless the code qualified
the names with "Roles::". This is redundant and unnecessary.

Remove this redundancy to show that we understand how the language
works.

Note: we could also transform the enum into an enum class and remove
the "Role" prefix from the names. That would arguably be "cleaner",
but then the enum doesn't auto-convert to/from int, but Qt uses int
to pass the roles to functions. So let's go the simple way that
avoids casting.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
46e120f81a Cleanup: remove includes from maplocationmodel.cpp
Neither "QDebug" nor "algorithm" were necessary.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
c5f355ee8b Cleanup: remove default constructor from MapLocation
Since this is no longer a Q_METATYPE, nobody will try to
default construct this object. Remove the default constructor
and guarantee that there will be no null divesite.

Of course, the lack of default constructor means that the
default argument to the "selected" member variable should
be removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
0c374af176 Map: don't derive MapLocation from QObject
Map location is
1) A plain value type
2) Never passed to QML

Make it a simple C++ class.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
4eaf6b20be Cleanup: remove accessor functions from MapLocation
Let's face it: this is a value type. No point in having Java-style
getters and setters. Replace by plain old and boring member variables.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
fe07a47989 Cleanup: remove MapLocation::coordinateChanged signal
Nobody was listening for that signal. Remove it. This, quite
obviously, makse the setCoordinateNoEmit() function redundant.
Merge with setCoordinateNoEmit().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
15f418e046 Cleanup: remove Q_PROPERTIEs from MapLocation
We never dish out an object of this type to QML. It is unclear how
Q_PROPERTIEs could be of any use.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
406e83ac30 Cleanup: remove MapLocationModel::count() and the attribute count
These were not used anywhere and the function was redundant [same
result as rowCount()].

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
b9c35e21ea Cleanup: remove MapLocationModel::get() function
It was not called anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
8e2d3254a2 Cleanup: remove Q_INVOKABLE from MapLocationModel::setSelected()
The function does not appear to be called from QML anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
773604f0df Cleanup: remove MapLocationModel::isSelected() function
That function was replaced by a model-attribute.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
1d01fff006 Map: export isSelected as attribute from MapLocationModel
Recently we changed the MapLocationModel-items to store whether
they are selected. Thus, we can directly export an isSelected
flag instead of calling a function taking a dive-site argument.

1) This makes the QML easier to read.
2) This avoids passing pointers through QML which has caused
   us lots of pain.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
9322092e41 Cleanup: simplify role handling in MapLocationModel
To connect a model to QML, one is supposed to provide a
  QHash<int, QByteArray> MapLocationModel::roleNames()
function that returns a role -> attribute-name hash.

That was realized by filling the hash in the constructor,
storing it as a member variable, using static strings that
were declared in the class-definition and defined in the
translation unit.

Adding a new role was a pain and the whole thing was totally
pointless as the attribute names were used nowhere else and
the roleNames() function is called only once.

Simply do, what we do everywhere else: initialize the hash
in the roleNames() function and use normal string literals.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
4dd86cc205 CHANGELOG.md update
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
f27d440bb3 Dive site: don't emit divesChanged signals when editing dive site
When editing the dive site, for certain fields a divesChanged signal
was emitted so that the dive-list can be updated.

Arguably it is wrong to decide which fields are relevant to the
dive list in the undo-command code. Therefore, let the list
catch the dive-site-edited signal and decide itself.

But the actual reason for this commit is that if the dive-site
field of a dive changes, we might have to reload the dive-location-model
because suddenly a new dive site appears. Now if this is done
in QML context on some Qt version (notably 5.9) we get crashes
later on. But that can happen if the user moves a flag. So in that
case only send a diveSiteChanged signal.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
093adf1ea8 Map: highlight correct dive sites in dive site mode
Since changing the highlighting to use the selected dive, dive
sites with no dive were never highlighted in dive site mode.
Obviously, because there was no dive to be selected.

Therefore special-case all dive-site selection code to recognize
when we are in dive site mode.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
fc706a0d72 Filter: reload map on myInvalidate
Since selection change doesn't to a full map reload, we have to
reload the map on filter changes, since the shown dive sites change.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
4713611ea8 Cleanup: remove TabDiveSite::updateFilter() function
This one-liner was called in only one place from the same class.
Just fold it into the caller.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
652b78657e Map: calculate the z value in the model
Since not fully reloading the map on selection change,
the selected sites were not moved to the top. Not calculating
the z-value in QML, but making it a simple model property
helps.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
b766525183 Selection: properly update selection flag of map location
Owing to the recent changes, when the selection flag in the
MapLocationModel was not updated correctly when the user
manually selected the dive. Do that before raising the
divesSelected signal in DiveListView::selectionChanged()
because that will cause the MainWindow to repaint the flags.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
488eb15423 Desktop: show all selected dive sites on click
When clicking a dive site on the map, the QML code would set
the selected dive site, but then all dives of dive sites in
the vicinity were set. But still only the clicked-on dive site
was shown.

Therefore, don't set the list of selected dive sites in QML,
but later in DiveListView::selectDives(), where we know all
the dives that were selected.

This, again, gives nasty entanglement of diverse widgets and
models.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
b39f2406c6 Map: don't fully reset model on selection change
When changing the selection the MapLocationModel was reset.
This lead to crashes on Qt-5.9 which are due to QML accessing
data that was freed during model reset. This putative Qt bug
doesn't happen on newer Qt versions. At least Qt-5.12 is known
to work.

Instead of fighting the bug, let's simply not reset the model
but send a dataChanged() for every element of the MapLocationModel.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
cabe70be80 Desktop: reload map after refreshing the list
In MainWindow::refreshDisplay() with doRecreateDiveList=true
the map was reset before the dive list was recreated. This
makes no sense and only worked because the map was reloaded
again when a dive in the list was selected.

Reload the map after recreating the dive list.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
bce31ab862 Map: generate pixmap name in model
Experimentation has shown that the image of a flag will
only be changed after dataChanged() if it is a simple
property. The old code had a complex QML expression and
then - for some reason - it didn't work.

To give us better control over the flags and avoid full
reloads of the map therefore introduce a model-property
pixmap name. The name depends on whether the site is
selected and if not, whether we are in divesite-edit mode.
This makes the code rather convoluted. Firstly, we have
to save whether the site is selected in the map-item.
Secondly we have to access the global map-widget, which
in turn has to go to the map-widget helper (layering
violation!).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
28cb75b73d Map: explicitly reload selected map on click
When clicking on a flag
 1) The QML would call MapLocationModel::setSelected() with
    fromClick = true
 2) MapLocationModel::setSelected() would emit a signal
    selectedLocationChanged()
 3) MapWidgetHelper would catch that signal and do the actual
    processing.
Other functions would call MapLocationModel::setSelected() with
fromClick = false, which would not emit the selectedLocationChanged()
signal.

Detangle this a bit by calling the selectedLocationChanged() function
directly from QML and remove the fromClick parameter.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Berthold Stoeger
f818ac3352 Map: replace enterEditMode()/exitEditMode() by updateEditMode()
There weree two functions in MapWidgetHelper: one to enter and
one to exit edit mode. Both functions set the flag and emitted
a signal if the flag had changed.

Since the edit mode only depends on a flag of the filter this
can be simplified to a simple function that updates the flag
and raises the signal if the flag changed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-06 11:48:47 -07:00
Dirk Hohndel
a921acb3ce Travis: build Subsurface AppImage against Qt 5.12
For this we need our own hand crafted trusty container with Qt 5.12,
including QtWebKit and an updated cmake and libdbus, as well as already
build googlemaps plugin, grantlee and libgit2.

At the same time stop uploading the Subsurface AppImage in the
traditional trusty build.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-05 17:54:09 -07:00
Dirk Hohndel
6670ea7bdb build-system: add -quick flag for build.sh
With this flag we assume that we don't need to rebuild grantlee and googlemaps.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-05 17:54:09 -07:00
Dirk Hohndel
373415bb52 build-system: add Dockerfile for Qt 5.12 on Trusty
We'll use this to create a better AppImage on Travis.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-05 17:54:09 -07:00
Dirk Hohndel
8401658af2 Update translation source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-05 17:54:09 -07:00
Berthold Stoeger
009f47c5dc Desktop: improve recognition of HTML-notes
To recognize HTML-notes the text was scanned for <div> tags. But
apparently the planner notes do not feature such a thing. Therefore
extend recognition of HTML to <table> tags.

Note we can't use the <html> or <span> tags, because these are
*always* produced by the QTextEdit::toHtml() function.

Fixes #2265

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-30 09:31:50 -07:00
Linus Torvalds
98d171630c Update libdivecomputer with Cosmiq+ fixes
Nothing huge, but this fixes the Deepblu Cosmiq+ gasmix parsing, and
properly stops downloading when we've hit a dive we already have.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-30 09:15:15 -07:00
Paul Buxton
3c4fd5d599 Fix broken windows build with latest MXE
Replaces some enums with names that do not clash with windows #defines.
Specifically:
ERROR -> ERRORED, PASCAL->PASCALS, IGNORE->IGNORED,FLOAT->FLOATVAL

Signed-off-by: Paul Buxton <paulbuxton.mail@googlemail.com>
2019-08-29 12:55:25 -07:00
Stefan Fuchs
193c456f06 Fix new CNS calculation - remove error with factor of 10
Fix a typo in the new CNS calculation which introduced a error of
factor 10.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2019-08-28 22:28:30 +02:00
Berthold Stoeger
b3fd824d18 Map: catch null divesites in map widget selection code
Just to be sure, refuse to add null divesites to the selection.

Moreover, refuse to call the setSelected function on a null-divesite.
I got an unfriendly Qt-Warning there:

"Passing incompatible arguments to C++ functions from JavaScript is
dangerous and deprecated."
"This will throw a JavaScript TypeError in future releases of Qt!"

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-28 07:12:01 -07:00
Berthold Stoeger
25b30da244 Profile: properly initialize plot_info structures
The create_plot_info_new() function releases old plot data. This
can only work if the plot_info structure was initialized previously.
The ProfileWidget2 did that by a memset, but other parts of the code
did not.

Therefore, introduce a init_plot_info() function and call that when
generating a plot_info struct. Constructors would make this so much
easier - but since this is called from C, we can't use them.

Fixes #2251

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-28 07:10:09 -07:00
Stefan Fuchs
0e55739f03 Show surface degassing in the planner only when configured time != 0
This prevents from useless "Air" tag in profile when this feature is
not used.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2019-08-26 13:19:06 +02:00
Dirk Hohndel
96f71e6cb1 Update README and ReleaseNotes for 4.9.2
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-08-24 15:04:54 -07:00
Dirk Hohndel
92a2a20d16 Update list of supported dive computers
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-08-24 15:04:54 -07:00
Dirk Hohndel
7501e7b311 Latest translations
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-08-24 15:03:27 -07:00
Linus Torvalds
d570cb789f Update libdivecomputer to support the Aqualung i200c
I got confirmation from Tiago Thedim Dias that my libdivecomputer patch
makes BLE downloading work from the i200c, and already pushed out the
libdivecomputer changes earlier.  This updates the subproject in
subsurface to have those changes.

This also adds the bluetooth name patterns for the i300c and a few other
Aqualung dive computers we hadn't added yet.  That should make them show
up in the bleutooth device list even without having to check the "Show
all bluetooth devices" check-box.

Tiago claims he didn't need that, and I wonder if we have some overly
permissive match somewhere, but it's the right thing to do regardless.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-24 15:02:50 -07:00