If we edit any of these fields, we create new strings via strdup (or a
fresh tag_list). So if the edits are rejected, free all that memory.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We do all of our edits on a copy of the dive - but the tag_list points to
the tag_list of the master dive (based on how we create that copy of the
master dive). So only free the tag_list if it is already different from
the master dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
1) All the variables in the sample structures are strongly typed
2) Two additional types were declared in units.h:
o2pressure_t
bearing_t
3) The following variables were added:
diluentpressure
o2setpoint
o2sensor[3]
4) Changes to a number of files were made to chanf
sample->po2 to sample->po2.mbar
bearing to bearring.degrees
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Changes to hold a pointer to the struct picture on the model, so we can
use it to determine the correct positioning of the image on the profile.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It plots in the wrong place for now, because I need to change the model a
bit. But it shares the same pixmap with the other widget which is nice. :)
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Ignore the warnings for now, this patch connects and disconnects the (not
done yet) plotPictures() method.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This will make referencing it from a few places more easy.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The picture list is a single linked list where the pictures have a node to
their next element. When adding the same picture to two dives, things got
way way wrong and crashes were appearing.
This will replicate the information (filename, latitude and longitude) for
each dive that has the picture, BUT it still tries to save as much as
possible on the actual pixmap.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code correctly saves the added pictures on the xml backend.
next: git backend.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We parsed it rigth for dive computers, but not for the manually filled
per-dive case. The git save seems to have gotten it right.
I think this has been broken since the whole "move as much as possible to
the dive computer sections", but I didn't actually check.
Reported-by: roberto forini <forini.r@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Also seems intuitive. What's odd is that in the Planner you get a
confirmation dialog while here you don't. We should be consistent.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The edit starts with the current value, but our data() function didn't
return that in the edit role.
Thanks Tomaz for explaining this to me.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Gas changes (can) have a bogus waypoint following at the same depth with 0
time. Those were confusing the decision whether to show a waypoint.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
QPixmap cannot be accessed from outside the Main thread, but QImage can.
so change that. Also, make the Photo widget display in Icon mode.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Small changes in the model to display the pictures of the dives.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This method should give the correct data to all views that the model is
connected to.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Update the picture model to use the new picture function calls, wich made
the code smaller and easyer to understand. AND as a plus, it doesn't use
the magic 123 identifier for pictures. AND it correctly adds images
without timestamp to the list.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit breaks the loading of images that were done in the divelist
into smaller bits. A bit of code refactor was done in order to correct the
placement of a few methods.
ShiftTimesDialog::EpochFromExiv got moved to Exif::epoch dive_add_picture
is now used instead of add_event picture_load_exif_data got implemented
using the old listview code. dive_set_geodata_from_picture got
implemented using the old listview code.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add the FOR_EACH_PICTURE macro and the code for picture count.
This uses C99 - but I will keep it like this and wait for dirk
to scream at me.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a picture_list struct that will hold all the pictures relative to a
dive. Before we used to hold events for the pictures, but an event is a
much bigger struct so this will save a bit of memory, and we will also
stop to use magic flags and special treatment for pictures on the dive
profile.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The existing code took an odd approach. It tried to change all selected
dives whenever the user edited a field, and kept all this backup data in
case the user rejected the edits.
This code takes the opposite approach. Only edit a copy of the selected
dive and then when the user accepts it, edit all the dives and when the
user rejects the edit simply redraw the screen (as all the "real" data is
still unchanged).
This not only saves quite a bit of code, it should be much easier to get
correct.
Admitedly this code will need quite a bit more testing to make sure it
works as intended, but as far as I can tell it already gets more scenarios
right than the previous implementation.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There are new check-boxes to modify the look of the diveplan in the notes.
The old behaviour appears with "verbatim display", others are shorter,
runtimes, stoplengths and transitions being optional. Also round to full
meters and minutes to remove optical clutter.
To be done: Remember these setting in the config.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In order to call this as slot it needs to have defaults for all arguments.
So we need to change the gasmix into a pointer - which is actually better
as this allows to easily pass a NULL pointer when we want to continue to
use the previous gas.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Every single user of the get_gas_name() function wanted to just use the
result to create a message or printout, and that made the interface a bit
cumbersome.
This adds a "gasname()" wrapper that returns a static buffer with the
result in it, which is neither pretty nor thread-safe, but is a much
simpler interface to work with.
Our dive planning isn't multi-threaded, so nothing should care.
[ This also converts a few open-coded gasname debug printouts to use the
helper function, resulting in prettier printouts and less code ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add new methods to the MinMaxAvgWidget class to allow us to override the
default tooltips of its min and max icons, and then uses these methods to
make the tooltips for the Stats tab Depth instance more descriptive.
See #521
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>