Commit graph

844 commits

Author SHA1 Message Date
Dirk Hohndel
f5411b7d68 Desktop/settings: hook up button to clear remembered DCs
And at least admit that the reset settings button isn't hooked up at all.
OOOOPS.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Dirk Hohndel
b5fe44bb87 Desktop/settings: add button to forget remembered dive computers
This isn't hooked up, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Dirk Hohndel
0d7c1e9918 Desktop/remember DCs: avoid highlighted button
On macOS the first of the four DC buttons was highlighted for some reason.
Explicitly setting autoDefault to no solved that problem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Dirk Hohndel
413b05ab89 Desktop/remember DCs: move non-UI-specific code into the core layer
This way we can use the same functionality from the mobile UI as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Dirk Hohndel
4eb8ed1b29 Desktop/remember DCs: hook up the shortcut buttons
The straight forward code to update the currentIndex of the combobox doesn't
appear to work on macOS (but works fine on Linux). Calling the event loop and
then calling update afterwards seems very unintuitive, but it appears to fix
the issue in my testing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Dirk Hohndel
99261775ce Desktop/remember DCs: remember dive computers that were used
The algorithm tries to keep the order of the buttons the same. So if a dive
computer was used that's already remembered, don't reorder the buttons. But if
a new dive computer is used, add it as the first one and move the others back,
potentially dropping the oldest one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Dirk Hohndel
e2ee8c57df Desktop/remember DCs: base UI
Simply create the buttons that can be used as shortcuts to previously used dive
computers. This isn't hooked up at all.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23 11:49:30 -07:00
Berthold Stoeger
21b1550739 Dive media: on import read metadata only once
On import of dive media, the timestamp is read from the
metadata to check if the image belongs to the selected dives.
The pictures are then listed in a dialog.

Currently, the metadata is read twice if images are outside
of a dive: once in picture_check_valid() and if it turns
out that the picture is not valid again in picture_get_time()
to display the proper timestamp.

Even though metadata-extraction is reasonably fast, this is
a bit of an embarrassment.

Instead, read the timestamps only once in the constructor of
the dialog and from then on only used these timestamps. Keep
the timestamps in a QVector. Rename the picture_check_valid()
function to picture_check_valid_time() and pass a timestamp
instead of a filename.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-19 14:44:34 -07:00
Jan Mulder
7efcb0594c Desktop UI: small layout correction export dialog
2 UI items where poorly aligned. Fixed here.

Reported-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-16 08:07:33 -07:00
Tomaz Canabrava
7319b50a5d code cleanup: replace lring with file local function
And simplify the code.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-15 15:51:26 -07:00
Tomaz Canabrava
77d7e550fe code cleanup: no need for default if we test every case
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-15 15:51:26 -07:00
Tomaz Canabrava
7ab35f7858 code cleanup: use ByteArray.size() instead of strlen
Removes a size_t vs int warning

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-15 15:51:26 -07:00
Tomaz Canabrava
00ef514da3 code cleanup: pre-calculate the test and pass it directly
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-15 15:51:26 -07:00
Tomaz Canabrava
6d552d61b9 code cleanup: allocate the vector in one go
The << alternative can reallocate the vector, but we know it's size, so
preallocate.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-15 15:51:26 -07:00
Tomaz Canabrava
858740e8a1 code cleanup: simplify if / else chains
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-15 15:51:26 -07:00
Tomaz Canabrava
9e6a3bee0d code cleanup: remove allocations
Simply create the string in one go.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-15 15:51:26 -07:00
Tomaz Canabrava
2d6633eee0 code cleanup: use nullptr in C++ files
Using 0 or NULL are C idioms.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-15 15:51:26 -07:00
Tomaz Canabrava
17a6f28827 code cleanup: unamed namespace instead of global or static variables
Unamed namespace behaves the same way as static variables in C source.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-15 15:51:26 -07:00
Tomaz Canabrava
3b4877a073 code cleanup: sort headers alphabetically
This was driving me nuts.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-15 15:51:26 -07:00
willemferguson
809471fe4d Update the dive list context menu to reflect new media interface
A minor change to the UI. The wording of the two items in the dive
list context menu "Load image(s) from file(s)" and "Load
image from web" are updated since we now deal with both images
and videos. So it becomes "Load media from file(s)".... etc.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-15 07:20:55 -07:00
Jan Mulder
d16bcd8978 Desktop: remove "edit dive" from log menu
Nowadays, we edit dives just by starting to enter data for the dive.
There is no need to explicitly ask to start editing the dive, using the
now removed menu option. This was a left-over of a long past history.

This is fallout from PR #1673.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-14 13:18:42 -07:00
Dirk Hohndel
313351c396 Add Q_OBJECT macro to two more classes
These also showed up as concerns when creating translation strings.
Adding them thankfully didn't create new strings, but not having them
potentially leads to incorrect runtime behavior.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-14 11:55:24 -07:00
Jan Mulder
5133a38d25 Desktop: disable UI elements that make no sense during editing
As described in the referenced issue, we where able to navigate to
nonlogical static pages (like information, statistics. extra data) when
adding a dive. These are output style pages that make no sense on
edit or add. Further, disable access to some pages when entering edit mode.

Notice that the small change in file mainwindow.cpp is simply
because this this not work at all, and became superfluous any
way.

Fixes: #1445

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-14 10:00:54 +02:00
Robert C. Helling
afe363fa85 Optional anonymization upon export
Add a checkbox that triggers replacement of all English characters by
x's in notes, buddy, dive guide and (while we are at it) suit.

This is ment for people sharing logs for debugging that are concious
about privacy issues. It leaves the lenth of strings in tact as well
as special charcters as those might be needed to track down a particular
parsing problem.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-09-13 08:16:54 -07:00
Berthold Stoeger
31f1af07c2 Planner: fix display of "overlapping dives" message
1) Add a missing <div>

2) More importantly: recognize html content via <div>-tags instead of
   <table>-tags.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-12 14:17:55 -07:00
Stefan Fuchs
56fda691ec Fix broken translations in dive list filter plus simplify strings
Fix some broken translations in the dive list filter UI by adding
Q_OBJECT line to the class definitions of filter classes.

Plus simplify some strings given to translation by separating parts
like ": ".

Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Suggested-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-09-12 10:24:48 +02:00
jan Iversen
a037578015 core/settings: change bestmixend to int, to allow qml to work
depth_t is a good struct in C, but bad in QML.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11 17:25:00 -07:00
jan Iversen
2385f48c6a core/settings ... : remove qPref* includes in qPref.h
reduce number of includes by removing qPref* includes in qPref.h

Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11 17:25:00 -07:00
jan Iversen
684e334fb6 core: declare cloud_status in qPrefCloudStorage
qml declaration of cloud_status (defined in pref.h) does not
belong in qPref.h but in qPrefCloudStorage

Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11 17:25:00 -07:00
jan Iversen
1a130ec461 desktop/profile-widget: update signal from _changed to Changed
Update connect calls to use Changed from qPref, due to QML demands

Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11 17:22:58 -07:00
Dirk Hohndel
2b3f6c607b prefs: cloud_new_password is not a preference
It's a mamber of the cloud storage authentication class, used to hold the
proposed new password until the backend has accepted it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-10 16:26:49 -07:00
Dirk Hohndel
ae653703a5 prefs: git_local_only is not a preference
It's the current state of the app, so it should be a global variable, not a
preference.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-10 16:26:49 -07:00
Jan Mulder
876e6adf74 Desktop: Remove webservice, remove UI components (2)
Actually remove the Subsurface webservice UI from the source, and
deal with all the fallout.

Notice that a part of the change in subsurfacewebservices.cpp is
a block of code that becomes unused, but might contain some valid
logic to be used later. Very similar code is in core/gpslocation.cpp.
And as I earlier broke something here, the unused code is ifdef-ed for
now.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-09 18:28:08 -07:00
Jan Mulder
90fb34baab Desktop: Remove webservice, remove UI components (1)
The very first part of the full removal of the GPS webservice. This
removes the UI artefacts and a tiny bit fallout. This leaves in place
all the background processing.

Be very careful here as this can break workflow of users that currently
have unapplied GPS coordinates sitting in the webservice, and do upgrade
to the version where this commit goes in. They have no clean UI way any more
to apply those GPS fixes from the desktop.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-09 18:28:08 -07:00
Berthold Stoeger
2bd0c2143e Cleanup: constify get_units()
get_units() returns a pointer to the units struct in the preferences.
Callers should not modify the preferences via this struct, therefore
make the return value point to const.

This is a small step in constifying the global preferences structure.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-07 11:03:30 -07:00
Jan Mulder
12789a3f9f Desktop: buddies in the dive list
As proposed in RFC #1587, now also alllow buddies to be shown in the
divelist.

Fixes: #1587

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-04 15:02:07 -07:00
Dirk Hohndel
0ef145337a Desktop: allow using a file dialog to find Garmin folder
If we don't auto-detect where the Garmin Descent is mounted, the user
can either just type in the correct path, or can use a file diealog to
specify it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-01 17:46:19 -07:00
Dirk Hohndel
23067e5dd8 Desktop: fix warnings when building preferences UI
Fixes #1618

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-01 08:13:24 -07:00
Berthold Stoeger
89e0c3f464 Cleanup: make DiveTripModel a global object
DiveTripModel (the model describing the dive-list) was destroyed
and recreated on every reset of the list. This seems excessive.
Instead - in analogy to most other models - make it a single
global object.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-01 07:48:43 -07:00
Berthold Stoeger
b1fb578eb9 Filter: remove diveSiteAdded signal of MainTab
Signals can be useful. In this case, a simple function call does
it. Thus, remove the signal. It can be readded later at an more
appropriate place.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-31 07:48:23 -07:00
Berthold Stoeger
156e053050 Dive trips: don't crash on repeated trip-removal
In the UI it is possible to remove a dive from a trip twice,
which leads to a crash, because trip is NULL (obviously).

Instead of doing a proper fix (don't show the "remove from
trip" entry in the first place), ignore dives without a
trip, since a rewrite of the undo-code is planned for the
medium future anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-29 21:38:48 -07:00
Dirk Hohndel
2d87a657d2 Revert "desktop-widgets: remove QSettings from desktop-widgets"
This reverts commit 321a920a98.

It appears that the load_xxx functions aren't called, so while the correct
values are stored to the settings, they aren't retrieved. Let's revert while
this gets fixed.

Fixes #1609

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-29 03:09:10 -07:00
Dirk Hohndel
edfecfad81 Cleanup: we don't support configuring a Uemis SDA
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-28 12:03:03 -07:00
Linus Torvalds
270e9eccad Make device enumeration use the device transport data
This removes some special-case code for Uemis, replacing it with simply
passing in the device transport information.

This makes device enumeration work for the Garmin Descent (if it is
listed by libdivecomputer as a USB storage device, that is).

I don't actually do any of the libdivecomputer parsing yet, and only
have a stub for the Garmin Descent, but now the directory selection
works with that stub. The actual download obviously does not.

[Dirk Hohndel: removed obsolete FIXME from code]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-27 22:10:38 -07:00
Jan Mulder
cae30f450a Show new firmware notice for OSTC Plus
Also show a new firmware notice for a HW OSTC Plus. This appeared
to be broken (as can be verified on the current master from today,
as HW just released version 2.98 of the firmware).

Notice that there is some confusion in both Subsurface and
Libdivecomputer with respect to types of OSTCs. Physcically,
there exist 2 type of OSTC3's. The first edition with
only DC_TRANSPORT_SERIAL (and an USB connector), and a second
version that lacks the connector but supports both BT and BLE.
Confusingly, the second version is marked OSTC3 on the device,
but the user needs to select OSTC Plus (which is basically a 3rd
version of the OSTC3, combined with a successor of the OSTC Sport)
to download dives using BT/BLE.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-08-27 17:41:09 -07:00
Lubomir I. Ivanov
449782a892 divelistview: always show at least one column
Currently it is possible to hide all columns by unchecking them
in the context menu that appears by right clicking the header
of the divelist. But once all are hidden the header disappears.
This can cause a situation where the user cannot show any
columns and the only fix for that is to edit the application
configuration.

To avoid this sutuation prevent the last column from being hidden.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-08-26 23:08:24 -07:00
Lubomir I. Ivanov
5aa55e7ed5 modeldelegates: use font metrics for dive list row height
Include font metrics as part of the height in DiveListDelegate::sizeHint().

When 22px is hardcoded, this handles small fonts, but for larger
fonts it seem that the bottom of the dive list row text is cut
on Windows.

Keep 22px as the minimum size hint, but for larger fonts
use QFontMetric::height().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-08-26 23:06:00 -07:00
jan Iversen
321a920a98 desktop-widgets: remove QSettings from desktop-widgets
The variables referenced are moved into qPref in earlier commits
so in general all QSettings calls are replaced by qPref*:: calls

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00
jan Iversen
c85f5c560c desktop-widget: remove QSettings
Update desktop-widget to use qPrefDisplay (amended variable)

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00
jan Iversen
ebc0e6d3f3 core/tests: merge Animations and add vars. to qPrefDisplay
Add class variable tooltip_position to qPrefDisplay
Add class variable lastDir to qPrefDisplay
qPrefDisplay is updated to use new qPrefPrivate functions
Adjust test cases incl. qml tests

qPrefAnimations only has 1 variable, that really is a display variable
Merge the variable into qPrefDisplay, to simplify setup (and avoid loading
extra page in qml).

correct theme to save in correct place, and make it a static
class variable

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-25 11:49:47 -07:00