summaryrefslogtreecommitdiffstats
path: root/printer.cpp
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2015-06-23 00:10:32 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-07-05 20:58:33 +0300
commitfcde03e84948b0c78c2dd7d8a334cd6def5879af (patch)
tree6af2de0fcade631e8c5089d2fd5168d7d3ad00ff /printer.cpp
parent5981cf170f9878cbe13da98667fd8817160335a6 (diff)
downloadsubsurface-fcde03e84948b0c78c2dd7d8a334cd6def5879af.tar.gz
Printing: choose printing color mode 'color/greyscale'
We can have color printouts only if the printer supports color prints, the user selected 'print in colors' from the print dialog and the default printer settings (Operating system wise) is to print in colors, Otherwise the prints will be in greyscale. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'printer.cpp')
-rw-r--r--printer.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/printer.cpp b/printer.cpp
index 50027c23b..5c93d2fed 100644
--- a/printer.cpp
+++ b/printer.cpp
@@ -26,9 +26,25 @@ void Printer::putProfileImage(QRect profilePlaceholder, QRect viewPort, QPainter
void Printer::render()
{
- QPointer<ProfileWidget2> profile = MainWindow::instance()->graphics();
+ // apply user settings
+ int divesPerPage;
+ if (printOptions->color_selected && printer->colorMode()) {
+ printer->setColorMode(QPrinter::Color);
+ } else {
+ printer->setColorMode(QPrinter::GrayScale);
+ }
+ switch (printOptions->p_template) {
+ case print_options::ONE_DIVE:
+ divesPerPage = 1;
+ break;
+ case print_options::TWO_DIVE:
+ divesPerPage = 2;
+ break;
+ }
+ int Pages = ceil(getTotalWork(printOptions) / (float)divesPerPage);
// keep original preferences
+ QPointer<ProfileWidget2> profile = MainWindow::instance()->graphics();
int profileFrameStyle = profile->frameStyle();
int animationOriginal = prefs.animation_speed;
double fontScale = profile->getFontPrintScale();
@@ -47,17 +63,6 @@ void Printer::render()
painter.setRenderHint(QPainter::Antialiasing);
painter.setRenderHint(QPainter::SmoothPixmapTransform);
- int divesPerPage;
- switch (printOptions->p_template) {
- case print_options::ONE_DIVE:
- divesPerPage = 1;
- break;
- case print_options::TWO_DIVE:
- divesPerPage = 2;
- break;
- }
- int Pages = ceil(getTotalWork(printOptions) / (float)divesPerPage);
-
// get all refereces to diveprofile class in the Html template
QWebElementCollection collection = webView->page()->mainFrame()->findAllElements(".diveprofile");