summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2013-11-30 00:00:01 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-05 19:33:42 +0100
commit053bee8b80f4f987718c6633b831a58eb231b599 (patch)
tree06e23aa3565c31c61d50c80533b3454a68b6ed54 /src/plugins
parentaae1eb3b03d0a0fff130dbba32e7e4250fb5df7f (diff)
QPrinter - Clean up Print Engine Key defaults and tests
The PrintEngine keys are not consistently treated across the platforms and are not properly tested. Start the process of making the print engines behave consistently by documenting and testing the current behavior. Ensure all unsupported features return a consistent default value. The auto test for valuePreservation() has been flaky depending on the platform and installed printers so remove it and replace it with more complete testing. If no native printers available then don't test the native engines. Fixes for the individual inconsistent keys will follow. Task-number: QTBUG-26430 Change-Id: Iab914d7e0a5ae4a2cdc24c8645751f0910cf440c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac.mm88
1 files changed, 78 insertions, 10 deletions
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm
index f363b1772f..dd2bd718f6 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm
@@ -591,20 +591,52 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
return;
switch (key) {
- case PPK_CollateCopies:
+
+ // The following keys are properties or derived values and so cannot be set
+ case PPK_PageRect:
+ break;
+ case PPK_PaperRect:
+ break;
+ case PPK_PaperSources:
+ break;
+ case PPK_SupportsMultipleCopies:
break;
+ case PPK_SupportedResolutions:
+ break;
+
+ // The following keys are settings that are unsupported by the Mac PrintEngine
case PPK_ColorMode:
break;
+ case PPK_CollateCopies:
+ // TODO Add support using PMSetCollate / PMGetCollate
+ break;
case PPK_Creator:
+ // TODO Add value preservation support by using local variable
+ break;
+ case PPK_CustomBase:
break;
case PPK_DocumentName:
+ // TODO Add support using PMPrintSettingsSetJobName / PMPrintSettingsGetJobName
+ break;
+ case PPK_Duplex:
+ // TODO Add support using PMSetDuplex / PMGetDuplex
+ break;
+ case PPK_FontEmbedding:
break;
case PPK_PageOrder:
+ // TODO Check if can be supported via Cups Options
break;
case PPK_PaperSource:
+ // TODO Check if can be supported via Cups Options
+ break;
+ case PPK_PrinterProgram:
break;
case PPK_SelectionOption:
break;
+ case PPK_WindowsPageSize:
+ break;
+
+ // The following keys are properties and settings that are supported by the Mac PrintEngine
case PPK_Resolution: {
PMPrinter printer;
UInt32 count;
@@ -709,9 +741,7 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
d->hasCustomPageMargins = true;
break;
}
-
- default:
- break;
+ // No default so that compiler will complain if new keys added and not handled in this engine
}
}
@@ -724,16 +754,59 @@ QVariant QMacPrintEngine::property(PrintEnginePropertyKey key) const
return *d->valueCache.find(key);
switch (key) {
+
+ // The following keys are settings that are unsupported by the Mac PrintEngine
+ // Return sensible default values to ensure consistent behavior across platforms
case PPK_CollateCopies:
+ // TODO Add support using PMSetCollate / PMGetCollate
ret = false;
break;
case PPK_ColorMode:
ret = QPrinter::Color;
break;
case PPK_Creator:
+ ret = QString();
+ break;
+ case PPK_CustomBase:
+ // Special case, leave null
break;
case PPK_DocumentName:
+ // TODO Add support using PMPrintSettingsSetJobName / PMPrintSettingsGetJobName
+ ret = QString();
+ break;
+ case PPK_Duplex:
+ // TODO Add support using PMSetDuplex / PMGetDuplex
+ ret = QPrinter::DuplexNone;
+ break;
+ case PPK_FontEmbedding:
+ ret = false;
+ break;
+ case PPK_PageOrder:
+ // TODO Check if can be supported via Cups Options
+ ret = QPrinter::FirstPageFirst;
+ break;
+ case PPK_PaperSource:
+ // TODO Check if can be supported via Cups Options
+ ret = QPrinter::Auto;
+ break;
+ case PPK_PaperSources: {
+ // TODO Check if can be supported via Cups Options
+ QList<QVariant> out;
+ out << int(QPrinter::Auto);
+ ret = out;
+ break;
+ }
+ case PPK_PrinterProgram:
+ ret = QString();
break;
+ case PPK_SelectionOption:
+ ret = QString();
+ break;
+ case PPK_WindowsPageSize:
+ // Special case, leave null
+ break;
+
+ // The following keys are properties and settings that are supported by the Mac PrintEngine
case PPK_FullPage:
ret = d->fullPage;
break;
@@ -757,10 +830,6 @@ QVariant QMacPrintEngine::property(PrintEnginePropertyKey key) const
case PPK_OutputFileName:
ret = d->outputFilename;
break;
- case PPK_PageOrder:
- break;
- case PPK_PaperSource:
- break;
case PPK_PageRect: {
// PageRect is returned in device pixels
QRect r;
@@ -855,8 +924,7 @@ QVariant QMacPrintEngine::property(PrintEnginePropertyKey key) const
ret = margins;
break;
}
- default:
- break;
+ // No default so that compiler will complain if new keys added and not handled in this engine
}
return ret;
}