After one selected a dive and then selects NO dive don't touch
the visibility of UI fields for depth and duration.
So if previously selected dive was a manually added dive, keep them
visible. If it was no manually added dive keep them invisible.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Change the merging behavior for the following information:
Divemaster, buddy, suit:
From "(a) or (b)" to "a, b"
Notes:
From "(a) or (b)" to "a\n--\nb"
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Remove duplicate and incorrect setPlainText call via macro for dive notes.
Deal correctly with ASCII line breaks "\n" in dive notes with html
markup (replace them with <br>).
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
The centerOn*() functions can just return early
for invalid input, instead of branching the conditions.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
- Add the helper coordIsValid() and use it in centerOnCoordinate().
This checks for NaN coordinates and prevents an infinite while() loop.
- Use '-= 1.0' instead of '--' to be more clear that the decremented
variable is a float
- Store the current center with 'centerStored' in
centerOnCoordinate(). Fixes a possible zoom out glitch.
- use Math.floor() to convert 'zoomLevel' to integer when estimating
zoomOut in centerOn*()
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The zoom out function is no longer used as we don't zoom
out when a dive doesn't have dive site coordinates.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
There was a problem with the current different duration
for pan and zoom. Ideally the pan should before the zoom:
Map zooms out -> pan to new center starts -> zoom in
The problem with this is that if the map pans out too much it
loses it's center and the above scheme would not work.
To solve the problem, make the duration of pan and zoom
the same this is not idea, but prevents the case where
the map would not zoom-in at the correct center.
Also remove the easing function.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Currently when the user is typing new coordinates the
marker on the map changes location right away. Disable that and
add a 'flag' button that should be pressed instead. Also make the
coordinates update when pressing Enter or when the text
field loses focus.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
When the map is performing zoom/pan animation and the
user performs an action that would trigger a new zoom/pan
animation, but some glitches can occurs. An example
would be when one clicks a dive in the dive list -
the zoom/pan animation will trigger, so that the map
is centered on the dive site, but if the user clicks the
[+] button to zoom-in, while the animation is running
the map will glitch.
This patch prevents such glitches by stopping
all running animations in progress when the user:
- single clicks the map
- uses the mouse-wheel to zoom
- presses the [+] / [-] buttons
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Avoid using qvariant_cast() with getRole() in favor of
MapLocation::coordinate() in MapWidgetHelper::reloadMapLocations().
This makes the code more readble.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Once the user starts editing a dive site, make sure to pass
coordinates of either the current map center (if a new MapLocation
is being added) or the coordinates of the existing MapLocation.
The "Dive site management" coordinates text field would receive
these new coordinates after the displayed_dive_site struct
is updated and the coordinatesChanged() signal is emitted.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Once the user starts editing the coordinates by hand
(from the "Dive site management" UI) make sure to
update the map to center on those user entered
coordinates.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This should help us to move parsing that is not XML related to other
files, hopefully making the code cleaner.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
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>