aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2013-07-10Print: cleanup for PrintLayout::printTable()Gravatar Lubomir I. Ivanov
also includes: - experiment with colored background for headings - experiment with 'left' alignment for headings ('th' tag CSS does not support 'text-align') - whitespace fixes Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-10Print: use the actual dive tableGravatar Lubomir I. Ivanov
Currently only for the table print, but now we use the actual dive table to iterate trough all dives (find only selected if needed) and print their 'number' element in table rows. Also improves the new-page detection algorithm slightly. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-10Print: initial implementation of the table printGravatar Lubomir I. Ivanov
PrintLayout for now only handles the table print, while the data output itself is work in progress. For now there is a simple HTML/CSS table logic based on QTextDocument. There is an iterative algorithm which listens for a page increase and adds a heading on top of the new page. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-10Print: add a print preview for testing purposesGravatar Lubomir I. Ivanov
Use a QPrintPreviewDialog, while the print logic is WIP. This way Qt will show the print output in a window instead of exporting to a file and opending it manualy. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-10Print: add a setup() method to PrintLayoutGravatar Lubomir I. Ivanov
The setup() method will be called each time to obtain the current printer settings. Also it calculates required scalling based on screen agains printer DPI. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-10Print: add a class for print layoutingGravatar Lubomir I. Ivanov
PrintLayout is a class that will handle the layouting part of dive profiles, text, tables depending on the settings of a QPrinter and the PrinterDialog and PrintOptions instances. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-10Print: connect all the options widgets to slotsGravatar Lubomir I. Ivanov
By connecting to slots we always modify values at a previously set 'struct options' pointer. Also have the setup of slots and pre-set values in a separate setup(struct options *) function. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-10Print: correct tab order in the options widgetGravatar Lubomir I. Ivanov
Tab order should begin from the topmost widget and then descend towards the bottom end of the dialog. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-10Print: label update on height slider moveGravatar Lubomir I. Ivanov
The PrintOptions widget has value labels next to the horizontal sliders. Add slots to update these labels when a slider moves. Patch also makes a modification so that the PrintOptions constructor requires a 'struct options' pointer. If an options struct is not received we do not set predefined values and do not connect signals to slots, where options will be updated immediately. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-09Print: further adjust the print options widget UIGravatar Lubomir I. Ivanov
Makes the controls less cluterred on Ubuntu. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-09Print: add all controls to the print options widgetGravatar Lubomir I. Ivanov
- adds missing file printoptions.ui - adds all controls present in the GTK version of the print dialog custom tab Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-09Print: add UI for a print dialogGravatar Lubomir I. Ivanov
PrintOptions is a QWidget class to be used as an addition to a future print dialog (possibly based on QPrintDialog). Currently only contains a couple of radio buttons. PrintDialog (printdialog.cpp/h) which is a basic QDialog is currently added for testing only and it holds an instance of PrintOptions. Calling File->Print opens this test dialog for now. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-05Calculate deco stops, TTS and NDLGravatar Anton Lundin
Calculate TTS and NDL, and Deco stops when they don't already exist in the samle and show them in the mouse-over. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-05Profile: prevent a bug when switching viewsGravatar Lubomir I. Ivanov
While in zoomed mode and when resizing the splitters or switching views the profile tooltip can end up being at the wrong location and also the zoom state becomes corrupt, so perhaps the entire transformation needs to be reset. To prevent the bug we listen for relevent to the profile splitter resize event, view changes and clear()/plot() the entire profile graphics. This is an slow/expensive solution and perhaps there are cheaper alternatives e.g. updating only the scene rectangle and tooltip, somehow. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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-05Profile: small tweak for tooltip separator lineGravatar Lubomir I. Ivanov
Add 3px of a initial horizontal offset. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-05Profile: collapse tooltip back to original heightGravatar Lubomir I. Ivanov
When collapsing the tooltip we want it's border to become the same height as when no tooltip info was visible - i.e. post creation. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-04Fix Uemis Zurich downloadsGravatar Linus Torvalds
Commit 48ba01b807cc ("Enable downloads from the UEMIS Zurich") mistakenly switched the meaning of the "force_download" argument when it moved from "struct argument_block" to being a direct argument. This fixes it right back. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-04Qt: Implement trip merging logicGravatar Linus Torvalds
So during my Maui trip, I had a short hiatus in diving, causing subsurface to start a new trip for the last day of diving. I could have just started the old gtk branch to fix it up, but decided that I might as well try to implement the "merge trip" logic in the Qt branch instead. This is the end result of that. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> 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-04Profile: use more levels of zoomGravatar Lubomir I. Ivanov
Makes it easier to see colored lines - e.g. velocity with 20 levels of zoom. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-04Profile: prevent a zoom glitch at maximum zoom levelGravatar Lubomir I. Ivanov
The 'else if' condition in ProfileGraphicsView::wheelEvent() is causing a zoom-in / zoom-out loop at zoomLevel = 10. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-04Added a messageBox when the planner quits with a working plan.Gravatar Tomaz Canabrava
Added a messageBox to warn the user that he quit with a working plan, to reduce the risk of unwanted loss of work. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Added the left / right shortcuts for moving the handlers around in time.Gravatar Tomaz Canabrava
Added the left / right shortcuts for moving the handlers around in time, this also made me wonder why we have the 'previous dc' on the menu, it got actually to broke my code on the shortcuts for the planner because they are active everytime - should they be active only when the profile's visible or they serve any other purpose? If they serve only for the profile, I'll get them out of the menu and put them in their proper place - the profile view. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Added 'up' and 'down' actions on the dive planner.Gravatar Tomaz Canabrava
Added 'up' and 'down' keyboard actions on the dive planner, you need to select the handlers with ctrl + click, then press up to make the handler go 1m up, or down, to make the handler go 1m down. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Added a 'delete' action, with the keyboard.Gravatar Tomaz Canabrava
Added a delete action from the keyboard, there's also a possibility to add the same action from the menu, but I frankly don't like much the idea. so, to delete a handler now, you need to select it ( ctrl + click ) then press the delete button. Multiple delection is also possible. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Added a shortcut to 'esc', so it clears the selection or cancels the plan.Gravatar Tomaz Canabrava
Added a shortcut to the esc key, so it clears the selection, if there's no selection, it acts just like clicking on the 'cancel' button. Next: delete selected handlers. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Make possible to 'select' an handler by ctrl+clickGravatar Tomaz Canabrava
Make possible to select an handler by ctrl+click on it, this will be used in the future for the shortcut actions, like delete, arrow keys, and such. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Fixed the 'hard to grab' Handler, Dive Planner now is very smooth.Gravatar Tomaz Canabrava
So, it was on the docs, but I didn't read it before, if the scene has items that ignores transformations, we need to pass the view transform to the method that gets the items in the scene. I also used IntersectsItemBoundingRect instead of IntersectsItemsShape because it's faster, and our items are small, so we don't need an very accurate but slower method. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Make it possible to drag a handle between handlersGravatar Tomaz Canabrava
Make it possible to drag a handle between handlers, this way the configuration of the dive is more acurate and easyer to make. I'v discovered a problem where it's a bit hard to 'grab' the handler, investigating it now. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Make it possible to add a handler between othersGravatar Tomaz Canabrava
Make it possible to add a handler between others, someone asked why I didn't make like this from the beginning, the answer is that I wanted to have something stable before messing a bit more with the planner, but since the planer is almost-stable, I added. :) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-04Better positioning of buttons on dive plannerGravatar Tomaz Canabrava
Better positioning of buttons on the dive planner. The ok / cancel buttons are in the correct place, and the '+' sign for time will not overlap the time string anymore. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.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-07-02Revert "Profile: add white outline to all text"Gravatar Dirk Hohndel
This reverts commit 44c33742c26dcf9387b5c837c161e33ddc5eb060. I mistakenly applied the wrong version of the patch. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-02Silence some warningsGravatar Dirk Hohndel
One of them actually looks like it was a bug... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-02Merge branch 'nitpicks' of github.com:tcanabrava/subsurfaceGravatar Dirk Hohndel
2013-07-02Make the increase time button to work.Gravatar Tomaz Canabrava
Makes the increase time button to work, it will increase the minimum time, not the correct time of the dive. the total time is calculated by the deco, and does not come from this, unless the deco is smaller than the minimum time. This patch also fixes the problem where a button would only click once - I was holding the first clicked button as the 'mouse grabber', bad tomaz. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Make the 'increase depth' button to work.Gravatar Tomaz Canabrava
Make the increase depth button to work, it also adds a 'safety' stop at 150m, I know that this is deep, and maybe we need to adjust this to a better safety stop. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Removed user-entered lines on the plan, keeping only deco.Gravatar Tomaz Canabrava
Removed the user-entered lines on the plan, keeping only deco, This way the graph looks way prettier and we don't loose any functionality. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Change the color of the DepthString based on it's deepnessGravatar Tomaz Canabrava
Change the color of the DepthString based on it's deepness on the profile planner. The new color of the profileString ( the string that follows the mouse stating how deep you are) is now interpolated from SAMPLE_SHALLOW and SAMPLE_DEEP - but since those two colors were the same and I had to change it so that could work, I want somebody to check if my choose of colors were ok. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Use the same profile colors on the planer for the Time and DepthGravatar Tomaz Canabrava
Use the same profile colors on the planner for the Time and Depth rulers. this needed a new method on the rulers - setColor, that will call the setPen method and make everything behave properly. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Fixed positioning of the dive Handlers.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Correct collors for the DivePlanner background.Gravatar Tomaz Canabrava
Use the correct colors for the Background on the Dive Plan, same as on the Profile. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Added the last 'tick' to the rulersGravatar Tomaz Canabrava
The last tick to the rulers were missing, this was making them to look odd, this make the rulers better looking, but it caused the other-non-ported-yet-to-percent stuff to behave in a not so good way, most visible one is the handlers, gonna update them next. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Change the rules so they work with percentages.Gravatar Tomaz Canabrava
Changed the ruler so that they work with percentages, also added a new method to the rules to set the size of the ticks. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Added a method and a simple stub to position things using percentage.Gravatar Tomaz Canabrava
Added a method and a simple stub to position things on the canvas using percentage - this way I have a proper control on where I want to put things on screen and it will make simpler for future changes, even if the amount of code written is a bit bigger. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Shared background for profile and planner.Gravatar Tomaz Canabrava
Share the background for profile and planner. Those are not the same class, but they should behave somwheat the same. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Added 2 new files to handle the common stuff for graphics.Gravatar Tomaz Canabrava
Added 2 new files, graphicsview-common.h/cpp, that should have the common stuff shared between the dive profile viewer and the dive planner. the amount of duplicated code would be huge if we go the road of two different classes for each one, but since the planner took a more 'Qtish' way of behavior, in comparisson to the profile - that's most a Cairo-To-Qt literal translation, we cant easily merge the code without a complete ( and unwanted ) reestruturation of the profile code, thus, this new files will serve as a bridge between them. Initially I put there only the colors - since that's wat most easilyy shareable. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-29Profile: add white outline to all textGravatar Lubomir I. Ivanov
Goal: no blending between profile text and graph lines Qt doesn't seem to provide an easy-to-go solution in terms of styling the z-order of the pen and brush layers of a QAbstractGraphicsShapeItem (or alternatively pen offset), which is needed if for example one likes the pen not to cover the text fill. Calling QGraphicsSimpleTextItem->setPen() on small text can cover bigger portions of the text, as the pen ends on top of the fill and given the pen stroke path ends up scaling exactly at the fill path border but not on the outside, for example. Since we don't get quick control over that (and to avoid the issue in a naive way), we set the text as bold and the white outline lands over the "bold-ed" area of glyphs. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-28Profile: move the bounding box below plot dataGravatar Lubomir I. Ivanov
In certain conditions a number such as '51' could end up being partially hidden under the white bounding box in such a way that the digit '1' is barely visible. Putting the bounding box bellow all plot data solves the issue. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>