Commit graph

527 commits

Author SHA1 Message Date
Tomaz Canabrava
e49d6213ad Move qt-ui to desktop-widgets
Since we have now destkop and mobile versions, 'qt-ui' was a very
poor name choice for a folder that contains only destkop-enabled
widgets.

Also, move the graphicsview-common.h/cpp to subsurface-core because
it doesn't depend on qgraphicsview, it merely implements all the
colors that we use throughout Subsurface, and we will use colors on both
desktop and mobile versions

Same thing applies for metrics.h/cpp

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Giorgio Marzano
44bdcffcd4 Display divetime according to dive mode and translation
Many time stats in maintab display also seconds in short freediving

Signed-off-by: Giorgio Marzano <marzano.giorgio@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-18 17:37:49 -07:00
Robert C. Helling
dbd07af59f Mark dive type list for translation
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-14 13:15:40 -07:00
Lubomir I. Ivanov
4ed418dcc2 Fix font issue on Windows 10 in the weight widget
Column headers were drawin in a smaller font. This fixes it for no
apparent reason.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08 11:52:37 +01:00
Dirk Hohndel
37445df0b9 Clear date and time when no dive is shown
So far we showed bogus date and time - whatever time it might be in UTC at
midnight 2000-1-1 in your timezone. Instead we now show a discrete little
"-" in both fields.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08 07:38:26 +01:00
Tomaz Canabrava
2eed9c0b9b Move the algorithm to divesite.cpp file
This shouldn't be on the maintab.cpp, this file is already too convoluted.

[Dirk Hohndel: slightly refactored this commit and the next one to make
               the code actually work and make the split across the two
               commits more reasonable]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08 06:27:38 +01:00
Tomaz Canabrava
786f164046 Be way more carefull when copying dive site
I don't know how I was not shot regarding on how broken the
old behavior was.

The new behavior:

1 copy the old_dive_site on top of the current_dive_site
  only if the current_dive_site was actually a new uuid,
  created by that method.

2 if the current_dive_site is an existing one but it doesn't
  have gps coords, copy only the gps coords.

This fixes existing dive sites copying notes and coordinates
from the old_dive_site.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 21:17:03 +01:00
Tomaz Canabrava
20f8c89d64 Remove unused code
This was needed when maintab had to thinker every little aspect
of the dive site selection, which has not been necessary for quite
a while.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 21:15:51 +01:00
Tomaz Canabrava
6979ebfdae Make dive trip location edit work again.
:D

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-01 18:01:34 -04:00
Tomaz Canabrava
d25e456fcc Hide trip location when launching Subsurface
It was ugly to show trip and dive location when no dive
was selected.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-01 18:01:22 -04:00
Tomaz Canabrava
3548d11195 Update the dive site location when editing
Simple.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-01 18:01:15 -04:00
Tomaz Canabrava
db97f33e13 Add a new QLineEdit to set the dive trip location
This is different from a dive site, as it's not a dive site. It's just a
normal string, while a dive site has gps coordinates.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-01 17:59:44 -04:00
Tomaz Canabrava
cbf02ac7ab Fix multi-dive edit regarding Dive Sites
Now it correctly sets the same dive site instead of
creating a new one for each dive.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-30 19:28:55 -04:00
Tomaz Canabrava
0847447cda Make 'Choose dive site' work as 'Rename'
But it will actually create a new dive site, not just rename the existing
one.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-30 19:24:38 -04:00
Tomaz Canabrava
2794af4166 Remove unused code
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-30 19:24:27 -04:00
Dirk Hohndel
aedbde1e86 Delete unused dive sites after edit
This way they don't continue to clutter the globe.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-29 20:58:57 -04:00
Dirk Hohndel
1b8ac21f6b Correctly handle updating the name of dive sites from GPS
If the user downloaded the GPS data from the Subsurface webservice before
naming a dive site, we run into a special case where entering a new name
for a dive location should just update the name of the automatically named
site which already has the correct GPS information.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-29 20:10:29 -04:00
Tomaz Canabrava
64453893a0 Do not set text on the Location LineEdit
Since the location is only true with a valid uuid, set the
uuid on it, it will search for a valid name and set there.
this fixes a few inconsistencies handling  the locations.

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
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
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
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
Tomaz Canabrava
d59e89e569 Make Facebook more user friendly
The current way that facebook works is terrible: it's scattered
around tons of files ( at least 4 different files and classes )
this moves things around a bit, add a disconnect button that
was missing, cleans tons of code and fix inconsistencies.

I will also redo this part for 5.0, but it's too late for 4.5

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-16 21:16:58 -07:00
Dirk Hohndel
c41810e5a5 When editing a manually added dive, correctly update max depth
The fixup_dive() function assumes that values that are set already in the
divecomputer and dive structures come from a reliable source - sometimes
dive computers are able to track a maximum depth continuously, so that
value can be larger than the deepest sample and we need to honor that.

But in the case of a manually added dive, the samples define the dive. So
in this case we need to reset the values that were calculated when the
dive was first added so that the user can then edit the dive and reduce
the maximum depth reached in the profile and have that reflected in the
dive list.

Fixes #926

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-11 10:54:05 -07:00
Sander Kleijwegt
d22a135343 Fix edit & show of divesites for new and existing dives.
The UI detects when it should refresh the loction after the
user finished editting a divesite. Creating and editting
divesites is now working even when the current dive is not
saved yet.

Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-29 20:10:32 -07:00
Sander Kleijwegt
9770369889 Always show the dive site edit button
Update the tooltip and enable only when there is a divesite selected

Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-28 16:16:05 -07:00
Sander Kleijwegt
67abcd0c2c Fix mouse clicks on divesite completer.
Use clicked instead of activated signal on the completerList to
handle the selection of a divesite.

Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-28 16:15:25 -07:00
Tomaz Canabrava
b8a09ca520 Keep the dive list disabled if editing a dive
When, in a dive edit mode user entered a dive site
and went to dive site edit mode then finished the ds
edit, the app would lose the disabled property of the
dive list, making it possible to select a new dive
when we where editing another one, complete mess.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 18:00:26 -07:00
Tomaz Canabrava
fc6d819616 Create a new dive site and edit it automatically
If the user clicks on the first or second option of the drop
down list, subsurface will move him to the dive site edit panel
automatically, since it's a new dive site and there's no information
about it yet.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 18:00:15 -07:00
Tomaz Canabrava
0ba832ef12 Move dive site list to its correct position
When we are in display dive mode, and then edit the
location text edit, going to edit dive mode, the location
text edit will be moved a bit below of it's original position
but the Dive Site List would be already opened, and stuck
on it's original position, covering the dive list.
This patch fixes that.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 17:59:25 -07:00
Tomaz Canabrava
03702edf87 Get taxonomy from edit dive site widget
Moved the get taxonomy button from the maintab to the edit dive site
widget.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 17:58:59 -07:00
Tomaz Canabrava
aaa70ff56e Turn the get taxonomy button into a manage dive site button
The get taxonomy button will be inside the manage dive site interface.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 17:58:46 -07:00
Dirk Hohndel
e03b553e80 Make created dive site uuid deterministic
Having random uuids seemed like a good idea, but there are several
situations where they really cause problems. One is merging dive file
imports from V2 logfiles. Another is testing such imports.

Instead of making the uuid random we now hash the name and add the
timestamp of the first dive associated with this dive site to the hash
(first in this context is "first encountered" with no guarantee that it is
the chronologically first). This way V2 imports create deterministic uuids
but uuid conflicts are still extremely unlikely, even if the user has
multiple dive sites with the same name.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:43:48 -07:00
Robert C. Helling
260ea879e5 Make debugging cleaner
Don't try to connect the globe when NOMARBLE is active.

Check exisistance before trying to open an image file.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-03 22:19:36 -07:00
Tomaz Canabrava
7efa924067 Transform GlobeGPS in a static instance() class
This is needed to start easing the transition from the completely
wrong and bogus MainWindow::instance()->globe() calls. this is still
wrong, but with it I removed one level of indirection.
I did that now because I wanted to not taint the location management
when I use it to deal with the globe.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-31 10:28:17 -07:00
Tomaz Canabrava
9130ff8a97 Correctly update the dive when the user edits dive_site
We didn't correctly update the dive site as soon as the
dive_site edit finished, and this time we are actually
correctly updating things using signals instead of calling
the mainwindow for everything.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-31 10:27:16 -07:00
Tomaz Canabrava
0a473b3a2a Fix mouse interaction with the Location List
paint methods should be used only to paint, not to trigger other
widget behaviours ( we could got ourselves into a bad recursion
bug from that ). Also, enabled mouse tracking to correctly track
the mouse movement inside the widget.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16 18:34:22 -07:00
Dirk Hohndel
076f86202a Change API signature to act on dive_site, not uuid
This way in the future we can pass in a pointer to a dive site that isn't
linked in our dive site list yet (i.e., while we are editing).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16 12:41:04 -07:00