summaryrefslogtreecommitdiffstats
path: root/src/printsupport/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/printsupport/kernel')
-rw-r--r--src/printsupport/kernel/qcups.cpp4
-rw-r--r--src/printsupport/kernel/qplatformprintdevice.cpp18
-rw-r--r--src/printsupport/kernel/qplatformprintdevice.h8
-rw-r--r--src/printsupport/kernel/qprintdevice.cpp8
-rw-r--r--src/printsupport/kernel/qprintdevice_p.h2
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp8
-rw-r--r--src/printsupport/kernel/qprinter.cpp9
-rw-r--r--src/printsupport/kernel/qprinterinfo.cpp30
8 files changed, 54 insertions, 33 deletions
diff --git a/src/printsupport/kernel/qcups.cpp b/src/printsupport/kernel/qcups.cpp
index 8505e8356c..5236b8c8fa 100644
--- a/src/printsupport/kernel/qcups.cpp
+++ b/src/printsupport/kernel/qcups.cpp
@@ -44,12 +44,12 @@
QT_BEGIN_NAMESPACE
-static QStringList cupsOptionsList(QPrinter *printer) Q_DECL_NOTHROW
+static QStringList cupsOptionsList(QPrinter *printer) noexcept
{
return printer->printEngine()->property(PPK_CupsOptions).toStringList();
}
-void setCupsOptions(QPrinter *printer, const QStringList &cupsOptions) Q_DECL_NOTHROW
+void setCupsOptions(QPrinter *printer, const QStringList &cupsOptions) noexcept
{
printer->printEngine()->setProperty(PPK_CupsOptions, QVariant(cupsOptions));
}
diff --git a/src/printsupport/kernel/qplatformprintdevice.cpp b/src/printsupport/kernel/qplatformprintdevice.cpp
index d8d568d6fa..3d76cad688 100644
--- a/src/printsupport/kernel/qplatformprintdevice.cpp
+++ b/src/printsupport/kernel/qplatformprintdevice.cpp
@@ -60,7 +60,7 @@ QPlatformPrintDevice::QPlatformPrintDevice(const QString &id)
m_haveOutputBins(false),
m_haveDuplexModes(false),
m_haveColorModes(false)
-#ifndef QT_NO_MIMETYPE
+#if QT_CONFIG(mimetype)
, m_haveMimeTypes(false)
#endif
{
@@ -163,7 +163,7 @@ QPageSize QPlatformPrintDevice::supportedPageSize(const QPageSize &pageSize) con
// e.g. Windows defines DMPAPER_11X17 and DMPAPER_TABLOID with names "11x17" and "Tabloid", but both
// map to QPageSize::Tabloid / PPD Key "Tabloid" / ANSI B Tabloid
if (pageSize.id() != QPageSize::Custom) {
- for (const QPageSize &ps : m_pageSizes) {
+ for (const QPageSize &ps : qAsConst(m_pageSizes)) {
if (ps.id() == pageSize.id() && ps.name() == pageSize.name())
return ps;
}
@@ -171,7 +171,7 @@ QPageSize QPlatformPrintDevice::supportedPageSize(const QPageSize &pageSize) con
// Next try match on id only if not custom
if (pageSize.id() != QPageSize::Custom) {
- for (const QPageSize &ps : m_pageSizes) {
+ for (const QPageSize &ps : qAsConst(m_pageSizes)) {
if (ps.id() == pageSize.id())
return ps;
}
@@ -186,7 +186,7 @@ QPageSize QPlatformPrintDevice::supportedPageSize(QPageSize::PageSizeId pageSize
if (!m_havePageSizes)
loadPageSizes();
- for (const QPageSize &ps : m_pageSizes) {
+ for (const QPageSize &ps : qAsConst(m_pageSizes)) {
if (ps.id() == pageSizeId)
return ps;
}
@@ -200,7 +200,7 @@ QPageSize QPlatformPrintDevice::supportedPageSize(const QString &pageName) const
if (!m_havePageSizes)
loadPageSizes();
- for (const QPageSize &ps : m_pageSizes) {
+ for (const QPageSize &ps : qAsConst(m_pageSizes)) {
if (ps.name() == pageName)
return ps;
}
@@ -233,7 +233,7 @@ QPageSize QPlatformPrintDevice::supportedPageSizeMatch(const QPageSize &pageSize
return pageSize;
// Try to find a supported page size based on point size
- for (const QPageSize &ps : m_pageSizes) {
+ for (const QPageSize &ps : qAsConst(m_pageSizes)) {
if (ps.sizePoints() == pageSize.sizePoints())
return ps;
}
@@ -353,10 +353,11 @@ QVector<QPrint::ColorMode> QPlatformPrintDevice::supportedColorModes() const
return m_colorModes;
}
-#ifndef QT_NO_MIMETYPE
+#if QT_CONFIG(mimetype)
void QPlatformPrintDevice::loadMimeTypes() const
{
}
+#endif // mimetype
QVariant QPlatformPrintDevice::property(QPrintDevice::PrintDevicePropertyKey key) const
{
@@ -381,13 +382,14 @@ bool QPlatformPrintDevice::isFeatureAvailable(QPrintDevice::PrintDevicePropertyK
return false;
}
+#if QT_CONFIG(mimetype)
QList<QMimeType> QPlatformPrintDevice::supportedMimeTypes() const
{
if (!m_haveMimeTypes)
loadMimeTypes();
return m_mimeTypes;
}
-#endif // QT_NO_MIMETYPE
+#endif // mimetype
QPageSize QPlatformPrintDevice::createPageSize(const QString &key, const QSize &size, const QString &localizedName)
{
diff --git a/src/printsupport/kernel/qplatformprintdevice.h b/src/printsupport/kernel/qplatformprintdevice.h
index d95a5add9b..64723db92e 100644
--- a/src/printsupport/kernel/qplatformprintdevice.h
+++ b/src/printsupport/kernel/qplatformprintdevice.h
@@ -58,7 +58,9 @@
#include <QtCore/qvariant.h>
#include <QtCore/qvector.h>
+#if QT_CONFIG(mimetype)
#include <QtCore/qmimetype.h>
+#endif
#include <QtGui/qpagelayout.h>
@@ -125,7 +127,7 @@ public:
virtual bool setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value);
virtual bool isFeatureAvailable(QPrintDevice::PrintDevicePropertyKey key, const QVariant &params) const;
-#ifndef QT_NO_MIMETYPE
+#if QT_CONFIG(mimetype)
virtual QList<QMimeType> supportedMimeTypes() const;
#endif
@@ -139,7 +141,7 @@ protected:
virtual void loadOutputBins() const;
virtual void loadDuplexModes() const;
virtual void loadColorModes() const;
-#ifndef QT_NO_MIMETYPE
+#if QT_CONFIG(mimetype)
virtual void loadMimeTypes() const;
#endif
@@ -178,7 +180,7 @@ protected:
mutable bool m_haveColorModes;
mutable QVector<QPrint::ColorMode> m_colorModes;
-#ifndef QT_NO_MIMETYPE
+#if QT_CONFIG(mimetype)
mutable bool m_haveMimeTypes;
mutable QList<QMimeType> m_mimeTypes;
#endif
diff --git a/src/printsupport/kernel/qprintdevice.cpp b/src/printsupport/kernel/qprintdevice.cpp
index 50fc14169d..7fca3e45bf 100644
--- a/src/printsupport/kernel/qprintdevice.cpp
+++ b/src/printsupport/kernel/qprintdevice.cpp
@@ -260,12 +260,12 @@ bool QPrintDevice::isFeatureAvailable(PrintDevicePropertyKey key, const QVariant
return isValid() ? d->isFeatureAvailable(key, params) : false;
}
-#ifndef QT_NO_MIMETYPE
+#if QT_CONFIG(mimetype)
QList<QMimeType> QPrintDevice::supportedMimeTypes() const
{
return isValid() ? d->supportedMimeTypes() : QList<QMimeType>();
}
-#endif // QT_NO_MIMETYPE
+#endif // mimetype
# ifndef QT_NO_DEBUG_STREAM
void QPrintDevice::format(QDebug debug) const
@@ -296,7 +296,7 @@ void QPrintDevice::format(QDebug debug) const
debug << "), defaultResolution=" << defaultResolution()
<< ", defaultDuplexMode=" << defaultDuplexMode()
<< ", defaultColorMode="<< defaultColorMode();
-# ifndef QT_NO_MIMETYPE
+# if QT_CONFIG(mimetype)
const QList<QMimeType> mimeTypes = supportedMimeTypes();
if (!mimeTypes.isEmpty()) {
debug << ", supportedMimeTypes=(";
@@ -304,7 +304,7 @@ void QPrintDevice::format(QDebug debug) const
debug << " \"" << mimeType.name() << '"';
debug << ')';
}
-# endif // !QT_NO_MIMETYPE
+# endif // mimetype
} else {
debug << "null";
}
diff --git a/src/printsupport/kernel/qprintdevice_p.h b/src/printsupport/kernel/qprintdevice_p.h
index 562ccd2057..a2b18f08cf 100644
--- a/src/printsupport/kernel/qprintdevice_p.h
+++ b/src/printsupport/kernel/qprintdevice_p.h
@@ -139,7 +139,7 @@ public:
bool setProperty(PrintDevicePropertyKey key, const QVariant &value);
bool isFeatureAvailable(PrintDevicePropertyKey key, const QVariant &params) const;
-#ifndef QT_NO_MIMETYPE
+#if QT_CONFIG(mimetype)
QList<QMimeType> supportedMimeTypes() const;
#endif
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index e3a5c3d2e8..add57e9d95 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -1105,16 +1105,16 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
if (mode == property(PPK_Duplex).toInt() || !d->m_printDevice.supportedDuplexModes().contains(mode))
break;
switch (mode) {
- case QPrinter::DuplexNone:
+ case QPrint::DuplexNone:
d->devMode->dmDuplex = DMDUP_SIMPLEX;
break;
- case QPrinter::DuplexAuto:
+ case QPrint::DuplexAuto:
d->devMode->dmDuplex = d->m_pageLayout.orientation() == QPageLayout::Landscape ? DMDUP_HORIZONTAL : DMDUP_VERTICAL;
break;
- case QPrinter::DuplexLongSide:
+ case QPrint::DuplexLongSide:
d->devMode->dmDuplex = DMDUP_VERTICAL;
break;
- case QPrinter::DuplexShortSide:
+ case QPrint::DuplexShortSide:
d->devMode->dmDuplex = DMDUP_HORIZONTAL;
break;
default:
diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp
index ed4292ff3d..ddcd8c4702 100644
--- a/src/printsupport/kernel/qprinter.cpp
+++ b/src/printsupport/kernel/qprinter.cpp
@@ -149,7 +149,12 @@ void QPrinterPrivate::initEngines(QPrinter::OutputFormat format, const QPrinterI
printEngine = ps->createNativePrintEngine(printerMode, printerName);
paintEngine = ps->createPaintEngine(printEngine, printerMode);
} else {
- const auto pdfEngineVersion = (pdfVersion == QPrinter::PdfVersion_1_4 ? QPdfEngine::Version_1_4 : QPdfEngine::Version_A1b);
+ static const QHash<QPrinter::PdfVersion, QPdfEngine::PdfVersion> engineMapping {
+ {QPrinter::PdfVersion_1_4, QPdfEngine::Version_1_4},
+ {QPrinter::PdfVersion_A1b, QPdfEngine::Version_A1b},
+ {QPrinter::PdfVersion_1_6, QPdfEngine::Version_1_6}
+ };
+ const auto pdfEngineVersion = engineMapping.value(pdfVersion, QPdfEngine::Version_1_4);
QPdfPrintEngine *pdfEngine = new QPdfPrintEngine(printerMode, pdfEngineVersion);
paintEngine = pdfEngine;
printEngine = pdfEngine;
@@ -1843,7 +1848,7 @@ QList<int> QPrinter::supportedResolutions() const
= d->printEngine->property(QPrintEngine::PPK_SupportedResolutions).toList();
QList<int> intlist;
intlist.reserve(varlist.size());
- for (auto var : varlist)
+ for (const auto &var : varlist)
intlist << var.toInt();
return intlist;
}
diff --git a/src/printsupport/kernel/qprinterinfo.cpp b/src/printsupport/kernel/qprinterinfo.cpp
index 2eec95d254..167b2361ef 100644
--- a/src/printsupport/kernel/qprinterinfo.cpp
+++ b/src/printsupport/kernel/qprinterinfo.cpp
@@ -3,9 +3,9 @@
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the QtGui module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:FDL$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
@@ -14,13 +14,25 @@
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
** $QT_END_LICENSE$
**
****************************************************************************/