aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profilegraphics.h
AgeCommit message (Collapse)Author
2013-11-01Added a new option to edit the dives.Gravatar Tomaz Canabrava
Added a new option to edit the dive in the profile view. The option will only be visible if the dive was manually entered or if the dive is a plan. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-10-15Fixed the moving around of the InfoPanel on non KDE enviroments.Gravatar Tomaz Canabrava
This patch restores the ability to move the info-overlay panel on the profile. For some reason the eventFilter wasn't working (and actually, looking at the code, it really shouldn't, because I didn't see where I set it to work, maybe someone (me) broke it a long time ago) well, it seems fixed now at least. :) Tested on XFCE, Gnome and KDE, with three different window managers. [Dirk Hohndel: removed debug output] Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15Random white space cleanupGravatar Dirk Hohndel
Because I can. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-11Remove unused arg in plot_cylinder_pressureGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-27Added a toolbar to the profileGravatar Maximilian Güntner
The toolbar adds two buttons to the profile. The user can now toggle the scaling (zoomed to dive/round up to 30 mins) and adding /removing ruler to/from the profile using this toolbar. Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-09-27Added a ruler which can be dragged along the profileGravatar Maximilian Güntner
This patch adds a ruler QGraphicsItem which can be dragged along the profile. The ruler displays minimum, maximum and average for depth and speed (ascent/descent rate). Also, all used gas will be displayed. This also adds a new attribute to struct plot_data to store the speed (not just as velocity_t). Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-08-05Support more than one event of the same type in Qt tooltip.Gravatar Michael Andreen
Since the tooltip text was used as key in the map, two events of the same type, close to eachother, would cause one of them to not be removed. Since ToolTip::removeToolTip() isn't used, we don't need a QMap and can use a QList instead, so all tooltips are properly cleared. Signed-off-by: Michael Andreen <harv@ruin.nu> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-18Profile: support grayscale plottingGravatar Lubomir I. Ivanov
This patch adds the getColor() helper function to ProfileGraphicsView and EventItem so that retrieving a certain color can depend on a 'isGrayscale' flag. This flag is private and only set by ProfileGraphicsView::setPrintMode() at this point. EventItem also now accepts 'grayscale' as a constructor argument. A couple of side modifications are: - move setBackgroundBrush() to ProfileGraphicsView::plot() - set the same pen color as brush color for the dot in the '!' symbol inside EventItem::EventItem(). TODO: look for color issues when printing using the custom grayscale table Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-18Profile: add the isGrayscale flagGravatar Lubomir I. Ivanov
setPrintMode() can now be used to set the profile to be plotted in grayscale. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-18Profile: use a printMode flag in ProfileGraphicsViewGravatar Lubomir I. Ivanov
When printing the profile there are certain features which we want different (or disabled). This includes font scale ignoring and showing a toolip. To achieve that we check for a printMode flag in ProfileGraphicsView which can be set using setPrintMode(bool). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-05Profile: improve tooltip animationGravatar Lubomir I. Ivanov
Remove a couple of expand() calls(?). Also store the last expanded rectangle size in the private variable nextRectangle and use that in collapse() animation. Patch prevents a small jump/resize glitch if the user quickly hovers over and out of the profile while the tooltip is still resizing. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-04Profile: attempt on better zoom and pan logicGravatar Lubomir I. Ivanov
QGraphicsView::AnchorUnderMouse does not work for Qt 4.8.1 on Ubuntu 12.04 and if the mouseMoveEvent overload is disabled it practically can be seen that the anchor point is [0, 0] instead of the mouse location. After a suggestion found on the web this patch attempts to use the hidden scroll bars to calculate reposition on pan and zoom *near the mouse cursor. On the other hand QAbstactSlider (QScrollBar) class strangly uses negative offsets for minimum scroll position, which makes the implementation even more ugly. [*near] because it's not that accurate! Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-02Profile: add white outline to all textGravatar Lubomir I. Ivanov
To draw the white outline around profile text we trace a text path using QPainterPath::addText() and then create a couple of QGraphicsPathItem objects. One of the objects is outlined using QPainterPathStroker and is placed at the bottom of a QGraphicsItemGroup with a white brush. The other object holds the standard colored text and is placed on top. Notes: - possibly quite expensive on older machines - ProfileGraphicsView::plot_text() now returns a QGraphicsItemGroup - QGraphicsSimpleTextItem uses a top-left baseline anchor while QPainterPath::addText() uses a bottom-left baseline which is a bit mysterious, requires the -3 offset for a match and is possibly non-portable across fonts and sizes. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-19Consistently use slots / signalsGravatar Dirk Hohndel
We started out using Q_SLOTS and Q_SIGNALS but then changed our mind. Let's make this consistent again. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-14Plot cleanupGravatar Dirk Hohndel
Use a helper to make things easier to read. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-10Added a slot to set the full time of the dive planGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10Added a simple "TextEditor" in the graph, for a plan mode.Gravatar Tomaz Canabrava
Added a simple TextEditor in the graph for the 'Dive Plan' mode, this text editor is very simple, so the user can double click on 'depth' or 'duration' to set the depth or duration of the dive. Since this was a test, only 'duration' was done, and I'll add duration on the next commit. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10Added a 'Plan' mode and a 'Dive' mode on the profile.Gravatar Tomaz Canabrava
Added a 'Plan' mode and a 'Dive' mode on the profile. Those modes tell the application what can be done: Plan - the dive's dinamyc and can be changed, 'Dive', the dive is fixed ( most probably downloaded from a dive computer and it's readonly. ) - now I need to properly populate stuff. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10Implemented the movement of the ToolTip by Hand.Gravatar Tomaz Canabrava
Reimplement the movement of the tooltip by hand, we were adding / removing childs of the tooltip quite often, wich broke the movement of the item using the default behavior, aparently Qt uses a cache of the transformation of the item, assuming that the bounding box of it will not get modified while dragging. wich in our particular case, is a falacy. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10Save / Restore toolTip information position on the Profile when switching dives.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10Fix memory leakGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-07Hide/Show tooltip on mouse over view widgetGravatar Helio Chissini de Castro
Proper hide/show tooltip under ProfileGraphicsView. Events are not properly handled and no custom tolltip status was stored. Text are properly hidden now when tooltip is collapsed. Reported-by: Tomaz Canabrava Signed-off-by: Helio Chissini de Castro <helio@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31Show the gas with the pressure diagramGravatar Dirk Hohndel
This is a feature that had been requested a few times in the past and when debugging my "show only used gases" commit I realized that this would have been extremely useful to have... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-26Hook up most of the Preferences dialogGravatar Dirk Hohndel
The imperial/metric super setting doesn't have any effect. But changing the individual units now works and is tracked. And causes the display to change after clicking "OK" (but not yet when clicking "Apply"). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22The never ending, futile fight for whitespace consistencyGravatar Dirk Hohndel
I just need to write a tool that does this... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22Re-enable dive computer selectiomGravatar Dirk Hohndel
This had been disabled by some redraw optimizations in commit 81406b80c6ec ("Fix loading a second dive, after the first file was loaded."). We need to redraw the plot not only if the dive changed but also if the selected divecomputer changed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-16Fix loading a second dive, after the first file was loaded.Gravatar Tomaz Canabrava
This patch fixes loading a second dive-file after the first one had been loaded. it simply clears some information and makes sure that the current selected dive is invalid when the file closes. I also did a bit of code cleanup on this one to make things simpler in the future. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-10Fixed loading the first dive via command line on the profile.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-10Fixed Zoom and Positioning of the Ruler ItemsGravatar Tomaz Canabrava
The items are still being placed far from each other when zooming in - I need a bit of help with the math for that. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-10Fix some compiler warningsGravatar Dirk Hohndel
Passing the alignment as int instead of float or double was actually a bug as CENTER is defined as (-0.5) ... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-10Change the plot text so it receives a QPointF instead of x,y, and a ParentGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-10Only drag the tooltip panel when not zooming.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-10Fix Tooltip Positions, code cleanupGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09The Zoom is working just like the GTK Version.Gravatar Tomaz Canabrava
This code enables Zoom in / Out with the Wheel, and it also enables panning by moving the mouse around. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09Removed unused code that I'm sure it's safe to delete.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09Plot the vertical ruler on the left of the profile.Gravatar Tomaz Canabrava
Plot the numbers on the left of the profile. It seems that everythign is being plotted - But I can see that there are coordinate-errors on the code. ( the GTK one plots some curves below of the dive, but the Qt one is overlapping - probably the way that I'm using the gc information) Need to investigate a bit. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-09Plot pp TextGravatar Tomaz Canabrava
This patch plots the PP text, but when I plotted I realized that the gc.pi.mapp is being calculated wrong, probably something went wrong on the calculations - it's comming zered always. So, only one line & text is plotted. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09Plotting deco text.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-09Plotting cylinder pressure text.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09Plotting depth text.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09Plotting temperature text.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09Plot of the Cylinder Pressure over time.Gravatar Tomaz Canabrava
a few code was moved around, a macro that contained the form of x ? : y; had to be rewritten to x ? x : y since c++ doesn't allow ternarys without the middle operator. The color-choosing for the Cylinder Pressure broke on the Qt port - but it's a small issue. I'm painting everyone as 'dark green' now, will fix that later. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-08Stop passing around gc and piGravatar Dirk Hohndel
Make the graphics_context part of the ProfileGraphicsView and remember that the plot info is already a part of the graphics_context (we kept passing around both of them in the Gtk code... pointless but a leftover from before adding the pi to the gc...) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-08Plot the temperature GraphGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-08Make tooltips worksGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-08Work on the tooltips - WIP.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-08Better design for the ToolTip Handler.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-07Added a bit of documentation on how to use the ToolTips & removed 2 bad-api ↵Gravatar Dirk Hohndel
methods Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-07Adds real support for ToolTips.Gravatar Dirk Hohndel
This patch changes the Event drawing so it can display tooltips. It is now the responsibility of the item to show / hide a tooltip. A bit of code-refactoring got on here too because I was using only QGraphicsItem calls and I wanted to use a hover in / hover out event to show / hide the tooltip. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-07Added the first overlay of the tooltips, with some test data.Gravatar Tomaz Canabrava
The tooltips now can: 1 - be moved around the canvas 2 - dynamically expand / retreat when a new tooltip is added. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>