Skip to content

Commit 993eb75

Browse files
committed
Fix printing on non-A4 after restructuring
1 parent ea39f02 commit 993eb75

File tree

7 files changed

+6
-70
lines changed

7 files changed

+6
-70
lines changed

src/ippprinter.cpp

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename)
541541
QJsonObject o = opAttrs();
542542
o.insert("job-name", QJsonObject {{"tag", IppMsg::NameWithoutLanguage}, {"value", fileinfo.fileName()}});
543543

544-
QString PaperSize = getAttrOrDefault(jobAttrs, "media").toString();
544+
Params.paperSizeName = getAttrOrDefault(jobAttrs, "media").toString(Params.paperSizeName.c_str()).toStdString();
545545

546546
QString targetFormat = getAttrOrDefault(jobAttrs, "document-format").toString();
547547
qDebug() << "target format:" << targetFormat;
@@ -573,18 +573,17 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename)
573573
}
574574
}
575575

576-
577576
if(jobAttrs.contains("media-col") && jobAttrs.contains("media"))
578577
{
579-
qDebug() << "moving media to media-col" << PaperSize;
580-
if(!PaperSizes.contains(PaperSize))
578+
qDebug() << "moving media to media-col" << Params.paperSizeName.c_str();
579+
if(!PaperSizes.contains(Params.paperSizeName.c_str()))
581580
{
582-
emit convertFailed(tr("Unknown document format dimensions"));
581+
emit convertFailed(tr("Unsupported paper size"));
583582
return;
584583
}
585584

586-
int x = PaperSizes[PaperSize].width()*100;
587-
int y = PaperSizes[PaperSize].height()*100;
585+
int x = PaperSizes[Params.paperSizeName.c_str()].width()*100;
586+
int y = PaperSizes[Params.paperSizeName.c_str()].height()*100;
588587

589588
QJsonObject Dimensions =
590589
{{"tag", IppMsg::BeginCollection},
@@ -633,11 +632,6 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename)
633632
Params.format = PrintParameters::URF;
634633
}
635634

636-
if(!PaperSizes.contains(Params.paperSizeName.c_str()))
637-
{
638-
qDebug() << "Unsupported paper size" << Params.paperSizeName.c_str();
639-
emit convertFailed(tr("Unsupported paper size"));
640-
}
641635
QSizeF size = PaperSizes[Params.paperSizeName.c_str()];
642636
Params.paperSizeUnits = PrintParameters::Millimeters;
643637
Params.paperSizeW = size.width();
@@ -688,16 +682,6 @@ void IppPrinter::print(QJsonObject jobAttrs, QString filename)
688682
}
689683
else
690684
{
691-
if(PaperSize == "")
692-
{
693-
PaperSize = "iso_a4_210x297mm";
694-
}
695-
else if(!PaperSizes.contains(PaperSize))
696-
{
697-
emit convertFailed(tr("Unsupported print media"));
698-
return;
699-
}
700-
701685
QString Sides = getAttrOrDefault(jobAttrs, "sides").toString();
702686

703687
if(Sides=="two-sided-long-edge")

translations/harbour-seaprint-de.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,6 @@
287287
<source>Failed to open file</source>
288288
<translation>Öffnen der Datei fehlgeschlagen</translation>
289289
</message>
290-
<message>
291-
<source>Unsupported print media</source>
292-
<translation>Nicht unterstütztes Druckmedium</translation>
293-
</message>
294290
<message>
295291
<source>Cannot convert this file format</source>
296292
<translation>Dateiformat konnte nicht konvertiert werden</translation>
@@ -299,10 +295,6 @@
299295
<source>Unknown document format</source>
300296
<translation>Unbekanntes Dokumentenformat</translation>
301297
</message>
302-
<message>
303-
<source>Unknown document format dimensions</source>
304-
<translation>Unbekannte Dokumentenformat Größe</translation>
305-
</message>
306298
<message>
307299
<source>Preparing</source>
308300
<translation>Vorbereiten</translation>

translations/harbour-seaprint-es.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,6 @@
287287
<source>Failed to open file</source>
288288
<translation>Error al abrir archivo</translation>
289289
</message>
290-
<message>
291-
<source>Unsupported print media</source>
292-
<translation>Medio impreso no soportado</translation>
293-
</message>
294290
<message>
295291
<source>Cannot convert this file format</source>
296292
<translation>No se puede convertir este formato de archivo</translation>
@@ -299,10 +295,6 @@
299295
<source>Unknown document format</source>
300296
<translation>Formato de documento desconocido</translation>
301297
</message>
302-
<message>
303-
<source>Unknown document format dimensions</source>
304-
<translation>Dimensiones del formato de documento desconocido</translation>
305-
</message>
306298
<message>
307299
<source>Preparing</source>
308300
<translation>Preparando</translation>

translations/harbour-seaprint-fr.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,6 @@
287287
<source>Failed to open file</source>
288288
<translation>Échec de l&apos;ouverture du fichier</translation>
289289
</message>
290-
<message>
291-
<source>Unsupported print media</source>
292-
<translation>Média d&apos;impression non supporté</translation>
293-
</message>
294290
<message>
295291
<source>Cannot convert this file format</source>
296292
<translation>Impossible de convertir ce format de fichier</translation>
@@ -299,10 +295,6 @@
299295
<source>Unknown document format</source>
300296
<translation>Format de document inconnu</translation>
301297
</message>
302-
<message>
303-
<source>Unknown document format dimensions</source>
304-
<translation>Format de dimensions du document inconnu</translation>
305-
</message>
306298
<message>
307299
<source>Preparing</source>
308300
<translation>En cours de préparation</translation>

translations/harbour-seaprint-nl.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,6 @@
287287
<source>Failed to open file</source>
288288
<translation>Bestand openen mislukt</translation>
289289
</message>
290-
<message>
291-
<source>Unsupported print media</source>
292-
<translation>Niet-ondersteunde afdrukmedia</translation>
293-
</message>
294290
<message>
295291
<source>Cannot convert this file format</source>
296292
<translation>Kan dit bestandsformaat niet converteren</translation>
@@ -299,10 +295,6 @@
299295
<source>Unknown document format</source>
300296
<translation>Onbekend documentformaat</translation>
301297
</message>
302-
<message>
303-
<source>Unknown document format dimensions</source>
304-
<translation>Onbekende afmetingen van documentformaat</translation>
305-
</message>
306298
<message>
307299
<source>Preparing</source>
308300
<translation>Voorbereiden</translation>

translations/harbour-seaprint-pl.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,18 +287,10 @@
287287
<source>Failed to open file</source>
288288
<translation type="unfinished"></translation>
289289
</message>
290-
<message>
291-
<source>Unknown document format dimensions</source>
292-
<translation type="unfinished"></translation>
293-
</message>
294290
<message>
295291
<source>Unknown document format</source>
296292
<translation type="unfinished"></translation>
297293
</message>
298-
<message>
299-
<source>Unsupported print media</source>
300-
<translation type="unfinished"></translation>
301-
</message>
302294
<message>
303295
<source>Cannot convert this file format</source>
304296
<translation type="unfinished"></translation>

translations/harbour-seaprint-zh_CN.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,6 @@
287287
<source>Failed to open file</source>
288288
<translation>打开文件失败</translation>
289289
</message>
290-
<message>
291-
<source>Unsupported print media</source>
292-
<translation>不支持打印媒体文件</translation>
293-
</message>
294290
<message>
295291
<source>Cannot convert this file format</source>
296292
<translation>无法转换此文件格式</translation>
@@ -299,10 +295,6 @@
299295
<source>Unknown document format</source>
300296
<translation>未知文档格式</translation>
301297
</message>
302-
<message>
303-
<source>Unknown document format dimensions</source>
304-
<translation>未知稳定格式尺寸</translation>
305-
</message>
306298
<message>
307299
<source>Preparing</source>
308300
<translation type="unfinished"></translation>

0 commit comments

Comments
 (0)