Commit 5fdbecf4 authored by Oliver Sander's avatar Oliver Sander

Simplify method FilePrinter::psPaperSize

The method FilePrinter::psPaperSize used to contain a long
list of hard-coded paper sizes for the different paper formats.
This patch makes the method get the same information
from QPrinter directly, which is much simpler and more
robust, too.

Note that the method is not actually used anywhere in okular,
though, so this change is purely cosmetic.

REVIEW: 130043
parent 1a5e20e2
......@@ -266,42 +266,12 @@ bool FilePrinter::detectCupsConfig()
QSize FilePrinter::psPaperSize( QPrinter &printer )
{
QSize size;
QSize size = printer.pageLayout().pageSize().sizePoints();
switch ( printer.pageSize() ) {
case QPrinter::A0: size = QSize( 2384, 3370 ); break;
case QPrinter::A1: size = QSize( 1684, 2384 ); break;
case QPrinter::A2: size = QSize( 1191, 1684 ); break;
case QPrinter::A3: size = QSize( 842, 1191 ); break;
case QPrinter::A4: size = QSize( 595, 842 ); break;
case QPrinter::A5: size = QSize( 420, 595 ); break;
case QPrinter::A6: size = QSize( 298, 420 ); break;
case QPrinter::A7: size = QSize( 210, 298 ); break;
case QPrinter::A8: size = QSize( 147, 210 ); break;
case QPrinter::A9: size = QSize( 105, 147 ); break;
case QPrinter::B0: size = QSize( 2835, 4008 ); break;
case QPrinter::B1: size = QSize( 2004, 2835 ); break;
case QPrinter::B2: size = QSize( 1417, 2004 ); break;
case QPrinter::B3: size = QSize( 1001, 1417 ); break;
case QPrinter::B4: size = QSize( 709, 1001 ); break;
case QPrinter::B5: size = QSize( 499, 709 ); break;
case QPrinter::B6: size = QSize( 354, 499 ); break;
case QPrinter::B7: size = QSize( 249, 354 ); break;
case QPrinter::B8: size = QSize( 176, 249 ); break;
case QPrinter::B9: size = QSize( 125, 176 ); break;
case QPrinter::B10: size = QSize( 88, 125 ); break;
case QPrinter::C5E: size = QSize( 459, 649 ); break;
case QPrinter::Comm10E: size = QSize( 297, 684 ); break;
case QPrinter::DLE: size = QSize( 312, 624 ); break;
case QPrinter::Executive: size = QSize( 522, 756 ); break;
case QPrinter::Folio: size = QSize( 595, 935 ); break;
case QPrinter::Ledger: size = QSize( 1224, 792 ); break;
case QPrinter::Legal: size = QSize( 612, 1008 ); break;
case QPrinter::Letter: size = QSize( 612, 792 ); break;
case QPrinter::Tabloid: size = QSize( 792, 1224 ); break;
case QPrinter::Custom: return QSize( (int) printer.widthMM() * ( 25.4 / 72 ),
(int) printer.heightMM() * ( 25.4 / 72 ) );
default: return QSize();
if ( printer.pageSize() == QPrinter::Custom )
{
return QSize( (int) printer.widthMM() * ( 25.4 / 72 ),
(int) printer.heightMM() * ( 25.4 / 72 ) );
}
if ( printer.orientation() == QPrinter::Landscape ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment