Commit graph

10 commits

Author SHA1 Message Date
Lubomir I. Ivanov
df8107830e Print: provide means for profile layouting
printlayout.cpp(h):

This patch cleans some test code and adds the function
printProfileDives() that accepts a number of dives
per rows and columns. It can technically fit any number
of dives on a page given the page size allows it. Both
landscape and portrait layouts are supported.

It now replaces the old methods:
printTwoDives()
printSixDives()

Space is reserved for data tables that will be placed
bellow profiles on a later stage.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-27 09:29:30 -07:00
Lubomir I. Ivanov
e5b18db802 Print: improve table printing by using QTableView
The current QTextDocument implementation is slow due to
HTML parsing. By using QTableView with QAbstractTableModel
we boost the performance of the table print drastically.
This patch completely replaces the old solution.

There is a hidden QTableView widget which is populated
with all data and rendered using a QPainter attached to
the printer device.

A couple of new classes are added in models.h/cpp
that handle the table print model and these are then used
in printlayout.h/cpp.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-08-05 06:59:19 +02:00
Lubomir I. Ivanov
fc84f8868d Print: add method to convert profile to grayscale
(experimental)

Add the method PrintLayout::convertPixmapToGrayscale()
to convert a rendered profile pixmap to grayscale.
It will probably be faster to have
ProfileGraphicsView render in grayscale under certain
conditions (and use a specific color table) instead -
e.g.:

ProfileGraphicsView::setPrintMode(bool printMode,
	bool useGrayScale);

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-18 12:00:12 -07:00
Lubomir I. Ivanov
3aae3ff547 Print: mark some functions in PrintLayout as 'const'
It might be a good practice to declare certain class
'helper' functions as constant members. But I don't
think there are performance benefits to that other
than the readability ones.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-11 12:55:48 +03:00
Lubomir I. Ivanov
eab31855f5 Print: show column titles for table print
Patch does:
- set individual column width and name
(held in tableColumnNames, tableColumnWidths)
- reduce font size in the table
- more small tweaks in the style sheet

TODO: finish printing all dive data

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-11 00:52:39 +03:00
Lubomir I. Ivanov
af1c55c29d Print: move some header includes to cpp files
We don't really need includes of display.h and dive.h in
printoptions.h and printlayout.h or forward declartions
of 'struct dive' and 'struct options' in there.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-11 00:45:29 +03:00
Lubomir I. Ivanov
9a99aa4c58 Print: use the actual dive table
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-10 22:55:40 +03:00
Lubomir I. Ivanov
eb4312c9ba Print: initial implementation of the table print
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-10 19:32:15 +03:00
Lubomir I. Ivanov
20804b16d3 Print: add a setup() method to PrintLayout
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-10 16:18:16 +03:00
Lubomir I. Ivanov
41bad7695e Print: add a class for print layouting
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-10 15:34:57 +03:00