summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2022-05-23 19:35:21 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2022-05-24 22:08:35 +0200
commit6769bd1544c56a514fe35bf16d05614605a49bea (patch)
tree6418a3fd3f0ab07d046d9f8b0d1964b498f3a62e
parentf953d7597fd55089a9de75da6d3550f7116d7a79 (diff)
Move QPdf namespace enums into QPdfDocumentRenderOptions enum classes
[ChangeLog][QtPDF] The QPdf namespace is removed. Change-Id: I9c760c9187760a3a8356e90113ca1ab3535bed95 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
-rw-r--r--src/pdf/CMakeLists.txt1
-rw-r--r--src/pdf/qpdfdocument.cpp24
-rw-r--r--src/pdf/qpdfdocumentrenderoptions.h30
-rw-r--r--src/pdf/qpdfdocumentrenderoptions.qdoc37
-rw-r--r--src/pdf/qpdfnamespace.h76
-rw-r--r--src/pdf/qpdfnamespace.qdoc77
6 files changed, 70 insertions, 175 deletions
diff --git a/src/pdf/CMakeLists.txt b/src/pdf/CMakeLists.txt
index ae2f71120..05b4424a9 100644
--- a/src/pdf/CMakeLists.txt
+++ b/src/pdf/CMakeLists.txt
@@ -25,7 +25,6 @@ qt_internal_add_module(Pdf
qpdfsearchmodel.cpp qpdfsearchmodel.h qpdfsearchmodel_p.h
qpdfselection.cpp qpdfselection.h qpdfselection_p.h
qtpdfglobal.h
- qpdfnamespace.h
INCLUDE_DIRECTORIES
../3rdparty/chromium
DEFINES
diff --git a/src/pdf/qpdfdocument.cpp b/src/pdf/qpdfdocument.cpp
index 7015236c5..2b1176583 100644
--- a/src/pdf/qpdfdocument.cpp
+++ b/src/pdf/qpdfdocument.cpp
@@ -760,35 +760,35 @@ QImage QPdfDocument::render(int page, QSize imageSize, QPdfDocumentRenderOptions
int rotation = 0;
switch (renderOptions.rotation()) {
- case QPdf::Rotate0:
+ case QPdfDocumentRenderOptions::Rotation::Rotate0:
rotation = 0;
break;
- case QPdf::Rotate90:
+ case QPdfDocumentRenderOptions::Rotation::Rotate90:
rotation = 1;
break;
- case QPdf::Rotate180:
+ case QPdfDocumentRenderOptions::Rotation::Rotate180:
rotation = 2;
break;
- case QPdf::Rotate270:
+ case QPdfDocumentRenderOptions::Rotation::Rotate270:
rotation = 3;
break;
}
- const QPdf::RenderFlags renderFlags = renderOptions.renderFlags();
+ const QPdfDocumentRenderOptions::RenderFlags renderFlags = renderOptions.renderFlags();
int flags = 0;
- if (renderFlags & QPdf::RenderAnnotations)
+ if (renderFlags & QPdfDocumentRenderOptions::RenderFlag::Annotations)
flags |= FPDF_ANNOT;
- if (renderFlags & QPdf::RenderOptimizedForLcd)
+ if (renderFlags & QPdfDocumentRenderOptions::RenderFlag::OptimizedForLcd)
flags |= FPDF_LCD_TEXT;
- if (renderFlags & QPdf::RenderGrayscale)
+ if (renderFlags & QPdfDocumentRenderOptions::RenderFlag::Grayscale)
flags |= FPDF_GRAYSCALE;
- if (renderFlags & QPdf::RenderForceHalftone)
+ if (renderFlags & QPdfDocumentRenderOptions::RenderFlag::ForceHalftone)
flags |= FPDF_RENDER_FORCEHALFTONE;
- if (renderFlags & QPdf::RenderTextAliased)
+ if (renderFlags & QPdfDocumentRenderOptions::RenderFlag::TextAliased)
flags |= FPDF_RENDER_NO_SMOOTHTEXT;
- if (renderFlags & QPdf::RenderImageAliased)
+ if (renderFlags & QPdfDocumentRenderOptions::RenderFlag::ImageAliased)
flags |= FPDF_RENDER_NO_SMOOTHIMAGE;
- if (renderFlags & QPdf::RenderPathAliased)
+ if (renderFlags & QPdfDocumentRenderOptions::RenderFlag::PathAliased)
flags |= FPDF_RENDER_NO_SMOOTHPATH;
if (renderOptions.scaledClipRect().isValid()) {
diff --git a/src/pdf/qpdfdocumentrenderoptions.h b/src/pdf/qpdfdocumentrenderoptions.h
index ea30e61cc..c746d2c15 100644
--- a/src/pdf/qpdfdocumentrenderoptions.h
+++ b/src/pdf/qpdfdocumentrenderoptions.h
@@ -41,7 +41,7 @@
#ifndef QPDFDOCUMENTRENDEROPTIONS_H
#define QPDFDOCUMENTRENDEROPTIONS_H
-#include <QtPdf/qpdfnamespace.h>
+#include <QtPdf/qtpdfglobal.h>
#include <QtCore/qobject.h>
#include <QtCore/qrect.h>
@@ -50,13 +50,32 @@ QT_BEGIN_NAMESPACE
class QPdfDocumentRenderOptions
{
public:
+ enum class Rotation {
+ Rotate0,
+ Rotate90,
+ Rotate180,
+ Rotate270
+ };
+
+ enum class RenderFlag {
+ None = 0x000,
+ Annotations = 0x001,
+ OptimizedForLcd = 0x002,
+ Grayscale = 0x004,
+ ForceHalftone = 0x008,
+ TextAliased = 0x010,
+ ImageAliased = 0x020,
+ PathAliased = 0x040
+ };
+ Q_DECLARE_FLAGS(RenderFlags, RenderFlag)
+
constexpr QPdfDocumentRenderOptions() noexcept : m_renderFlags(0), m_rotation(0), m_reserved(0) {}
- constexpr QPdf::Rotation rotation() const noexcept { return static_cast<QPdf::Rotation>(m_rotation); }
- constexpr void setRotation(QPdf::Rotation r) noexcept { m_rotation = r; }
+ constexpr Rotation rotation() const noexcept { return static_cast<Rotation>(m_rotation); }
+ constexpr void setRotation(Rotation r) noexcept { m_rotation = quint32(r); }
- constexpr QPdf::RenderFlags renderFlags() const noexcept { return static_cast<QPdf::RenderFlags>(m_renderFlags); }
- constexpr void setRenderFlags(QPdf::RenderFlags r) noexcept { m_renderFlags = quint32(r.toInt()); }
+ constexpr RenderFlags renderFlags() const noexcept { return static_cast<RenderFlags>(m_renderFlags); }
+ constexpr void setRenderFlags(RenderFlags r) noexcept { m_renderFlags = quint32(r.toInt()); }
constexpr QRect scaledClipRect() const noexcept { return m_clipRect; }
constexpr void setScaledClipRect(const QRect &r) noexcept { m_clipRect = r; }
@@ -77,6 +96,7 @@ private:
};
Q_DECLARE_TYPEINFO(QPdfDocumentRenderOptions, Q_PRIMITIVE_TYPE);
+Q_DECLARE_OPERATORS_FOR_FLAGS(QPdfDocumentRenderOptions::RenderFlags)
constexpr inline bool operator==(const QPdfDocumentRenderOptions &lhs, const QPdfDocumentRenderOptions &rhs) noexcept
{
diff --git a/src/pdf/qpdfdocumentrenderoptions.qdoc b/src/pdf/qpdfdocumentrenderoptions.qdoc
index 8e03df882..24ddb930e 100644
--- a/src/pdf/qpdfdocumentrenderoptions.qdoc
+++ b/src/pdf/qpdfdocumentrenderoptions.qdoc
@@ -52,13 +52,42 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \enum QPdfDocumentRenderOptions::Rotation
+
+ This enum describes the rotation of the page for rendering.
+
+ \value Rotate0 Do not rotate (the default)
+ \value Rotate90 Rotate 90 degrees clockwise
+ \value Rotate180 Rotate 180 degrees
+ \value Rotate270 Rotate 270 degrees clockwise
+
+ \sa QPdfDocument::render()
+*/
+/*!
+ \enum QPdfDocumentRenderOptions::RenderFlag
+
+ This enum is used to describe how a page should be rendered.
+
+ \value None The default value, representing no flags.
+ \value Annotations The page is rendered with annotations.
+ \value OptimizedForLcd The text of the page is rendered optimized for LCD display.
+ \value Grayscale The page is rendered grayscale.
+ \value ForceHalftone Always use halftones for rendering if the output image is stretched.
+ \value TextAliased Anti-aliasing is disabled for rendering text.
+ \value ImageAliased Anti-aliasing is disabled for rendering images.
+ \value PathAliased Anti-aliasing is disabled for rendering paths.
+
+ \sa QPdfDocument::render()
+*/
+
+/*!
\fn QPdfDocumentRenderOptions::QPdfDocumentRenderOptions()
Constructs a QPdfDocumentRenderOptions object.
*/
/*!
- \fn QPdf::Rotation QPdfDocumentRenderOptions::rotation() const
+ \fn QPdfDocumentRenderOptions::Rotation QPdfDocumentRenderOptions::rotation() const
Returns the rotation used for rendering a page from a PDF document.
@@ -66,7 +95,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QPdfDocumentRenderOptions::setRotation(QPdf::Rotation rotation)
+ \fn void QPdfDocumentRenderOptions::setRotation(QPdfDocumentRenderOptions::Rotation rotation)
Sets the \a rotation used for rendering a page from a PDF document.
@@ -74,7 +103,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QPdf::RenderFlags QPdfDocumentRenderOptions::renderFlags() const
+ \fn QPdfDocumentRenderOptions::RenderFlags QPdfDocumentRenderOptions::renderFlags() const
Returns the special flags used for rendering a page from a PDF document.
@@ -82,7 +111,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QPdfDocumentRenderOptions::setRenderFlags(QPdf::RenderFlags flags)
+ \fn void QPdfDocumentRenderOptions::setRenderFlags(QPdfDocumentRenderOptions::RenderFlags flags)
Sets the special \a flags used for rendering a page from a PDF document.
diff --git a/src/pdf/qpdfnamespace.h b/src/pdf/qpdfnamespace.h
deleted file mode 100644
index 9c2d3bf0d..000000000
--- a/src/pdf/qpdfnamespace.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias König <tobias.koenig@kdab.com>
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPDF module of the Qt Toolkit.
-**
-** $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
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** 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$
-**
-****************************************************************************/
-
-#ifndef QPDFNAMESPACE_H
-#define QPDFNAMESPACE_H
-
-#include <QtPdf/qtpdfglobal.h>
-#include <QtCore/qobject.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QPdf {
- Q_NAMESPACE_EXPORT(Q_PDF_EXPORT)
-
- enum Rotation {
- Rotate0,
- Rotate90,
- Rotate180,
- Rotate270
- };
- Q_ENUM_NS(Rotation)
-
- enum RenderFlag {
- NoRenderFlags = 0x000,
- RenderAnnotations = 0x001,
- RenderOptimizedForLcd = 0x002,
- RenderGrayscale = 0x004,
- RenderForceHalftone = 0x008,
- RenderTextAliased = 0x010,
- RenderImageAliased = 0x020,
- RenderPathAliased = 0x040
- };
- Q_FLAG_NS(RenderFlag)
- Q_DECLARE_FLAGS(RenderFlags, RenderFlag)
- Q_DECLARE_OPERATORS_FOR_FLAGS(RenderFlags)
-}
-
-QT_END_NAMESPACE
-#endif
diff --git a/src/pdf/qpdfnamespace.qdoc b/src/pdf/qpdfnamespace.qdoc
deleted file mode 100644
index 3dbe59595..000000000
--- a/src/pdf/qpdfnamespace.qdoc
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Tobias König <tobias.koenig@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtPDF module of the Qt Toolkit.
-**
-** $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
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** 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$
-**
-****************************************************************************/
-
-/*!
- \namespace QPdf
- \inmodule QtPdf
- \keyword QPdf Namespace
-
- \brief The QPdf namespace contains miscellaneous identifiers
- used throughout the QtPdf module.
-*/
-
-/*!
- \enum QPdf::Rotation
-
- This enum describes the rotation of the page for rendering.
-
- \value Rotate0 Do not rotate (the default)
- \value Rotate90 Rotate 90 degrees clockwise
- \value Rotate180 Rotate 180 degrees
- \value Rotate270 Rotate 270 degrees clockwise
-
- \sa QPdfDocument::render()
-*/
-/*!
- \enum QPdf::RenderFlag
-
- This enum is used to describe how a page should be rendered.
-
- \value NoRenderFlags The default value, representing no flags.
- \value RenderAnnotations The page is rendered with annotations.
- \value RenderOptimizedForLcd The text of the page is rendered optimized for LCD display.
- \value RenderGrayscale The page is rendered grayscale.
- \value RenderForceHalftone Always use halftones for rendering if the output image is stretched.
- \value RenderTextAliased Anti-aliasing is disabled for rendering text.
- \value RenderImageAliased Anti-aliasing is disabled for rendering images.
- \value RenderPathAliased Anti-aliasing is disabled for rendering paths.
-
- \sa QPdfDocument::render()
-*/
-