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>
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>
Just because we want to update the latest information on the Notes tab
doesn't mean we are done editing.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
After an edit when the dive is redisplayed we are not copying the data
from current dive back over displayed dive (as the reasonable assumption
is that we just edited the displayed dive and copied the information into
the current dive)- so make sure that after the dive site handling the
displayed dive does in fact have the correct dive site information.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When we download GPS data from the webservice we can end up with dive
sites that are simply a place holder for the the GPS fix. If we replace
the name of one of those sites we should just delete the site (assuming it
isn't used in another dive, which is unlikely but theoretically possible).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- do not create dive sites unless the user has accepted the changes
- all modification are tracked in the displayed_dive_site
- when the user accepts the changes, the real dive site list (and the
selected dives) are updated according to what is in the
displayed_dive_site
This adds quite verbose debugging messages and disables a section of code
that has a special case for data created by the Subsurface web service.
This code needs some re-thinking and should eventually go away.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The way a QCompleter works is that it grabs whatever
data it has in the completerRole and sets it back on
the line edit.
I Bypassed the QCompleter delegate to show something
other than the completerRole (so, for instance, if you
write 'B', you could get 'Blue Hole' as the returned text,
but in fact the QCompleter has the 'B' as internal string
(because of the weird - and wrong way in which we are
dealing with completion - trying to complete for something
that's not inside the model yet).
So I hooked up a signal that will listen to the complete's
index, and if it's the first row() it's surely the special
case - then we bypass QCompleter return string and use
our own.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Do not overwrite a dive site if the name is the same
as any other dive site, create a new one and duplicate
the information.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Hooked up an eventFilter on the QListView that displays our dive sites so
it would filter the keys enter and space, storing the current dive_site
uuid when that happens.
Also it stores the uuid on clicks.
Now we need to get that information when processing acceptedChanges() and
check if the uuid stored there == displayed_dive_site.uuid and also if
text != displayed_dive_site.name, because if the user didn't click on
anything but only wrote stuff on the LineEdit no dive site would be
selected and so uuid == displayed_dive_site.uuid (wich would mean 'no
changes')
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This teaches the edit divemode about the fact that we can have multiple
dc's with different divemodes. The previous code always just edited the
first dc.
This was reported by Ian Pitt in:
https://groups.google.com/forum/#!category-topic/subsurface-divelog/4Zf47KS4Ifk
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For some reason the completer wouldn't show the delegate if the line order
of the code was different.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
At least my compiler warns about ! binding stronger than == and
thus comparing a bool to an int. I guess this is what was meant.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
No point in searching for the right tag if the user picked no taxonomy to
be shown. And no point in showing an empty value, either.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
A bit more complex than I tought it would be (and a ton of trial
and error to find the right spot on the delegate to draw stuff)
this delegate follows the current style (so it should be okaish
on a dark and on a light theme)
This is supposed to work on a QCompleter, but it doesn't (I really don't
know why, so maybe I'll remove that completer. sigh.)
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a functional but hard to expand model for the dive sites.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This isn't perfect - I'd like to have them show behind the word Location
instead as what we have now creates movement in the position of the fields
on the screen which I think is distracting.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If we download dive site locations from the companion app we can be
slightly smarter if the user overwrite the location feel on the Notes tab.
We can be pretty sure that they wanted to keep the GPS location and just
correct the dive site name (or possibly assign that location to an
existing dive site).
This tries to accomplish that.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't erase the trip information after the user started editing it.
Don't act as if a dive was edited - it's trip information we are
modifying.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I had to create an event filter to deal with the missing callbacks from
QPlainTextEdit (it doesn't support editingFinished()).
Also we need to manually create a dive site on a newly added dive if the
user entered one.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This doesn't work yet because we don't get the taxonomy from the geo
referencing services yet - but it's ready to be populated.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Hopefully we now have the UI semantics figured out.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Free memory returned from parse_mkvi_value()
Free memory returned from printGPSCoords()
Free memory allocated in added_list and removed_list
Free memory allocated when adding suffix to dive site name
Free memory allocated in cache_deco_state()
Free memory allocated in build_filename()
Free memory allocated in get_utf8()
Free memory allocated in alloc_dive()
Free memory allocated as cache but never used
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This was a poorly implemented hack when we executed the reverse geo lookup
in the main thread and opening a V2 file could take a very long time. We
need to do the "Welcome" message quite differently.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>