summaryrefslogtreecommitdiffstats
path: root/src/widgets/platforms/mac/qprintengine_mac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/platforms/mac/qprintengine_mac.mm')
-rw-r--r--src/widgets/platforms/mac/qprintengine_mac.mm71
1 files changed, 0 insertions, 71 deletions
diff --git a/src/widgets/platforms/mac/qprintengine_mac.mm b/src/widgets/platforms/mac/qprintengine_mac.mm
index fb40677e2d..b01d7a5762 100644
--- a/src/widgets/platforms/mac/qprintengine_mac.mm
+++ b/src/widgets/platforms/mac/qprintengine_mac.mm
@@ -90,12 +90,7 @@ bool QMacPrintEngine::begin(QPaintDevice *dev)
}
}
OSStatus status = noErr;
-#ifndef QT_MAC_USE_COCOA
- status = d->shouldSuppressStatus() ? PMSessionBeginCGDocumentNoDialog(d->session, d->settings, d->format)
- : PMSessionBeginCGDocument(d->session, d->settings, d->format);
-#else
status = PMSessionBeginCGDocumentNoDialog(d->session, d->settings, d->format);
-#endif
if (status != noErr) {
d->state = QPrinter::Error;
@@ -139,9 +134,7 @@ Qt::HANDLE QMacPrintEngine::handle() const
QMacPrintEnginePrivate::~QMacPrintEnginePrivate()
{
-#ifdef QT_MAC_USE_COCOA
[printInfo release];
-#endif
delete paintEngine;
}
@@ -250,12 +243,7 @@ bool QMacPrintEngine::newPage()
Q_D(QMacPrintEngine);
Q_ASSERT(d->state == QPrinter::Active);
OSStatus err =
-#ifndef QT_MAC_USE_COCOA
- d->shouldSuppressStatus() ? PMSessionEndPageNoDialog(d->session)
- : PMSessionEndPage(d->session);
-#else
PMSessionEndPageNoDialog(d->session);
-#endif
if (err != noErr) {
if (err == kPMCancel) {
// User canceled, we need to abort!
@@ -357,18 +345,7 @@ int QMacPrintEngine::metric(QPaintDevice::PaintDeviceMetric m) const
PMPrinter printer;
if(PMSessionGetCurrentPrinter(d->session, &printer) == noErr) {
PMResolution resolution;
-#ifndef QT_MAC_USE_COCOA
-# if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
- PMPrinterGetOutputResolution(printer, d->settings, &resolution);
- } else
-# endif
- {
- PMPrinterGetPrinterResolution(printer, kPMCurrentValue, &resolution);
- }
-#else
PMPrinterGetOutputResolution(printer, d->settings, &resolution);
-#endif
val = (int)resolution.vRes;
break;
}
@@ -397,11 +374,7 @@ void QMacPrintEnginePrivate::initialize()
{
Q_Q(QMacPrintEngine);
-#ifndef QT_MAC_USE_COCOA
- Q_ASSERT(!session);
-#else
Q_ASSERT(!printInfo);
-#endif
if (!paintEngine)
paintEngine = new QCoreGraphicsPaintEngine();
@@ -410,14 +383,9 @@ void QMacPrintEnginePrivate::initialize()
fullPage = false;
-#ifndef QT_MAC_USE_COCOA
- if (PMCreateSession(&session) != 0)
- session = 0;
-#else
QMacCocoaAutoReleasePool pool;
printInfo = [[NSPrintInfo alloc] initWithDictionary:[NSDictionary dictionary]];
session = static_cast<PMPrintSession>([printInfo PMPrintSession]);
-#endif
PMPrinter printer;
if (session && PMSessionGetCurrentPrinter(session, &printer) == noErr) {
@@ -441,32 +409,9 @@ void QMacPrintEnginePrivate::initialize()
}
}
-#ifndef QT_MAC_USE_COCOA
- bool settingsInitialized = (settings != 0);
- bool settingsOK = !settingsInitialized ? PMCreatePrintSettings(&settings) == noErr : true;
- if (settingsOK && !settingsInitialized)
- settingsOK = PMSessionDefaultPrintSettings(session, settings) == noErr;
-
-
- bool formatInitialized = (format != 0);
- bool formatOK = !formatInitialized ? PMCreatePageFormat(&format) == noErr : true;
- if (formatOK) {
- if (!formatInitialized) {
- formatOK = PMSessionDefaultPageFormat(session, format) == noErr;
- }
- formatOK = PMSessionValidatePageFormat(session, format, kPMDontWantBoolean) == noErr;
- }
-#else
settings = static_cast<PMPrintSettings>([printInfo PMPrintSettings]);
format = static_cast<PMPageFormat>([printInfo PMPageFormat]);
-#endif
-#ifndef QT_MAC_USE_COCOA
- if (!settingsOK || !formatOK) {
- qWarning("QMacPrintEngine::initialize: Unable to initialize QPainter");
- state = QPrinter::Error;
- }
-#endif
QHash<QMacPrintEngine::PrintEnginePropertyKey, QVariant>::const_iterator propC;
for (propC = valueCache.constBegin(); propC != valueCache.constEnd(); propC++) {
@@ -476,20 +421,9 @@ void QMacPrintEnginePrivate::initialize()
void QMacPrintEnginePrivate::releaseSession()
{
-#ifndef QT_MAC_USE_COCOA
- if (shouldSuppressStatus()) {
- PMSessionEndPageNoDialog(session);
- PMSessionEndDocumentNoDialog(session);
- } else {
- PMSessionEndPage(session);
- PMSessionEndDocument(session);
- }
- PMRelease(session);
-#else
PMSessionEndPageNoDialog(session);
PMSessionEndDocumentNoDialog(session);
[printInfo release];
-#endif
printInfo = 0;
session = 0;
}
@@ -512,12 +446,7 @@ bool QMacPrintEnginePrivate::newPage_helper()
cgEngine->d_func()->restoreGraphicsState();
OSStatus status =
-#ifndef QT_MAC_USE_COCOA
- shouldSuppressStatus() ? PMSessionBeginPageNoDialog(session, format, 0)
- : PMSessionBeginPage(session, format, 0);
-#else
PMSessionBeginPageNoDialog(session, format, 0);
-#endif
if(status != noErr) {
state = QPrinter::Error;
return false;