aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
AgeCommit message (Collapse)Author
2014-07-29Do not show the heartrate info unconditionally.Gravatar Tomaz Canabrava
use the preferences instead. Fixes #664 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29Make the Axis set the changed flag when a new line is setGravatar Tomaz Canabrava
This was preventing the recalculation of the ticks, making the line static when we enabled or disabled the PP graphs. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29Change the Ruler text values when metric system changes.Gravatar Tomaz Canabrava
"ups", as I did this in Metric system I forgot to update to imperial when the user selected it. Fixes #665 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29Retain the start time when creating plan from diveGravatar Dirk Hohndel
We need to make sure that the start time is set before we start adding points. Fixes #661 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29Fix time zone conversionsGravatar Dirk Hohndel
I know I tested this - no idea how I missed this. Anyway, this was of course utterly bogus. Whenever we get a time from a time_t into a Qt Date or Time datastructure, we need to adjust it by the timezone offset as otherwise Qt will assume it's in local time and helpfully change it to the wrong values for us. See #655 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29Remove unused variableGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29Another string to translateGravatar Sergey Starosek
[Dirk Hohndel: took only one of the two parts and adjusted commit message accordingly] Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29C++ Correctness and code cleanup.Gravatar Tomaz Canabrava
Use const-reference where we can gain a bit of speed from that and clear an else { if {}} by using else if. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29Don't mess with the selection when closing a fileGravatar Dirk Hohndel
Our core structures are kept consistent by calling delete_single_dive() and there is no reason at all to even touch the UI selection as this all goes away with cleanUpEmpty() Fixes #660 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-26Add dive: initialize start time of diveGravatar Dirk Hohndel
commit f29f41ae9ea8 ("Planner: fix start time handling") broke the start time handling for Add dive. While in actual planner mode we set the start time for the plan, we did not do this when simply adding a dive. The moment the time / date was changed (which admittedly in real life a user would most likely do) all was well, but if the user just accepted the "now + 1h" default, things went badly wrong. Fixes #658 See #655 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-25PrintLayout: fix a potential bug in the recent table print updateGravatar Lubomir I. Ivanov
There is a weird QPicture dependency; we need to offset a page by headingRowHeightD2, which is half the heading height. The same doesn't make sense if we are rendering the table widget directly to the printer-painter. Moving the offset inside 'pageIndexes' is less desirable. The bug itself manifests when a top margin is set on Win32, while on Linux it's more obvious. On new page start, a fixed height from the last dive on the previous page becomes visible even if the math seems correct. Offsetting both the page index and the vertical position at which the QPicture is placed fixes that. If 'table.render(&painter...)' is used the bug also goes away and our 'pageIndexes' start to make sense again, but we want to use QPicture so that the table is in vector. I don't have a good explanation why this happens! Tested on Ubuntu 12.04 and Win7. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-25PrintDialog: make "print only selected" the default optionGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24PrintLayout: vectorize the table printGravatar Lubomir I. Ivanov
Use QPicture to do that. QPainter::drawPicture() requires offsetting the target QPoint's Y value by two times the headingRow height. This can be improved the hardcodding the offset when the 'pageIndexes' are calculated, but is a bit complicated. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24PrintLayout: reduce the scope of 'pic' and 'picPainter'Gravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24PrintLayout: modify the profile font size based on the #dives per pageGravatar Lubomir I. Ivanov
For the profile print, the number of dives per page is: divesPerRow * divesPerColumn If we have more 3, 0.6 seems optimal, while for less we can pretty much use the default scale of 1.0. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24PrintLayout: draw the profile to a QImage only on LinuxGravatar Lubomir I. Ivanov
The QImage fix for the recently reported "huge-vector-lines-in-PDF-printouts" bug is only needed on Linux. For Win32 and OSx we can render to vector. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24PrintLayout: fix the ProfilePrintModel fontGravatar Lubomir I. Ivanov
Fixing the font size is required, because we don't really support a dynamic row height, as the row height is set in the class constructor. 7 seems optimal for all print modes. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24PrintLayout: disable the QPainter scalingGravatar Lubomir I. Ivanov
This is wrong because we don't really need to scale. We already have the estimated page dimentions in pixels, so taking the quotient of the printer DPI and screen DPI and then scaling (probably up) our rendered widgets via the QPainter introduces blur (due to the oversampling), and a performance penalty. By rendering at the exact dimensions we ensure that the widgets are crisp at a 100% printout. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24PrintLayout: a whitespace fixGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24Printing: add 1 dive per page optionGravatar Lubomir I. Ivanov
With this option there is an exception, which makes the notes section of the profile table occupy half the page. This way dive plans can reasonably be printed. Fixes #636 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24Planner: fix start time handlingGravatar Dirk Hohndel
We setup the startTime for the dive plan in too many places... but never actually copied it into the planned dive. Fixes #640 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24Sort dive table after adding a diveGravatar Dirk Hohndel
The dive might not be the newest dive in the dive list. Fixes #637 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24Translate progressbar textGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24Align progressbar text to center of the widgetGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-24Update strings for translationsGravatar Dirk Hohndel
Including a tiny change for one of the new strings to be consistent with the capitalization rules we recently established. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Planner: fix an enduring assert on startupGravatar Lubomir I. Ivanov
qt 5.3, win7 64bit. beginRemoveRows() asserts in removeSelectedPoints() because rowCount() - 1, becomes less than firstRow. This needs a check in removeSelectedPoints() if the number of passed rows is zero. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Only repopulate the dive info once ( we were repopulating 4 times )Gravatar Tomaz Canabrava
This makes the screen repopulate itself after a dive change only one time instead of the old 4. we were repopulateing when we removed the actual selection to reset the old selection previously stored, sigh. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Only use HTML if the text has a <table>Gravatar Tomaz Canabrava
The text we generate for the diveplan has a table inside, and we must use HTML only for the dive plan. so I treat all text as HTML, look for a table item, if it doesn't have, I treat it as Simple text and set it on the notes. Works and makes linus loves me again. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Code cleanup: HeartRate item was doing insane thingsGravatar Tomaz Canabrava
This simplifies so much of the code that we were using to control the visibility of the HeartRate. now things are much saner. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Animation speed is a value, not a booleanGravatar Tomaz Canabrava
This breaks compatibility with old preferences, but it's a single key and not that very important so I don't think it's a bigger issue I've renamed prefs.animation to prefs.animation_speed to denote that it's a value, and not a state. Also, fixed the places that were treating it as a state (on/off) to treat it like a correct value. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Don't plot pictures in Print modeGravatar Tomaz Canabrava
The pictures were being plotted in print mode, the main reason for this was that when we entered print mode and had already a picture plotted, the method would return before removing them from the screen. This fixes it. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Set visibility in a saner wayGravatar Tomaz Canabrava
for some reason we did a if(true) setValue(true) else serValue(false) now we just use the value to set the value. =p Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Break really long line.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Whitespace fixes.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-19De-duplicate planner default settingsGravatar Anton Lundin
All other default settings we get from subsurfacestartup.c's initialization of the prefs struct. The planner had its defaults there and in the retrieve of the settings from QSettings. This changes so the defaults for planner settings will be read from the defaults prefs struct as all other settings. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18get_gas_at_time needs to always give us a valid gasv4.1.91Gravatar Dirk Hohndel
Before this function was changed it was really supposed to just change a gas that was passed in in case there was an event that changed the mix - but with the new name the caller will assume that they get a valid gasmix. And promptly we had one caller that didn't initialize gas to be based on the first cylinder before calling get_gas_at_time(). Instead of adding yet one more spot that knows about the oddity of the old API I simply changed get_gas_at_time() to do what it name appears to imply and fixed the other callers not to bother to initialize the gasmix. Fixes #647 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Add missing application iconGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Print: remove the options for height from display.h's 'struct options'Gravatar Lubomir I. Ivanov
Not supported. Also the profile in "6 dives per page" doesn't really allow much variations because it looks bad if we scale it down further on A4. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Print: remove the height sliders from the PrintOptions classGravatar Lubomir I. Ivanov
These were hidden and we don't really support them because our print layouting is not that flexible in Qt! Note: printoptions.ui is now converted to UNIX line breaks. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Do not plot text twice for information.Gravatar Tomaz Canabrava
Well, the information was bad, it was being printed twice if the text is HTML, print only once. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Bypass the PDF bug by painting on a QImage and paint the image to pdfGravatar Tomaz Canabrava
well... we have a good and working printing system now. :) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Close the print dialog after a sucessfull printGravatar Tomaz Canabrava
I think it's intuitive to do not warn if everything was according to the plan, and keep the dialog open after a print was due is something that I find it strange. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Add the HTML Delegate to printing.Gravatar Tomaz Canabrava
This patch just adds the HTML Delegate to print the text. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Fixed memleakGravatar Tomaz Canabrava
The model was not being deleted when the table was, and thus we recreated it for every print. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18No need to delete a QPointerGravatar Tomaz Canabrava
QPointer is a smart pointer, it will delete itself when the refcount == 0. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Save / Restore the QPainter before operations.Gravatar Tomaz Canabrava
I don't know if this fixes anything, but it is asked of us to do that by the Qt docs. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Added a HTML Displayable DelegateGravatar Tomaz Canabrava
Added a HTML delegate to show rendered HTML on print. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Convert get_gas_from_events to get_gas_at_timeGravatar Anton Lundin
This converts the get_gas_from_events to a get_gas_at_time function that actually maps our events to what cylinder and thus gas we are breathing at that time. [Dirk Hohndel: fixed to actually use the gas that was looked up (and make things compile)] Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Use more of our propper types in the plannerGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-18Correct usage of current_dive to displayed_diveGravatar Anton Lundin
current_dive is the selected dive, and displayed_dive is the one we are currently drawing. They are quite often the same one, but not in the case of adding a dive for example. This fixes potential null pointer dereferences in the case of a blank divelist, and makes sure we use the correct data in the case of adding and planning dives. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>