Commit graph

19 commits

Author SHA1 Message Date
Dirk Hohndel
1cf31eeaf9 Make Subsurface compile with NO_PRINTING set
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 10:18:37 -07:00
Gehad elrobey
231f90bd26 Printing: call print from printer class
This is the main function that prints dive lists.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 10:08:04 -07:00
Gehad elrobey
b4e1563d10 Printing: remove the print_options struct from display.h
Move print_options struct to printoptions.h, its more relevant to be
placed here.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 10:07:59 -07:00
Gehad elrobey
912606e1c7 Printing: Remove the obsolete code from PrintDialog
We don't need any further calls to printLayout as it will be replaced by
Printer class that handles the new custom printing capability.
Also fix one coding style issue.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 10:07:46 -07:00
Lubomir I. Ivanov
7ea728e95f Print: add the support to store margins and printer options
All the print options will be stored after the user closes
or "cancels" the print dialog.

There seems to be no good way to store the last
selected page size, because print dialogs are different and
some just list them as strings - A4, A3, etc.

The patch also applies the following changes:
- renames display.h's 'struct options' to 'struct print_options'
as these were really just for the print dialog
- the print_options dialog now stores more options as 'bool'
- demote PrintDialog's 'printOptions' to 'private'

Fixes #653

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-13 15:05:11 -08:00
Dirk Hohndel
4fd0dfcabb Printing: only give up if no size is available
Checking for available printers appears to sometimes fail, even if there
is a valid PDF or PS printer.

Instead we bail if we can't get a valid size for the printer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 10:01:38 -07:00
Lubomir I. Ivanov
69676b08fb Print: display an error message if no printers are found
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>
2014-08-04 09:47:18 -07:00
Anton Lundin
198199adae Remove printing when building for Android
Qt for Android doesn't support printing.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-27 10:42:07 -07:00
Dirk Hohndel
76e6420f6b Massive automated whitespace cleanup
I know everyone will hate it.
Go ahead. Complain. Call me names.
At least now things are consistent and reproducible.
If you want changes, have your complaint come with a patch to
scripts/whitespace.pl so that we can automate it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 20:09:57 -08:00
Boris Barbulovski
ccb1c33d02 Put include guard to every header
* ensure include guard to every header
* comment endif guard block

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:37:01 -08:00
Boris Barbulovski
7c4c0802dc PrintDialog small improvements.
* Remove closeClicked() slot, and use QDialogs accept() slot
* Simplify QObject::connect call by removing the QObject scope.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 08:20:17 -08:00
Boris Barbulovski
02e9a6d07b PrintDialog class cleanup.
* Remove static PrintDialog::instance() method
* Remove void PrintDialog::runDialog() method
* construct/destruct print dialog on demand

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 08:15:42 -08:00
Lubomir I. Ivanov
fc06a69c43 PrintDialog: reset the progress bar each time the dialog opens
This requires us to expose the progressBar as a private
class member.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-12-04 15:52:21 +02:00
Lubomir I. Ivanov
e4f35fb51a Print: fix some forward declarations
In the PrintLayout constructor we receive a pointer
of PrintDialog, but the type is incomplete, as we only
forward declare it in the class header. If we decide
to eventually call a method from PrintDialog we also
need to include printdialog.h in printlayout.cpp.

The patch also fixes a similar issue in printdialog.h.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-12-04 15:47:33 +02:00
Lubomir I. Ivanov
ecf483db46 PrintDialog: add a 'Close' button
The dialog was missing a 'Close' button so we add it.
Also change the mnemonic of the 'Preview' button, as it
was the same as the one for print 'Print'.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-12-04 14:14:04 +02:00
Lubomir I. Ivanov
d90cca5c4e PrintDialog: add separate Preview/Print buttons
We rename our old 'Print' button to 'Preview' (as it did just that),
and add a new one called 'Print' which does the direct printing,
by creating a QPrintDialog instance. Both buttons are located
on top of the dialog for now in a QHBoxLayout.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-12-04 13:51:34 +02:00
Lubomir I. Ivanov
9dc45af915 Print: add a print preview for testing purposes
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-10 19:27:10 +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
Lubomir I. Ivanov
52534bfb68 Print: add UI for a print dialog
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-09 21:01:42 +03:00