Commit graph

17074 commits

Author SHA1 Message Date
Christof Arnosti
33643bb0af travis build-scripts: update container
While the project doesn't use Travis anymore, these scripts are indeed
useful when building locally, so it makes sense to keep them current and
working.

Signed-off-by: Christof Arnosti <charno@charno.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-07 12:34:43 -08:00
Christof Arnosti
e6158c55e1 usb-serial-for-android: add dependency
Signed-off-by: Christof Arnosti <charno@charno.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-07 12:34:43 -08:00
Berthold Stoeger
f7cf3e6b16 divetripmodel: send shown changed signal on reset
Once the the mobile app uses the new models, this will be necessary
to get the correct number of filtered dives after startup.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-07 12:04:19 -08:00
Berthold Stoeger
2e52f43d94 divetripmodel: mark derived classes as final
This is an idle "optimization": The compiler may now not need
to access the vtable when calling virtual functions.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-07 12:04:19 -08:00
Berthold Stoeger
b575a794ea divetripmodel: use change of CURRENT_ROLE to propagate current dive
If compiled on mobile, on change of the current dive, don't send
a signal, but send changed-event with the CURRENT_ROLE for both
dives that changed status (previously selected and newly selected).
Mobile does not use this yet, but will do so with the new flattened
models.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-06 13:46:41 -08:00
Berthold Stoeger
dbddec59d3 divetripmodel: add TRIP_HAS_CURRENT_ROLE
This role returns true if the given trip contains the current
dive. This will be needed by the mobile list model to decide
if a newly added trip should be expanded right away.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-06 13:46:41 -08:00
Berthold Stoeger
a88ab64cf8 divetripmodel: introduce CURRENT_ROLE
Use this role to test whether a dive is the currently displayed dive.
This will be needed to transport changes of the current dive to
the mobile list models.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-06 13:46:41 -08:00
Dirk Hohndel
97e26fd51b mobile: allow disabling BT support from the command line
This is a quick hack to reduce the noise in the log file when chasing other
bugs. Maybe this should not be enabled on release builds, but right now I don't
think the harm that having this in would do.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-06 10:00:13 +01:00
Berthold Stoeger
2a97934db4 Cleanup: Move stringToList to core/qthelper.cpp
The same code was used in desktop and undo commands. Let's unify.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-06 10:00:13 +01:00
Berthold Stoeger
c495a49b1b Cleanup: use getDiveSelection() for shifting time
There are two cases where dive-times are shifted: in an explicit
dialog and when editing the date/time of a dive.

In each of these cases, the selected dives were collected manually.
Instead use the getDiveSelection() function. Since this returns
a std::vector, change the argument of Command::ShiftTime() to
such a std::vector.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-06 10:00:13 +01:00
Berthold Stoeger
62adc24d15 Core: don't return invalid cylinders from explicit_first_cylinder()
For reasons which I don't yet understand, when plotting a dive
whose first cylinder is not cylinder 0 and then plotting a dive
with only one cylinder, it can happen that for the latter
explicit_first_cylinder() returns an erroneous value.

This is due to the way in which we copy the dive to be plotted
to displayed_dive.

For now, make sure that no invalid cylinder is returned to avoid
crashes. This will have to be changed anyway, since this is very
fundamentally not thread-safe and inefficient.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-06 10:00:13 +01:00
Dirk Hohndel
763dbf256a desktop UI: fix typo in GPS import UI
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-05 09:35:43 -08:00
Berthold Stoeger
8a0eecfd5e cleanup: make version_printed variable static and local to function
The version_printed variable is used to print version information
only once. It was a global variable, but never used outside of
its function. Therefore, move it into the function and make it
static. Since this is a plain old datatype (POD), it makes no
no difference whatsoever whether the static variable is in block
scope or not. Indeed, it is initialized in the data segment). Well,
we are in C mode and therefore everything has to be POD by definition.
I tested this on gcc and clang.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-05 11:07:32 +01:00
Dirk Hohndel
9f8d593a15 Mobile UI: fix typo in disabled planner setup
While this is disabled and is unlikely to be completed, the typo caused
confusion with translators.

This shows one of the weaknesses of the way we set up our translations, in that
always both desktop and mobile are translated together, and disabled code is
also included in those translations, causing unnecessary work for the
translators.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-04 08:03:44 -08:00
Dirk Hohndel
bd1e0eea51 Update translation source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-03 09:58:55 -08:00
Berthold Stoeger
2b3dc019db selection: update selection on key-presses
Commit 2cea115ddb "fixed" the selection
by hooking into mouseRelease events. An unintended consequence was
that scrolling with the cursor keys didn't update the current dive.

Therefore, also hook into the corresponding key-press events.
This is just horrible, but I'm not aware of any possibility to fix
it properly.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:23:53 -08:00
Berthold Stoeger
d6114fc37e mobile/filter: derive numShown from a new Q_PROPERTY
The number of dives was updated when the model of the list was
changed. Since we removed the multi-threading, the model is
not disconnected/connected anymore and therefore we don't get
the appropriate signal. Instead of introducing a different
signal, make the shown-value a Q_PROPERTY. Thus, we can easily
send a changed signal if we have to.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
6f2a6fef14 CHANGELOG.md update
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
4cff23ef7a mobile: remove filter settings
These are not used anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
eed4e2746d filter: don't search in background on mobile
I experienced weird crashes that seemed timing-related when
using the filter. Therefore, remove the multi-threading thing.
So far no more crashes, but keep a close eye on that.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Dirk Hohndel
b5a427c880 mobile/filter: use more appropriate placeholder text
This way it matches the filter mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
e0766aa4bd filter: introduce people- and tags-filtering in the mobile UI
Add a combo-box where the user can switch between "fulltext",
"people" and "tags" filtering. Connect the combobox to the
already existing filter-code.

Dirk: make combo-box smaller by using a smaller font and restricting
the width. Setting both maximum and preferred widths gives more
consistent results.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
c1e33aac21 filter: implement searching for tags and people in mobile filter
Implement tag- and people-filtering in the mobile version of
DiveFilter. As opposed to the desktop version, this has no
different modes: it always searches "startswith" and "all of".
I.e. all of the search strings must match and a tag / person
is considered as matching if it starts with the search term.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
f3a3d93b85 filter: remove diveContainsText()
This function checked a dive for a search string. Its functionality
was replaced by a fulltext index.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
8cb43ed237 filter: use DiveFilter on mobile
Use the DiveFilter class on mobile to update the filter. This
is mostly for convergence of the mobile and desktop models.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
fd7dd5421b filter: implement full-text filtering in mobile version of DiveFilter
In analogy to the desktop version, use the fulltext index in
DiveFilter. This code is not yet executed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
e754b2df84 filter: remove DiveFilter::updateDiveStatus from class
This function did not access any class members and was not used
outside the tranlation unit. Let's make it local (i.e. static)
to the translation unit.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
78405c7265 mobile: remove DiveListSortModel::getFilterString()
This member function was never used.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
5bbc0fdb58 filter: compile fulltext index on mobile
The code is not used yet.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
2c038a24b0 filter: fix tab-order of filter widget
This was basically random.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
3103ca89d9 filter: on show focus on fulltext-field
After pressing CTRL-F let the user immediately enter a search
string.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
2bd4c6f6ec filter: connect fulltext filter to frontend
There are now three filter modes:
1) Dive site
2) Fulltext
3) Normal

When doing a fulltext search, get the dives that match the
fulltext filter and then apply the other filters on that list.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
68d6a75ea3 filter: add fulltext field to filter widget
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
d3f6e032cc filter: index/unindex dives on loading or clearing logs
When loading dive data, populate the fulltext index. When clearing
dive data, free the fulltext index. When deleting a dive, remove it
from the fulltext index.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
6434ad2628 filter: add fulltext filtering code
Add code that indexes all words of a dive and provides searching
for words.

A query is represented by the FullTextQuery class, which can be
initialized by assigning a string to it. It is basically a list
of words.

The result of a search is stored in the FullTextResult class,
which is a list of dives.

The actual indexing and searching is implemented in the FullText
class. However, this class is not exported because the interface
is partially accessible to C. Notably, the reloading of the
fulltext index is done from the C core.

Currently, the indexing and searching is totally unoptimized.
In a ~4000 dives test-log searches typically took single-digit
ms times. There is ample room for optimization (e.g. when
searching for multiple words, chose the words with few dives
first and when down to a few dives, check them individually).

The words of each dive are tokenized and uppercased and
cached with the dive. A pointer to these words is stashed
in the dive structure.

For now, compile only on desktop.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Berthold Stoeger
41aae1aebe filter: move StringMode out of FilterData
The FilterData struct has the enum StringMode, which describes how
strings are searched (substring, startswith, exact). To make it
more generally accessible, remove it from the class. Since it is
an "enum class", the values don't pollute the global namespace anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
Dirk Hohndel
34549c4cc3 Update libdivecomputer
Pull upstream libdivecomputer updates from Jef Driesen:

     - fix lack of "end of deco" on DiveSystem iDive computers by reporting
       long NDL values

     - clean up handling of Oceanic empty logbugger

     - fix BLE download for Oceanic Pro Plus X that doesn't like the serial
       number handshake.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-28 09:48:13 -08:00
Berthold Stoeger
3f4d9fa975 cleanup: remove preferences-other-icon
No user of that.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28 08:16:41 -08:00
Berthold Stoeger
41a9dd1519 cleanup: remove advanced.png icon
No user of that.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28 08:16:41 -08:00
Berthold Stoeger
08debcaef1 cleanup: remove gaschangeICD icon
No user of that.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28 08:16:41 -08:00
Berthold Stoeger
32d24fa21c cleanup: remove scale.svg and scale.png icons
No users of those.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28 08:16:41 -08:00
Berthold Stoeger
c63fc40c25 cleanup: remove go-top.svg icon
No user of that.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28 08:16:41 -08:00
Berthold Stoeger
d05c946d92 cleanup: remove two unused icon-aliases and one icon
There were no users of these...?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28 08:16:41 -08:00
Berthold Stoeger
3e9b661c22 cleanup: remove setTabIcon() calls in MainTab
These were used to remove warning-icons to mark tabs with user
changes. However these icons haven't been set since commit
a86aca0378.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28 08:16:41 -08:00
Berthold Stoeger
f1e1a9634a cleanup: simplify string-comparison in CylindersModel::setData()
Convert to QString instead of a QByteArray. Use qPrintable()
instead of data(). This might do one more UTF16->UTF8 conversion.
However, this is completely irrelevant, since we don't change
the type of a cylinder in a tight loop.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28 08:12:26 -08:00
Berthold Stoeger
ee1c438d41 cleanup: fix leak in CylindersModel::setData()
The C-string cyl->type.description was set without the old data
being freed. Free the old string before overwriting the pointer.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28 08:12:26 -08:00
Berthold Stoeger
f55c15e5f9 cleanup: make CylindersModel::cylinderAt private
The last outside use of the function was replaced by calls
to data().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28 08:12:26 -08:00
Berthold Stoeger
cb80ff746b crash fix: Don't cast to CylindersModel or CylindersModelFiltered
The tank-info-delegate cast its model to CylindersModelFiltered,
since this is what the equipment-tab uses since implementing the
filtering of unused cylinders. However, the planner users the same
delegate and still uses the unfiltered CylindersModel. This means
that the (dynamic) cast returns a null pointer and crashes.

One possibility would be to derive CylindersModelFiltered and
CylindersModel from the same class that defines virtual functions
and cast to that class.

This is a different attempt: don't cast (i.e. stay with a
QAbstractItemModel and play it via Qt's model-view system. Firstly,
replace the passInData function by a role to setData(). Secondly,
read the working-pressure and size via new columns using data().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28 08:12:26 -08:00
Dirk Hohndel
9214bdb3c5 documentation: additional explanations around Windows USB drivers
This is adapted from a conversation with Jef.

Suggested-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-27 14:57:59 -08:00
Berthold Stoeger
fb18bc0803 cleanup: don't update tabs twice in MainTab::rejectChanges
The updateDiveInfo() call updates all tabs. No need to do
it right afterwards.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-27 14:49:01 -08:00