Commit graph

3871 commits

Author SHA1 Message Date
Tomaz Canabrava
94d05d1cb6 Do not try to center if already on center
This makes the globe smoother while moving around same gps
dive sites.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-27 06:43:18 -04:00
Tomaz Canabrava
1239056fb6 Center on the dive site also via keyboard
Now mouse and keyboard navigation over the list of current
dive sites will update the marble globe position.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-27 06:43:18 -04:00
Tomaz Canabrava
6633ab302d Change globe position when mouse over dive site
When the mouse moves over the dive site list, the globe
should show the current one under the mouse.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-27 06:43:18 -04:00
Tomaz Canabrava
a5d2003e3a Only get the icon for add/geocode once
Each time we searched for an icon on the qt resource
we had to open, inflate, create, store, delete the icon.
now we search for it only once, use as cache and make
the world a better place.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-27 06:43:18 -04:00
Anton Lundin
07b4bdd1b3 Reset progressbar on disconnect
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-25 09:56:58 -07:00
Anton Lundin
117de891c7 Disable update firmware button on any other action
Firmware updates can only be done on a newly opened device.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-25 09:56:51 -07:00
Anton Lundin
8946c82242 Probe and expose OSTC3 model information
This looks at the OSTC3 hw descriptor and exposes that model info as a
read-only line edit, so you can see in clear text the name of the model
of computer.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-25 09:56:11 -07:00
Anton Lundin
94a86df9a3 Rename Suunto config field to be consistent
All the conflicting fields for suunto vyper configs are named _1, so
rename this one to be in the same style.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-25 09:55:33 -07:00
Gaetan Bisson
24471cfd0d Initialize currUuid
Signed-off-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-24 07:10:17 -07:00
Miika Turkia
9102f23b42 Add icon for georeference in preferences
It looks odd if one item is missing an icon. Thus suggesting (yet
another) placeholder icon for the preferences dialog.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 21:58:23 -07:00
Dirk Hohndel
d85a448ee8 Dive edit: if the user didn't pick a dive site, don't mess with it
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 20:03:53 -07:00
Dirk Hohndel
6ee2a44235 Merge branch 'NewLocationEditDropdown' 2015-09-23 14:18:40 -07:00
Tomaz Canabrava
483320a0c0 Disable edit dive site if already in edit mode
If user selected a new dive site (a dive site that doesn't
exists yet, to be created) and clicked in edit it would edit
the *old* dive site. this is not optimal, but since it
removes a severe regression it will be like this (I won't
change it till 5.0) for a while, until I have time to
actually code something not messy for that.

The current dive location management is *much* nicer than
the old one, code-wise. No more magic numbers, magic codepaths,
magic constants, qt black magic. It's straigth-forward code
simple to follow, simple to edit.

This was something I was actually postponing for 5.0 but I
managed to get a boost of subsurface time at work.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:50 -07:00
Tomaz Canabrava
7426f18a96 Handles Dive Selection gracefully
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:50 -07:00
Tomaz Canabrava
ffae64ded7 Code cleanup
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:50 -07:00
Tomaz Canabrava
1e88982d6f Much simpler code to set the dive site
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:50 -07:00
Tomaz Canabrava
fec33cee93 Don't crash on new dive site
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:49 -07:00
Tomaz Canabrava
a9642d5751 Do not display popup with modifiers
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:49 -07:00
Tomaz Canabrava
d95856d3b2 Select an index if no index is selected
Defaults to first row.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:49 -07:00
Tomaz Canabrava
cc6967b53c Set the correct dive site uuid
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:49 -07:00
Tomaz Canabrava
5b3d52acec Correctly fix the popup position
When the message to 'This dive site is being edited' was
being show while the popup to choose the dive site, the
line edit was being covered. now it correctly moves to
the correct place.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:49 -07:00
Tomaz Canabrava
d586970f31 Removed a ton of dead code
Unused dead code / hack for the old QCompleter

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:49 -07:00
Tomaz Canabrava
e4c0ee32cd Handle palette change for dive site selection
If you select a dive site with a different uuid than your
current dive.dive_site_uuid, you should get a different
pallete to state clearly that something changed.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:23 -07:00
Tomaz Canabrava
7d863b5c28 Fix keyboard inconsistencies
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:23 -07:00
Tomaz Canabrava
4b8eec6c58 Fix new/existing dive site choices
Only set the currType and currUuid if text changed.
This is needed because if you hit key_down it would
set NEW_DIVE_SITE because a keypress on the lineedit was
due.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:23 -07:00
Tomaz Canabrava
80b42bd28b Set the current dive site uid / text
Start to make this thing usefull: Upon selecting the current index
or writting something on the line edit, we need to set the dive site.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:23 -07:00
Tomaz Canabrava
4352412731 Correctly handle space and tab
Space and tab should select the item in the itemview and hide
it; enter and return also do that automatically.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:23 -07:00
Tomaz Canabrava
33a19328d8 Block focus out event
The line edit wasn't being properly updated regarding its
paint event. Turns out it was because it received a focus
out event and then stopped refreshing the paint.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:23 -07:00
Tomaz Canabrava
eb2c78e953 Random fixes and improvements
Whitespace fixes, constructor fixes, new slot (still unused)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:22 -07:00
Tomaz Canabrava
fdec250723 Whitespace fix
Sorry.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:22 -07:00
Tomaz Canabrava
dd21ab6b11 Fix correct size of the popup
Correct the popup visibility.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:22 -07:00
Tomaz Canabrava
317c3de91d Handle dive site activation
Connect the view activated signal to send us the index.
Removing debug output that I forgot inside it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:22 -07:00
Tomaz Canabrava
534e07399a Made it possible to keypress again
Click outside of the popup closes it, also handles theme
enter / return keys.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:22 -07:00
Tomaz Canabrava
fdd28fddf2 Start to handle keypresses
Keypress management is one of the main functions of the completer, so we
must create an event filter and hook things up properly.
key esq / enter should close the popup (and not leave us with a popup open
and no way to close it - it breaks X)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:22 -07:00
Tomaz Canabrava
c4c7e7a7f4 Display the popup in the correct place
The popup should be shown beneath the QLineEdit. this code here
is shamelessy stolen from the QCompleter source code because I
really didn't want to rethink the correct way of doing this.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:22 -07:00
Tomaz Canabrava
012e8ccb46 Re-add the 'plus' button on the delegate
This was missing in the delegate - now it's prettier.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:22 -07:00
Tomaz Canabrava
8c9a4ecd4b Stabilize the location model/proxy model
Since I removed the old location edit from the UI, I also need to
remove a bit of code from the UI that was calling it.

fix a few crashes regarding the old location edit.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:15:19 -07:00
Tomaz Canabrava
be6e190bd2 Skeleton of the new LocationCombobox
This is the bare minimum skeleton of the new completer for the dive site
management. Nothing works, yet, nothing is hoocked up, yet.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 14:07:07 -07:00
Dirk Hohndel
a30e78140f Hide a couple of debugging messages
They are useful to show when trying to figure out what's going on, so just
move them behind a check for verbose.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 12:20:21 -07:00
Dirk Hohndel
c9f72e510a Show progress bar when loading from cloud storage by default
It turns out that I forgot to make sure that the progress bar is shown if
the user has things set up so that the cloud storage is the default dive
file that they open.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 12:16:45 -07:00
Dirk Hohndel
48e47c9048 Windows XP doesn't contain a valid CA for our cloud certificate
This is the authentication check and cloud server availability check which
are different from the one git does. The mechanism for overriding things
is different from there, but this should work just as well.

We intercept the SslErrors signal and if we get the known good hash for
our certificate, we simply call it good.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-23 12:11:20 -07:00
Dirk Hohndel
e66f0895c6 Dive merging: make sure that the profile is redrawn
This uses the just introduced refreshProfile() function.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-22 19:59:58 -07:00
Dirk Hohndel
aeac5fcb6d Add refreshProfile member function to MainWindow class
While the whole idea of calling these functions through the MainWindow
instance is atrocious, until we change the architecture of all this
refreshProfile() is a useful function to have.

In order to make this cleaner to implement I allowed an argument to
ProfileWidget's replot() which allows picking a specific dive. By
defaulting this to 0 we get the previous behavior when calling replot()
without an argument.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-22 19:58:14 -07:00
Linus Torvalds
34da4801f4 Be much more careful about merging dives
This patch changes the dive merging to be much more careful about
things, because it turns out that we had several small oddities that
caused big merge issues.

The oddities are:

 - the dive "duration" is actually how long we spend under water.

   But that means that when we do "dive->when + dive.duration.seconds"
   to calculate the end of the dive, that is nonsensical if you came up
   to the surface in the middle of a dive.

   Now, normally you don't see profiles like that, but once you start
   merging dives together, it can go from "small detail" to "dominant
   factor".

 - We have two different cases of merging: the automatic "merge new dive
   computer download if it looks like the same dive" (which always has a
   merge offset of 0, since we merge it as a new dive computer) and the
   "merge two different dives into one longer dive.

   The code assumed that it could look at the "downloaded" flag for the
   dive to check one or the other, but that doesn't really work.
   Reading a dive from an XML file isn't any different from downloading
   it.

   So we need to change the logic to determine what kind of merge it is
   to actually check the passed-in time offset.

With this, Stuart Vernon's test-case of eight dives with short surface
intervals in between end up merging correctly into one dive.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Reported-by: Stuart Vernon <stuartv@force2.net>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-22 19:36:54 -07:00
Robert C. Helling
e644fe5d97 Fix image offset calculation
It seems this has never worked and nobody ever tested it. There was some
confusion with time zones since Qt takes by default local time when
converting from/to epoch while the exif library used UTC.

For my single test dive, this works now. But this needs more testing!!!

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-21 10:26:11 -07:00
Dirk Hohndel
04773705e3 Fix build error on Windows with Qt5.5
I'm not quite sure why this works, but it appears to do the trick.
Apparently you are supposed not to have the meta type declaration in a
shared header file. Also, with Qt5.5 you can't have the declaration for
QBluetoothDeviceInfo, not even on Windows.

This may need more tweaking to make sure it works on all combinations of
OS and Qt version.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-20 15:08:14 -07:00
Dirk Hohndel
06d6ca94f3 When calling save-as with cloud storage as default, pick sane filename
Passing the cloud URL to the file select box leaves "git syntax" in the
filename which makes us look for a directory with a git repository in it
and give non-sensical error messages to the user.

With this we simply use the users email address as local filename with a
.ssrf suffix.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-20 10:15:34 -07:00
Linus Torvalds
e4d2092f33 Uemis downloader: start downloading using the correct dive ID
The logic to pick the initial dive ID for the uemis downloader was very
confused, and did not work at all when restarting a download when the
Uemis filled up, and the "Force download all dives" flag was set.  It
also required a rather odd Uemis-specific callback from the download UI
because of how it picked the initial ID.

This changes the logic to just look at the list of downloaded dives when
restarting, which simplifies the logic a lot, gets rid of the odd
special callback, and also means that the whole "Force download" issue
just goes away.  It seems to work now.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-19 21:30:33 -07:00
Claudiu Olteanu
a319c42310 Rename BTH_ADDR_STR_LEN macro
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-19 09:43:33 -07:00
Claudiu Olteanu
89540e0fb2 Fix Bluetooth address truncation issues on Windows
On some Windows platforms when we convert a Bth address to a String
it is formatted as "(XX:XX:XX:XX:XX:XX)". Therefore we first try to
remove the round parentheses and finally we truncate the string
to 17 because there are 6 two-digit hex values and 5 colons.

Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-19 09:43:06 -07:00