aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2014-01-19Fixed Temperature TextGravatar Tomaz Canabrava
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>
2014-01-19Fix the positioning of the Labels using the new DiveTextItemGravatar Tomaz Canabrava
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>
2014-01-19Remove the plotText function, standardize with the TextItem.Gravatar Tomaz Canabrava
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>
2014-01-19Enter dive edit mode on divemaster field focusGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-19Expand tags approach to divemaster fieldGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-19Populate divemaster completion model using CSVGravatar Sergey Starosek
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>
2014-01-19Use focus policy setting from widget constructorGravatar Sergey Starosek
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>
2014-01-19Ignore mouse wheel events on tags widgetGravatar Sergey Starosek
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>
2014-01-19Stop doing the (very expensive) pow() calculation pointlesslyGravatar Linus Torvalds
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>
2014-01-18Add mean depth to new profileGravatar Dirk Hohndel
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>
2014-01-18Fix potential crash in getColor functionsGravatar Dirk Hohndel
If the index is out of range, just return black. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-18Fix maxdepth in new profileGravatar Dirk Hohndel
get_maxdepth() already gives you the correctly rounded maximum depth. Don't mess with it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-18Fix crash in new profileGravatar Michael Andreen
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>
2014-01-17Plot the Temperature Text.Gravatar Tomaz Canabrava
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>
2014-01-17Add the gas pressure plot.Gravatar Tomaz Canabrava
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>
2014-01-17Create a version of create_graph_info that doesn't depend on GC.Gravatar Tomaz Canabrava
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>
2014-01-17Add Information about the Pressure to the Model.Gravatar Tomaz Canabrava
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>
2014-01-17Added the Cylinder Pressure AxisGravatar Tomaz Canabrava
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>
2014-01-17Remove warning about a null pixmap.Gravatar Tomaz Canabrava
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>
2014-01-17Remove warning about item not on the scene.Gravatar Tomaz Canabrava
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>
2014-01-17Fix a crash.Gravatar Tomaz Canabrava
I forgot to initialize a variable, sorry. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17Fix compile time warningsGravatar Dirk Hohndel
Plus some small whitespace fixes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17Do not display the Time AxisGravatar Tomaz Canabrava
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>
2014-01-17Made the Axis be aware of Direction.Gravatar Tomaz Canabrava
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>
2014-01-17Added the Temperature Graph.Gravatar Tomaz Canabrava
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>
2014-01-17Transform the DiveProfileItem to an Abstract GeneralizationGravatar Tomaz Canabrava
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>
2014-01-17Added a DiveEventItem that knows how to handle itself.Gravatar Tomaz Canabrava
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>
2014-01-17Started the code for a grid that knows how to handle itself.Gravatar Tomaz Canabrava
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>
2014-01-17The plot-profile method was being called too many times.Gravatar Tomaz Canabrava
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>
2014-01-17Use the same methods as the old profile to discover the boundaries.Gravatar Tomaz Canabrava
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>
2014-01-17Treat Sensus CSV import specially on GUIGravatar Miika Turkia
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>
2014-01-17Add Sensus XSLT as a resource and enable itGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17Support for XSLT template for CSV importGravatar Miika Turkia
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>
2014-01-17XSLT for parsing Sensus Ultra CSV exportGravatar Miika Turkia
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>
2014-01-17Sample log from Sensus Ultra, exported in CSVGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17Remove duplicate method callGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17Don't include stdbool.h when included from C++Gravatar Anton Lundin
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>
2014-01-16Add switch statement to CodingStyleGravatar Dirk Hohndel
Requested-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Save XML files into a memory buffer rather than directly into a fileGravatar Linus Torvalds
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>
2014-01-16Get rid of build warningsGravatar Dirk Hohndel
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>
2014-01-16Fix compile error when not building with CONFIG+=debugGravatar Dirk Hohndel
There are still some warnings left, but at least it compiles now. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Fix some memory leaks.Gravatar Boris Barbulovski
Memory leaks were caused by broken parent/child relations. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Whitespace and coding style updatesGravatar Dirk Hohndel
Another futile attempt to cleanup the code and make coding style and whitespace consistent. I tried to add a file that describes the key points of our coding style. I have no illusions that this will help the least bit... This commit should ONLY change whitespace Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Show old profile when starting SubsurfaceGravatar Dirk Hohndel
Tomaz code had us start on the depth model tab (when built in debug mode). It seems to make much more sense to still show the fully featured profile by default. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Reworked the calculate_max_limits and plotted the dive.Gravatar Tomaz Canabrava
Created a new version of calculate_max_limits that doesn't have a graphics_context and returns a plot_info. The code is basically the same as the old calculate_max_limits, so there's not much to talk about. The rest of the code is just boilerplate to plug the Profile code with the axis and model stuff, to be plotted on screen. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Added debug code to help understand the ProfileGravatar Tomaz Canabrava
This commit adds a QTableView if built in debug mode. This is very userful to understand the Profile that will be drawn by the graphics classes and fix the possible errors. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Importantly, I had forgotten to start the state machineGravatar Tomaz Canabrava
The state machine needs to be started before it works; now the animations are working. :) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Added names to the states, so it's easier to debug.Gravatar Tomaz Canabrava
There's a Qt visual debug / helper tool made by KDAB named GammaRay that uses QObject instrospection to understand what's happening on a QProject. This tool uses the Object Name to display the items on a list, so I've added the QState's names to their objects, which greatly helps debugging with Gamma Ray the states of the StateMachine. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Added a Context menu so we can test the state switching.Gravatar Tomaz Canabrava
The context menu added here should only be temporary, it's an easy and simple way to test the transitions of the items on screen. They seem a bit broken atm, I'll try to fix that. :) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Added the Animations for the transitions of the States.Gravatar Tomaz Canabrava
This code creates the animations that will be triggered when an state changes. Things like hiding items and such should be handled this way. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>