Add support for building with mingw-w64 GCC. Fix warnings

This commit is contained in:
Alexey Pavlov 2022-03-12 20:51:21 +03:00 committed by Jakub Melka
parent 2c5aca7ea6
commit d4ee4b890b
41 changed files with 174 additions and 113 deletions

View File

@ -17,8 +17,6 @@
QT += core gui xml widgets
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
@ -30,7 +28,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
# 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
QMAKE_CXXFLAGS += /std:c++latest /utf-8
include(../Pdf4Qt.pri)
DESTDIR = $$OUT_PWD/..

View File

@ -2,8 +2,6 @@ QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
@ -15,7 +13,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
# 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
QMAKE_CXXFLAGS += /std:c++latest /utf-8
include(../Pdf4Qt.pri)
INCLUDEPATH += $$PWD/../PDF4QtLib/Sources

34
Pdf4Qt.pri Normal file
View File

@ -0,0 +1,34 @@
# 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/>.
win32-msvc*: {
QMAKE_CXXFLAGS += /std:c++latest /utf-8 /bigobj
}
win32-*g++|unix: {
CONFIG += link_pkgconfig
QMAKE_CXXFLAGS += -std=c++20
win32: {
QMAKE_CXXFLAGS += -Wa,-mbig-obj
}
}
win32 {
CONFIG += skip_target_version_ext
} else {
CONFIG += unversioned_libname
}

View File

@ -20,6 +20,8 @@ QT += core gui widgets winextras
TARGET = Pdf4QtDocDiff
TEMPLATE = app
include(../Pdf4Qt.pri)
VERSION = 1.1.0
RC_ICONS = $$PWD/app-icon.ico
@ -28,7 +30,6 @@ QMAKE_TARGET_DESCRIPTION = "PDF Document Diff"
QMAKE_TARGET_COPYRIGHT = "(c) Jakub Melka 2018-2021"
DEFINES += QT_DEPRECATED_WARNINGS
QMAKE_CXXFLAGS += /std:c++latest /utf-8
INCLUDEPATH += $$PWD/../PDF4QtLib/Sources
DESTDIR = $$OUT_PWD/..

View File

@ -20,6 +20,8 @@ QT += core gui widgets winextras
TARGET = Pdf4QtDocPageOrganizer
TEMPLATE = app
include(../Pdf4Qt.pri)
VERSION = 1.1.0
RC_ICONS = $$PWD/app-icon.ico
@ -28,7 +30,6 @@ QMAKE_TARGET_DESCRIPTION = "PDF Document Page Organizer"
QMAKE_TARGET_COPYRIGHT = "(c) Jakub Melka 2018-2021"
DEFINES += QT_DEPRECATED_WARNINGS
QMAKE_CXXFLAGS += /std:c++latest /utf-8
INCLUDEPATH += $$PWD/../PDF4QtLib/Sources
DESTDIR = $$OUT_PWD/..

View File

@ -1075,7 +1075,7 @@ bool PageItemModel::dropMimeData(const QMimeData* data, Qt::DropAction action, i
rows.push_back(row);
}
qSort(rows);
std::sort(rows.begin(), rows.end());
// Sanity checks on rows
if (rows.empty())

View File

@ -20,7 +20,8 @@ QT += gui widgets xml
TARGET = Pdf4QtLib
TEMPLATE = lib
win32:TARGET_EXT = .dll
include(../Pdf4Qt.pri)
VERSION = 1.1.0
QMAKE_TARGET_DESCRIPTION = "PDF rendering / editing library for Qt"
@ -205,46 +206,56 @@ CONFIG(debug, debug|release) {
SUFFIX = d
}
# Link to freetype library
LIBS += -L$$Pdf4Qt_DEPENDENCIES_PATH/FreeType/ -lfreetype$${SUFFIX}
INCLUDEPATH += $$Pdf4Qt_DEPENDENCIES_PATH/FreeType/include
DEPENDPATH += $$Pdf4Qt_DEPENDENCIES_PATH/FreeType/include
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 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 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
# 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
# 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 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
# 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_CXXFLAGS += /std:c++latest /utf-8 /bigobj
QMAKE_RESOURCE_FLAGS += -threshold 0 -compress 9
PdfforQt_library.files = $$DESTDIR/Pdf4QtLib.dll

View File

@ -1415,7 +1415,7 @@ void PDFAnnotationManager::drawAnnotation(const PageAnnotation& annotation,
{
errors.push_back(PDFRenderError(RenderErrorType::Error, exception.getMessage()));
}
catch (PDFRendererException exception)
catch (const PDFRendererException &exception)
{
errors.push_back(exception.getError());
}

View File

@ -293,7 +293,7 @@ QImage PDFAbstractColorSpace::getImage(const PDFImageData& imageData,
fillRGBBuffer(inputColors, outputLine, intent, cms, reporter);
}
catch (PDFException lineException)
catch (const PDFException &lineException)
{
QMutexLocker lock(&exceptionMutex);
if (!exception)
@ -396,7 +396,7 @@ QImage PDFAbstractColorSpace::getImage(const PDFImageData& imageData,
*outputLine++ = *alphaLine++;
}
}
catch (PDFException lineException)
catch (const PDFException &lineException)
{
QMutexLocker lock(&exceptionMutex);
if (!exception)

View File

@ -585,7 +585,7 @@ PDFDocument PDFDocumentReader::readFromBuffer(const QByteArray& buffer)
PDFObjectStorage storage(std::move(objects), PDFObject(xrefTable.getTrailerDictionary()), qMove(m_securityHandler));
return PDFDocument(std::move(storage), m_version);
}
catch (PDFException parserException)
catch (const PDFException &parserException)
{
m_result = Result::Failed;
m_errorMessage = parserException.getMessage();
@ -770,7 +770,7 @@ PDFDocument PDFDocumentReader::readDamagedDocumentFromBuffer(const QByteArray& b
PDFObjectStorage storage(std::move(objects), PDFObject(trailerDictionaryObject), qMove(m_securityHandler));
return PDFDocument(std::move(storage), m_version);
}
catch (PDFException parserException)
catch (const PDFException &parserException)
{
m_result = Result::Failed;
m_warnings << parserException.getMessage();

View File

@ -548,9 +548,9 @@ private:
void PDFStructureTreeTextFlowCollector::visitStructureTree(const PDFStructureTree* structureTree)
{
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, QString(), PDFDocumentTextFlow::StructureItemStart});
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, QString(), PDFDocumentTextFlow::StructureItemStart, {} });
acceptChildren(structureTree);
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, QString(), PDFDocumentTextFlow::StructureItemEnd});
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, QString(), PDFDocumentTextFlow::StructureItemEnd, {} });
}
void PDFStructureTreeTextFlowCollector::markHasContent()
@ -564,7 +564,7 @@ void PDFStructureTreeTextFlowCollector::markHasContent()
void PDFStructureTreeTextFlowCollector::visitStructureElement(const PDFStructureElement* structureElement)
{
size_t index = m_items->size();
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, QString(), PDFDocumentTextFlow::StructureItemStart});
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, QString(), PDFDocumentTextFlow::StructureItemStart, {} });
// Mark stack so we can delete unused items
m_hasContentStack.push_back(false);
@ -579,37 +579,37 @@ void PDFStructureTreeTextFlowCollector::visitStructureElement(const PDFStructure
if (!title.isEmpty())
{
markHasContent();
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, QString(), PDFDocumentTextFlow::StructureTitle});
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, QString(), PDFDocumentTextFlow::StructureTitle, {} });
}
if (!language.isEmpty())
{
markHasContent();
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, language, PDFDocumentTextFlow::StructureLanguage });
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, language, PDFDocumentTextFlow::StructureLanguage, {} });
}
if (!alternativeDescription.isEmpty())
{
markHasContent();
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, alternativeDescription, PDFDocumentTextFlow::StructureAlternativeDescription });
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, alternativeDescription, PDFDocumentTextFlow::StructureAlternativeDescription, {} });
}
if (!expandedForm.isEmpty())
{
markHasContent();
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, expandedForm, PDFDocumentTextFlow::StructureExpandedForm });
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, expandedForm, PDFDocumentTextFlow::StructureExpandedForm, {} });
}
if (!actualText.isEmpty())
{
markHasContent();
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, actualText, PDFDocumentTextFlow::StructureActualText });
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, actualText, PDFDocumentTextFlow::StructureActualText, {} });
}
if (!phoneme.isEmpty())
{
markHasContent();
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, phoneme, PDFDocumentTextFlow::StructurePhoneme });
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, phoneme, PDFDocumentTextFlow::StructurePhoneme, {} });
}
for (const auto& textItem : m_extractor->getText(structureElement))
@ -623,7 +623,7 @@ void PDFStructureTreeTextFlowCollector::visitStructureElement(const PDFStructure
const bool hasContent = m_hasContentStack.back();
m_hasContentStack.pop_back();
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, QString(), PDFDocumentTextFlow::StructureItemEnd });
m_items->push_back(PDFDocumentTextFlow::Item{ QRectF(), -1, QString(), PDFDocumentTextFlow::StructureItemEnd, {} });
if (!hasContent)
{
@ -702,12 +702,12 @@ PDFDocumentTextFlow PDFDocumentTextFlowFactory::create(const PDFDocument* docume
PDFTextFlows textFlows = PDFTextFlow::createTextFlows(textLayout, PDFTextFlow::FlowFlags(PDFTextFlow::SeparateBlocks) | PDFTextFlow::RemoveSoftHyphen, pageIndex);
PDFDocumentTextFlow::Items flowItems;
flowItems.emplace_back(PDFDocumentTextFlow::Item{ QRectF(), pageIndex, PDFTranslationContext::tr("Page %1").arg(pageIndex + 1), PDFDocumentTextFlow::PageStart });
flowItems.emplace_back(PDFDocumentTextFlow::Item{ QRectF(), pageIndex, PDFTranslationContext::tr("Page %1").arg(pageIndex + 1), PDFDocumentTextFlow::PageStart, {} });
for (const PDFTextFlow& textFlow : textFlows)
{
flowItems.emplace_back(PDFDocumentTextFlow::Item{ textFlow.getBoundingBox(), pageIndex, textFlow.getText(), PDFDocumentTextFlow::Text, textFlow.getBoundingBoxes() });
}
flowItems.emplace_back(PDFDocumentTextFlow::Item{ QRectF(), pageIndex, QString(), PDFDocumentTextFlow::PageEnd });
flowItems.emplace_back(PDFDocumentTextFlow::Item{ QRectF(), pageIndex, QString(), PDFDocumentTextFlow::PageEnd, {} });
QMutexLocker lock(&mutex);
items[pageIndex] = qMove(flowItems);
@ -760,7 +760,7 @@ PDFDocumentTextFlow PDFDocumentTextFlowFactory::create(const PDFDocument* docume
PDFDocumentTextFlow::Items flowItems;
for (PDFInteger pageIndex : pageIndices)
{
flowItems.emplace_back(PDFDocumentTextFlow::Item{ QRectF(), pageIndex, PDFTranslationContext::tr("Page %1").arg(pageIndex + 1), PDFDocumentTextFlow::PageStart });
flowItems.emplace_back(PDFDocumentTextFlow::Item{ QRectF(), pageIndex, PDFTranslationContext::tr("Page %1").arg(pageIndex + 1), PDFDocumentTextFlow::PageStart, {} });
for (const PDFStructureTreeTextItem& sequenceItem : extractor.getTextSequence(pageIndex))
{
if (sequenceItem.type == PDFStructureTreeTextItem::Type::Text)
@ -768,7 +768,7 @@ PDFDocumentTextFlow PDFDocumentTextFlowFactory::create(const PDFDocument* docume
flowItems.emplace_back(PDFDocumentTextFlow::Item{ sequenceItem.boundingRect, pageIndex, sequenceItem.text, PDFDocumentTextFlow::Text, sequenceItem.characterBoundingRects });
}
}
flowItems.emplace_back(PDFDocumentTextFlow::Item{ QRectF(), pageIndex, QString(), PDFDocumentTextFlow::PageEnd });
flowItems.emplace_back(PDFDocumentTextFlow::Item{ QRectF(), pageIndex, QString(), PDFDocumentTextFlow::PageEnd, {} });
}
result = PDFDocumentTextFlow(qMove(flowItems));

View File

@ -707,7 +707,7 @@ void PDFPageContentProcessor::processContent(const QByteArray& content)
m_operands.clear();
m_errorList.append(PDFRenderError(RenderErrorType::Error, exception.getMessage()));
}
catch (PDFRendererException exception)
catch (const PDFRendererException &exception)
{
m_operands.clear();
m_errorList.append(exception.getError());
@ -3401,7 +3401,7 @@ bool PDFPageContentProcessor::isContentSuppressedByOC(PDFObjectReference ocgOrOc
{
ocmd = PDFOptionalContentMembershipObject::create(m_document, PDFObject::createReference(ocgOrOcmd));
}
catch (PDFException e)
catch (const PDFException &e)
{
m_errorList.push_back(PDFRenderError(RenderErrorType::Error, e.getMessage()));
}

View File

@ -700,7 +700,7 @@ protected:
/// Returns optional content activity
const PDFOptionalContentActivity* getOptionalContentActivity() const { return m_optionalContentActivity; }
class PDFTransparencyGroupGuard
class PDF4QTLIBSHARED_EXPORT PDFTransparencyGroupGuard
{
public:
explicit PDFTransparencyGroupGuard(PDFPageContentProcessor* processor, PDFTransparencyGroup&& group);

View File

@ -246,7 +246,7 @@ std::vector<PDFDependentLibraryInfo> PDFDependentLibraryInfo::getLibraryInfo()
libjpegInfo.library = tr("libjpeg");
libjpegInfo.license = tr("permissive + ack.");
libjpegInfo.url = tr("https://www.ijg.org/");
#if defined(Q_OS_UNIX)
#if defined(Q_OS_UNIX) || defined(__MINGW32__)
libjpegInfo.version = tr("%1").arg(JPEG_LIB_VERSION);
#else
libjpegInfo.version = tr("%1.%2").arg(JPEG_LIB_VERSION_MAJOR).arg(JPEG_LIB_VERSION_MINOR);

View File

@ -20,7 +20,8 @@ QT += core gui widgets winextras printsupport texttospeech network xml
TARGET = Pdf4QtViewer
TEMPLATE = lib
win32:TARGET_EXT = .dll
include(../Pdf4Qt.pri)
VERSION = 1.1.0
DEFINES += PDF4QTVIEWER_LIBRARY
@ -30,7 +31,9 @@ QMAKE_TARGET_COPYRIGHT = "(c) Jakub Melka 2018-2021"
DEFINES += QT_DEPRECATED_WARNINGS
QMAKE_CXXFLAGS += /std:c++latest /utf-8
win32-*g++|unix: {
LIBS += -ltbb
}
INCLUDEPATH += $$PWD/../PDF4QtLib/Sources
DESTDIR = $$OUT_PWD/..

View File

@ -361,7 +361,7 @@ void PDFDocumentPropertiesDialog::initializeFonts(const pdf::PDFDocument* docume
}
}
}
catch (pdf::PDFException)
catch (const pdf::PDFException &)
{
// Do nothing, some error occured, continue with next font
continue;
@ -370,7 +370,7 @@ void PDFDocumentPropertiesDialog::initializeFonts(const pdf::PDFDocument* docume
}
}
}
catch (pdf::PDFException)
catch (const pdf::PDFException &)
{
// Do nothing, some error occured
}

View File

@ -318,8 +318,8 @@ PDFProgramController::PDFProgramController(QObject* parent) :
m_undoRedoManager(nullptr),
m_recentFileManager(new PDFRecentFileManager(this)),
m_optionalContentActivity(nullptr),
m_futureWatcher(nullptr),
m_textToSpeech(nullptr),
m_futureWatcher(nullptr),
m_CMSManager(new pdf::PDFCMSManager(this)),
m_toolManager(nullptr),
m_annotationManager(nullptr),

View File

@ -663,7 +663,7 @@ void PDFSidebarWidget::onAttachmentCustomContextMenuRequested(const QPoint& pos)
QMessageBox::critical(this, tr("Error"), tr("Failed to save attachment to file. %1").arg(file.errorString()));
}
}
catch (pdf::PDFException e)
catch (const pdf::PDFException &e)
{
QMessageBox::critical(this, tr("Error"), tr("Failed to save attachment to file. %1").arg(e.getMessage()));
}

View File

@ -263,11 +263,11 @@ PDFViewerSettings::Settings::Settings() :
m_allowLaunchApplications(true),
m_allowLaunchURI(true),
m_allowDeveloperMode(false),
m_multithreadingStrategy(pdf::PDFExecutionPolicy::Strategy::AlwaysMultithreaded),
m_compiledPageCacheLimit(128 * 1024),
m_thumbnailsCacheLimit(PIXMAP_CACHE_LIMIT),
m_fontCacheLimit(pdf::DEFAULT_FONT_CACHE_LIMIT),
m_instancedFontCacheLimit(pdf::DEFAULT_REALIZED_FONT_CACHE_LIMIT),
m_multithreadingStrategy(pdf::PDFExecutionPolicy::Strategy::AlwaysMultithreaded),
m_speechRate(0.0),
m_speechPitch(0.0),
m_speechVolume(1.0),

View File

@ -69,9 +69,9 @@ PDFViewerSettingsDialog::PDFViewerSettingsDialog(const PDFViewerSettings::Settin
m_settings(settings),
m_cmsSettings(cmsSettings),
m_otherSettings(otherSettings),
m_certificateStore(certificateStore),
m_actions(),
m_isLoadingData(false),
m_certificateStore(certificateStore),
m_enabledPlugins(enabledPlugins),
m_plugins(plugins),
m_networkAccessManager(nullptr),

View File

@ -20,6 +20,8 @@ QT += core gui widgets winextras
TARGET = Pdf4QtViewerLite
TEMPLATE = app
include(../Pdf4Qt.pri)
VERSION = 1.1.0
RC_ICONS = $$PWD/app-icon.ico
@ -28,7 +30,10 @@ QMAKE_TARGET_DESCRIPTION = "PDF viewer for Qt, Lite version"
QMAKE_TARGET_COPYRIGHT = "(c) Jakub Melka 2018-2021"
DEFINES += QT_DEPRECATED_WARNINGS
QMAKE_CXXFLAGS += /std:c++latest /utf-8
win32-*g++|unix: {
LIBS += -ltbb
}
INCLUDEPATH += $$PWD/../PDF4QtLib/Sources $$PWD/../PDF4QtViewer
DESTDIR = $$OUT_PWD/..

View File

@ -20,18 +20,20 @@ DEFINES += AUDIOBOOKPLUGIN_LIBRARY
QT += gui widgets
include(../../Pdf4Qt.pri)
LIBS += -L$$OUT_PWD/../..
LIBS += -lPdf4QtLib
QMAKE_CXXFLAGS += /std:c++latest /utf-8
win32-*g++: {
LIBS += -lole32 -lsapi
}
INCLUDEPATH += $$PWD/../../Pdf4QtLib/Sources
DESTDIR = $$OUT_PWD/../../pdfplugins
CONFIG += c++11
SOURCES += \
audiobookcreator.cpp \
audiobookplugin.cpp \

View File

@ -18,6 +18,7 @@
#include "audiobookcreator.h"
#ifdef Q_OS_WIN
#include <windows.h>
#include <sapi.h>
#if defined(PDF4QT_USE_PRAGMA_LIB)
#pragma comment(lib, "ole32")

View File

@ -20,18 +20,16 @@ DEFINES += DIMENSIONPLUGIN_LIBRARY
QT += gui widgets
include(../../Pdf4Qt.pri)
LIBS += -L$$OUT_PWD/../..
LIBS += -lPdf4QtLib
QMAKE_CXXFLAGS += /std:c++latest /utf-8
INCLUDEPATH += $$PWD/../../Pdf4QtLib/Sources
DESTDIR = $$OUT_PWD/../../pdfplugins
CONFIG += c++11
SOURCES += \
dimensionsplugin.cpp \
dimensiontool.cpp \

View File

@ -20,18 +20,16 @@ DEFINES += OBJECTINSPECTORPLUGIN_LIBRARY
QT += gui widgets
include(../../Pdf4Qt.pri)
LIBS += -L$$OUT_PWD/../..
LIBS += -lPdf4QtLib
QMAKE_CXXFLAGS += /std:c++latest /utf-8
INCLUDEPATH += $$PWD/../../Pdf4QtLib/Sources
DESTDIR = $$OUT_PWD/../../pdfplugins
CONFIG += c++11
SOURCES += \
objectinspectordialog.cpp \
objectinspectorplugin.cpp \
@ -61,3 +59,7 @@ FORMS += \
objectstatisticsdialog.ui \
objectviewerwidget.ui \
statisticsgraphwidget.ui
win32-*g++|unix: {
LIBS += -ltbb
}

View File

@ -35,9 +35,9 @@ ObjectViewerWidget::ObjectViewerWidget(QWidget *parent) :
ObjectViewerWidget::ObjectViewerWidget(bool isPinned, QWidget* parent) :
QWidget(parent),
ui(new Ui::ObjectViewerWidget),
m_isPinned(isPinned),
m_cms(nullptr),
m_document(nullptr),
m_isPinned(isPinned),
m_isRootObject(false)
{
ui->setupUi(this);
@ -252,7 +252,7 @@ void ObjectViewerWidget::updateUi()
ui->stackedWidget->setCurrentWidget(ui->contentTextBrowserPage);
}
}
catch (pdf::PDFException exception)
catch (const pdf::PDFException &exception)
{
ui->contentTextBrowser->setText(exception.getMessage());
ui->stackedWidget->setCurrentWidget(ui->contentTextBrowserPage);

View File

@ -20,18 +20,16 @@ DEFINES += OUTPUTPREVIEWPLUGIN_LIBRARY
QT += gui widgets
include(../../Pdf4Qt.pri)
LIBS += -L$$OUT_PWD/../..
LIBS += -lPdf4QtLib
QMAKE_CXXFLAGS += /std:c++latest /utf-8
INCLUDEPATH += $$PWD/../../Pdf4QtLib/Sources
DESTDIR = $$OUT_PWD/../../pdfplugins
CONFIG += c++11
SOURCES += \
inkcoveragedialog.cpp \
outputpreviewdialog.cpp \

View File

@ -20,18 +20,16 @@ DEFINES += REDACTPLUGIN_LIBRARY
QT += gui widgets
include(../../Pdf4Qt.pri)
LIBS += -L$$OUT_PWD/../..
LIBS += -lPdf4QtLib
QMAKE_CXXFLAGS += /std:c++latest /utf-8
INCLUDEPATH += $$PWD/../../Pdf4QtLib/Sources
DESTDIR = $$OUT_PWD/../../pdfplugins
CONFIG += c++11
SOURCES += \
createredacteddocumentdialog.cpp \
redactplugin.cpp

View File

@ -20,18 +20,16 @@ DEFINES += SOFTPROOFINGPLUGIN_LIBRARY
QT += gui widgets
include(../../Pdf4Qt.pri)
LIBS += -L$$OUT_PWD/../..
LIBS += -lPdf4QtLib
QMAKE_CXXFLAGS += /std:c++latest /utf-8
INCLUDEPATH += $$PWD/../../Pdf4QtLib/Sources
DESTDIR = $$OUT_PWD/../../pdfplugins
CONFIG += c++11
SOURCES += \
softproofingplugin.cpp \
settingsdialog.cpp

View File

@ -20,6 +20,8 @@ QT += core gui widgets winextras
TARGET = Pdf4QtViewerProfi
TEMPLATE = app
include(../Pdf4Qt.pri)
VERSION = 1.1.0
RC_ICONS = $$PWD/app-icon.ico
@ -28,7 +30,10 @@ QMAKE_TARGET_DESCRIPTION = "PDF viewer for Qt, Profi version"
QMAKE_TARGET_COPYRIGHT = "(c) Jakub Melka 2018-2021"
DEFINES += QT_DEPRECATED_WARNINGS
QMAKE_CXXFLAGS += /std:c++latest /utf-8
win32-*g++|unix: {
LIBS += -ltbb
}
INCLUDEPATH += $$PWD/../PDF4QtLib/Sources $$PWD/../PDF4QtViewer
DESTDIR = $$OUT_PWD/..

View File

@ -17,7 +17,9 @@
QT += gui widgets
CONFIG += c++11 console
include(../Pdf4Qt.pri)
CONFIG += console
CONFIG -= app_bundle
# The following define makes your compiler emit warnings if you use
@ -31,8 +33,6 @@ DEFINES += QT_DEPRECATED_WARNINGS
# 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
QMAKE_CXXFLAGS += /std:c++latest /utf-8
INCLUDEPATH += $$PWD/../PDF4QtLib/Sources
DESTDIR = $$OUT_PWD/..

View File

@ -15,9 +15,11 @@
# You should have received a copy of the GNU Lesser General Public License
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
CONFIG += c++11 console
CONFIG += console
CONFIG -= app_bundle
include(../Pdf4Qt.pri)
TARGET = PdfTool
VERSION = 1.1.0
@ -28,7 +30,12 @@ QMAKE_TARGET_COPYRIGHT = "(c) Jakub Melka 2018-2021"
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
QMAKE_CXXFLAGS += /std:c++latest /utf-8
win32-*g++|unix: {
LIBS += -ltbb
win32: {
LIBS += -lole32 -lsapi
}
}
INCLUDEPATH += $$PWD/../PDF4QtLib/Sources

View File

@ -95,7 +95,7 @@ int PDFToolHelpApplication::execute(const PDFToolOptions& options)
infos.emplace_back(qMove(info));
}
qSort(infos);
std::sort(infos.begin(), infos.end());
for (const Info& info : infos)
{

View File

@ -189,7 +189,7 @@ int PDFToolAttachmentsApplication::execute(const PDFToolOptions& options)
return ErrorFailedWriteToFile;
}
}
catch (pdf::PDFException e)
catch (const pdf::PDFException &e)
{
PDFConsole::writeError(PDFToolTranslationContext::tr("Failed to save attachment to file. %1").arg(e.getMessage()), options.outputCodec);
return ErrorFailedWriteToFile;

View File

@ -21,6 +21,7 @@
#include <QFileInfo>
#include <windows.h>
#include <sapi.h>
#if defined(PDF4QT_USE_PRAGMA_LIB)

View File

@ -254,7 +254,7 @@ int PDFToolInfoFonts::execute(const PDFToolOptions& options)
}
}
}
catch (pdf::PDFException)
catch (const pdf::PDFException &)
{
// Do nothing, some error occured, continue with next font
continue;
@ -263,7 +263,7 @@ int PDFToolInfoFonts::execute(const PDFToolOptions& options)
}
}
}
catch (pdf::PDFException)
catch (const pdf::PDFException &)
{
// Do nothing, some error occured
}

View File

@ -61,7 +61,7 @@ int PDFToolInfoMetadataApplication::execute(const PDFToolOptions& options)
QByteArray rawData = document.getDecodedStream(metadata.getStream());
PDFConsole::writeData(rawData);
}
catch (pdf::PDFException e)
catch (const pdf::PDFException &e)
{
PDFConsole::writeError(e.getMessage(), options.outputCodec);
}

View File

@ -122,7 +122,7 @@ int PDFToolSeparate::execute(const PDFToolOptions& options)
}
}
}
catch (pdf::PDFException exception)
catch (const pdf::PDFException &exception)
{
PDFConsole::writeError(exception.getMessage(), options.outputCodec);
}

View File

@ -211,7 +211,7 @@ int PDFToolUnite::execute(const PDFToolOptions& options)
return ErrorFailedWriteToFile;
}
}
catch (pdf::PDFException exception)
catch (const pdf::PDFException &exception)
{
PDFConsole::writeError(exception.getMessage(), options.outputCodec);
return ErrorUnknown;

View File

@ -134,7 +134,7 @@ void PDFXmlExportVisitor::visitStream(const pdf::PDFStream* stream)
m_writer->writeTextElement("text", text);
}
}
catch (pdf::PDFException)
catch (const pdf::PDFException &)
{
// Do nothing
}

View File

@ -22,6 +22,8 @@ CONFIG -= app_bundle
TEMPLATE = app
include(../Pdf4Qt.pri)
INCLUDEPATH += $$PWD/../Pdf4QtLib/Sources
DESTDIR = $$OUT_PWD/..
@ -30,8 +32,6 @@ LIBS += -L$$OUT_PWD/..
LIBS += -lPdf4QtLib
QMAKE_CXXFLAGS += /std:c++latest
SOURCES += \
tst_lexicalanalyzertest.cpp