Issue #25: Remove pro/qbs, fix MSVC build

This commit is contained in:
Jakub Melka
2022-09-17 13:56:41 +02:00
parent 8ffc4f9189
commit 3b57f85d4d
66 changed files with 125 additions and 1931 deletions

View File

@@ -1,338 +0,0 @@
# Copyright (C) 2018-2022 Jakub Melka
#
# This file is part of PDF4QT.
#
# PDF4QT is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# with the written consent of the copyright owner, any later version.
#
# PDF4QT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
QT += gui widgets xml svg
TARGET = Pdf4QtLib
TEMPLATE = lib
include(../Pdf4Qt.pri)
QMAKE_TARGET_DESCRIPTION = "PDF rendering / editing library for Qt"
QMAKE_TARGET_COPYRIGHT = "(c) Jakub Melka 2018-2022"
DEFINES += PDF4QTLIB_LIBRARY
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
DESTDIR = $$OUT_PWD/..
SOURCES += \
sources/pdfaction.cpp \
sources/pdfadvancedtools.cpp \
sources/pdfalgorithmlcs.cpp \
sources/pdfannotation.cpp \
sources/pdfblendfunction.cpp \
sources/pdfccittfaxdecoder.cpp \
sources/pdfcertificatemanager.cpp \
sources/pdfcertificatemanagerdialog.cpp \
sources/pdfcms.cpp \
sources/pdfcompiler.cpp \
sources/pdfcreatecertificatedialog.cpp \
sources/pdfdiff.cpp \
sources/pdfdocumentbuilder.cpp \
sources/pdfdocumentmanipulator.cpp \
sources/pdfdocumenttextflow.cpp \
sources/pdfdocumenttextfloweditormodel.cpp \
sources/pdfdocumentwriter.cpp \
sources/pdfexecutionpolicy.cpp \
sources/pdffile.cpp \
sources/pdfform.cpp \
sources/pdficontheme.cpp \
sources/pdfitemmodels.cpp \
sources/pdfjavascriptscanner.cpp \
sources/pdfjbig2decoder.cpp \
sources/pdfmultimedia.cpp \
sources/pdfobject.cpp \
sources/pdfobjecteditormodel.cpp \
sources/pdfobjecteditorwidget.cpp \
sources/pdfobjectutils.cpp \
sources/pdfoptimizer.cpp \
sources/pdfoptionalcontent.cpp \
sources/pdfoutline.cpp \
sources/pdfpagecontenteditorstylesettings.cpp \
sources/pdfpagecontenteditortools.cpp \
sources/pdfpagecontenteditorwidget.cpp \
sources/pdfpagecontentelements.cpp \
sources/pdfpagenavigation.cpp \
sources/pdfpagetransition.cpp \
sources/pdfpainterutils.cpp \
sources/pdfparser.cpp \
sources/pdfdocument.cpp \
sources/pdfdocumentreader.cpp \
sources/pdfpattern.cpp \
sources/pdfplugin.cpp \
sources/pdfprogress.cpp \
sources/pdfredact.cpp \
sources/pdfsecurityhandler.cpp \
sources/pdfselectpagesdialog.cpp \
sources/pdfsignaturehandler.cpp \
sources/pdfsnapper.cpp \
sources/pdfstructuretree.cpp \
sources/pdftexteditpseudowidget.cpp \
sources/pdftextlayout.cpp \
sources/pdftransparencyrenderer.cpp \
sources/pdfutils.cpp \
sources/pdfwidgettool.cpp \
sources/pdfwidgetutils.cpp \
sources/pdfxfaengine.cpp \
sources/pdfxreftable.cpp \
sources/pdfvisitor.cpp \
sources/pdfencoding.cpp \
sources/pdfcatalog.cpp \
sources/pdfpage.cpp \
sources/pdfstreamfilters.cpp \
sources/pdfdrawspacecontroller.cpp \
sources/pdfdrawwidget.cpp \
sources/pdfcolorspaces.cpp \
sources/pdfrenderer.cpp \
sources/pdfpagecontentprocessor.cpp \
sources/pdfpainter.cpp \
sources/pdfrenderingerrorswidget.cpp \
sources/pdffunction.cpp \
sources/pdfnametounicode.cpp \
sources/pdffont.cpp \
sources/pdfimage.cpp
HEADERS += \
sources/pdfaction.h \
sources/pdfadvancedtools.h \
sources/pdfalgorithmlcs.h \
sources/pdfannotation.h \
sources/pdfblendfunction.h \
sources/pdfccittfaxdecoder.h \
sources/pdfcertificatemanager.h \
sources/pdfcertificatemanagerdialog.h \
sources/pdfcms.h \
sources/pdfcompiler.h \
sources/pdfcreatecertificatedialog.h \
sources/pdfdbgheap.h \
sources/pdfdiff.h \
sources/pdfdocumentbuilder.h \
sources/pdfdocumentdrawinterface.h \
sources/pdfdocumentmanipulator.h \
sources/pdfdocumenttextflow.h \
sources/pdfdocumenttextfloweditormodel.h \
sources/pdfdocumentwriter.h \
sources/pdfexecutionpolicy.h \
sources/pdffile.h \
sources/pdfform.h \
sources/pdficontheme.h \
sources/pdfitemmodels.h \
sources/pdfjavascriptscanner.h \
sources/pdfjbig2decoder.h \
sources/pdfmeshqualitysettings.h \
sources/pdfmultimedia.h \
sources/pdfnametreeloader.h \
sources/pdfobject.h \
sources/pdfobjecteditormodel.h \
sources/pdfobjecteditorwidget.h \
sources/pdfobjecteditorwidget_impl.h \
sources/pdfobjectutils.h \
sources/pdfoperationcontrol.h \
sources/pdfoptimizer.h \
sources/pdfoptionalcontent.h \
sources/pdfoutline.h \
sources/pdfpagecontenteditorstylesettings.h \
sources/pdfpagecontenteditortools.h \
sources/pdfpagecontenteditorwidget.h \
sources/pdfpagecontentelements.h \
sources/pdfpagenavigation.h \
sources/pdfpagetransition.h \
sources/pdfpainterutils.h \
sources/pdfparser.h \
sources/pdfglobal.h \
sources/pdfconstants.h \
sources/pdfdocument.h \
sources/pdfdocumentreader.h \
sources/pdfpattern.h \
sources/pdfplugin.h \
sources/pdfprogress.h \
sources/pdfredact.h \
sources/pdfsecurityhandler.h \
sources/pdfselectpagesdialog.h \
sources/pdfsignaturehandler.h \
sources/pdfsignaturehandler_impl.h \
sources/pdfsnapper.h \
sources/pdfstructuretree.h \
sources/pdftexteditpseudowidget.h \
sources/pdftextlayout.h \
sources/pdftransparencyrenderer.h \
sources/pdfwidgettool.h \
sources/pdfwidgetutils.h \
sources/pdfxfaengine.h \
sources/pdfxreftable.h \
sources/pdfflatmap.h \
sources/pdfvisitor.h \
sources/pdfencoding.h \
sources/pdfcatalog.h \
sources/pdfnumbertreeloader.h \
sources/pdfpage.h \
sources/pdfstreamfilters.h \
sources/pdfdrawspacecontroller.h \
sources/pdfdrawwidget.h \
sources/pdfflatarray.h \
sources/pdfcolorspaces.h \
sources/pdfrenderer.h \
sources/pdfpagecontentprocessor.h \
sources/pdfpainter.h \
sources/pdfutils.h \
sources/pdfrenderingerrorswidget.h \
sources/pdffunction.h \
sources/pdfnametounicode.h \
sources/pdffont.h \
sources/pdfexception.h \
sources/pdfimage.h
FORMS += \
sources/pdfcertificatemanagerdialog.ui \
sources/pdfcreatecertificatedialog.ui \
sources/pdfpagecontenteditorstylesettings.ui \
sources/pdfpagecontenteditorwidget.ui \
sources/pdfrenderingerrorswidget.ui \
sources/pdfselectpagesdialog.ui
RESOURCES += cmaps.qrc
Pdf4Qt_DEPENDENCIES_PATH = $$absolute_path(../../PdfforQt-Dependencies, $$PWD)
Pdf4Qt_OPENSSL_PATH = $$absolute_path(../../Tools, $$[QT_INSTALL_PREFIX])
CONFIG(debug, debug|release) {
SUFFIX = d
}
win32-msvc*: {
# Link to freetype library
LIBS += -L$$Pdf4Qt_DEPENDENCIES_PATH/FreeType/ -lfreetype$${SUFFIX}
INCLUDEPATH += $$Pdf4Qt_DEPENDENCIES_PATH/FreeType/include
DEPENDPATH += $$Pdf4Qt_DEPENDENCIES_PATH/FreeType/include
# Link to OpenJPEG library
LIBS += -L$$Pdf4Qt_DEPENDENCIES_PATH/OpenJPEG/lib/ -lopenjp2$${SUFFIX}
INCLUDEPATH += $$Pdf4Qt_DEPENDENCIES_PATH/OpenJPEG/include/openjpeg-2.3
DEPENDPATH += $$Pdf4Qt_DEPENDENCIES_PATH/OpenJPEG/include/openjpeg-2.3
DEFINES += OPJ_STATIC
# Link to Independent JPEG Groups libjpeg
LIBS += -L$$Pdf4Qt_DEPENDENCIES_PATH/libjpeg/bin/ -ljpeg$${SUFFIX}
INCLUDEPATH += $$Pdf4Qt_DEPENDENCIES_PATH/libjpeg/include
DEPENDPATH += $$Pdf4Qt_DEPENDENCIES_PATH/libjpeg/include
# Link OpenSSL
LIBS += -L$$Pdf4Qt_OPENSSL_PATH/OpenSSL/Win_x64/bin -L$$Pdf4Qt_OPENSSL_PATH/OpenSSL/Win_x64/lib -llibcrypto -llibssl
INCLUDEPATH += $$Pdf4Qt_OPENSSL_PATH/OpenSSL/Win_x64/include
DEPENDPATH += $$Pdf4Qt_OPENSSL_PATH/OpenSSL/Win_x64/include
# Add OpenSSL to installations
openssl_lib.files = $$Pdf4Qt_OPENSSL_PATH/OpenSSL/Win_x64/bin/libcrypto-1_1-x64.dll $$Pdf4Qt_OPENSSL_PATH/OpenSSL/Win_x64/bin/libssl-1_1-x64.dll
openssl_lib.path = $$DESTDIR/install
INSTALLS += openssl_lib
# Link zlib
LIBS += -L$$Pdf4Qt_DEPENDENCIES_PATH/zlib/bin/ -lzlibstatic$${SUFFIX}
INCLUDEPATH += $$Pdf4Qt_DEPENDENCIES_PATH/zlib/include
DEPENDPATH += $$Pdf4Qt_DEPENDENCIES_PATH/zlib/include
# Link lcms2
LIBS += -L$$Pdf4Qt_DEPENDENCIES_PATH/lcms2/bin$${SUFFIX}/ -llcms2_static
INCLUDEPATH += $$Pdf4Qt_DEPENDENCIES_PATH/lcms2/include
DEPENDPATH += $$Pdf4Qt_DEPENDENCIES_PATH/lcms2/include
}
win32-*g++|unix: {
PKGCONFIG += freetype2 libopenjp2 libjpeg lcms2 libssl libcrypto zlib
LIBS += -ltbb
win32: {
LIBS += -lmscms -lcrypt32 -lsecur32
}
}
# ensure debug info even for RELEASE build
CONFIG += force_debug_info
QMAKE_RESOURCE_FLAGS += -threshold 0 -compress 9
PdfforQt_library.files = $$DESTDIR/Pdf4QtLib.dll
PdfforQt_library.path = $$DESTDIR/install
PdfforQt_library.CONFIG += no_check_exist
INSTALLS += PdfforQt_library
qt_libraries.files = $$[QT_INSTALL_BINS]/Qt?Widgets$${SUFFIX}.dll \
$$[QT_INSTALL_BINS]/Qt?Gui$${SUFFIX}.dll \
$$[QT_INSTALL_BINS]/Qt?Core$${SUFFIX}.dll \
$$[QT_INSTALL_BINS]/Qt?WinExtras$${SUFFIX}.dll \
$$[QT_INSTALL_BINS]/Qt?Svg$${SUFFIX}.dll \
$$[QT_INSTALL_BINS]/Qt?PrintSupport$${SUFFIX}.dll \
$$[QT_INSTALL_BINS]/Qt?TextToSpeech$${SUFFIX}.dll \
$$[QT_INSTALL_BINS]/Qt?Network$${SUFFIX}.dll \
$$[QT_INSTALL_BINS]/Qt?Xml$${SUFFIX}.dll
qt_libraries.path = $$DESTDIR/install
INSTALLS += qt_libraries
qt_plugin_platform.files = $$[QT_INSTALL_PLUGINS]/platforms/qwindows$${SUFFIX}.dll
qt_plugin_platform.path = $$DESTDIR/install/platforms
INSTALLS += qt_plugin_platform
qt_plugin_style.files = $$[QT_INSTALL_PLUGINS]/styles/qwindowsvistastyle$${SUFFIX}.dll
qt_plugin_style.path = $$DESTDIR/install/styles
INSTALLS += qt_plugin_style
qt_plugin_imageformat.files = $$[QT_INSTALL_PLUGINS]/imageformats/qgif$${SUFFIX}.dll \
$$[QT_INSTALL_PLUGINS]/imageformats/qicns$${SUFFIX}.dll \
$$[QT_INSTALL_PLUGINS]/imageformats/qico$${SUFFIX}.dll \
$$[QT_INSTALL_PLUGINS]/imageformats/qjpeg$${SUFFIX}.dll \
$$[QT_INSTALL_PLUGINS]/imageformats/qsvg$${SUFFIX}.dll \
$$[QT_INSTALL_PLUGINS]/imageformats/qtga$${SUFFIX}.dll \
$$[QT_INSTALL_PLUGINS]/imageformats/qtiff$${SUFFIX}.dll \
$$[QT_INSTALL_PLUGINS]/imageformats/qwbpm$${SUFFIX}.dll \
$$[QT_INSTALL_PLUGINS]/imageformats/qwebp$${SUFFIX}.dll
qt_plugin_imageformat.path = $$DESTDIR/install/imageformats
INSTALLS += qt_plugin_imageformat
qt_plugin_iconengine.files = $$[QT_INSTALL_PLUGINS]/iconengines/qsvgicon$${SUFFIX}.dll
qt_plugin_iconengine.path = $$DESTDIR/install/iconengines
INSTALLS += qt_plugin_iconengine
qt_plugin_printsupport.files = $$[QT_INSTALL_PLUGINS]/printsupport/windowsprintersupport$${SUFFIX}.dll
qt_plugin_printsupport.path = $$DESTDIR/install/printsupport
INSTALLS += qt_plugin_printsupport
qt_plugin_texttospeech.files = $$[QT_INSTALL_PLUGINS]/texttospeech/qtexttospeech_sapi$${SUFFIX}.dll
qt_plugin_texttospeech.path = $$DESTDIR/install/texttospeech
INSTALLS += qt_plugin_texttospeech
VC_REDIST_FILES = $$files($$(VCToolsRedistDir)/$$(VSCMD_ARG_TGT_ARCH)/Microsoft.VC143.CRT/*.dll)
vc_redist.files = $$VC_REDIST_FILES
vc_redist.path = $$DESTDIR/install
INSTALLS += vc_redist
# Debug code for list of all variables and its values
#for(var, $$list($$enumerate_vars())) {
# value = $$eval($$var)
# message($$var = $$value)
#}

View File

@@ -1,52 +0,0 @@
import qbs
Pdf4QtLibrary {
name: "Pdf4QtLib"
Depends { name: "Qt"; submodules: ["core", "gui", "widgets", "xml", "svg"] }
Depends { name: "openssl" }
Depends { name: "freetype" }
Depends { name: "libjpeg" }
Depends { name: "openjpeg" }
Depends { name: "lcms" }
Depends {
condition: qbs.toolchain.contains("gcc") && !qbs.toolchain.contains("mingw")
name: "tbb"
}
Depends {
condition: qbs.hostOS.contains("linux")
name: "fontconfig"
}
Properties {
condition: qbs.toolchain.contains("msvc") || qbs.toolchain.contains("clang")
cpp.cxxFlags: "/bigobj"
}
Properties {
condition: qbs.hostOS.contains("windows")
cpp.defines: "PDF4QTLIB_LIBRARY"
}
files: [
"sources/*.cpp",
"sources/*.h",
"sources/*.ui",
"cmaps.qrc",
]
Export {
Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["core", "gui", "widgets", "xml", "svg"] }
cpp.includePaths: ["sources"]
Depends { name: "openssl" }
Depends { name: "freetype" }
Depends { name: "libjpeg" }
Depends { name: "openjpeg" }
Depends { name: "lcms" }
Depends {
condition: qbs.toolchain.contains("gcc") && !qbs.toolchain.contains("mingw")
name: "tbb"
}
Depends {
condition: qbs.hostOS.contains("linux")
name: "fontconfig"
}
}
}

View File

@@ -206,7 +206,7 @@ PDFCreateLineTypeTool::PDFCreateLineTypeTool(PDFDrawWidgetProxy* proxy, PDFToolM
addTool(m_pickTool);
connect(m_pickTool, &PDFPickTool::pointPicked, this, &PDFCreateLineTypeTool::onPointPicked);
m_fillColor.setAlphaF(0.2);
m_fillColor.setAlphaF(0.2f);
updateActions();
}
@@ -495,7 +495,7 @@ PDFCreateEllipseTool::PDFCreateEllipseTool(PDFDrawWidgetProxy* proxy, PDFToolMan
addTool(m_pickTool);
connect(m_pickTool, &PDFPickTool::rectanglePicked, this, &PDFCreateEllipseTool::onRectanglePicked);
m_fillColor.setAlphaF(0.2);
m_fillColor.setAlphaF(0.2f);
updateActions();
}

View File

@@ -1309,7 +1309,7 @@ void PDFAnnotationManager::drawWidgetAnnotationHighlight(QRectF annotationRectan
if (color.isValid())
{
color.setAlphaF(0.2);
color.setAlphaF(0.2f);
// Draw annotation rectangle by highlight color
QPainterPath highlightArea;
@@ -2128,8 +2128,8 @@ void PDFWidgetAnnotationManager::createWidgetsForMarkupAnnotations(QWidget* pare
const PDFMarkupAnnotation* markupMainAnnotation = pageAnnotation.annotation->asMarkupAnnotation();
QColor color = markupMainAnnotation->getDrawColorFromAnnotationColor(markupMainAnnotation->getColor(), 1.0);
QColor titleColor = QColor::fromHslF(color.hueF(), color.saturationF(), 0.2, 1.0);
QColor backgroundColor = QColor::fromHslF(color.hueF(), color.saturationF(), 0.9, 1.0);
QColor titleColor = QColor::fromHslF(color.hueF(), color.saturationF(), 0.2f, 1.0f);
QColor backgroundColor = QColor::fromHslF(color.hueF(), color.saturationF(), 0.9f, 1.0f);
QString style = "QGroupBox { "
"border: 2px solid black; "

View File

@@ -26,6 +26,11 @@
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#if defined(PDF4QT_COMPILER_MSVC)
#pragma warning(push)
#pragma warning(disable: 4996)
#endif
#include <openssl/bio.h>
#include <openssl/rsa.h>
#include <openssl/rsaerr.h>
@@ -258,3 +263,7 @@ bool PDFSignatureFactory::sign(QString certificateName, QString password, QByteA
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
#pragma GCC diagnostic pop
#endif
#if defined(PDF4QT_COMPILER_MSVC)
#pragma warning(pop)
#endif

View File

@@ -2052,7 +2052,7 @@ std::vector<PDFColorComponent> PDFIndexedColorSpace::transformColorsToBaseColorS
const int byteOffset = int(colorIndex * colorComponentCount);
// We must point into the array. Check first and last component.
Q_ASSERT(byteOffset + colorComponentCount - 1 < m_colors.size());
Q_ASSERT(byteOffset + colorComponentCount - 1 < static_cast<size_t>(m_colors.size()));
const char* bytePointer = m_colors.constData() + byteOffset;

View File

@@ -171,7 +171,7 @@ PDFInteger PDFDocumentReader::findXrefTableOffset(const QByteArray& buffer)
throw PDFException(tr("Start of object reference table not found."));
}
Q_ASSERT(startXRefPosition + std::strlen(PDF_START_OF_XREF_MARK) < buffer.size());
Q_ASSERT(startXRefPosition + std::strlen(PDF_START_OF_XREF_MARK) < static_cast<size_t>(buffer.size()));
PDFLexicalAnalyzer analyzer(buffer.constData() + startXRefPosition + std::strlen(PDF_START_OF_XREF_MARK), buffer.constData() + buffer.size());
const PDFLexicalAnalyzer::Token token = analyzer.fetch();
if (token.type != PDFLexicalAnalyzer::TokenType::Integer)

View File

@@ -245,7 +245,7 @@ void PDFStructureTreeTextContentProcessor::finishText()
if (trimmedText.size() < m_currentText.size())
{
// Fix character bounding boxes...
if (m_characterBoundingRects.size() == m_currentText.size())
if (m_characterBoundingRects.size() == static_cast<size_t>(m_currentText.size()))
{
std::vector<QRectF> boundingRects(std::next(m_characterBoundingRects.cbegin(), index), std::next(m_characterBoundingRects.cbegin(), index + trimmedText.length()));
m_characterBoundingRects = std::move(boundingRects);
@@ -266,7 +266,7 @@ void PDFStructureTreeTextContentProcessor::finishText()
m_currentText = qMove(reversed);
std::reverse(m_characterBoundingRects.begin(), m_characterBoundingRects.end());
}
Q_ASSERT(m_currentText.size() == m_characterBoundingRects.size() || m_characterBoundingRects.empty());
Q_ASSERT(static_cast<size_t>(m_currentText.size()) == m_characterBoundingRects.size() || m_characterBoundingRects.empty());
m_textSequence.emplace_back(PDFStructureTreeTextItem::createText(std::move(m_currentText), m_pageIndex, m_currentBoundingBox, std::move(m_characterBoundingRects)));
}
m_currentText = QString();

View File

@@ -2286,9 +2286,9 @@ void PDFPageContentElementManipulator::drawPage(QPainter* painter,
PDFPainterStateGuard guard(painter);
QPen pen(Qt::SolidLine);
pen.setWidthF(2.0);
pen.setColor(QColor::fromRgbF(0.8, 0.8, 0.1, 0.7));
pen.setColor(QColor::fromRgbF(0.8f, 0.8f, 0.1f, 0.7f));
QBrush brush(Qt::SolidPattern);
brush.setColor(QColor::fromRgbF(1.0, 1.0, 0.0, 0.2));
brush.setColor(QColor::fromRgbF(1.0f, 1.0f, 0.0f, 0.2f));
painter->setPen(std::move(pen));
painter->setBrush(std::move(brush));

View File

@@ -705,7 +705,7 @@ PDFObject PDFParser::getObject()
{
case PDFLexicalAnalyzer::TokenType::Boolean:
{
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::Bool);
Q_ASSERT(m_lookAhead1.data.typeId() == QMetaType::Bool);
const bool value = m_lookAhead1.data.toBool();
shift();
return PDFObject::createBool(value);
@@ -713,7 +713,7 @@ PDFObject PDFParser::getObject()
case PDFLexicalAnalyzer::TokenType::Integer:
{
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::LongLong);
Q_ASSERT(m_lookAhead1.data.typeId() == QMetaType::LongLong);
const PDFInteger value = m_lookAhead1.data.toLongLong();
shift();
@@ -723,7 +723,7 @@ PDFObject PDFParser::getObject()
m_lookAhead2.type == PDFLexicalAnalyzer::TokenType::Command &&
m_lookAhead2.data.toByteArray() == PDF_REFERENCE_COMMAND)
{
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::LongLong);
Q_ASSERT(m_lookAhead1.data.typeId() == QMetaType::LongLong);
const PDFInteger generation = m_lookAhead1.data.toLongLong();
shift();
shift();
@@ -738,7 +738,7 @@ PDFObject PDFParser::getObject()
case PDFLexicalAnalyzer::TokenType::Real:
{
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::Double);
Q_ASSERT(m_lookAhead1.data.typeId() == QMetaType::Double);
const PDFReal value = m_lookAhead1.data.toDouble();
shift();
return PDFObject::createReal(value);
@@ -746,7 +746,7 @@ PDFObject PDFParser::getObject()
case PDFLexicalAnalyzer::TokenType::String:
{
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::ByteArray);
Q_ASSERT(m_lookAhead1.data.typeId() == QMetaType::QByteArray);
QByteArray array = m_lookAhead1.data.toByteArray();
array.shrink_to_fit();
shift();
@@ -755,7 +755,7 @@ PDFObject PDFParser::getObject()
case PDFLexicalAnalyzer::TokenType::Name:
{
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::ByteArray);
Q_ASSERT(m_lookAhead1.data.typeId() == QMetaType::QByteArray);
QByteArray array = m_lookAhead1.data.toByteArray();
array.shrink_to_fit();
shift();

View File

@@ -31,6 +31,11 @@
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#if defined(PDF4QT_COMPILER_MSVC)
#pragma warning(push)
#pragma warning(disable: 4996)
#endif
#include <openssl/rc4.h>
#include <openssl/md5.h>
#include <openssl/aes.h>
@@ -2605,7 +2610,7 @@ PDFObject PDFPublicKeySecurityHandler::createEncryptionDictionaryObject() const
factory << PDFInteger(int32_t(m_permissions));
factory.endDictionaryItem();
// Jakub Melka: 131105 is mysterious value set by Adobe Acrobat Pro
// Jakub Melka: 131105 is mysterious value set by Acrobat Pro
// when using public key security
factory.beginDictionaryItem("R");
factory << PDFInteger(131105);
@@ -2622,3 +2627,6 @@ PDFObject PDFPublicKeySecurityHandler::createEncryptionDictionaryObject() const
#pragma GCC diagnostic pop
#endif
#if defined(PDF4QT_COMPILER_MSVC)
#pragma warning(pop)
#endif

View File

@@ -28,6 +28,11 @@
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#if defined(PDF4QT_COMPILER_MSVC)
#pragma warning(push)
#pragma warning(disable: 4996)
#endif
#include <openssl/err.h>
#include <openssl/sha.h>
#include <openssl/rsa.h>
@@ -2109,3 +2114,7 @@ pdf::PDFCertificateStore::CertificateEntries pdf::PDFCertificateStore::getSystem
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
#pragma GCC diagnostic pop
#endif
#if defined(PDF4QT_COMPILER_MSVC)
#pragma warning(pop)
#endif

View File

@@ -1394,7 +1394,7 @@ void PDFSelectTableTool::drawPage(QPainter* painter,
if (isTablePicked() && pageIndex == m_pageIndex)
{
PDFPainterStateGuard guard(painter);
QColor color = QColor::fromRgbF(0.0, 0.0, 0.5, 0.2);
QColor color = QColor::fromRgbF(0.0f, 0.0f, 0.5f, 0.2f);
QRectF rectangle = pagePointToDevicePointMatrix.mapRect(m_pickedRectangle);
const PDFReal lineWidth = PDFWidgetUtils::scaleDPI_x(getProxy()->getWidget(), 2.0);

View File

@@ -10360,7 +10360,7 @@ void PDFXFALayoutEngine::layoutFlow(LayoutParameters& layoutParameters, bool bre
QStringList colWidths = layoutParameters.colWidths.split(' ', Qt::SkipEmptyParts);
for (size_t i = 0; i < columnWidths.size(); ++i)
{
if (i >= colWidths.size())
if (i >= static_cast<size_t>(colWidths.size()))
{
break;
}
@@ -12134,19 +12134,19 @@ void PDFXFAEngineImpl::drawUi(const xfa::XFA_ui* ui,
passwordEdit || signature || textEdit;
const bool isDefaultUi = !isNonDefaultUi || defaultUi;
if (textEdit || (isDefaultUi && value.value.typeId() == QVariant::String))
if (textEdit || (isDefaultUi && value.value.typeId() == QMetaType::QString))
{
drawUiTextEdit(textEdit, value, errors, nominalExtentArea, paragraphSettingsIndex, painter);
}
else if (checkButton || (isDefaultUi && value.value.typeId() == QVariant::Bool))
else if (checkButton || (isDefaultUi && value.value.typeId() == QMetaType::Bool))
{
drawUiCheckButton(checkButton, value, nominalExtentArea, painter);
}
else if (imageEdit || (isDefaultUi && value.value.typeId() == QVariant::Image))
else if (imageEdit || (isDefaultUi && value.value.typeId() == QMetaType::QImage))
{
drawUiImageEdit(imageEdit, value, errors, nominalExtentArea, painter);
}
else if (numericEdit || (isDefaultUi && value.value.typeId() == QVariant::Double))
else if (numericEdit || (isDefaultUi && value.value.typeId() == QMetaType::Double))
{
drawUiNumericEdit(numericEdit, value, errors, nominalExtentArea, paragraphSettingsIndex, painter);
}
@@ -12166,9 +12166,9 @@ void PDFXFAEngineImpl::drawUi(const xfa::XFA_ui* ui,
{
errors << PDFRenderError(RenderErrorType::NotImplemented, PDFTranslationContext::tr("XFA: Buttons not implemented."));
}
else if (dateTimeEdit || (isDefaultUi && (value.value.typeId() == QVariant::DateTime ||
value.value.typeId() == QVariant::Date ||
value.value.typeId() == QVariant::Time)))
else if (dateTimeEdit || (isDefaultUi && (value.value.typeId() == QMetaType::QDateTime ||
value.value.typeId() == QMetaType::QDate ||
value.value.typeId() == QMetaType::QTime)))
{
drawUiDateTimeEdit(dateTimeEdit, value, errors, nominalExtentArea, paragraphSettingsIndex, painter);
}
@@ -12391,15 +12391,15 @@ void PDFXFAEngineImpl::drawUiDateTimeEdit(const xfa::XFA_dateTimeEdit* dateTimeE
QString text;
if (value.value.typeId() == QVariant::DateTime)
if (value.value.typeId() == QMetaType::QDateTime)
{
text = value.value.toDateTime().toString();
}
else if (value.value.typeId() == QVariant::Time)
else if (value.value.typeId() == QMetaType::QTime)
{
text = value.value.toTime().toString();
}
else if (value.value.typeId() == QVariant::Date)
else if (value.value.typeId() == QMetaType::QDate)
{
text = value.value.toDate().toString();
}