Commit graph

88 commits

Author SHA1 Message Date
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
Miika Turkia
c0ac73a478 Fix a crash when editing manually added dive
I have manually added dives from an ancient version of Subsurface.
Trying to edit these caused Subsurface to crash due to comparison of
string of dc.model that did not exist (to a static string). And further
down the execution path we were crashing as there were no samples
associated with the dive.

See #941

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08 16:42:27 -07:00
Dirk Hohndel
eccac1321f Deal with weird transifex issue involving leading space
Apparently transifex drops the leading space in the translation string and
then at runtime the string no longer matches. So let's just code this
differently.

This of course creates a new string but that new string should be the
string that transifex already asks people to translate...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-08 10:05:06 +01:00
Dirk Hohndel
58fbee7150 Make logical block match indentation
Coverity CID 1325519

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-03 09:47:37 -04:00
Robert C. Helling
562dfa1c5d Spelling corrections
Spell Setpoint without space in user visable strings.

Explain authorized_paired.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-18 10:04:50 -07:00
Dirk Hohndel
2d68214eac Planner: show new icon to indicate that last point can't be deleted
Having the trash can disappear is somewhat intuitive, but I'd argue this
is even more so.

Fixes #789

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-17 15:27:49 -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
Sander Kleijwegt
30a410036b Do not ignore the first tag on autocompletion.
Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-09 13:05:14 -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
dcda950202 Fix recursive stack-overflow
Only call this when needed, if there's no function set
as callback, always return true.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 18:41:47 -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
ab32295f89 Add a new model: SsrfFilterProxyModel
Add a new Model, it's the QSortFilterProxyModel that accepts
functions to filter / sort. so instead of creating a new class
for each different sorting (overkill), now we can just create
a function and pass to this class.  I'll rework the filtering
system of subsurface to use this - in the meantime I've created
this to ease the creation of another filter: the dive sites
by gps coordinates.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 18:41:14 -07:00
Grace Karanja
390c10bb08 QML UI: Remove unneeded MobileDive class
The MobileDive class in divelistmodel.h is a duplication of the
Dive class in templatelayout.h. This patch moves the Dive to
the qthelper file.

[Dirk Hohndel: merged with upstream master - let's hope I didn't
               mess anything up]

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 15:47:48 -07:00
Grace Karanja
5a7dbf0225 QML UI: Use AddDive instead of clear dive
No need to clear the dives when adding a new one.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-31 15:24:15 -07:00
Grace Karanja
a3bdf49b84 QML UI: Clear divelist model before starting new dive
When user clicks on AddDive, we should clear the model.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-08-31 15:24:14 -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
Tomaz Canabrava
118e978b5a Display dives from the same location on the list
Some dive sites are separated in more than one real dive site
(for instance, a 'blue hole' dive site that has different
entry points on the gps), so instead of checking only the
dive_site id, also check it's name.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20 22:23:25 -07:00
Dirk Hohndel
d93984448c Merge branch 'boyle-ready' of https://github.com/Slagvi/subsurface
Fixed merge conflicts in
	deco.c
	dive.h
	planner.c

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17 21:45:51 -07:00
Jan Darowski
6856e87689 VPM-B: Add conservatism levels to the ui. Fix planner settings disabling.
Conservatism level can now be changed from gui, is saved in settings.
Also way of disabling the planner settings in the ui was improved
to support more deco models and be called at the widget creation.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-08-15 15:16:51 +02:00
Tomaz Canabrava
25273a3912 Remove obsolete comment
We don't allow building against Qt4 anymore.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15 04:59:23 -07:00
Tomaz Canabrava
ed30059183 Add DiveSitePicturesModel
This model should be used inside the Edit Dive Site mode.
It should display all photos from all dives that are part
of this dive site, ignoring trips.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15 04:59:01 -07:00
Dirk Hohndel
7e7dcb2451 QML UI: sort by date, not by date string
Just a quick bit of cleanup to separate date (the sortable, numeric value)
from the date string that we want to display (but not sort by).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-24 11:17:48 -07:00
Grace Karanja
aae27629c4 QL UI: Add DiveId role to DiveListModel
This will be used when rendering the dive profile and also when
saving the dive changes.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-07-17 19:12:39 +03: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
Grace Karanja
ebcf3e67c5 QML UI: whitespace fix
Fix some whitespace issues in the QMLManager and DiveListModel
classes.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
2015-07-10 06:04:18 -07:00
Joakim Bygdell
68ceb75294 Planner: disable unrelated planner settings
When VPM-B is the choosen deco algorithm changing,
GF low and high have no effect. So lets disable them similar to what we do
for recreational mode.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-07 11:49:16 -07:00
Robert C. Helling
a7d18a9fa6 Round MOD of gas rather than truncate
For the proper calculation, we need to take salinity and surface pressure
into account (rather than depth = bar * 10 - 10)

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-05 15:53:49 -07:00
Rick Walsh
8c4e1e6bfa Read planner preferences when we use them
Read and use the last_stop preference in the plan function.
Read the plan notes preferences and set variables (plan_verbatim,
plan_display_runtime, plan_display_duration, and plan_display_transitions)
in the add_plan_to_notes function. Don't read the preferences and set
variables otherwise. Both plan and add_plan_to_notes functions are called
on data change.

Previous behaviour was:
- Set variables on declaration
- Reset variables in plan function (even variables that only relate to
  planner notes output)
- Changing a preference triggered set_xxx function which sets variable,
  then plan function, which sets variable again.

Apart from being inefficient, the previous behaviour made it difficult to
track down where and when variables were set.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-05 06:37:01 -07:00
Jan Darowski
500fbe4994 VPM-B: add deco choice to the ui.
Removed recreational mode from ui and pref and replaced it with
new deco_mode enum.
Added radio button ui selection.
Set default deco_mode to Buehlmann algorithm.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-07-03 23:07:58 +02: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
43bb8881fd Correctly removes the Location Completion Model
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 19:21:50 -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
Tomaz Canabrava
324b6182aa Remove location completion model
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>
2015-07-01 18:54:19 -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
Dirk Hohndel
57bad198cb Show icon in dive list to mark dives that have GPS data
The icon is public domain and came from
https://commons.wikimedia.org/wiki/File:Emblem-earth.svg

(also removed the redundant entry for "edit" from the .qrc file)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-29 10:44:17 -07:00
Rick Walsh
425020d2de Add only switch at required stop option
Add the option to only switch at required stop to the planner UI.  This is not actually used yet.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26 06:14:24 -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
1ecc9b0cc0 Address uninitialized member warnings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22 10:57:51 -07:00
Dirk Hohndel
c01c35ca0c Cylinder model: fix an obscure case that would access cylinder -1
If we remove a cylidner for a unique gas and that is allowable, then don't
try to copy from cylinder with index same_gas (which is still -1).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21 21:30:38 -07:00
Dirk Hohndel
f5726c3d18 Fix a number of resource leaks
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>
2015-06-21 21:13:32 -07:00
Grace Karanja
2f25fe9f0b Rename dive class to avoid conflict
Rename the Dive class in divelistmodel.h to a void a conflict with
the Dive class in templatelayout.h

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 14:29:24 -07:00
Grace Karanja
d613ed0105 Add more dive details to the DiveListModel
Add some more details to the model.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 14:28:57 -07:00