Commit graph

21 commits

Author SHA1 Message Date
Tomaz Canabrava
6d9206150a Organize the dive_sites alphabetically
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>
2015-05-31 16:02:35 -07:00
Tomaz Canabrava
8b96179d59 Fix crash when cancelling divesite edit with empty divesite
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>
2015-05-31 16:00:51 -07:00
Tomaz Canabrava
ac6a7ab24e Update DiveLocationModel when thread finishes
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>
2015-05-29 20:59:11 -07:00
Tomaz Canabrava
266e309962 LocationInformationModel moved to qt-models
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>
2015-05-29 20:58:48 -07:00
Dirk Hohndel
17b7bdfd2e Fix crash when rejecting dive site changes
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>
2015-05-27 07:53:14 -07:00
Dirk Hohndel
d6e32b02f6 Start editing new site regardless what the user does first
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>
2015-05-27 06:36:19 -07:00
Dirk Hohndel
bfee0a13f0 Dive site management: make sure currentDs is valid
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>
2015-05-27 06:31:34 -07:00
Tomaz Canabrava
ffffccee93 Filter out the dives that are not at dive_site.
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>
2015-05-26 21:48:45 -07:00
Tomaz Canabrava
785051c9dd Only repopulate model when needed.
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>
2015-05-26 21:47:55 -07:00
Tomaz Canabrava
b7ec57bdef Show the correct dive_site on the manage combobox
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>
2015-05-26 21:47:21 -07:00
Tomaz Canabrava
609688b489 Do not create a new dive site when curr is invalid
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>
2015-05-26 21:47:02 -07:00
Tomaz Canabrava
562ee7410c Don't setLocationId when accept/reject changes
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>
2015-05-26 21:46:29 -07:00
Dirk Hohndel
e201f0f2b1 Location management: reflect changes to a location's name
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-22 12:29:47 -07:00
Dirk Hohndel
d4b5854f82 Location management: reflect changes to the coordinates on the map
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>
2015-05-22 12:29:39 -07:00
Dirk Hohndel
b342730ec9 Location management: actually parse the GPS coordinates
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>
2015-05-22 11:56:03 -07:00
Dirk Hohndel
c11bbe4f38 Fix easily reproduced crash
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>
2015-05-17 14:05:24 -07:00
Tomaz Canabrava
10a0a252c8 Update the dive location when showing the dialog
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:54:08 -07:00
Tomaz Canabrava
0c33d585ea Implement the row count for location information
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:52:23 -07:00
Tomaz Canabrava
3235dd842e Implement the data method for location information
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:52:23 -07:00
Tomaz Canabrava
8115855428 Start the model for location information.
And implement the reset method.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17 13:52:19 -07:00
Tomaz Canabrava
5eb572b9c6 Move Locationinformation to its own file.
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>
2015-05-17 13:51:13 -07:00