After editing the cylinder table (e.g. deleting a cylinder) and
accepting the changes copy the whole dc samples for the dive edited.
This is important because the sensor idx in the samples may have changed.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
reset_cylinder may transform unused cylinders into zombie cylinders
inside the planner because it adds a depth info and therefore the
planner will use them.
By calling CylindersModel->updateDive these cylinders will become visible
and can be deleted by the user.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Store cylinder.depth in XML files and in git storage.
This info is in fact the gas switch depth of a specific gas/cylinder
in the planner.
This change avoids the need of typing in a user specific depth value
again when replanning an existing planned dive.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
If the user implicitly adds a dive site by editing a dive, and
a location filter is active, check the new dive site in the
location filter.
This is done by informing the LocationFilterModel of the new
dive site name prior to repopulation. The LocationFilterModel
then adds a corresponding entry and marks it as checked.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Since commit 01d961086c, the location filter
list is updated if a dive site is edited. The problem is that if the
name of a selected dive site is changed, the selection is lost.
Therefore, before repopulating, inform the location filter that a dive
site changed its name. The location filter then internally changes the
name and can properly transfer the old selection on repopulate. This is
performed via the new LocationInformationWidget::nameChanged signal,
which is connected to the new LocationFilterModel::changeName slot.
A special case to be handled is the following:
[ ] Site 1
[x] Site 2
and "Site 2" being renamed to "Site 1", i.e. both sites being merged.
Here, the merging is detected and "Site 1" will likewise be checked:
[x] Site 1
[x] Site 1
No merging is performed, as the list will be repopulated anyway.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Since commit 01d961086c, MainWindow::refreshDisplay()
is called in the refreshDiveInfo() signal of maintab after editing a
dive site. Since this was the only use of the refreshDiveInfo signal,
remove this signal and instead connect to MainWindow::refreshDisplay directly.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The function dive_site_less_than() in qt-models/divelocationmodel.cpp
does not what it promises: it uses less-or-equal instead of less-than
comparison.
Note that, even though this may sound pedantic, this is an actual bug.
Usually, sorting functions suppose that they are provided with
strict weak ordering, which <= does *not* provide.
This is the actual reason for the crash mentioned in commit
f8a3a85210.
While touching this function, make it of static linkage, since
its usage is local to this translation unit.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
set_userid() was declared in core/dive.h and dektop_widgets/subsurfacewebservices.h.
Remove the second instance because two declarations of the same function
are a recipe for disaster.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Until now when selecting a dive w/o dive site after having a previous
dive with dive site and location tags displayed, the location tags of the
previously selected dive where still displayed.
This fixes this behavior.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
When toggling the display of the partial pressure graph, the graph was
either not shown correctly or unnecessary ticks were left in the graph.
Calling the settingsChanged() method of the profileYAxis object solves
the problem by initializing the ticks according to the selected graphs.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is a continuation of commit 739b27427c,
in which a substring comparison was replaced by equality comparison to
avoid confusing UI behavior of the filter interface.
The suit and buddy filters were plagued by the same problem, so change
their code in analogy.
Fixes#551 (in conjunction with commit dd2466f518).
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Calls MainWindow::refreshDisplay() if a dive site was edited so that
the filter lists are updated. The old call to updateDiveInfo() was
removed because it is call implicitly in MainWindow::refreshDisplay()
anyway.
Fixes#675.
Requested-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Don't accidentally enable o2breaks option when entering planner in
RECREATIONAL mode.
Disable also label for min_switch_duration according to dive mode.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Pass the planner state struct to the profile computation so it can use
deco_time and first ceiling to display VPM-B ceiling.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
For UI responsiveness, we need to be able to run the planner in the background. This needs the
planner state to be localized (and we need to pass a pointer around).
In order to not let too many lines overrun (and to save typing in the future)
I have renamed instances of struct deco_state to ds. Yes this should have gone
to a separate commit but I accidentally commit --amend'ed it.
Computing of planner variations is temporarily disabled.
Unlock the planner when returning early
So we don't deadlock in add dive and recreational mode (which
use the planner without actually planning).
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Update the filters if the list of dives is updated by calling
MultiFilterSortModel::instance()->myInvalidate();
This had the side effect of clearing all selections. Thus, in
the repopulate() methods of the FilterModels, check those
entries that were checked previously. Since all the filter
models use the same code, introduce a base class FilterModelBase.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This replaces a dynamically allocated array of bool by std::vector<char>.
1) This makes the code shorter and less error prone, because memory
management has not to be done by hand.
2) It fixes a bug in the old code:
memset(checkState, false, list.count()) is wrong, because bool is
not guaranteed to be the same size as char!
Two notes:
1) QMap<>, QVector<>, etc. are used numerous times in the code, so
this doesn't introduce a new C++ concept. Here, the std:: version
is used, because there is no need for reference counting, COW
semantics, etc.
2) std::vector<char> is used instead of std::vector<bool>, because
the latter does a pessimization where a bitfield is used!
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The location filter used a substring comparison, which had
the side effect that dives with the location "Test 1" were
shown when filtering for "Test 12".
Moreover, avoid a deep copy of the location list. This is
done by looping over one item less than rowCount() instead
of removing the last item. While doing this, remove an
unnecessary if-statement.
This commit partially fixes#675.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When the user entered a dive site using autocompletion, it
is a known site, of which we might have a GPS location already.
Just fill the known site coordinates.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Add the capability to select the location name from a list, constructed
from the known dive sites in the logbook.
Fixes: #546
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Each preferences object owns its string members. In three cases, pointers
were copied instead of strings, leading to (in the best case) dangling
pointers if the user edited values:
1) In the GET_TXT macro in core/prefs-macros.h
2) In the PreferencesDialog::defaultsRequested() method
3) In main() of the mobile version
This patch fixes these issues, by using copy_string() or copy_prefs()
as appropriate.
The only reason that the old code didn't crash regularly is that the
default_prefs object was only used at startup and defaultsRequested()
is (at the moment?) dead code.
This patch also aligns the backslashes in core/pref.h and fixes a typo.
The declaration of copy_prefs() is moved to the core/prefs.h header.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
In some situations Travis CI doesn't seem to notice that a build failed and
give us a green check mark even though the build didn't succeed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>