Commit graph

17 commits

Author SHA1 Message Date
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
c89d83611b PrintDialog: make the dialog slightly larger
I don't recall why but this dialog ended with a fixed size
(setFixedSize()), so it has to be re-adjusted each time a change
is made in there. We resize it to compensate for the addition
of the progress bar.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-12-04 13:55:30 +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
576c3f559f PrintDialog: change a comment
The entire dialog is 'temporary' and should be replaced,
so we slightly modify the comment about the PrintOptions widget.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-12-04 13:46:08 +02:00
Lubomir I. Ivanov
eb1aa5a896 PrintDialog: add a progress bar in the dialog
This dialog will be eventually replaced by a better one, but
for now we can add a progress bar to it. Next step would be to
add separate Print/Preview buttons and emit progress bar updates
from the PrintLayout class.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-12-04 13:41:19 +02:00
Thiago Macieira
b22f1da59e Fix all leak-at-exit from singletons in Subsurface
Subsurface creates a lot of singleton instances on demand, but nothing
ever deleted them. Since they are singletons, these memory allocations
are technically not leaks. However, they clutter the output in valgrind
and other memory analysers, hiding the real issues.

The solution is to delete these items at exit. For the models and for
gettextFromC, the solution is to use a QScopedPointer, which will delete
its payload when it gets destroyed. For the dialogs and other widgets,
we can't do that: they need to be deleted before QApplication exits, so
we just set the parent in all of them to the main window.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-30 09:28:42 -08:00
Lubomir I. Ivanov
1ab915a7d9 Print: add an icon for the print dialog
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-11-30 18:56:25 +02:00
Lubomir I. Ivanov
f183da546b Print: adjustments to PrintDialog
- Hide the sizeing sliders from PrintOptions. we don't really
support any of those in PrintLayout and these are not that
useful and easy to implement, until some sort
of layouting/templating system is in place.
- Move the 'Print' button on top as a workaround, since if
it's bellow the print options it stays bellow an empty area
where the now hidden sizing sliders are.
- Resize the dialog to a smaller size

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-11-30 18:56:25 +02:00
Lubomir I. Ivanov
2b98d28980 printdialog: Remove the pre-set DPI and some comments
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15 04:24:15 -07:00
Lubomir I. Ivanov
b241b7c06a Print: add experimental code for printing profiles
PrintLayout::printSixDives() goes trough all dives
and prints their profiles on full portrait pages.

This method is based on resizing the ProfileGraphicsView
widget, plotting each dive and then 'grabbing' it using
QPixmap::grabWidget().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-18 12:00:12 -07: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
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
Lubomir I. Ivanov
2c7a208bc1 Print: label update on height slider move
The PrintOptions widget has value labels next to the
horizontal sliders. Add slots to update these labels
when a slider moves.

Patch also makes a modification so that the PrintOptions
constructor requires a 'struct options' pointer. If
an options struct is not received we do not set predefined
values and do not connect signals to slots, where
options will be updated immediately.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2013-07-10 09:57:24 +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