Commit graph

35 commits

Author SHA1 Message Date
Tomaz Canabrava
b23ff086cf Silence warnings in divelocationmodel.cpp
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08 20:58:21 -08:00
Lubomir I. Ivanov
9b20a5bd4f divelocationmodel: fix some signed/unsigned warnings
Use uint32_t for divesite UUIDs.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-11-07 22:26:32 -08:00
Tomaz Canabrava
d611d97406 Do not show lack of coordinates as having same gps information
The filter that takes care to show the dive sites that have the
same gps information should not take into account dives that have
no gps information.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-09 10:50:51 -07:00
Sander Kleijwegt
6427564d33 Hide current dive site from dive sites with same coordinates.
Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-12 08:28:13 -07:00
Sander Kleijwegt
8dafc32228 Remove id from divelocation selection list
Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-12 08:24:51 -07:00
Tomaz Canabrava
e36e4d1faa UI code to merge dive sites
Get the Qt data structures and convert to something
that we can use in our C - core.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 18:43:09 -07:00
Tomaz Canabrava
a3d6098c8c Display dive sites with same gps as the current
So we can merge them later - currently we are showing
only the ID, ugly - fixing next.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 18:42:15 -07:00
Tomaz Canabrava
71e366a6e4 Add function to filter same-gps dive sites
This should be userfull to show dive sites that are
mergeable.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 18:41:32 -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
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
Dirk Hohndel
2a4cacda21 Better invalid dive site name
This should ensure that no one ever might end up with our "invalid" name
for real. And it allows us to more easily test elsewhere for that invalid
value.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-17 08:39:49 -07:00
Tomaz Canabrava
56240cff5b Show only 1 possibility if string is unique
We should only show one possibility if the dive_site name
string is unique - we don't have that dive_site yet - so
we pass to the Completer filter a Dummy string that will
surelly not be a dive site - konami code.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16 18:33:57 -07:00
Dirk Hohndel
f98ace681a Dive site edit: add second "create" line without completion
We now have TWO special entries. One with just what the user has typed and
one with the first completion of that text. This way both Henrik and Linus
can get what they want. I'm not sure I love this, but it's easy to revert
if the consensus is that this is too confusing. But it's much easier to
discuss this if people can actually play with it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16 12:22:56 -07:00
Dirk Hohndel
14016f83ff Better text for fake completion entry
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-15 10:37:09 -07:00
Tomaz Canabrava
cd3f10d5ad Offer an option to just complete the text
Make the kids fight no more.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-14 14:54:01 -07:00
Dirk Hohndel
bc8c54f1ee Rename enum values for taxonomy
This avoids confusion and namespace collisions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02 10:22:31 -07:00
Dirk Hohndel
f554c2d16c Merge branch 'taxonomy' 2015-07-02 07:03:03 -07:00
Tomaz Canabrava
db8b140c52 More information on dive site model
All of dive site information is now exposed to the model

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 19:21:23 -07:00
Dirk Hohndel
a413141b33 Geo taxonomy: adjust the preferences to the new data structures
This allows us to pick which three categories of geo taxonomy will be
shown in the UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 12:38:40 -07:00
Tomaz Canabrava
7f83b35ec9 Add model to populate the Preferences for GeoRef
Simple model that list the options for GeoRef.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22 17:10:57 -07:00
Dirk Hohndel
f8a3a85210 Fix potential crash using std::sort
It's entirely unclear why std::sort sometimes accesses the element with
index -1. In my limited testing switching to qSort avoids that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 08:45:45 -07:00
Tomaz Canabrava
efeca58474 Correctly decrease the number of rows in the dive_site model
We were removing the dive site, but forgetting to decrease the amount of
rowCount, leading to crashes.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:41:21 -07:00
Tomaz Canabrava
09ca240c3e Do not reset the model when adding a new dive site
This makes insertion faster, and also it doesn't break the current
selection in the QComboBox.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:38:19 -07:00
Robert C. Helling
be0a708db0 Two if's to prevent null pointer dereferencing
I need these to prevent subsurface from segfaulting when opening a new log.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:25:46 -07:00
Tomaz Canabrava
6cd85d9b73 Simplify model handling and crashes fixes
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>
2015-06-01 21:36:48 -07:00
Tomaz Canabrava
9dc32de878 Remove Combobox from LocationManagement
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>
2015-06-01 21:35:50 -07:00
Tomaz Canabrava
a9ba98942c Correctly change the dive_site name
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>
2015-06-01 21:31:16 -07:00
Dirk Hohndel
64753e0682 Fix dive site sorting
std::sort sorts [first,last) so last is excluded.

Also fix the mis-spelling of the compare function.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 17:00:09 -07:00
Tomaz Canabrava
b8092c07a4 Create a new DiveSite when user clicks on add
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>
2015-06-01 13:24:37 -07:00
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
7129cef66f Don't calculate what we already have
We already have the correct number of dive_sites, why use a loop to
calculate it?

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 16:01:46 -07:00
Tomaz Canabrava
b35e48c68e Fix off-by-one error
i is one greater than the number of dive_sites, use the correct nr.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31 16:01:16 -07:00
Tomaz Canabrava
80fe3f88f9 Correctly set the dive site id on the dive
When changing the index of the combobox we were discarting the
dive_site_id. This fixes it.

Now I need to understand what's happening to the globe.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 20:59:47 -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