Move the printer support backend into it's own plugin
QPlatformIntegration can't have a dependency onto printing anymore now that printing lives in it's own library. Move it into a plugin of it's own. Change-Id: I3ec4b38f4336eb96d92ea799544d17af359c83e1 Reviewed-on: http://codereview.qt.nokia.com/3210 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>bb10
parent
f4f1b53b96
commit
6d2c5d9ffe
|
|
@ -199,18 +199,6 @@ QPlatformGLContext *QPlatformIntegration::createPlatformGLContext(QGuiGLContext
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Returns the platform's printing support.
|
||||
|
||||
\since 5.0
|
||||
*/
|
||||
|
||||
QPlatformPrinterSupport *QPlatformIntegration::printerSupport() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the platforms input context.
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ class QPlatformBackingStore;
|
|||
class QPlatformFontDatabase;
|
||||
class QPlatformClipboard;
|
||||
class QPlatformNativeInterface;
|
||||
class QPlatformPrinterSupport;
|
||||
class QPlatformDrag;
|
||||
class QPlatformGLContext;
|
||||
class QGuiGLFormat;
|
||||
|
|
@ -98,8 +97,6 @@ public:
|
|||
// Access native handles. The window handle is already available from Wid;
|
||||
virtual QPlatformNativeInterface *nativeInterface() const;
|
||||
|
||||
virtual QPlatformPrinterSupport *printerSupport() const;
|
||||
|
||||
protected:
|
||||
void screenAdded(QPlatformScreen *screen);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -48,8 +48,6 @@
|
|||
#include "qxcbclipboard.h"
|
||||
#include "qxcbdrag.h"
|
||||
|
||||
#include <QtPlatformSupport/private/qgenericunixprintersupport_p.h>
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
|
||||
|
|
@ -79,8 +77,7 @@
|
|||
#include <QtGui/QScreen>
|
||||
|
||||
QXcbIntegration::QXcbIntegration(const QStringList ¶meters)
|
||||
: m_printerSupport(new QGenericUnixPrinterSupport)
|
||||
, m_eventDispatcher(createUnixEventDispatcher())
|
||||
: m_eventDispatcher(createUnixEventDispatcher())
|
||||
{
|
||||
QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
|
||||
|
||||
|
|
@ -183,11 +180,6 @@ QPlatformNativeInterface * QXcbIntegration::nativeInterface() const
|
|||
return m_nativeInterface;
|
||||
}
|
||||
|
||||
QPlatformPrinterSupport *QXcbIntegration::printerSupport() const
|
||||
{
|
||||
return m_printerSupport;
|
||||
}
|
||||
|
||||
QPlatformClipboard *QXcbIntegration::clipboard() const
|
||||
{
|
||||
return m_connections.at(0)->clipboard();
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ public:
|
|||
|
||||
QPlatformNativeInterface *nativeInterface()const;
|
||||
|
||||
QPlatformPrinterSupport *printerSupport() const;
|
||||
QPlatformClipboard *clipboard() const;
|
||||
QPlatformDrag *drag() const;
|
||||
|
||||
|
|
@ -80,7 +79,6 @@ private:
|
|||
|
||||
QPlatformFontDatabase *m_fontDatabase;
|
||||
QPlatformNativeInterface *m_nativeInterface;
|
||||
QPlatformPrinterSupport *m_printerSupport;
|
||||
|
||||
QPlatformInputContext *m_inputContext;
|
||||
QAbstractEventDispatcher *m_eventDispatcher;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
#ifndef QT_NO_PRINTER
|
||||
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include "qplatformprintplugin_qpa.h"
|
||||
#include <QtPrintSupport/QPlatformPrinterSupport>
|
||||
|
||||
#if defined (Q_WS_WIN)
|
||||
|
|
@ -158,19 +158,24 @@ Q_GUI_EXPORT QSizeF qt_printerPaperSize(QPrinter::Orientation orientation,
|
|||
void QPrinterPrivate::createDefaultEngines()
|
||||
{
|
||||
QPrinter::OutputFormat realOutputFormat = outputFormat;
|
||||
#if !defined (QTOPIA_PRINTENGINE)
|
||||
#if defined (Q_OS_UNIX) && ! defined (Q_WS_MAC)
|
||||
if(outputFormat == QPrinter::NativeFormat) {
|
||||
realOutputFormat = QPrinter::PdfFormat;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
switch (realOutputFormat) {
|
||||
case QPrinter::NativeFormat: {
|
||||
#if defined (Q_WS_QPA)
|
||||
printEngine = QGuiApplicationPrivate::platformIntegration()->printerSupport()->createNativePrintEngine(printerMode);
|
||||
paintEngine = QGuiApplicationPrivate::platformIntegration()->printerSupport()->createPaintEngine(printEngine, printerMode);
|
||||
QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get();
|
||||
if (ps) {
|
||||
printEngine = ps->createNativePrintEngine(printerMode);
|
||||
paintEngine = ps->createPaintEngine(printEngine, printerMode);
|
||||
} else {
|
||||
QPdfPrintEngine *pdfEngine = new QPdfPrintEngine(printerMode);
|
||||
paintEngine = pdfEngine;
|
||||
printEngine = pdfEngine;
|
||||
}
|
||||
#elif defined (Q_WS_WIN)
|
||||
QWin32PrintEngine *winEngine = new QWin32PrintEngine(printerMode);
|
||||
paintEngine = winEngine;
|
||||
|
|
@ -179,10 +184,6 @@ void QPrinterPrivate::createDefaultEngines()
|
|||
QMacPrintEngine *macEngine = new QMacPrintEngine(printerMode);
|
||||
paintEngine = macEngine;
|
||||
printEngine = macEngine;
|
||||
#elif defined (QTOPIA_PRINTENGINE)
|
||||
QtopiaPrintEngine *qwsEngine = new QtopiaPrintEngine(printerMode);
|
||||
paintEngine = qwsEngine;
|
||||
printEngine = qwsEngine;
|
||||
#elif defined (Q_OS_UNIX)
|
||||
Q_ASSERT(false);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#ifndef QT_NO_PRINTER
|
||||
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include "qplatformprintplugin_qpa.h"
|
||||
#include <QtPrintSupport/QPlatformPrinterSupport>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
|
@ -176,7 +176,7 @@ QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const
|
|||
{
|
||||
const Q_D(QPrinterInfo);
|
||||
if (!isNull() && !d->hasPaperSizes) {
|
||||
d->paperSizes = QGuiApplicationPrivate::platformIntegration()->printerSupport()->supportedPaperSizes(*this);
|
||||
d->paperSizes = QPlatformPrinterSupportPlugin::get()->supportedPaperSizes(*this);
|
||||
d->hasPaperSizes = true;
|
||||
}
|
||||
return d->paperSizes;
|
||||
|
|
@ -184,12 +184,18 @@ QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const
|
|||
|
||||
QList<QPrinterInfo> QPrinterInfo::availablePrinters()
|
||||
{
|
||||
return QGuiApplicationPrivate::platformIntegration()->printerSupport()->availablePrinters();
|
||||
QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get();
|
||||
if (!ps)
|
||||
return QList<QPrinterInfo>();
|
||||
return ps->availablePrinters();
|
||||
}
|
||||
|
||||
QPrinterInfo QPrinterInfo::defaultPrinter()
|
||||
{
|
||||
return QGuiApplicationPrivate::platformIntegration()->printerSupport()->defaultPrinter();
|
||||
QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get();
|
||||
if (!ps)
|
||||
return QPrinterInfo();
|
||||
return QPlatformPrinterSupportPlugin::get()->defaultPrinter();
|
||||
}
|
||||
|
||||
#endif //Q_WS_QPA
|
||||
|
|
|
|||
Loading…
Reference in New Issue