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>
This commit is contained in:
Gehad elrobey 2015-06-23 00:10:32 +02:00 committed by Lubomir I. Ivanov
parent 5981cf170f
commit fcde03e849

View file

@ -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");