From 36547f4eff44361f7a6acd0cff107c0e47561f93 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Fri, 27 Apr 2012 01:33:35 +0200 Subject: Expose QPA API under qpa/* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The main reasons for doing this are: 1. _qpa.h end up in the master QtGui include file. QtGui is meant for userland applications. qpa code is neither binary nor source compatible. Inadvertant use of QPA api makes the user code binary-incompatible. 2. syncqt creates forwarding headers for non-private header files. This gives people the impression that this is public API. As discussed on the mailing list, even though QPA api is internal and subject to change, it needs to treated differently from private headers since they will be used by in-qtbase and out-of-qtbase plugins. This commit does the following: 1. The _qpa in QPA header files is dropped. 2. syncqt now treats any file with qplatform prefix as a special file and moves it to qpa/ directory. The recommended way of using QPA API in plugins is: #include . This allows the user include QPA API from multiple modules (for example, qplatformfoo might be in QtPrintSupport) 3. The user needs to explicitly add QT += -private to get access to the qpa api. 4. Creates compat headers for the olden style qplatformfoo_qpa.h and QPlatformFoo includes. This commit does not change the cpp filenames. This requires a more careful merging of existing non qpa cpp files and existing cpp files on a case by case basis. This can be done at anytime. The following files are not renamed as part of this changed but will be fixed as part of a future change: src/gui/kernel/qgenericpluginfactory_qpa.h src/gui/kernel/qgenericplugin_qpa.h src/gui/kernel/qwindowsysteminterface_qpa.h files were renamed using for x in `find . -name "qplatform*_qpa.h"`; do git mv $x "${x/_qpa.h/.h}"; done for x in `find . -name "qplatform*_qpa_p.h"`; do git mv $x "${x/_qpa_p.h/_p.h}"; done includes were renamed using script for file in `find . -name "*.h" -or -name "*.cpp" -or -name "*.mm"`; do sed -i -e 's,.*#.*include.*<\(Qt.*/\)\?\(QPlatform.*\)>,#include ,g' \ -e 's,.*#.*include.*"\(Qt.*/\)\?\(QPlatform.*\)",#include ,g' \ -e 's,.*#.*include.* "\(qplatform.*\)_qpa.h",#include ,g' \ -e 's,.*#.*include.*"\(qplatform.*\)_qpa_p.h",#include ,g' \ -e 's,.*#.*include.*<\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)>,#include ,g' \ -e 's,.*#.*include.*"\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)",#include ,g' \ $file done Change-Id: I04a350314a45746e3911f54b3b21ad03315afb67 Reviewed-by: Morten Johan Sørvig Reviewed-by: Samuel Rødal Reviewed-by: Friedemann Kleint Reviewed-by: Sean Harmer Reviewed-by: Lars Knoll Reviewed-by: Gunnar Sletta --- src/printsupport/dialogs/qpagesetupdialog_mac.mm | 2 +- src/printsupport/dialogs/qpagesetupdialog_win.cpp | 2 +- src/printsupport/kernel/kernel.pri | 4 +- src/printsupport/kernel/qplatformprintersupport.h | 86 ++++++++++++++++++++ .../kernel/qplatformprintersupport_qpa.cpp | 2 +- .../kernel/qplatformprintersupport_qpa.h | 86 -------------------- src/printsupport/kernel/qplatformprintplugin.cpp | 2 +- src/printsupport/kernel/qplatformprintplugin.h | 93 ++++++++++++++++++++++ src/printsupport/kernel/qplatformprintplugin_qpa.h | 93 ---------------------- src/printsupport/kernel/qprintengine_win.cpp | 2 +- src/printsupport/kernel/qprinter.cpp | 4 +- src/printsupport/kernel/qprinterinfo.cpp | 4 +- 12 files changed, 190 insertions(+), 190 deletions(-) create mode 100644 src/printsupport/kernel/qplatformprintersupport.h delete mode 100644 src/printsupport/kernel/qplatformprintersupport_qpa.h create mode 100644 src/printsupport/kernel/qplatformprintplugin.h delete mode 100644 src/printsupport/kernel/qplatformprintplugin_qpa.h (limited to 'src/printsupport') diff --git a/src/printsupport/dialogs/qpagesetupdialog_mac.mm b/src/printsupport/dialogs/qpagesetupdialog_mac.mm index 1dded4f905..3e84423fd8 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_mac.mm +++ b/src/printsupport/dialogs/qpagesetupdialog_mac.mm @@ -46,7 +46,7 @@ #include "qpagesetupdialog.h" #include "qabstractpagesetupdialog_p.h" -#include +#include #include QT_USE_NAMESPACE diff --git a/src/printsupport/dialogs/qpagesetupdialog_win.cpp b/src/printsupport/dialogs/qpagesetupdialog_win.cpp index 9d7387edba..cb69d0400f 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_win.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog_win.cpp @@ -47,7 +47,7 @@ #include "../kernel/qprintengine_win_p.h" #include "qabstractpagesetupdialog_p.h" #include "qprinter.h" -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/printsupport/kernel/kernel.pri b/src/printsupport/kernel/kernel.pri index d7c9f56545..10d9f877a0 100644 --- a/src/printsupport/kernel/kernel.pri +++ b/src/printsupport/kernel/kernel.pri @@ -6,8 +6,8 @@ HEADERS += \ $$PWD/qprinter_p.h \ $$PWD/qprinterinfo.h \ $$PWD/qprinterinfo_p.h \ - $$PWD/qplatformprintplugin_qpa.h \ - $$PWD/qplatformprintersupport_qpa.h + $$PWD/qplatformprintplugin.h \ + $$PWD/qplatformprintersupport.h SOURCES += \ $$PWD/qpaintengine_alpha.cpp \ diff --git a/src/printsupport/kernel/qplatformprintersupport.h b/src/printsupport/kernel/qplatformprintersupport.h new file mode 100644 index 0000000000..5dba56579c --- /dev/null +++ b/src/printsupport/kernel/qplatformprintersupport.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMPRINTINGSUPPORT_H +#define QPLATFORMPRINTINGSUPPORT_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + + +#ifndef QT_NO_PRINTER + +class QPrintEngine; + +class Q_PRINTSUPPORT_EXPORT QPlatformPrinterSupport +{ +public: + QPlatformPrinterSupport(); + virtual ~QPlatformPrinterSupport(); + + virtual QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode); + virtual QPaintEngine *createPaintEngine(QPrintEngine *, QPrinter::PrinterMode printerMode); + virtual QList supportedPaperSizes(const QPrinterInfo &) const; + + virtual QList availablePrinters(); + virtual QPrinterInfo defaultPrinter(); + + static QPrinter::PaperSize convertQSizeFToPaperSize(const QSizeF &sizef); + static QSizeF convertPaperSizeToQSizeF(QPrinter::PaperSize paperSize); + +protected: + static QPrinterInfo printerInfo(const QString &printerName, bool isDefault = false); + static void setPrinterInfoDefault(QPrinterInfo *p, bool isDefault); + static bool printerInfoIsDefault(const QPrinterInfo &p); + static int printerInfoCupsPrinterIndex(const QPrinterInfo &p); + static void setPrinterInfoCupsPrinterIndex(QPrinterInfo *p, int index); +}; + +#endif // QT_NO_PRINTER + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMPRINTINGSUPPORT_H diff --git a/src/printsupport/kernel/qplatformprintersupport_qpa.cpp b/src/printsupport/kernel/qplatformprintersupport_qpa.cpp index 1ed28b8090..9c0c3f131c 100644 --- a/src/printsupport/kernel/qplatformprintersupport_qpa.cpp +++ b/src/printsupport/kernel/qplatformprintersupport_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformprintersupport_qpa.h" +#include "qplatformprintersupport.h" #include diff --git a/src/printsupport/kernel/qplatformprintersupport_qpa.h b/src/printsupport/kernel/qplatformprintersupport_qpa.h deleted file mode 100644 index 5dba56579c..0000000000 --- a/src/printsupport/kernel/qplatformprintersupport_qpa.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORMPRINTINGSUPPORT_H -#define QPLATFORMPRINTINGSUPPORT_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - - -#ifndef QT_NO_PRINTER - -class QPrintEngine; - -class Q_PRINTSUPPORT_EXPORT QPlatformPrinterSupport -{ -public: - QPlatformPrinterSupport(); - virtual ~QPlatformPrinterSupport(); - - virtual QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode); - virtual QPaintEngine *createPaintEngine(QPrintEngine *, QPrinter::PrinterMode printerMode); - virtual QList supportedPaperSizes(const QPrinterInfo &) const; - - virtual QList availablePrinters(); - virtual QPrinterInfo defaultPrinter(); - - static QPrinter::PaperSize convertQSizeFToPaperSize(const QSizeF &sizef); - static QSizeF convertPaperSizeToQSizeF(QPrinter::PaperSize paperSize); - -protected: - static QPrinterInfo printerInfo(const QString &printerName, bool isDefault = false); - static void setPrinterInfoDefault(QPrinterInfo *p, bool isDefault); - static bool printerInfoIsDefault(const QPrinterInfo &p); - static int printerInfoCupsPrinterIndex(const QPrinterInfo &p); - static void setPrinterInfoCupsPrinterIndex(QPrinterInfo *p, int index); -}; - -#endif // QT_NO_PRINTER - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QPLATFORMPRINTINGSUPPORT_H diff --git a/src/printsupport/kernel/qplatformprintplugin.cpp b/src/printsupport/kernel/qplatformprintplugin.cpp index 2c87fcc5e6..ec068d87d1 100644 --- a/src/printsupport/kernel/qplatformprintplugin.cpp +++ b/src/printsupport/kernel/qplatformprintplugin.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformprintplugin_qpa.h" +#include "qplatformprintplugin.h" #include "private/qfactoryloader_p.h" QT_BEGIN_NAMESPACE diff --git a/src/printsupport/kernel/qplatformprintplugin.h b/src/printsupport/kernel/qplatformprintplugin.h new file mode 100644 index 0000000000..aec3e02fa6 --- /dev/null +++ b/src/printsupport/kernel/qplatformprintplugin.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMPRINTERSUPPORTPLUGIN_H +#define QPLATFORMPRINTERSUPPORTPLUGIN_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + + +class QPlatformPrinterSupport; + +struct QPlatformPrinterSupportFactoryInterface : public QFactoryInterface +{ + virtual QPlatformPrinterSupport *create(const QString &key) = 0; +}; + +#define QPlatformPrinterSupportFactoryInterface_iid "org.qt-project.QPlatformPrinterSupportFactoryInterface" + +Q_DECLARE_INTERFACE(QPlatformPrinterSupportFactoryInterface, QPlatformPrinterSupportFactoryInterface_iid) + +class Q_PRINTSUPPORT_EXPORT QPlatformPrinterSupportPlugin : public QObject, public QPlatformPrinterSupportFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QPlatformPrinterSupportFactoryInterface:QFactoryInterface) +public: + explicit QPlatformPrinterSupportPlugin(QObject *parent = 0); + ~QPlatformPrinterSupportPlugin(); + + virtual QStringList keys() const = 0; + virtual QPlatformPrinterSupport *create(const QString &key) = 0; + + static QPlatformPrinterSupport *get(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMPRINTERSUPPORTPLUGIN_H diff --git a/src/printsupport/kernel/qplatformprintplugin_qpa.h b/src/printsupport/kernel/qplatformprintplugin_qpa.h deleted file mode 100644 index aec3e02fa6..0000000000 --- a/src/printsupport/kernel/qplatformprintplugin_qpa.h +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORMPRINTERSUPPORTPLUGIN_H -#define QPLATFORMPRINTERSUPPORTPLUGIN_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - - -class QPlatformPrinterSupport; - -struct QPlatformPrinterSupportFactoryInterface : public QFactoryInterface -{ - virtual QPlatformPrinterSupport *create(const QString &key) = 0; -}; - -#define QPlatformPrinterSupportFactoryInterface_iid "org.qt-project.QPlatformPrinterSupportFactoryInterface" - -Q_DECLARE_INTERFACE(QPlatformPrinterSupportFactoryInterface, QPlatformPrinterSupportFactoryInterface_iid) - -class Q_PRINTSUPPORT_EXPORT QPlatformPrinterSupportPlugin : public QObject, public QPlatformPrinterSupportFactoryInterface -{ - Q_OBJECT - Q_INTERFACES(QPlatformPrinterSupportFactoryInterface:QFactoryInterface) -public: - explicit QPlatformPrinterSupportPlugin(QObject *parent = 0); - ~QPlatformPrinterSupportPlugin(); - - virtual QStringList keys() const = 0; - virtual QPlatformPrinterSupport *create(const QString &key) = 0; - - static QPlatformPrinterSupport *get(); -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QPLATFORMPRINTERSUPPORTPLUGIN_H diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index 37d2b27d15..3c079e24f3 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 6682550849..4929b3308e 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -52,8 +52,8 @@ #ifndef QT_NO_PRINTER -#include "qplatformprintplugin_qpa.h" -#include +#include +#include #include #if defined(Q_WS_X11) diff --git a/src/printsupport/kernel/qprinterinfo.cpp b/src/printsupport/kernel/qprinterinfo.cpp index 8d498a7e59..3d0ba7f31d 100644 --- a/src/printsupport/kernel/qprinterinfo.cpp +++ b/src/printsupport/kernel/qprinterinfo.cpp @@ -30,8 +30,8 @@ #ifndef QT_NO_PRINTER -#include "qplatformprintplugin_qpa.h" -#include +#include +#include QT_BEGIN_NAMESPACE -- cgit v1.2.3