mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	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:
		
							parent
							
								
									5981cf170f
								
							
						
					
					
						commit
						fcde03e849
					
				
					 1 changed files with 17 additions and 12 deletions
				
			
		
							
								
								
									
										29
									
								
								printer.cpp
									
										
									
									
									
								
							
							
						
						
									
										29
									
								
								printer.cpp
									
										
									
									
									
								
							| 
						 | 
					@ -26,9 +26,25 @@ void Printer::putProfileImage(QRect profilePlaceholder, QRect viewPort, QPainter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Printer::render()
 | 
					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
 | 
						// keep original preferences
 | 
				
			||||||
 | 
						QPointer<ProfileWidget2> profile = MainWindow::instance()->graphics();
 | 
				
			||||||
	int profileFrameStyle = profile->frameStyle();
 | 
						int profileFrameStyle = profile->frameStyle();
 | 
				
			||||||
	int animationOriginal = prefs.animation_speed;
 | 
						int animationOriginal = prefs.animation_speed;
 | 
				
			||||||
	double fontScale = profile->getFontPrintScale();
 | 
						double fontScale = profile->getFontPrintScale();
 | 
				
			||||||
| 
						 | 
					@ -47,17 +63,6 @@ void Printer::render()
 | 
				
			||||||
	painter.setRenderHint(QPainter::Antialiasing);
 | 
						painter.setRenderHint(QPainter::Antialiasing);
 | 
				
			||||||
	painter.setRenderHint(QPainter::SmoothPixmapTransform);
 | 
						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
 | 
						// get all refereces to diveprofile class in the Html template
 | 
				
			||||||
	QWebElementCollection collection = webView->page()->mainFrame()->findAllElements(".diveprofile");
 | 
						QWebElementCollection collection = webView->page()->mainFrame()->findAllElements(".diveprofile");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue