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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This class will surely be used on the mobile version, and it was very
tangled inside divepicturewidget.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Models.h now is quite minimal, I'll keep it like that for now, until it
grows huge again. I've also cleaned a bit the headers that are using it so
only the ones that actually need the stuff that I've left behind will
actually include this file.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
TreeModel is the base of some important models in Subsurface, the
statistics model and the dive list models, this second is the most
important one in the whole Subsurface universe.
This commit is another one in the series to make easy to create a mobile
version of Subsurface.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Another attempt to make it easyer to create the mobile version of
Subsurface.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Another attempt to make it easyer to create the mobile version.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
One more step to make it easyer to port the app to Mobile.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is another effort to make it easyer for the mobile
interface of Subsurface.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Another change to make it easier to program the mobile ui. This was a
fairly easy patch: just moved the contents of the file and fixed the
includes.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Still trying to make it easier for the Mobile Port:
This patch is a bit bigger than I hopped, but it was the smallest that I
could get.
A lot of TODO items where added where I broke the code because the current
implementation would break the QML implementtion on the designer. I'll
most probably fix those myself when I finish the transition to the models
to the new folder.
I only moved both models at once because there's an interdependency
between them (seems inevitable, tough, but I'll take a better look at it
later).
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
models.h / .cpp was getting too big (around 2.5k lines), and each change
triggered a rebuild in tons of parts of Subsurface, this is the first
commit trying to make the models code sane by removing them all of the
models.h/cpp file and also clearning code in the process.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is an attempt to help share code between the desktop version of
Subsurface and the mobile version.
More code will be moved around and the models will be split in a way that
will help recompile times and also creation of different interfaces for
different form-factors.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>