The name of the dive site on the globe wasn't being
updated when we changed the name of it in the dive
management dialog.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If the current_dive was the same as the dive send to
the LocationInformation widget, we would do nothing,
wich is wrong because we could have filled the information
on an add_dive_site action and then cancelled it, so the
info will stay there until we change it.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We didn't save the uuid of the newly created dive site on the affected
dive.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Reject changes was correct only for Edit, but not for Add. When in add
mode we need to retrieve the old dive site, and when in edit mode we
should do nothing.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Edit will always fire,
Filtering only if the dive site already exists.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
And not when we are adding a new dive site.
Also, remove hide button call.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I'm not sure if this is the right approach, but it seems to work: when we
reset the state of the widget, we try to get the current dive site from
the current dive, and set it.
This way it will work for the globe later.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When we start the dive site edit dialog, either for add or for edit, we
don't save the state, so the reject state didn't know what to do with the
dive site.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
So, there's only one crash left (that I put a big TODO: on the maintab.cpp
about) and I'll fix it tomorrow as it's quite late here and I'm almost
sleeping at the keyboard.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I tought about it a bit, and the combobox of the location management was a
bit overkill - we already have another combobox to select the divesite and
also the plus button to add one.
If the user wanna edit the current divesite, he can go to menu and edit it.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Correctly change and update the dive_site, updating the name on the
combobox or other attached views.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Also reorganized a bit of the code, and renamed a few misleading methods.
[Dirk Hohndel: remove some C++11 code]
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
run std::sort on the dive_site list inside of the model.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Only happens if you dont't have any divesites in your list, but either
way, it could happen.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch updates the DiveLocationModel when the
GeoLoockupInformationThread finishes, and also selects
the correct index for the displayed dive.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I forgot about this one, and we are going to use it
in the mobile version too.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Emitting the stopFilterDiveSite signal caused us to clean up the UI which
reset currentDs to NULL if this was a new dive site...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It doesn't matter if we first enter coordinates, name, description or
notes. If there is no currentDs we need to handle that gracefully.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When double clicking on the globe on a dive with no dive site we did
almost the right thing - except that we didn't create a dive site.
Not 100% sure this is the right place to do this, but it seems to work and
prevents the crash.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Untested code to filter out dives that are not at the active dive_site.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The old way we set the location and *then* updated the model, so the very
first location that we tried to show was empty.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When triggering the dive_site management, we need to get the uuid that was
send to us and set it as the current dive_site on the combobox, the dialog
can fill all required info for us.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We will however create a new dive site when the user clicks on the add
button - creating it here would led to strange behavior.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
setLocationId will filter the dives, so ignore the visual changes when
accepting / rejecting, it will only be triggered again when we are showing
this dialog again.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a bit aggressive as it changes the globe with every single
character that's entered, but it's better than what we had before.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We still don't respond correctly to a user changing them (i.e., the map
doesn't change), but at least once they change the dive to a different
dive and back to this one things get done correctly.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Open dive file. Click Location-manage. Pick a site. Click close. Click
Location-manage again. BOOM.
This seems to make sense, but since not a lot of the code is hooked up
yet, I'm not sure this is what we want in the end. But for now it prevents
an easily reproduced crash.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The SimpleWidgets file was getting too big, and location information will
also need a new model - a good way to do not mix everything is to put
things in a new file.
[Dirk Hohndel: added missing include of stdint.h]
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>