Commit graph

8665 commits

Author SHA1 Message Date
Jan Darowski
6856e87689 VPM-B: Add conservatism levels to the ui. Fix planner settings disabling.
Conservatism level can now be changed from gui, is saved in settings.
Also way of disabling the planner settings in the ui was improved
to support more deco models and be called at the widget creation.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-08-15 15:16:51 +02:00
Jan Darowski
cad866013b VPM-B: Add conservatism levels to deco.c
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-08-15 14:36:07 +02:00
Jan Darowski
499ec9af2f VPM-B: Add surface decompression time.
Now, we calculate the volume of free gas not only based on the deco
time but also time on the surface, needed for the full desaturation.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-08-15 14:32:36 +02:00
Dirk Hohndel
2455a5dec7 Merge branch 'custom-print' of github.com:neolit123/subsurface 2015-08-15 05:22:07 -07:00
Jan Darowski
c0fde4f50f VPM-B: Add Boyles compensation to the planner.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-08-15 14:21:18 +02:00
Jan Darowski
a828d528f9 VPM-B: Add simple Boyle's law compensation.
This is a very basic implementation that uses bin search for solving the cubic.
It's not called anywhere at this stage, needs to be changed to analytic solution.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-08-15 14:09:51 +02:00
Gehad elrobey
f3c5699714 Printing: remove silly white line at end of each page
QPrinter::pageRect() doesn't always return the correct value of the
printable area, which results in white horizontal lines of un-rendered
area at the bottom of each page, Use QPrinter::pageLayout() instead
which fixes the issue.

QPrinter::pageLayout() is added in QT 5.3, So use pageRect for previous
versions.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:05:26 +03:00
Gehad elrobey
5892fb5762 Printing: fill the QPainter background color before rendering
While rendering a dynamically sized view port, it may not fit the full
page size, But the background color should be the same for the whole
page, So fill the page background color with the template background
color before rendering.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:05:22 +03:00
Gehad elrobey
f7fcc96bff Printing: enhance 2 dives template
- Add more text padding on the left
- Reduce the width of the profile so that the padding on the right of it
is equal to the padding bottom from it.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:05:16 +03:00
Gehad elrobey
2d360e8a6d Printing: add table backgrounds and borders to six dives template
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:05:12 +03:00
Gehad elrobey
4f9349f548 Printing: use the same background for all the data cells flow layout
Dive notes should have the same background as the remaining data cells.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:05:07 +03:00
Gehad elrobey
c862636cf0 Printing: add 'dontbreak' css class to dives
Prevent breaking the dives in flowlayout, and the rows
in the table template. They should have the 'dontbreak'
css selector.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:04:58 +03:00
Gehad elrobey
6a9c4cb9d7 Printing: don't break dives into successive pages
While rendering a template with "0" dives per page value, try to fit
as many dives per page but don't break a dive into 2 pages.

Use a dynamically sized view port to fit the rendered area only,
and don't render the full page.

All the Template elements that shouldn't be broken should have
the CSS class "dontbreak".

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:04:45 +03:00
Gehad elrobey
31df69c401 Printing: disable ui elements on statistics print
Disable all the UI elements for "dive list print", disable
all the template settings as well, Template Edit button
will be enabled after statistics print supports color palettes.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:04:34 +03:00
Gehad elrobey
72b35d8e79 Printing: use border width from Grantlee backend
Find the border-width dynamically from the Grantlee backend.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:04:26 +03:00
Gehad elrobey
59eddc6259 Printing: export border to templates
As there is a problem with sizing the borders in QWebView, "vw" sizing is not
working as supposed with border-width, As a workaround we export border-width
dynamically, so that border-width is relatively the same for all page sizes.

The border-width is equal to the page width / 1000 which gives a nice range
for borders for A0 - A5 papers, Also prevent drawing zero pixel borders
and use 1 px borders as the minimum border.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:04:11 +03:00
Gehad elrobey
0ced68f15d Printing: fix scrolling bug by adding extra padding
This bug occurs in "table" and "flowlayout" templates, it takes place when
the size of the full web view to be rendered is not divisible by the size
of the view port (Page size), This issue is fixed by adding extra padding
to the bottom of the body so that the total body height is divisable
by the view port size.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:03:53 +03:00
Gehad elrobey
efe8dc9b57 Printing: remove the outer border from table template
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:03:49 +03:00
Gehad elrobey
d7f1a6b96e Printing: remove extra white spaces from 6 dives template
The are some rounding errors in the 6 dives template.
Solve them them by adding the color to the main body div.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:03:07 +03:00
Gehad elrobey
cfa34cc022 Printing: add more padding on the top of the profile
add more padding on the top of the profile so that the
left-right-top padding around the profile is the same.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:03:05 +03:00
Gehad elrobey
de889b90ad Printing: rename "Table cells" to "Table cells 1"
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:03:01 +03:00
Gehad elrobey
06e2fab291 Printing: insert placeholders in empty feilds
Don't leave fields empty, this may corrupt the layout, a better way is
to insert placeholders for empty data, which also provides a better UX.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:59 +03:00
Gehad elrobey
d72ba4f15a Printing: remove templates additional margins
Remove extra margins and paddings in templates.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:57 +03:00
Gehad elrobey
636c26feed Printing: hide scrollbar from QWebview to fix padding issue
The vertical scrollbar was causing a default margin at the right most of
the page which corrupted the page layout calculations. By hidding the
vertical scrollbar the issue is fixed.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:54 +03:00
Gehad elrobey
dc56d1fa54 Printing: remove the outer most border for all templates
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:51 +03:00
Gehad elrobey
ebd83b15da Printing: make the actual data font width regular (not bold)
The actual data needs to be regular font not a bold font, so use <p>
instead of <h1> tag for the actual data fields.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:48 +03:00
Gehad elrobey
5194401112 Printing: make default borders black
Make all borders black by default.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:46 +03:00
Gehad elrobey
0fadfae754 Printing: replace dark and light colors
Make dark colors for headers while lighter colors for data fields, this
is more intuitive, and makes the palettes more appealing.

Make dark color default for cells2

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:37 +03:00
Gehad elrobey
04fc07405a Printing: add color3 to templates and make it effective
Use the added color for 'Table cells 2'

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:35 +03:00
Gehad elrobey
e0ecccfa7b Printing: fix color numbers in printing templates
After adding the additional 'Table Cells 2' color to the color palette
fix the colors assigned to each field.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:33 +03:00
Gehad elrobey
1dbe10fe27 Printing: add another color in color palettes
Add another color 'Table cells 2' to the color palette, make all the
backgrounds solid white by default.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:30 +03:00
Gehad elrobey
1a2f154cf4 Printing: add statistics print
Add statistics table print option.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:28 +03:00
Gehad elrobey
f05e9c5c79 Printing: export more dive details with Grantlee backend
Add SAC, tags, used gas and dive rating to dive data fields exported
with Grantlee backend.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:20 +03:00
Gehad elrobey
e2dcee55a3 Printing: use pageRect() to support old QT versions
While calculating the page size use QPrinter::pageRect instead of
QPrinter::pageLayout which is added in QT 5.3 and is not supported in
earlier versions.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:17 +03:00
Gehad elrobey
11841563d2 Printing: add six dives per page template
Six dives per page templates makes good use of the page area, it can be
mainly used to produce a lightweight print outs.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:15 +03:00
Gehad elrobey
9c13e7a071 Printing: enhance templates layout
Make better use of extra spaces, and decrease the margin sizes.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:12 +03:00
Gehad elrobey
88c19adc78 Printing: hide warnings in dive profile while printing
While printing only draw headings, SP changes, gas events or bookmark
events, otherwise don't show anything.

Many warning logos can hide the useful information especially in
templates with small dive profile area.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:10 +03:00
Tomaz Canabrava
0aafa2556e Remove title of the dive site tab edit
There's no need to show the 'dive site' name on the group box

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15 05:02:07 -07:00
Gehad elrobey
8d0101bf3d Printing: templates should use colors defined in the color palette
Use the colors defined in the color palettes for all font, borders,
table sections and backgrounds of all templates.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:07 +03:00
Gehad elrobey
1d22bdc08c Printing: fix TemplateEdit color selection bug
When choosing a color from the QColorDialog, the TemplateEdit trigger to
change the current selected template to be custom, and then changes the
selected color. When the selected template is changed old template
values are copied to the current template which results in incorrect
behaviour.

This is fixed by checking for the current editting state before setting
the saved palettes as the current used palette.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:04 +03:00
Gehad elrobey
dd7bae378e Printing: fix wrong custom palette index
The custom palette index is defined by the CUSTOM directive, and it
should be used.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:02:01 +03:00
Gehad elrobey
55f09f0106 Printing: don't save invalid colors
When QColorDialog is closed with 'Cancel' button, it returns invalid color
that must be discarded. So check if color is valid to prevent replacing
the current color with black.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15 15:01:58 +03:00
Tomaz Canabrava
86f61a6664 Minor code cleanup.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15 05:01:33 -07:00
Tomaz Canabrava
b62cf45d59 Change colors of stars if widget has focus
Some widgets on the main tab don't show any kind of focus indicator on
some systems (like Mac), so it's a good thing to provide another way to
show that they indeed have focus.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15 05:00:30 -07:00
Tomaz Canabrava
25273a3912 Remove obsolete comment
We don't allow building against Qt4 anymore.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15 04:59:23 -07:00
Tomaz Canabrava
ed30059183 Add DiveSitePicturesModel
This model should be used inside the Edit Dive Site mode.
It should display all photos from all dives that are part
of this dive site, ignoring trips.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15 04:59:01 -07:00
Jan Darowski
a3e87bf1a1 VPM-B: Fix trial_ascent() for vpm-b.
Previously, current depth was checked, instead of the depth after the move.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-08-15 13:45:42 +02:00
Lubomir I. Ivanov
342479586d Planner: use the heap for note buffers
The default stack size on Windows per thread is 1024kb.
Using the heap prevents a stack overflow in add_plan_to_notes().

The alternative is to tell the linker to use N bytes of stack:
-Wl,--stack,N

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-10 00:04:17 -07:00
Miika Turkia
7e50711bd3 Set proper mode for file open dialog
Fixes #913

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-09 23:55:53 -07:00
Miika Turkia
e4353cb4a7 Report empty file error instead of OOM
If we are trying to open an empty file, skip the attempts to parse the
input and report an appropriate error message.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-09 23:55:45 -07:00