This item plots the DiveCalculatedCeiling over the profile. I still need
to add the Calc All Tissues version.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This just adds the texts for the gas profile. I've also added a method on
the dataModel() to return the diveId of the last used dive in a way that
the other methods can use it.
This code is almost 1-to-1 with the old one, a bit of thinkering can be
used to merge this loop with the upper one.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of asking the data as we do on the generic models, use the
internal knowledge of the class.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added the dive computer text on the bottom left side of the new Profile.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Changes the ZValue of the event items so they are plotted
on top of the profile, instead of being hidden on some.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch just cleans a bit the Cartesian Axis, we never used
ticks on it, just the grid lines ( that I need to animate a bit. )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This fixes temperature text replacing the old code
with the new DiveTextItem.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This uses a combination of items on the canvas which makes it easier to
position it where I want.
This also broke the other texts because I forgot about them. I will
fix that on the next commit.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Removed the plotText function and replaced it with the
DiveTextItem class - this way there's just one way to add
text on screen, and it also makes it easy to fix positioning
of stuff there. Which is what I'll try to fix on the next commit.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Split divemaster field value using comma and populate completion list.
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since we use tags widget for several input fields (tags, buddy,
divemaster), it makes sense to keep focus policy setting in one place.
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This prevents tags widgets (dive tags and buddy) from grabbing
focus on mouse wheel events but allows entering dive edit mode
on mouse click.
It was attempted earlier by Dirk (commit d117beca), but edit mode
did not work properly.
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This re-organizes the saturation calculations to be in my opinion
clearer: we used to have the "one second" case completely separate from
the "generic interval" case, and this undoes that.
It *does* keep the special static cache for the one-second buehlmann
factors, and expands that with a *dynamic* cache for each tissue index
that contains the previous value of the buehlmann factor for a
particular duration.
The point is, usually we end up using some fixed duration, so the cache
hit ratio is quite high. And doing a memory load from a cache is *much*
faster than calculating exponentials.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With massive hand-holding by Tomaz.
Writing for the new profile code is slightly different. You don't draw
anything, you just tell the widget where things are supposed to end up and
how they are supposed to look. Really nice.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The gasPressureItem needs to be initialized to null in the constructor.
Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I Moved the 'plot text' method of the Old Graphics to the new
layout - this one was mostly unchanged as it was already good
as is.
And used the TemperatureProfileItem to also display texts.
This was the first implementation of the new system that uses
*less* code than the original one, wich makes me happy.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added the Gas Pressure Graph with the related Model Changes
to access the cylinder index, pressure, interpolated pressure
and SAC.
The plot does not correctly plot its color right now but it's not hard to
do.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This version of the create plot info is the same as before, with the
difference that it doesn't depends on the gc.
Also fixed a crash.
The Pressure Index, Information and interpolated seems wrong,
I'm getting only zeroes.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added missing information about the pressure to the model; this shows that
I didn't do something right, as the model has 0 pressure information. Need
to fix that on the next commit.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The cylinder pressure axis is the 'Y' axis for the Cylinder plot.
I positioned it in around 20% to 60% of the screen state.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since I didn't add a pixmap to be the background of the new profile, yet,
things got wrong on mac and crashed. This should fix it.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch fixes a warning about the QGraphicsItems not being on the
QGraphicsScene, and thus, cannot be removed from it.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The old graph didn't display the time axis, so this will
also not display it. By not calling updateTicks the labels
and ticks of the Axis are not created.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Now we can create an axis that's topToBottom, BottomToTop, LeftToRight and
RightToLeft.
This was needed for the Temperature Plot, because it should be inverted
(starting on the bottom).
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added the Temperature Graph with its related classes. A Temperature Axis
is also created so the item is plotted on the right place.
Currently the Temperature Axis is just like the depth axis - top is
zero, wich means that the graph is inverted.
Also, the Temperature axis is being displayed as this helps debugging.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The DiveProfileItem contained much of the complexity and
algorithms for almost all line-based items on the canvas,
so I transformed that to a general abstraction and implemented
a new DiveProfileItem that uses it. this should reduce a
bit of code since the implementation of the PP Graphs, Temperature
Cylinder Pressure and maybe a few others will only need to
reimplement the paint() and the modelDataChanged() methods.
The rest is ready.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Simply pass a event to the item and it will know what
to do. The sad part is that this isn't true yet - there's
quite a bit of boilerplate that a lot of the items are needing,
but the good part is that the boolerplate is the same in
all of the items, which means that I can create a tiny bit
of abstraction to encapsulate it and the code will be
way smaller to setup the items on the canvas.
Right now the items are being correctly placed on the
right places. It doesn't supports hidding / showing yet.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The code for this item is a bit too big to be just the grid
of the dives and I know that, don't bully me. :)
The main idea of this grid is that it knows when it should be
updated. this is a bit different than the old code where all
the painting happened on the same method. This is bad because
it's more code, but it's better because if I break the grid,
only the grid will be broken, and it's easyer to spot the breakage.
in the old code if I did the wrong thing with the graphics context,
the whole graph gots messed out.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There was a bug in the old implementation where we needed to
trigger a repaint of the profile almost everywhere. this isn't
needed anymore on the new one, so do not use the same method
that will be killed when I finish this.e
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This method gathers information about the max and minimum sizes of
the cartesian axis that we should plot. It's still a bit cumberstone
for my taste, but this shouldn't be a problem. I think we need to
rework the 'Zoomed' version of it, since zoom or without zoom,
we should be good to go using the QGraphicsView.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
As Sensus import needs a specific XSLT and user specified parameters are
not used nor needed, tune the GUI accordingly (disable options and add
Sensus in the list of known imports).
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This will allow one to give CSV tag as parameter when importing CSV
files. On normal case one will use csv, but when special handling is
needed we can give a specific XSLT file instead.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Sensus divides temperature in one or two fields (depending on locale),
so it cannot be parsed with our generic CSV import XSLT. And e.g. depth
is in millimeters.
This supports only importing of single dive at a time. Multiple dives
would be in same file with first column being dive number.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
As noted by Thiago Macieira, we shouldn't include stdbool.h when were
included from a C++-file such as main.cpp
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This introduces a "struct membuffer" abstraction that you can write
things into, and makes the XML saving code write to the memory buffer
rather than a file.
The UDDF export already really wanted this: it used to write to a file,
only to then read that file back into memory, delete the file, and then
*rewrite* the file after doing the magic xslt transform.
But the longer-term reason for this is that I want to try to write other
formats, and I want to try to share most helpers. And those other
formats will need this memory buffer model.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is just to make it more obvious when new issues get introduced. The
build should always be free of warnings...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>