aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
AgeCommit message (Collapse)Author
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-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-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-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>
2014-01-16Aparrently there's no need for a showEvent here.Gravatar Tomaz Canabrava
Just removed some code that I tougth to use, but it looks like it's just a waste of lines. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Fix the size of the scene on screen and Background improvements.Gravatar Tomaz Canabrava
It seems that I forgot to add the background pixmap, but this is being done right now by luisa. This patch fixes the size of the scene by scaling everything to the size of the viewport as soon as a resize is done, and it also fixes the size of the - to be included - background pixmap. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Added all the state transitions for each state.Gravatar Tomaz Canabrava
This code adds all state transitions for the items on screen; they do not animate yet, but already move to the correct location (the location seems wrong on the screen, because I'v not correctly zoomed out the canvas yet). Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Added Constants to the code, to ease the setup of the transitions.Gravatar Tomaz Canabrava
Those constants will be used later on to setup all transitions of the Graphics Items on the canvas. They are the correct positions of each item inside and outside of the scene, in a way that the state machine can animate them smootly. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Started the work on the States for the Profile.Gravatar Tomaz Canabrava
This is a start of the work on the States for the Profile. All setup is done, all connections are done. Maybe there's something missing because I never worked with QStateMachine before, but it seems to work correctly. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Added the flag to ignore item transformations on the background.Gravatar Tomaz Canabrava
The background should be a Pixmap and thus it cannot zoom in or out; this keeps it the same size always, the full height of the scene. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Setup the default icon sizes and locations.Gravatar Tomaz Canabrava
Setup the default item sizes and locations inside of the QGraphicsScene. Also added every item to the scene so that it's correctly displayed on screen. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Initializing the new Profile Class.Gravatar Tomaz Canabrava
Beginning of the code for the constructor, just constructing some of the items and preparing for the State Machine to come. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Create a Time Axis that knows how to plot the minutes.Gravatar Tomaz Canabrava
Created a Time Axis based on the CartesianAxis that knows how to plot the minutes. This is needed because the CartesianAxis donesn't knows about minutes at all, and would plot the seconds instead. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Added a 'Depth' Axis that knows how to add its strings on screen.Gravatar Tomaz Canabrava
The CartesianAxis used a simple method to put things on screen which is wrong for almost any case besides the 'current value here' since we store things in milimeters on the axis, we need to convert those to meters before showing on the profile. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>