While it's nice to have immediate response to gradient factor changes,
there is an oddity that very low GFHigh values can cause infinite
decompression if the last stop is at 6m.
Robert fixed this and now errors out of deco after 48 hours, but if the
user simply wants to edit their GFHigh from (for example) 75 to 70 and
deletes the '5', we really don't want to trigger a recalculation for
GFHigh of 7...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The only time we want the close button is when showing an error at the
bottom of the main window.
In the other cases (maintab, globe) we need to explicitly hide it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Revert "Don't add a close button to KMessageWidget"
This reverts commit 75c9bcd726.
Revert "Remove unused variable"
This reverts commit 9edee3477a.
I was fixing the wrong problem... instead of removing the handling of the
Close button I should have figured out why the close button was
incorrectly shown in the first place.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It appears that at least on Win7-64 Windows tries to create the temporary
file in C:\ and fails because of insufficient permissions. How stupid is
that.
Instead we roll our own tempfiles, based on the already existing tempfile
name that is passed in.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If we add a picture to the dive, this will not change anything
else, so there's no need to recalculate the profile_plot info.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Save Yearly statistics as JSON data to the stats_files.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The layout was a hardcoded position without layouts, that
would only work on english language since other languages can
have bigger strings than the current ones.
Also removed the 'setFixedSize' stuff and let the widget
find it's best size for itself.
Fixes#656Fixes#396
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The issue with the dive list was actually the Planner Settings widget
that was in the same space as the dive list but hidden, but since it
had a minimum width we couldn't resize the dive list to be below the
planner settings minimum.
Fixed by inserting the contents of the Planner Settings into a QScroll
Area.
Fixes#679
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Some of the toolbox icons will trigger a recalculation of the dive,
triggering then a replot, that will copy the dive to the displayed_dive
again, but in the case of a edit this would discard the edition (
that would still be shown on the UI ) leaving the dive in an
unconsistent state.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When pressing Print or Preview from the PrintDialog, we need
to first check if there are printers installed. If not
we abort and show an error message.
This is needed because if no printers are installed,
things like the reported page height could be zero and
the profile and table print code in PrintLayout will
break.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In #671 a user reported that the table print outputs a blank page if there
are dives for one page or less to be printed.
This doesn't really makes any sense.
A possible bug in Qt4's QPicture is suspected, so we only enable the
vector print for Qt 5.0 and newer versions.
See #671
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Almost invisible, mostly looking like an odd bug in the profile code,
there was a tiny red line at depth 0 in the planned profile. Turns out
that was the missing mean depth. We didn't populate enough data in the
dive computer of the dive we generated from the plan (and the length of
the depth line was incorrectly determined by the duration of the dive
instead of the duration stored in the dive computer).
Fixes#570
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We need to change the displayed numeric value of the altitutde and not just the
unit suffix when changing unit systems.
Fixes#681
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
zip_open needs correct directory separators. QFile::encodeName does not
do this conversion, so we must call it explicitly.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This fixes the problem I pointed out im my comment to #667 and hopefully also
the original problem although I cannot confirm since i cannot reproduce the
problem in the first place.
See #677
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We don't blow into our cylinders under water.
Negative pressures should be allowed as they might arise from dive planning
without taking care of gas consumption.
fixes#644
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt internally always uses / as directory separator. #651 shows that in the recent
files menu, under windows we can have double entries with both versions of the
separator. This patch should normalize the menu entires to use the native separator
(i.e. \ on Windows). (Untested due to lack of Windows computer).
See #651
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is yet another unintended side effect of the UI restructure changes.
I stared at this code for so long - I can't believe I kept missing this.
Fixes#668
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The error with 'ungrabMouse' warning that we got was because
we were removing an item that had the mouse grab instead of
waiting a few milisseconds so it won't be the mouse grabber
anymore.
So I'v used the Animations::hide() to get rid of it, and
since it worked well, I'v also added a Animations::show()
method to display it in a good fade-in way.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added the remove_picture functionality, with code
shamelessy stolen from remove_event, and hoock it
up with the interface.
Fixes#650
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since the idea is to remove the picture in the future, we need
to not hold the row on the model, as when we delete one, the
other pictures will change the row. but the QUrl is unique.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch hides a picture from the dive, it should actually
remove it, but because I didn't found a quick way to remove
a picture from the dive yet, it just hides it.
To remove a picture from the dive, the DivePictureItem has to
remember the QUrl of the original file, to remove that from the
model, and currently it only has the QPixmap.
this can be for 4.2.1 or we can postpone 4.2 a tiny bit since this
is a important feature.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Reusing the displayed_dive for this caused all kind of odd problems that
were hard to reproduce, because the behavior depended on what was in the
corresponding fields of the current_dive. Worse: the GPS location handling
prevented us from reliably removing the location of a trip.
The solution isn't ideal and certainly isn't elegant. Maybe we simply
shouldn't reuse the widget here. But I think what I have now works - I
tried hard to make it break again and couldn't.
Fixes#659
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
"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>
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>
[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>
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>
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>
commit f29f41ae9e ("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>
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>
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>
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>
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>
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>
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>
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>
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>