diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 23 | ||||
-rw-r--r-- | src/host/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/pdf/CMakeLists.txt | 161 | ||||
-rw-r--r-- | src/pdf/configure.cmake | 39 | ||||
-rw-r--r-- | src/pdf/configure/BUILD.root.gn.in | 36 | ||||
-rw-r--r-- | src/pdf/jsbridge.cpp | 38 | ||||
-rw-r--r-- | src/pdf/plugins/imageformats/pdf/CMakeLists.txt | 11 | ||||
-rw-r--r-- | src/pdf/plugins/imageformats/pdf/main.cpp (renamed from src/plugins/imageformats/pdf/main.cpp) | 0 | ||||
-rw-r--r-- | src/pdf/plugins/imageformats/pdf/pdf.json (renamed from src/plugins/imageformats/pdf/pdf.json) | 0 | ||||
-rw-r--r-- | src/pdf/plugins/imageformats/pdf/qpdfiohandler.cpp (renamed from src/plugins/imageformats/pdf/qpdfiohandler.cpp) | 0 | ||||
-rw-r--r-- | src/pdf/plugins/imageformats/pdf/qpdfiohandler_p.h (renamed from src/plugins/imageformats/pdf/qpdfiohandler_p.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdfbookmarkmodel.cpp | 1 | ||||
-rw-r--r-- | src/pdf/qpdfbookmarkmodel.h (renamed from src/pdf/api/qpdfbookmarkmodel.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdfdestination.h (renamed from src/pdf/api/qpdfdestination.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdfdestination_p.h (renamed from src/pdf/api/qpdfdestination_p.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdfdocument.h (renamed from src/pdf/api/qpdfdocument.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdfdocument_p.h (renamed from src/pdf/api/qpdfdocument_p.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdfdocumentrenderoptions.h (renamed from src/pdf/api/qpdfdocumentrenderoptions.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdflinkmodel_p.h (renamed from src/pdf/api/qpdflinkmodel_p.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdflinkmodel_p_p.h (renamed from src/pdf/api/qpdflinkmodel_p_p.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdfnamespace.h (renamed from src/pdf/api/qpdfnamespace.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdfpagenavigation.h (renamed from src/pdf/api/qpdfpagenavigation.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdfpagerenderer.h (renamed from src/pdf/api/qpdfpagerenderer.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdfsearchmodel.h (renamed from src/pdf/api/qpdfsearchmodel.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdfsearchmodel_p.h (renamed from src/pdf/api/qpdfsearchmodel_p.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdfsearchresult.h (renamed from src/pdf/api/qpdfsearchresult.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdfsearchresult_p.h (renamed from src/pdf/api/qpdfsearchresult_p.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdfselection.h (renamed from src/pdf/api/qpdfselection.h) | 0 | ||||
-rw-r--r-- | src/pdf/qpdfselection_p.h (renamed from src/pdf/api/qpdfselection_p.h) | 0 | ||||
-rw-r--r-- | src/pdf/qtpdf.gni | 7 | ||||
-rw-r--r-- | src/pdf/qtpdfglobal.h (renamed from src/pdf/api/qtpdfglobal.h) | 0 | ||||
-rw-r--r-- | src/pdf/quick/qmldir | 4 | ||||
-rw-r--r-- | src/pdfquick/CMakeLists.txt | 55 | ||||
-rw-r--r-- | src/pdfquick/plugin.cpp (renamed from src/pdf/quick/plugin.cpp) | 8 | ||||
-rw-r--r-- | src/pdfquick/plugins.qmltypes (renamed from src/pdf/quick/plugins.qmltypes) | 0 | ||||
-rw-r--r-- | src/pdfquick/qml/+material/PdfStyle.qml (renamed from src/pdf/quick/qml/+material/PdfStyle.qml) | 0 | ||||
-rw-r--r-- | src/pdfquick/qml/+universal/PdfStyle.qml (renamed from src/pdf/quick/qml/+universal/PdfStyle.qml) | 0 | ||||
-rw-r--r-- | src/pdfquick/qml/PdfMultiPageView.qml (renamed from src/pdf/quick/qml/PdfMultiPageView.qml) | 0 | ||||
-rw-r--r-- | src/pdfquick/qml/PdfPageView.qml (renamed from src/pdf/quick/qml/PdfPageView.qml) | 0 | ||||
-rw-r--r-- | src/pdfquick/qml/PdfScrollablePageView.qml (renamed from src/pdf/quick/qml/PdfScrollablePageView.qml) | 0 | ||||
-rw-r--r-- | src/pdfquick/qml/PdfStyle.qml (renamed from src/pdf/quick/qml/PdfStyle.qml) | 0 | ||||
-rw-r--r-- | src/pdfquick/qquickpdfdocument.cpp (renamed from src/pdf/quick/qquickpdfdocument.cpp) | 0 | ||||
-rw-r--r-- | src/pdfquick/qquickpdfdocument_p.h (renamed from src/pdf/quick/qquickpdfdocument_p.h) | 3 | ||||
-rw-r--r-- | src/pdfquick/qquickpdflinkmodel.cpp (renamed from src/pdf/quick/qquickpdflinkmodel.cpp) | 0 | ||||
-rw-r--r-- | src/pdfquick/qquickpdflinkmodel_p.h (renamed from src/pdf/quick/qquickpdflinkmodel_p.h) | 7 | ||||
-rw-r--r-- | src/pdfquick/qquickpdfnavigationstack.cpp (renamed from src/pdf/quick/qquickpdfnavigationstack.cpp) | 4 | ||||
-rw-r--r-- | src/pdfquick/qquickpdfnavigationstack_p.h (renamed from src/pdf/quick/qquickpdfnavigationstack_p.h) | 7 | ||||
-rw-r--r-- | src/pdfquick/qquickpdfsearchmodel.cpp (renamed from src/pdf/quick/qquickpdfsearchmodel.cpp) | 0 | ||||
-rw-r--r-- | src/pdfquick/qquickpdfsearchmodel_p.h (renamed from src/pdf/quick/qquickpdfsearchmodel_p.h) | 7 | ||||
-rw-r--r-- | src/pdfquick/qquickpdfselection.cpp (renamed from src/pdf/quick/qquickpdfselection.cpp) | 4 | ||||
-rw-r--r-- | src/pdfquick/qquickpdfselection_p.h (renamed from src/pdf/quick/qquickpdfselection_p.h) | 6 | ||||
-rw-r--r-- | src/pdfquick/qquicktableviewextra.cpp (renamed from src/pdf/quick/qquicktableviewextra.cpp) | 0 | ||||
-rw-r--r-- | src/pdfquick/qquicktableviewextra_p.h (renamed from src/pdf/quick/qquicktableviewextra_p.h) | 5 | ||||
-rw-r--r-- | src/pdfquick/qtpdfquickglobal_p.h | 59 | ||||
-rw-r--r-- | src/pdfwidgets/CMakeLists.txt | 15 |
55 files changed, 432 insertions, 77 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f46b55f82..2db5f81e7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,9 +23,24 @@ set(QT_USE_FIXED_QT_ADD_RESOURCE_BASE TRUE) find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core) qt_build_repo_begin() -add_subdirectory(core) -add_subdirectory(process) -add_subdirectory(webenginewidgets) -add_subdirectory(webenginequick) +if(QT_FEATURE_qtwebengine_build) + add_subdirectory(core) + add_subdirectory(process) + if(QT_FEATURE_qtwebengine_widgets_build) + add_subdirectory(webenginewidgets) + endif() + if(QT_FEATURE_qtwebengine_quick_build) + add_subdirectory(webenginequick) + endif() +endif() +if(QT_FEATURE_qtpdf_build) + add_subdirectory(pdf) + if(QT_FEATURE_qtpdf_widgets_build) + add_subdirectory(pdfwidgets) + endif() + if(QT_FEATURE_qtpdf_quick_build) + add_subdirectory(pdfquick) + endif() +endif() qt_build_repo_end() diff --git a/src/host/CMakeLists.txt b/src/host/CMakeLists.txt index 9053d1e59..822fa8a27 100644 --- a/src/host/CMakeLists.txt +++ b/src/host/CMakeLists.txt @@ -36,3 +36,12 @@ if(QT_FEATURE_qtwebengine_build) DESTINATION ${WEBENGINE_ROOT_BUILD_DIR}/src/core/v8_toolchain ) endif() +if(QT_FEATURE_qtpdf_build) + install(FILES ${buildDir}/host_toolchain/BUILD.gn + DESTINATION ${WEBENGINE_ROOT_BUILD_DIR}/src/pdf/host_toolchain + ) + install(FILES ${buildDir}/v8_toolchain/BUILD.gn + DESTINATION ${WEBENGINE_ROOT_BUILD_DIR}/src/pdf/v8_toolchain + ) +endif() + diff --git a/src/pdf/CMakeLists.txt b/src/pdf/CMakeLists.txt new file mode 100644 index 000000000..b639b1243 --- /dev/null +++ b/src/pdf/CMakeLists.txt @@ -0,0 +1,161 @@ +if(NOT DEFINED WEBENGINE_ROOT_SOURCE_DIR) + get_filename_component(WEBENGINE_ROOT_SOURCE_DIR + "${CMAKE_CURRENT_LIST_DIR}/../.." REALPATH + ) +endif() +find_package(Qt6 ${PROJECT_VERSION} REQUIRED COMPONENTS Gui Network OpenGL Quick) +include(${WEBENGINE_ROOT_SOURCE_DIR}/cmake/Functions.cmake) +set(buildDir "${CMAKE_CURRENT_BINARY_DIR}") + +add_subdirectory(plugins/imageformats/pdf) + +qt_internal_add_module(Pdf + SOURCES + qpdfbookmarkmodel.cpp qpdfbookmarkmodel.h + qpdfdestination.cpp qpdfdestination.h qpdfdestination_p.h + qpdfdocument.cpp qpdfdocument.h qpdfdocument_p.h + qpdfdocumentrenderoptions.h + qpdflinkmodel.cpp qpdflinkmodel_p.h qpdflinkmodel_p_p.h + qpdfpagenavigation.cpp qpdfpagenavigation.h + qpdfpagerenderer.cpp qpdfpagerenderer.h + qpdfsearchmodel.cpp qpdfsearchmodel.h qpdfsearchmodel_p.h + qpdfsearchresult.cpp qpdfsearchresult.h qpdfsearchresult_p.h + qpdfselection.cpp qpdfselection.h qpdfselection_p.h + qtpdfglobal.h + qpdfnamespace.h + INCLUDE_DIRECTORIES + ../3rdparty/chromium + DEFINES + QT_BUILD_PDF_LIB + NOMINMAX + LIBRARIES + Qt::CorePrivate + Qt::Network + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui +) + +make_config_for_gn(Pdf gn_config) +make_install_only(Pdf) +qt_internal_add_docs(Pdf + doc/qtpdf.qdocconf +) + +## +# REPO BUILD +## + +if(WEBENGINE_REPO_BUILD) + find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core) + find_package(Gn ${QT_REPO_MODULE_VERSION} EXACT REQUIRED) + find_package(Ninja 1.7.2 REQUIRED) + find_package(Python2 2.7.5 REQUIRED) + find_package(Nodejs 10.19 REQUIRED) + find_package(PkgConfig) + if(PkgConfig_FOUND) + create_pkg_config_host_wrapper() + endif() + + ## + # TOOLCHAIN SETUP + ## + + if(LINUX) + setup_toolchains() + endif() + + ## + # MULTICONFIG SETUP + ## + + get_configs(configs) + get_architectures(archs) + + foreach(arch ${archs}) + foreach(config ${configs}) + + ## + # BULID.gn SETUP + ## + + set(buildGn pdf_${config}_${arch}) + add_gn_target(${buildGn} ${config} ${arch} SOURCES DEFINES CXX_COMPILE_OPTIONS C_COMPILE_OPTIONS INCLUDES) + resolve_target_includes(gnIncludes Pdf) + get_forward_declaration_macro(forwardDeclarationMacro) + read_gn_target(${buildGn} ${WEBENGINE_ROOT_BUILD_DIR}/src/pdf/${config}/gn_config.cxx.cmake) + read_gn_target(${buildGn} ${WEBENGINE_ROOT_BUILD_DIR}/src/pdf/${config}/gn_config.c.cmake) + configure_gn_target(${buildGn} ${config} + ${WEBENGINE_ROOT_SOURCE_DIR}/src/pdf/configure/BUILD.root.gn.in ${buildDir}/${config}/${arch}/BUILD.gn) + + ## + # GN PARAMETERS + ## + + unset(gnArgArg) + append_build_type_setup(gnArgArg) + append_compiler_linker_sdk_setup(gnArgArg) + append_sanitizer_setup(gnArgArg) + append_toolchain_setup(gnArgArg) + append_pkg_config_setup(gnArgArg) + + list(APPEND gnArgArg + qtwebengine_target="${buildDir}/${config}/${arch}:QtPdf" + enable_remoting=false + enable_web_speech=false + chrome_pgo_phase=0 + ) + + if(LINUX) + list(APPEND gnArgArg + use_x11=false + is_cfi=false + ozone_auto_platforms=false + use_gnome_keyring=false) + endif() + if(MACOS) + list(APPEND gnArgArg angle_enable_vulkan=false) + endif() + if(WIN32) + list(APPEND gnArgArg + ninja_use_custom_environment_files=false + safe_browsing_mode=0 + ) + endif() + + extend_gn_list(gnArgArg + ARGS pdf_enable_v8 + CONDITION QT_FEATURE_pdf_v8 + ) + extend_gn_list(gnArgArg + ARGS pdf_enable_xfa + CONDITION QT_FEATURE_pdf_xfa + ) + extend_gn_list(gnArgArg + ARGS pdf_enable_xfa_bmp + CONDITION QT_FEATURE_pdf_xfa_bmp + ) + extend_gn_list(gnArgArg + ARGS pdf_enable_xfa_gif + CONDITION QT_FEATURE_pdf_xfa_gif + ) + extend_gn_list(gnArgArg + ARGS pdf_enable_xfa_png + CONDITION QT_FEATURE_pdf_xfa_png + ) + extend_gn_list(gnArgArg + ARGS pdf_enable_xfa_tiff + CONDITION QT_FEATURE_pdf_xfa_tiff + ) + + ## + # GN CALL + ## + + execute_gn(gnArgArg) + endforeach() + endforeach() + set(arch ${CMAKE_SYSTEM_PROCESSOR}) + target_include_directories(Pdf PRIVATE ${buildDir}/$<CONFIG>/${arch}/gen) + add_gn_build_aritfacts_to_target(Pdf QtPdf ON ${buildDir}) +endif() diff --git a/src/pdf/configure.cmake b/src/pdf/configure.cmake new file mode 100644 index 000000000..ce1203205 --- /dev/null +++ b/src/pdf/configure.cmake @@ -0,0 +1,39 @@ +qt_feature("pdf-v8" PRIVATE + LABEL "Support V8" + PURPOSE "Enables javascript support." + AUTODETECT false + CONDITION NOT IOS +) +qt_feature("pdf-xfa" PRIVATE + LABEL "Support XFA" + PURPOSE "Enables XFA support." + CONDITION QT_FEATURE_pdf_v8 +) +qt_feature("pdf-xfa-bmp" PRIVATE + LABEL "Support XFA-BMP" + PURPOSE "Enables XFA-BMP support." + CONDITION QT_FEATURE_pdf_xfa +) +qt_feature("pdf-xfa-gif" PRIVATE + LABEL "Support XFA-GIF" + PURPOSE "Enables XFA-GIF support." + CONDITION QT_FEATURE_pdf_xfa +) +qt_feature("pdf-xfa-png" PRIVATE + LABEL "Support XFA-PNG" + PURPOSE "Enables XFA-PNG support." + CONDITION QT_FEATURE_pdf_xfa +) +qt_feature("pdf-xfa-tiff" PRIVATE + LABEL "Support XFA-TIFF" + PURPOSE "Enables XFA-TIFF support." + CONDITION QT_FEATURE_pdf_xfa +) +qt_configure_add_summary_section(NAME "Qt PDF") +qt_configure_add_summary_entry(ARGS "pdf-v8") +qt_configure_add_summary_entry(ARGS "pdf-xfa") +qt_configure_add_summary_entry(ARGS "pdf-xfa-bmp") +qt_configure_add_summary_entry(ARGS "pdf-xfa-gif") +qt_configure_add_summary_entry(ARGS "pdf-xfa-png") +qt_configure_add_summary_entry(ARGS "pdf-xfa-tiff") +qt_configure_end_summary_section() diff --git a/src/pdf/configure/BUILD.root.gn.in b/src/pdf/configure/BUILD.root.gn.in new file mode 100644 index 000000000..a0cd41747 --- /dev/null +++ b/src/pdf/configure/BUILD.root.gn.in @@ -0,0 +1,36 @@ +config("QtPdf_config") { + cflags = [ + @GN_CFLAGS_C@, + ] + cflags_cc = [ + @GN_CFLAGS_CC@, + ] + defines = [ + @GN_DEFINES@, + ] + include_dirs = [ + @GN_INCLUDE_DIRS@, + rebase_path("${target_gen_dir}/.moc/") + ] +} + +config("cpp17_config") { + # static initialized constexpr expressions must be compiled always as c++14 or always as c++17 + # and our qtwebengine core sources use them as c++17 + if (is_win) { + cflags_cc = [ "/std:c++17" ] + } else { + cflags_cc = [ "-std=c++17" ] + } +} + +shared_library("QtPdf") { + cmake_config = "@GN_CONFIG@" + configs += [ + ":cpp17_config", + ":QtPdf_config" + ] + deps = [ + "//third_party/pdfium" + ] +} diff --git a/src/pdf/jsbridge.cpp b/src/pdf/jsbridge.cpp deleted file mode 100644 index 33d3b2465..000000000 --- a/src/pdf/jsbridge.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtPDF module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://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.LGPLv3 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.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 later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "fpdfsdk/javascript/JS_Runtime_Stub.cpp" - diff --git a/src/pdf/plugins/imageformats/pdf/CMakeLists.txt b/src/pdf/plugins/imageformats/pdf/CMakeLists.txt new file mode 100644 index 000000000..8a33e590b --- /dev/null +++ b/src/pdf/plugins/imageformats/pdf/CMakeLists.txt @@ -0,0 +1,11 @@ +qt_internal_add_plugin(QPdfPlugin + OUTPUT_NAME qpdf + TYPE imageformats + SOURCES + main.cpp + qpdfiohandler.cpp qpdfiohandler_p.h + LIBRARIES + Qt::PdfPrivate +) + +make_install_only(QPdfPlugin) diff --git a/src/plugins/imageformats/pdf/main.cpp b/src/pdf/plugins/imageformats/pdf/main.cpp index b4d59353c..b4d59353c 100644 --- a/src/plugins/imageformats/pdf/main.cpp +++ b/src/pdf/plugins/imageformats/pdf/main.cpp diff --git a/src/plugins/imageformats/pdf/pdf.json b/src/pdf/plugins/imageformats/pdf/pdf.json index 1f5268ca1..1f5268ca1 100644 --- a/src/plugins/imageformats/pdf/pdf.json +++ b/src/pdf/plugins/imageformats/pdf/pdf.json diff --git a/src/plugins/imageformats/pdf/qpdfiohandler.cpp b/src/pdf/plugins/imageformats/pdf/qpdfiohandler.cpp index 4f610935c..4f610935c 100644 --- a/src/plugins/imageformats/pdf/qpdfiohandler.cpp +++ b/src/pdf/plugins/imageformats/pdf/qpdfiohandler.cpp diff --git a/src/plugins/imageformats/pdf/qpdfiohandler_p.h b/src/pdf/plugins/imageformats/pdf/qpdfiohandler_p.h index 99a91154c..99a91154c 100644 --- a/src/plugins/imageformats/pdf/qpdfiohandler_p.h +++ b/src/pdf/plugins/imageformats/pdf/qpdfiohandler_p.h diff --git a/src/pdf/qpdfbookmarkmodel.cpp b/src/pdf/qpdfbookmarkmodel.cpp index b0e8bbecd..0450870a1 100644 --- a/src/pdf/qpdfbookmarkmodel.cpp +++ b/src/pdf/qpdfbookmarkmodel.cpp @@ -272,6 +272,7 @@ void QPdfBookmarkModel::setStructureMode(StructureMode mode) int QPdfBookmarkModel::columnCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return 1; } diff --git a/src/pdf/api/qpdfbookmarkmodel.h b/src/pdf/qpdfbookmarkmodel.h index 8e06a1547..8e06a1547 100644 --- a/src/pdf/api/qpdfbookmarkmodel.h +++ b/src/pdf/qpdfbookmarkmodel.h diff --git a/src/pdf/api/qpdfdestination.h b/src/pdf/qpdfdestination.h index f9c186ff6..f9c186ff6 100644 --- a/src/pdf/api/qpdfdestination.h +++ b/src/pdf/qpdfdestination.h diff --git a/src/pdf/api/qpdfdestination_p.h b/src/pdf/qpdfdestination_p.h index 3520fb795..3520fb795 100644 --- a/src/pdf/api/qpdfdestination_p.h +++ b/src/pdf/qpdfdestination_p.h diff --git a/src/pdf/api/qpdfdocument.h b/src/pdf/qpdfdocument.h index 54ca687fa..54ca687fa 100644 --- a/src/pdf/api/qpdfdocument.h +++ b/src/pdf/qpdfdocument.h diff --git a/src/pdf/api/qpdfdocument_p.h b/src/pdf/qpdfdocument_p.h index b6ee2dfd0..b6ee2dfd0 100644 --- a/src/pdf/api/qpdfdocument_p.h +++ b/src/pdf/qpdfdocument_p.h diff --git a/src/pdf/api/qpdfdocumentrenderoptions.h b/src/pdf/qpdfdocumentrenderoptions.h index cafb4716f..cafb4716f 100644 --- a/src/pdf/api/qpdfdocumentrenderoptions.h +++ b/src/pdf/qpdfdocumentrenderoptions.h diff --git a/src/pdf/api/qpdflinkmodel_p.h b/src/pdf/qpdflinkmodel_p.h index cf9c0aad4..cf9c0aad4 100644 --- a/src/pdf/api/qpdflinkmodel_p.h +++ b/src/pdf/qpdflinkmodel_p.h diff --git a/src/pdf/api/qpdflinkmodel_p_p.h b/src/pdf/qpdflinkmodel_p_p.h index 0606b4746..0606b4746 100644 --- a/src/pdf/api/qpdflinkmodel_p_p.h +++ b/src/pdf/qpdflinkmodel_p_p.h diff --git a/src/pdf/api/qpdfnamespace.h b/src/pdf/qpdfnamespace.h index e76d0abd9..e76d0abd9 100644 --- a/src/pdf/api/qpdfnamespace.h +++ b/src/pdf/qpdfnamespace.h diff --git a/src/pdf/api/qpdfpagenavigation.h b/src/pdf/qpdfpagenavigation.h index dc412c33b..dc412c33b 100644 --- a/src/pdf/api/qpdfpagenavigation.h +++ b/src/pdf/qpdfpagenavigation.h diff --git a/src/pdf/api/qpdfpagerenderer.h b/src/pdf/qpdfpagerenderer.h index faeaef8af..faeaef8af 100644 --- a/src/pdf/api/qpdfpagerenderer.h +++ b/src/pdf/qpdfpagerenderer.h diff --git a/src/pdf/api/qpdfsearchmodel.h b/src/pdf/qpdfsearchmodel.h index 1a413c763..1a413c763 100644 --- a/src/pdf/api/qpdfsearchmodel.h +++ b/src/pdf/qpdfsearchmodel.h diff --git a/src/pdf/api/qpdfsearchmodel_p.h b/src/pdf/qpdfsearchmodel_p.h index 551eff47c..551eff47c 100644 --- a/src/pdf/api/qpdfsearchmodel_p.h +++ b/src/pdf/qpdfsearchmodel_p.h diff --git a/src/pdf/api/qpdfsearchresult.h b/src/pdf/qpdfsearchresult.h index 0acf03d52..0acf03d52 100644 --- a/src/pdf/api/qpdfsearchresult.h +++ b/src/pdf/qpdfsearchresult.h diff --git a/src/pdf/api/qpdfsearchresult_p.h b/src/pdf/qpdfsearchresult_p.h index eca37890e..eca37890e 100644 --- a/src/pdf/api/qpdfsearchresult_p.h +++ b/src/pdf/qpdfsearchresult_p.h diff --git a/src/pdf/api/qpdfselection.h b/src/pdf/qpdfselection.h index 70077fdb0..70077fdb0 100644 --- a/src/pdf/api/qpdfselection.h +++ b/src/pdf/qpdfselection.h diff --git a/src/pdf/api/qpdfselection_p.h b/src/pdf/qpdfselection_p.h index 37ca3a3ce..37ca3a3ce 100644 --- a/src/pdf/api/qpdfselection_p.h +++ b/src/pdf/qpdfselection_p.h diff --git a/src/pdf/qtpdf.gni b/src/pdf/qtpdf.gni deleted file mode 100644 index c31f3e9a0..000000000 --- a/src/pdf/qtpdf.gni +++ /dev/null @@ -1,7 +0,0 @@ -include_dirs = [ -] - -deps = [ - "//third_party/pdfium" -] - diff --git a/src/pdf/api/qtpdfglobal.h b/src/pdf/qtpdfglobal.h index 8b4b0c206..8b4b0c206 100644 --- a/src/pdf/api/qtpdfglobal.h +++ b/src/pdf/qtpdfglobal.h diff --git a/src/pdf/quick/qmldir b/src/pdf/quick/qmldir deleted file mode 100644 index 65fa95cda..000000000 --- a/src/pdf/quick/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -module QtQuick.Pdf -plugin pdfplugin -classname QtQuick2PdfPlugin -typeinfo plugins.qmltypes diff --git a/src/pdfquick/CMakeLists.txt b/src/pdfquick/CMakeLists.txt new file mode 100644 index 000000000..12cb393ff --- /dev/null +++ b/src/pdfquick/CMakeLists.txt @@ -0,0 +1,55 @@ +find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Qml Quick) + +get_configure_mode(configureMode) + +set(qml_files +# TODO: +# "qml/+material/PdfStyle.qml" +# "qml/+universal/PdfStyle.qml" + "qml/PdfMultiPageView.qml" + "qml/PdfPageView.qml" + "qml/PdfScrollablePageView.qml" + "qml/PdfStyle.qml" +) + +qt_internal_add_qml_module(PdfQuick + URI "QtQuick.Pdf" + VERSION "${PROJECT_VERSION}" + CLASS_NAME QtQuick2PdfPlugin + NO_GENERATE_PLUGIN_SOURCE + NO_PLUGIN_OPTIONAL + NO_GENERATE_QMLTYPES + PLUGIN_TARGET qtpdfquickplugin + QML_FILES ${qml_files} + DEPENDENCIES QtQuickControls2 + SOURCES + qquickpdfdocument.cpp qquickpdfdocument_p.h + qquickpdflinkmodel.cpp qquickpdflinkmodel_p.h + qquickpdfnavigationstack.cpp qquickpdfnavigationstack_p.h + qquickpdfsearchmodel.cpp qquickpdfsearchmodel_p.h + qquickpdfselection.cpp qquickpdfselection_p.h + qquicktableviewextra.cpp qquicktableviewextra_p.h + qtpdfquickglobal_p.h + INCLUDE_DIRECTORIES + ../3rdparty/chromium + PUBLIC_LIBRARIES + Qt::QuickPrivate + Qt::PdfPrivate + Qt::Core + Qt::Gui + Qt::Qml +) + +qt_internal_extend_target(qtpdfquickplugin + SOURCES + plugin.cpp + LIBRARIES + Qt::CorePrivate + Qt::PdfQuickPrivate +) + +make_install_only(PdfQuick) +make_install_only(qtpdfquickplugin) + + + diff --git a/src/pdf/quick/plugin.cpp b/src/pdfquick/plugin.cpp index b082fcb4a..23f32bc39 100644 --- a/src/pdf/quick/plugin.cpp +++ b/src/pdfquick/plugin.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE /*! - \qmlmodule QtQuick.Pdf 5.15 + \qmlmodule QtQuick.Pdf \title Qt Quick PDF QML Types \ingroup qmlmodules \brief Provides QML types for handling PDF documents. @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE To use the types in this module, import the module with the following line: \code - import QtQuick.Pdf 5.15 + import QtQuick.Pdf \endcode */ @@ -91,10 +91,6 @@ public: qmlRegisterType<QQuickPdfSearchModel>(uri, 5, 15, "PdfSearchModel"); qmlRegisterType<QQuickPdfSelection>(uri, 5, 15, "PdfSelection"); qmlRegisterType<QQuickTableViewExtra>(uri, 5, 15, "TableViewExtra"); - - qmlRegisterType(QUrl("qrc:/qt-project.org/qtpdf/qml/PdfPageView.qml"), uri, 5, 15, "PdfPageView"); - qmlRegisterType(QUrl("qrc:/qt-project.org/qtpdf/qml/PdfMultiPageView.qml"), uri, 5, 15, "PdfMultiPageView"); - qmlRegisterType(QUrl("qrc:/qt-project.org/qtpdf/qml/PdfScrollablePageView.qml"), uri, 5, 15, "PdfScrollablePageView"); } }; diff --git a/src/pdf/quick/plugins.qmltypes b/src/pdfquick/plugins.qmltypes index a30361d33..a30361d33 100644 --- a/src/pdf/quick/plugins.qmltypes +++ b/src/pdfquick/plugins.qmltypes diff --git a/src/pdf/quick/qml/+material/PdfStyle.qml b/src/pdfquick/qml/+material/PdfStyle.qml index 12df30466..12df30466 100644 --- a/src/pdf/quick/qml/+material/PdfStyle.qml +++ b/src/pdfquick/qml/+material/PdfStyle.qml diff --git a/src/pdf/quick/qml/+universal/PdfStyle.qml b/src/pdfquick/qml/+universal/PdfStyle.qml index e92f2a080..e92f2a080 100644 --- a/src/pdf/quick/qml/+universal/PdfStyle.qml +++ b/src/pdfquick/qml/+universal/PdfStyle.qml diff --git a/src/pdf/quick/qml/PdfMultiPageView.qml b/src/pdfquick/qml/PdfMultiPageView.qml index 71485c214..71485c214 100644 --- a/src/pdf/quick/qml/PdfMultiPageView.qml +++ b/src/pdfquick/qml/PdfMultiPageView.qml diff --git a/src/pdf/quick/qml/PdfPageView.qml b/src/pdfquick/qml/PdfPageView.qml index b90ad2d7f..b90ad2d7f 100644 --- a/src/pdf/quick/qml/PdfPageView.qml +++ b/src/pdfquick/qml/PdfPageView.qml diff --git a/src/pdf/quick/qml/PdfScrollablePageView.qml b/src/pdfquick/qml/PdfScrollablePageView.qml index 51d9e530d..51d9e530d 100644 --- a/src/pdf/quick/qml/PdfScrollablePageView.qml +++ b/src/pdfquick/qml/PdfScrollablePageView.qml diff --git a/src/pdf/quick/qml/PdfStyle.qml b/src/pdfquick/qml/PdfStyle.qml index 090465ce6..090465ce6 100644 --- a/src/pdf/quick/qml/PdfStyle.qml +++ b/src/pdfquick/qml/PdfStyle.qml diff --git a/src/pdf/quick/qquickpdfdocument.cpp b/src/pdfquick/qquickpdfdocument.cpp index 79b23ca84..79b23ca84 100644 --- a/src/pdf/quick/qquickpdfdocument.cpp +++ b/src/pdfquick/qquickpdfdocument.cpp diff --git a/src/pdf/quick/qquickpdfdocument_p.h b/src/pdfquick/qquickpdfdocument_p.h index cefa4f756..cfeeb7b98 100644 --- a/src/pdf/quick/qquickpdfdocument_p.h +++ b/src/pdfquick/qquickpdfdocument_p.h @@ -48,6 +48,7 @@ // We mean it. // +#include <QtPdfQuick/private/qtpdfquickglobal_p.h> #include <QtPdf/QPdfDocument> #include <QDateTime> #include <QJSValue> @@ -57,7 +58,7 @@ QT_BEGIN_NAMESPACE -class QQuickPdfDocument : public QObject, public QQmlParserStatus +class Q_PDFQUICK_EXPORT QQuickPdfDocument : public QObject, public QQmlParserStatus { Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) diff --git a/src/pdf/quick/qquickpdflinkmodel.cpp b/src/pdfquick/qquickpdflinkmodel.cpp index 4f3958337..4f3958337 100644 --- a/src/pdf/quick/qquickpdflinkmodel.cpp +++ b/src/pdfquick/qquickpdflinkmodel.cpp diff --git a/src/pdf/quick/qquickpdflinkmodel_p.h b/src/pdfquick/qquickpdflinkmodel_p.h index 6f19daa28..d777643ef 100644 --- a/src/pdf/quick/qquickpdflinkmodel_p.h +++ b/src/pdfquick/qquickpdflinkmodel_p.h @@ -48,15 +48,16 @@ // We mean it. // -#include "qquickpdfdocument_p.h" -#include "../api/qpdflinkmodel_p.h" +#include <QtPdfQuick/private/qtpdfquickglobal_p.h> +#include <QtPdfQuick/private/qquickpdfdocument_p.h> +#include <QtPdf/private/qpdflinkmodel_p.h> #include <QVariant> #include <QtQml/qqml.h> QT_BEGIN_NAMESPACE -class QQuickPdfLinkModel : public QPdfLinkModel +class Q_PDFQUICK_EXPORT QQuickPdfLinkModel : public QPdfLinkModel { Q_OBJECT Q_PROPERTY(QQuickPdfDocument *document READ document WRITE setDocument NOTIFY documentChanged) diff --git a/src/pdf/quick/qquickpdfnavigationstack.cpp b/src/pdfquick/qquickpdfnavigationstack.cpp index 044023ef6..e41e43ed5 100644 --- a/src/pdf/quick/qquickpdfnavigationstack.cpp +++ b/src/pdfquick/qquickpdfnavigationstack.cpp @@ -205,7 +205,7 @@ void QQuickPdfNavigationStack::push(int page, QPointF location, qreal zoom, bool QStringList ret; for (auto d : m_pageHistory) ret << QString::number(d->page); - return ret.join(','); + return ret.join(QLatin1Char(',')); }(); } @@ -248,7 +248,7 @@ void QQuickPdfNavigationStack::update(int page, QPointF location, qreal zoom) QStringList ret; for (auto d : m_pageHistory) ret << QString::number(d->page); - return ret.join(','); + return ret.join(QLatin1Char(',')); }(); } diff --git a/src/pdf/quick/qquickpdfnavigationstack_p.h b/src/pdfquick/qquickpdfnavigationstack_p.h index 5df00add5..1d37a4a85 100644 --- a/src/pdf/quick/qquickpdfnavigationstack_p.h +++ b/src/pdfquick/qquickpdfnavigationstack_p.h @@ -48,14 +48,15 @@ // We mean it. // -#include "qquickpdfdocument_p.h" -#include "../api/qpdfdestination_p.h" +#include <QtPdfQuick/private/qtpdfquickglobal_p.h> +#include <QtPdfQuick/private/qquickpdfdocument_p.h> +#include <QtPdf/private/qpdfdestination_p.h> #include <QtQml/qqml.h> QT_BEGIN_NAMESPACE -class QQuickPdfNavigationStack : public QObject +class Q_PDFQUICK_EXPORT QQuickPdfNavigationStack : public QObject { Q_OBJECT Q_PROPERTY(int currentPage READ currentPage NOTIFY currentPageChanged) diff --git a/src/pdf/quick/qquickpdfsearchmodel.cpp b/src/pdfquick/qquickpdfsearchmodel.cpp index d91ca69f8..d91ca69f8 100644 --- a/src/pdf/quick/qquickpdfsearchmodel.cpp +++ b/src/pdfquick/qquickpdfsearchmodel.cpp diff --git a/src/pdf/quick/qquickpdfsearchmodel_p.h b/src/pdfquick/qquickpdfsearchmodel_p.h index 3f0f6f4c1..ad92d4222 100644 --- a/src/pdf/quick/qquickpdfsearchmodel_p.h +++ b/src/pdfquick/qquickpdfsearchmodel_p.h @@ -48,15 +48,16 @@ // We mean it. // -#include "qquickpdfdocument_p.h" -#include "../api/qpdfsearchmodel.h" +#include <QtPdfQuick/private/qtpdfquickglobal_p.h> +#include <QtPdfQuick/private/qquickpdfdocument_p.h> +#include <QtPdf/qpdfsearchmodel.h> #include <QtCore/qvariant.h> #include <QtQml/qqml.h> QT_BEGIN_NAMESPACE -class QQuickPdfSearchModel : public QPdfSearchModel +class Q_PDFQUICK_EXPORT QQuickPdfSearchModel : public QPdfSearchModel { Q_OBJECT Q_PROPERTY(QQuickPdfDocument *document READ document WRITE setDocument NOTIFY documentChanged) diff --git a/src/pdf/quick/qquickpdfselection.cpp b/src/pdfquick/qquickpdfselection.cpp index bdedb4dfb..54a13828a 100644 --- a/src/pdf/quick/qquickpdfselection.cpp +++ b/src/pdfquick/qquickpdfselection.cpp @@ -49,7 +49,7 @@ Q_LOGGING_CATEGORY(qLcIm, "qt.pdf.im") QT_BEGIN_NAMESPACE -static const QRegularExpression WordDelimiter("\\s"); +static const QRegularExpression WordDelimiter(QStringLiteral("\\s")); /*! \qmltype PdfSelection @@ -323,6 +323,8 @@ QVariant QQuickPdfSelection::inputMethodQuery(Qt::InputMethodQuery query) const break; case Qt::ImPlatformData: break; + case Qt::ImReadOnly: + break; case Qt::ImQueryInput: case Qt::ImQueryAll: qWarning() << "unexpected composite query"; diff --git a/src/pdf/quick/qquickpdfselection_p.h b/src/pdfquick/qquickpdfselection_p.h index 75631a876..b364a6c03 100644 --- a/src/pdf/quick/qquickpdfselection_p.h +++ b/src/pdfquick/qquickpdfselection_p.h @@ -48,18 +48,18 @@ // We mean it. // +#include <QtPdfQuick/private/qtpdfquickglobal_p.h> +#include <QtPdfQuick/private/qquickpdfdocument_p.h> #include <QPointF> #include <QPolygonF> #include <QVariant> #include <QtQml/qqml.h> #include <QtQuick/qquickitem.h> -#include "qquickpdfdocument_p.h" - QT_BEGIN_NAMESPACE class QPdfSelection; -class QQuickPdfSelection : public QQuickItem +class Q_PDFQUICK_EXPORT QQuickPdfSelection : public QQuickItem { Q_OBJECT Q_PROPERTY(QQuickPdfDocument *document READ document WRITE setDocument NOTIFY documentChanged) diff --git a/src/pdf/quick/qquicktableviewextra.cpp b/src/pdfquick/qquicktableviewextra.cpp index 017764a95..017764a95 100644 --- a/src/pdf/quick/qquicktableviewextra.cpp +++ b/src/pdfquick/qquicktableviewextra.cpp diff --git a/src/pdf/quick/qquicktableviewextra_p.h b/src/pdfquick/qquicktableviewextra_p.h index 11b4955a1..30eed696d 100644 --- a/src/pdf/quick/qquicktableviewextra_p.h +++ b/src/pdfquick/qquicktableviewextra_p.h @@ -48,16 +48,17 @@ // We mean it. // +#include <QtPdfQuick/private/qtpdfquickglobal_p.h> +#include <QtQuick/private/qquicktableview_p.h> #include <QPointF> #include <QPolygonF> #include <QVariant> #include <QtQml/qqml.h> #include <QtQuick/qquickitem.h> -#include <QtQuick/private/qquicktableview_p.h> QT_BEGIN_NAMESPACE -class QQuickTableViewExtra : public QObject +class Q_PDFQUICK_EXPORT QQuickTableViewExtra : public QObject { Q_OBJECT Q_PROPERTY(QQuickTableView *tableView READ tableView WRITE setTableView) diff --git a/src/pdfquick/qtpdfquickglobal_p.h b/src/pdfquick/qtpdfquickglobal_p.h new file mode 100644 index 000000000..226a82c28 --- /dev/null +++ b/src/pdfquick/qtpdfquickglobal_p.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine 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 QTPDFQUICKGLOBAL_H +#define QTPDFQUICKGLOBAL_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_NAMESPACE + +#ifndef QT_STATIC +# if defined(QT_BUILD_PDFQUICK_LIB) +# define Q_PDFQUICK_EXPORT Q_DECL_EXPORT +# else +# define Q_PDFQUICK_EXPORT Q_DECL_IMPORT +# endif +#else +# define Q_PDFQUICK_EXPORT +#endif + +QT_END_NAMESPACE + +#endif // QTPDFQUICKGLOBAL_H diff --git a/src/pdfwidgets/CMakeLists.txt b/src/pdfwidgets/CMakeLists.txt new file mode 100644 index 000000000..04ca1387e --- /dev/null +++ b/src/pdfwidgets/CMakeLists.txt @@ -0,0 +1,15 @@ +find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets) + +qt_internal_add_module(PdfWidgets + SOURCES + qpdfview.cpp qpdfview.h qpdfview_p.h + qtpdfwidgetsglobal.h + LIBRARIES + Qt::WidgetsPrivate + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui + Qt::Widgets + Qt::Pdf +) +make_install_only(PdfWidgets) |