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>
This isn't perfect, but at least tells the user if we weren't able to
connect and are working just off the local cache.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We can't build with -DNO_MARBLE after some previous commit broke
globe.cpp
- centerOnCurrentDive() is still existing in the code while removed from
header in 6b81fb49d0.
- Some referenced to MainWindow::instance()->globe() even if we are
building with no marble.
- include stdint.h
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If we added two dives, and then tried to edit
the first added one, the current 'added dive'
set on main_tab would be the second one, so when
we got to the accept() part of the call, it would
reselect the last added_dive that we had.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We were relying in the current_dive to display the
globe coordinates correctly - but this is not always
the case: you can be inserting a new dive site and it
isn't yet inside of the dive until the user presses
accept. So always pass the uuid of the dive site that
we want to display.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Connect the signals and slots so we can use the stuff I programmed.
Sorry for the noise on the patch - most of this is whitespace
fixes done by the QtCreator.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This method was written a long time ago, now we need to use the new
versions of it.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When setting a dive, we fire the dive site change a few times after the
index of the QComboBox is changed; we don't need that - fire just once.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Clear was the right method to call when we used a line edit, and the line
edit didn't had a model to provide data. Calling clear() on a QComboBox
will delete all itens inside of it, and what we wanted was to choose an
invalid index - and that's -1
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code was commented out when I started to port the locations to new
code, and it's harmless to remove it now.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>