From 993eb75cf7c0fcc34722f4d9cfa1c1e5fb643e69 Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Wed, 23 Mar 2022 20:34:38 +0100 Subject: [PATCH] Fix printing on non-A4 after restructuring --- src/ippprinter.cpp | 28 ++++++-------------------- translations/harbour-seaprint-de.ts | 8 -------- translations/harbour-seaprint-es.ts | 8 -------- translations/harbour-seaprint-fr.ts | 8 -------- translations/harbour-seaprint-nl.ts | 8 -------- translations/harbour-seaprint-pl.ts | 8 -------- translations/harbour-seaprint-zh_CN.ts | 8 -------- 7 files changed, 6 insertions(+), 70 deletions(-) diff --git a/src/ippprinter.cpp b/src/ippprinter.cpp index 77dd51a..0b2906f 100644 --- a/src/ippprinter.cpp +++ b/src/ippprinter.cpp @@ -541,7 +541,7 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename) QJsonObject o = opAttrs(); o.insert("job-name", QJsonObject {{"tag", IppMsg::NameWithoutLanguage}, {"value", fileinfo.fileName()}}); - QString PaperSize = getAttrOrDefault(jobAttrs, "media").toString(); + Params.paperSizeName = getAttrOrDefault(jobAttrs, "media").toString(Params.paperSizeName.c_str()).toStdString(); QString targetFormat = getAttrOrDefault(jobAttrs, "document-format").toString(); qDebug() << "target format:" << targetFormat; @@ -573,18 +573,17 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename) } } - if(jobAttrs.contains("media-col") && jobAttrs.contains("media")) { - qDebug() << "moving media to media-col" << PaperSize; - if(!PaperSizes.contains(PaperSize)) + qDebug() << "moving media to media-col" << Params.paperSizeName.c_str(); + if(!PaperSizes.contains(Params.paperSizeName.c_str())) { - emit convertFailed(tr("Unknown document format dimensions")); + emit convertFailed(tr("Unsupported paper size")); return; } - int x = PaperSizes[PaperSize].width()*100; - int y = PaperSizes[PaperSize].height()*100; + int x = PaperSizes[Params.paperSizeName.c_str()].width()*100; + int y = PaperSizes[Params.paperSizeName.c_str()].height()*100; QJsonObject Dimensions = {{"tag", IppMsg::BeginCollection}, @@ -633,11 +632,6 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename) Params.format = PrintParameters::URF; } - if(!PaperSizes.contains(Params.paperSizeName.c_str())) - { - qDebug() << "Unsupported paper size" << Params.paperSizeName.c_str(); - emit convertFailed(tr("Unsupported paper size")); - } QSizeF size = PaperSizes[Params.paperSizeName.c_str()]; Params.paperSizeUnits = PrintParameters::Millimeters; Params.paperSizeW = size.width(); @@ -688,16 +682,6 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename) } else { - if(PaperSize == "") - { - PaperSize = "iso_a4_210x297mm"; - } - else if(!PaperSizes.contains(PaperSize)) - { - emit convertFailed(tr("Unsupported print media")); - return; - } - QString Sides = getAttrOrDefault(jobAttrs, "sides").toString(); if(Sides=="two-sided-long-edge") diff --git a/translations/harbour-seaprint-de.ts b/translations/harbour-seaprint-de.ts index bcc5356..66bb67c 100644 --- a/translations/harbour-seaprint-de.ts +++ b/translations/harbour-seaprint-de.ts @@ -287,10 +287,6 @@ Failed to open file Öffnen der Datei fehlgeschlagen - - Unsupported print media - Nicht unterstütztes Druckmedium - Cannot convert this file format Dateiformat konnte nicht konvertiert werden @@ -299,10 +295,6 @@ Unknown document format Unbekanntes Dokumentenformat - - Unknown document format dimensions - Unbekannte Dokumentenformat Größe - Preparing Vorbereiten diff --git a/translations/harbour-seaprint-es.ts b/translations/harbour-seaprint-es.ts index 437967f..63b6bfd 100644 --- a/translations/harbour-seaprint-es.ts +++ b/translations/harbour-seaprint-es.ts @@ -287,10 +287,6 @@ Failed to open file Error al abrir archivo - - Unsupported print media - Medio impreso no soportado - Cannot convert this file format No se puede convertir este formato de archivo @@ -299,10 +295,6 @@ Unknown document format Formato de documento desconocido - - Unknown document format dimensions - Dimensiones del formato de documento desconocido - Preparing Preparando diff --git a/translations/harbour-seaprint-fr.ts b/translations/harbour-seaprint-fr.ts index 89a7d7c..d4d86a7 100644 --- a/translations/harbour-seaprint-fr.ts +++ b/translations/harbour-seaprint-fr.ts @@ -287,10 +287,6 @@ Failed to open file Échec de l'ouverture du fichier - - Unsupported print media - Média d'impression non supporté - Cannot convert this file format Impossible de convertir ce format de fichier @@ -299,10 +295,6 @@ Unknown document format Format de document inconnu - - Unknown document format dimensions - Format de dimensions du document inconnu - Preparing En cours de préparation diff --git a/translations/harbour-seaprint-nl.ts b/translations/harbour-seaprint-nl.ts index fb4f95c..d28b4f9 100644 --- a/translations/harbour-seaprint-nl.ts +++ b/translations/harbour-seaprint-nl.ts @@ -287,10 +287,6 @@ Failed to open file Bestand openen mislukt - - Unsupported print media - Niet-ondersteunde afdrukmedia - Cannot convert this file format Kan dit bestandsformaat niet converteren @@ -299,10 +295,6 @@ Unknown document format Onbekend documentformaat - - Unknown document format dimensions - Onbekende afmetingen van documentformaat - Preparing Voorbereiden diff --git a/translations/harbour-seaprint-pl.ts b/translations/harbour-seaprint-pl.ts index 322af6d..99eecb0 100644 --- a/translations/harbour-seaprint-pl.ts +++ b/translations/harbour-seaprint-pl.ts @@ -287,18 +287,10 @@ Failed to open file - - Unknown document format dimensions - - Unknown document format - - Unsupported print media - - Cannot convert this file format diff --git a/translations/harbour-seaprint-zh_CN.ts b/translations/harbour-seaprint-zh_CN.ts index bc127a9..eb0dcc8 100644 --- a/translations/harbour-seaprint-zh_CN.ts +++ b/translations/harbour-seaprint-zh_CN.ts @@ -287,10 +287,6 @@ Failed to open file 打开文件失败 - - Unsupported print media - 不支持打印媒体文件 - Cannot convert this file format 无法转换此文件格式 @@ -299,10 +295,6 @@ Unknown document format 未知文档格式 - - Unknown document format dimensions - 未知稳定格式尺寸 - Preparing