Commit graph

74 commits

Author SHA1 Message Date
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
Grace Karanja
ee9452ae8a Group dives by trips
Group dives according to the allocated dive trips.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 14:28:39 -07:00
Grace Karanja
305509ad5f Add dive notes to the divelistmodel
Add the dive notes field into the DiveListModel class.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 14:28:08 -07:00
Grace Karanja
b7e4b35cde Add DiveListModel
This model will be used to show the dives in QML. This commit adds
the model, and the means to link it to QML.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 14:26:56 -07:00
Rick Walsh
4dfdea1e1d Add planner minimum gas switch duration option
Add the option for a minimum gas switch duration 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-19 09:15:09 -07:00
Robert C. Helling
eca7d998e1 Set up signalling to display notes in planner again.
This got broken in a recent transition to more abstract models.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 20:33:07 -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
Dirk Hohndel
2adf120f69 Fix cross build on Windows
int32_t is unknown otherwise.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 13:54:13 -07:00