2020-09-12 23:03:53 +00:00
cmake_minimum_required(VERSION 3.16)
2011-05-29 09:27:07 +00:00
2017-09-02 17:57:46 +00:00
# KDE Application Version, managed by release script
2021-11-08 19:40:45 +00:00
set (RELEASE_SERVICE_VERSION_MAJOR "22")
2022-03-12 12:03:14 +00:00
set (RELEASE_SERVICE_VERSION_MINOR "07")
2019-12-10 16:39:40 +00:00
set (RELEASE_SERVICE_VERSION_MICRO "70")
set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
2017-09-02 17:57:46 +00:00
2020-09-11 16:26:35 +00:00
project(okular VERSION ${RELEASE_SERVICE_VERSION})
2014-08-06 20:51:03 +00:00
2020-09-12 23:03:53 +00:00
set(QT_REQUIRED_VERSION "5.12.0") # Remember to update the QT_DEPRECATED_WARNINGS_SINCE below
set(KF5_REQUIRED_VERSION "5.68.0") # Remember to update the KF_DEPRECATED_WARNINGS_SINCE below
2014-08-06 20:51:03 +00:00
2021-11-30 23:15:56 +00:00
set(OKULAR_UI "" CACHE STRING "Which Okular user interface to build. Possible values: desktop, mobile, both. Default: desktop (except on Android, where it is 'mobile')")
2022-04-03 09:52:53 +00:00
option(FORCE_NOT_REQUIRED_DEPENDENCIES "List (semicolon-separated) of dependencies that will be downgraded from REQUIRED to RECOMMENDED")
if (ANDROID AND (NOT FORCE_NOT_REQUIRED_DEPENDENCIES) AND (NOT FORCE_NOT_REQUIRED_DEPENDENCIES STREQUAL ""))
set(FORCE_NOT_REQUIRED_DEPENDENCIES "KF5Wallet;KF5DocTools;KF5JS;TIFF;JPEG;LibSpectre;KF5KExiv2;CHM;KF5KHtml;LibZip;DjVuLibre;EPub;Discount;")
endif()
function(set_okular_optional_package_properties _name _props)
if(NOT "${_props}" STREQUAL "PROPERTIES")
message(FATAL_ERROR "PROPERTIES keyword is missing in set_okular_optional_package_properties() call.")
endif()
set(options) # none
set(oneValueArgs DESCRIPTION URL PURPOSE)
set(multiValueArgs) # none
CMAKE_PARSE_ARGUMENTS(_SPP "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(_SPP_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown keywords given to set_okular_optional_package_properties(): \"${_SPP_UNPARSED_ARGUMENTS}\"")
endif()
set(DEPENDENCY_TYPE "REQUIRED")
if (${_name} IN_LIST FORCE_NOT_REQUIRED_DEPENDENCIES)
set(DEPENDENCY_TYPE "RECOMMENDED")
endif()
set_package_properties(${_name} PROPERTIES
TYPE ${DEPENDENCY_TYPE}
DESCRIPTION ${_SPP_DESCRIPTION}
URL ${_SPP_URL}
PURPOSE "${_SPP_PURPOSE} You can make the dependency optional adding ${_name} to the FORCE_NOT_REQUIRED_DEPENDENCIES cmake option"
)
endfunction()
2021-11-30 23:15:56 +00:00
if(OKULAR_UI STREQUAL "")
if(ANDROID)
set(OKULAR_UI "mobile")
else()
set(OKULAR_UI "desktop")
endif()
endif()
2020-02-01 10:02:33 +00:00
if(OKULAR_UI STREQUAL "desktop" OR OKULAR_UI STREQUAL "both")
set(BUILD_DESKTOP ON)
else()
set(BUILD_DESKTOP OFF)
endif()
if(OKULAR_UI STREQUAL "mobile" OR OKULAR_UI STREQUAL "both")
set(BUILD_MOBILE ON)
else()
set(BUILD_MOBILE OFF)
endif()
2021-11-24 16:58:52 +00:00
if (BUILD_MOBILE)
set(QT_REQUIRED_VERSION "5.15.2")
2019-10-25 15:06:59 +00:00
endif()
2020-04-07 22:36:08 +00:00
find_package(ECM ${KF5_REQUIRED_VERSION} CONFIG REQUIRED)
2014-08-06 20:51:03 +00:00
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
include(ECMInstallIcons)
include(ECMSetupVersion)
include(ECMOptionalAddSubdirectory)
2014-08-10 18:35:46 +00:00
include(GenerateExportHeader)
include(FeatureSummary)
2015-03-04 06:52:20 +00:00
include(ECMAddAppIcon)
2016-08-13 20:32:31 +00:00
include(KDECompilerSettings NO_POLICY_SCOPE)
2014-08-10 18:35:46 +00:00
include(KDEInstallDirs)
include(KDECMakeSettings)
2014-08-12 21:36:11 +00:00
include(ECMAddTests)
2016-07-15 19:05:38 +00:00
include(ECMAddAppIcon)
2017-09-05 08:58:58 +00:00
include(CMakePackageConfigHelpers)
2020-04-08 00:33:25 +00:00
include(ECMSetupQtPluginMacroNames)
2015-04-09 19:59:40 +00:00
2022-03-07 23:09:02 +00:00
# append the plugins from the install tree folder to the QT_PLUGIN_PATH
if(UNIX)
set(ENV{QT_PLUGIN_PATH} "$ENV{QT_PLUGIN_PATH}:${KDE_INSTALL_FULL_QTPLUGINDIR}")
elseif(WIN32)
set(ENV{QT_PLUGIN_PATH} "$ENV{QT_PLUGIN_PATH};${KDE_INSTALL_FULL_QTPLUGINDIR}")
endif()
2020-02-27 19:47:40 +00:00
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
2017-09-02 17:57:46 +00:00
ecm_setup_version(${PROJECT_VERSION}
2016-10-29 10:42:59 +00:00
VARIABLE_PREFIX OKULAR
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/core/version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/Okular5ConfigVersion.cmake")
2014-08-06 20:51:03 +00:00
2021-08-13 13:37:53 +00:00
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED COMPONENTS Core Test Widgets PrintSupport Svg Qml Quick)
2014-11-08 04:33:23 +00:00
2019-10-25 15:06:59 +00:00
if(ANDROID)
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED COMPONENTS AndroidExtras)
endif()
2020-04-08 00:33:25 +00:00
ecm_setup_qtplugin_macro_names(
JSON_ARG2
2020-04-07 22:46:27 +00:00
"OKULAR_EXPORT_PLUGIN"
2020-04-08 00:33:25 +00:00
CONFIG_CODE_VARIABLE
PACKAGE_SETUP_AUTOMOC_VARIABLES
)
2018-02-05 23:36:00 +00:00
2015-04-14 19:04:26 +00:00
find_package(KF5 ${KF5_REQUIRED_VERSION} REQUIRED COMPONENTS
2014-08-09 14:05:30 +00:00
Archive
Bookmarks
2016-01-30 15:50:11 +00:00
Completion
2014-08-09 14:05:30 +00:00
Config
ConfigWidgets
CoreAddons
2021-04-26 11:49:43 +00:00
I18n
2014-08-09 14:05:30 +00:00
KIO
ThreadWeaver
2016-07-11 17:40:49 +00:00
WindowSystem
2014-08-09 14:05:30 +00:00
)
2018-04-16 20:35:40 +00:00
2022-04-03 09:52:53 +00:00
find_package(KF5Wallet ${KF5_REQUIRED_VERSION})
set_okular_optional_package_properties(KF5Wallet PROPERTIES
PURPOSE "Required for document storing passwords in secure wallets.")
2020-09-09 12:13:09 +00:00
if(KF5Wallet_FOUND)
add_definitions(-DWITH_KWALLET=1)
endif()
2022-04-03 09:52:53 +00:00
find_package(KF5DocTools ${KF5_REQUIRED_VERSION})
set_okular_optional_package_properties(KF5DocTools PROPERTIES
PURPOSE "Required for compiling and installing the user documentation.")
find_package(KF5JS ${KF5_REQUIRED_VERSION})
set_okular_optional_package_properties(KF5JS PROPERTIES
PURPOSE "Required for supporting JavaScript in PDF documents")
2020-09-09 12:13:09 +00:00
if(KF5JS_FOUND)
add_definitions(-DWITH_KJS=1)
endif()
2022-04-03 09:52:53 +00:00
if (BUILD_DESKTOP)
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED COMPONENTS DBus)
find_package(KF5 ${KF5_REQUIRED_VERSION} REQUIRED COMPONENTS Parts Crash IconThemes TextWidgets)
find_package(KF5Purpose)
set_okular_optional_package_properties(KF5Purpose PROPERTIES
DESCRIPTION "A framework for services and actions integration"
PURPOSE "Required for enabling the share menu.")
if (KF5Purpose_FOUND)
set(PURPOSE_FOUND 1)
else()
set(PURPOSE_FOUND 0)
endif()
find_package(Qt5TextToSpeech ${QT_REQUIRED_VERSION} CONFIG)
set_okular_optional_package_properties(Qt5TextToSpeech PROPERTIES
PURPOSE "Enables speech features.")
if (Qt5TextToSpeech_FOUND)
add_definitions(-DHAVE_SPEECH)
endif()
endif()
if (BUILD_MOBILE)
find_package(KF5Kirigami2)
set_package_properties(KF5Kirigami2 PROPERTIES
DESCRIPTION "A QtQuick based components set"
PURPOSE "Required at runtime by the mobile app"
TYPE RUNTIME
)
endif()
2018-04-13 15:35:17 +00:00
if(NOT WIN32 AND NOT ANDROID)
2017-03-18 00:58:05 +00:00
find_package(KF5 ${KF5_REQUIRED_VERSION} REQUIRED COMPONENTS
Activities
)
2018-04-13 15:35:17 +00:00
set_package_properties("KF5Activities" PROPERTIES
DESCRIPTION "Activities interface library"
URL "https://api.kde.org/frameworks/kactivities/html/"
PURPOSE "Required for Activities integration.")
2017-03-18 00:58:05 +00:00
endif()
2014-08-09 14:05:30 +00:00
find_package(Phonon4Qt5 CONFIG REQUIRED)
2011-05-29 09:27:07 +00:00
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)
2014-10-08 22:17:53 +00:00
find_package(ZLIB REQUIRED)
2020-09-12 23:03:53 +00:00
find_package(Poppler "0.86.0" COMPONENTS Qt5)
2022-04-03 09:52:53 +00:00
set_okular_optional_package_properties(Poppler PROPERTIES
2018-03-20 23:30:22 +00:00
PURPOSE "Support for PDF files in okular.")
2022-03-25 13:28:10 +00:00
find_package(Freetype)
2022-04-03 09:52:53 +00:00
set_okular_optional_package_properties(Freetype PROPERTIES
2022-03-25 13:28:10 +00:00
DESCRIPTION "A font rendering engine"
URL "https://www.freetype.org"
PURPOSE "Provides freetype font support in the okular DVI generator.")
find_package(TIFF)
2022-04-03 09:52:53 +00:00
set_okular_optional_package_properties(TIFF PROPERTIES
2022-03-25 13:28:10 +00:00
DESCRIPTION "A library for reading and writing TIFF formatted files,"
URL "http://www.libtiff.org"
PURPOSE "Support for TIFF files in okular.")
find_package(JPEG)
2022-04-03 09:52:53 +00:00
set_okular_optional_package_properties(JPEG PROPERTIES
2022-03-25 13:28:10 +00:00
DESCRIPTION "A library for reading and writing JPEG image files."
URL "https://www.ijg.org"
PURPOSE "Support for PalmDB documents in okular.")
set(LIBSPECTRE_MINIMUM_VERSION "0.2")
find_package(LibSpectre "${LIBSPECTRE_MINIMUM_VERSION}")
2022-04-03 09:52:53 +00:00
set_okular_optional_package_properties(LibSpectre PROPERTIES
2022-03-25 13:28:10 +00:00
DESCRIPTION "A PostScript rendering library"
URL "https://libspectre.freedesktop.org"
PURPOSE "Support for PS files in okular.")
find_package(KF5KExiv2 CONFIG)
2022-04-03 09:52:53 +00:00
set_okular_optional_package_properties(KF5KExiv2 PROPERTIES
2022-03-25 13:28:10 +00:00
DESCRIPTION "Wrapper around Exiv2 library"
URL "https://commits.kde.org/libkexiv2"
2022-04-03 09:52:53 +00:00
PURPOSE "Support for exif rotation in image files.")
2022-03-25 13:28:10 +00:00
find_package(CHM)
2022-04-03 09:52:53 +00:00
set_okular_optional_package_properties(CHM PROPERTIES
2022-03-25 13:28:10 +00:00
DESCRIPTION "A library for dealing with Microsoft ITSS/CHM format files"
URL "http://www.jedrea.com/chmlib"
PURPOSE "Support CHM files in okular.")
find_package(KF5KHtml CONFIG)
2022-04-03 09:52:53 +00:00
set_okular_optional_package_properties(KF5KHtml PROPERTIES
2022-03-25 13:28:10 +00:00
DESCRIPTION "HTML rendering library"
PURPOSE "Support CHM files in okular.")
find_package(LibZip)
2022-04-03 09:52:53 +00:00
set_okular_optional_package_properties(LibZip PROPERTIES
2022-03-25 13:28:10 +00:00
DESCRIPTION "A library for reading, creating, and modifying zip archives"
URL "https://libzip.org/"
PURPOSE "Support CHM files in okular.")
find_package(DjVuLibre "3.5.17")
2022-04-03 09:52:53 +00:00
set_okular_optional_package_properties(DjVuLibre PROPERTIES
2022-03-25 13:28:10 +00:00
DESCRIPTION "A library for dealing with DjVu formatted files"
URL "https://djvulibre.djvuzone.org"
PURPOSE "Support for DjVu files in okular.")
find_package(EPub)
2022-04-03 09:52:53 +00:00
set_okular_optional_package_properties(EPub PROPERTIES
2022-03-25 13:28:10 +00:00
DESCRIPTION "A library for reading EPub documents"
URL "http://sourceforge.net/projects/ebook-tools"
PURPOSE "Support for EPub documents in Okular.")
find_package(QMobipocket "2" CONFIG)
2022-04-03 09:52:53 +00:00
set_okular_optional_package_properties(QMobipocket PROPERTIES
2022-03-25 13:28:10 +00:00
DESCRIPTION "A library for reading Mobipocket documents"
URL "https://commits.kde.org/kdegraphics-mobipocket"
PURPOSE "Support for Mobipocket documents in Okular.")
find_package(Discount)
2022-04-03 09:52:53 +00:00
set_okular_optional_package_properties(Discount PROPERTIES
2022-03-25 13:28:10 +00:00
DESCRIPTION "A library that gives you formatting functions suitable for marking down entire documents or lines of text"
URL "https://www.pell.portland.or.us/~orc/Code/discount/"
PURPOSE "Support for Markdown documents in Okular.")
2020-09-17 05:13:44 +00:00
add_definitions(-DQT_USE_QSTRINGBUILDER)
2014-09-10 20:30:35 +00:00
add_definitions(-DTRANSLATION_DOMAIN="okular")
2017-12-05 08:48:40 +00:00
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
2022-04-02 21:21:33 +00:00
add_definitions(-DQT_NO_CAST_FROM_ASCII)
add_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
add_definitions(-DQT_NO_CAST_TO_ASCII)
2020-09-12 23:03:53 +00:00
add_definitions(-DQT_DEPRECATED_WARNINGS_SINCE=0x050C00)
add_definitions(-DKF_DEPRECATED_WARNINGS_SINCE=0x054400)
2022-03-18 21:57:31 +00:00
add_definitions(-DQT_NO_KEYWORDS)
2014-08-09 14:05:30 +00:00
2020-12-02 17:57:49 +00:00
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${PHONON_INCLUDES} core/synctex ${CMAKE_BINARY_DIR}/core)
2011-05-29 09:27:07 +00:00
2022-01-19 22:33:21 +00:00
if(BUILD_MOBILE AND KF5Kirigami2_VERSION VERSION_LESS "5.85")
message(FATAL_ERROR "Disable mobile build. This requires Kirigami 5.85 or greater.")
set(BUILD_MOBILE OFF)
endif()
2015-08-26 22:05:06 +00:00
option(BUILD_COVERAGE "Build the project with gcov support" OFF)
if(BUILD_COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
endif()
2020-11-18 19:32:56 +00:00
add_subdirectory( icons ) # an own directory for multi-size icons retrieved by KIconThemeLoader
add_subdirectory( part )
2020-02-01 10:02:33 +00:00
if(BUILD_DESKTOP)
add_subdirectory( shell )
endif()
2014-08-09 10:47:33 +00:00
add_subdirectory( generators )
2022-03-25 13:28:10 +00:00
if(BUILD_MOBILE)
add_subdirectory( mobile )
endif()
2018-07-09 05:37:58 +00:00
if(BUILD_TESTING)
add_subdirectory( autotests )
2018-07-09 05:43:44 +00:00
endif()
2014-08-06 20:51:03 +00:00
2018-04-16 20:35:40 +00:00
if(KF5DocTools_FOUND)
add_subdirectory(doc)
endif()
2006-03-26 12:19:40 +00:00
2007-03-10 13:15:49 +00:00
include(OkularConfigureChecks.cmake)
2007-03-18 17:14:36 +00:00
if(NOT WIN32)
set(MATH_LIB m)
else(NOT WIN32)
set(MATH_LIB)
endif(NOT WIN32)
2006-03-26 12:19:40 +00:00
2006-06-12 21:58:24 +00:00
# okularcore
2006-03-26 12:19:40 +00:00
2006-06-12 21:58:24 +00:00
set(okularcore_SRCS
2007-04-20 11:26:05 +00:00
core/action.cpp
2006-06-03 09:22:26 +00:00
core/annotations.cpp
core/area.cpp
2007-02-05 00:49:40 +00:00
core/audioplayer.cpp
2006-12-27 16:04:49 +00:00
core/bookmarkmanager.cpp
2006-06-03 09:22:26 +00:00
core/chooseenginedialog.cpp
core/document.cpp
2013-04-05 22:39:35 +00:00
core/documentcommands.cpp
2007-07-07 20:35:01 +00:00
core/fontinfo.cpp
2007-02-25 00:07:59 +00:00
core/form.cpp
2006-06-03 09:22:26 +00:00
core/generator.cpp
2007-04-20 17:17:44 +00:00
core/generator_p.cpp
2007-01-03 14:30:48 +00:00
core/misc.cpp
2008-08-23 00:07:59 +00:00
core/movie.cpp
2006-12-05 08:53:26 +00:00
core/observer.cpp
2014-09-11 17:36:01 +00:00
core/debug.cpp
2006-06-03 09:22:26 +00:00
core/page.cpp
2007-03-24 10:47:22 +00:00
core/pagecontroller.cpp
2007-01-05 23:12:06 +00:00
core/pagesize.cpp
2006-06-03 09:22:26 +00:00
core/pagetransition.cpp
2006-11-03 17:57:32 +00:00
core/rotationjob.cpp
2008-04-13 22:31:59 +00:00
core/scripter.cpp
2006-10-09 18:02:59 +00:00
core/sound.cpp
2007-01-02 17:45:32 +00:00
core/sourcereference.cpp
2007-01-13 23:15:28 +00:00
core/textdocumentgenerator.cpp
2013-05-18 11:57:46 +00:00
core/textdocumentsettings.cpp
2006-06-03 09:22:26 +00:00
core/textpage.cpp
2012-07-07 17:40:52 +00:00
core/tilesmanager.cpp
2006-06-30 21:42:41 +00:00
core/utils.cpp
2008-04-27 11:05:59 +00:00
core/view.cpp
2007-11-26 21:43:54 +00:00
core/fileprinter.cpp
Add option to ignore print margins for non-PDF generators
Summary:
This adds a combobox in the print dialog of the non-PDF
generators to allow selecting whether or not to take
print margins into account.
For the PDF case and rasterized printing, new print otions have
been implemented in commit 2e97d587508dff08aaf86ff149c8ed6b7658950d
already, which adds an additional option to do no scaling at all.
For consistency reasons, the same terms also used for the PDF
case are used in the combobox (i.e. the two of the three that
apply).
This adds a new abstract class 'PrintOptionsWidget' with a
'ignorePrintMargins()' method to indicate whether print margins
should be ignored or not, and a default implementation.
The existing widget for the PDF generator now derives from this
class.
In order to avoid an ABI breakage, the return value of
'Document::printConfigurationWidget' is left as a 'QWidget *'
and a dynamic_cast is done on use.
FilePrinter is adapted to take into account the value set by
'QPrinter::setFullPage()' and the margin options
are now passed accordingly (either the values set in the dialog or '0').
A big thanks to Albert Astals Cid <aacid@kde.org> for showing how
to extend the initial implementation to cover more generators.
Test Plan:
1) Open a PostScript file in Okular (using a document size that matches
a paper size available on the printer used later makes it easier
to see things behave as expected)
2) open print dialog, go to "Print options" and notice that there is a new
"Scale mode" combobox whose value is set to "Fit to printable area"
by default.
3) don't change any options, print to a printer that has hardware margins
Expected result: the document is scaled to the printable area (e.g.
scaled down so that the printer's hardware margins remain empty) as it
has been without this change.
4) Set the value of the "Print Options" -> "Scale mode" combobox to
"Fit to full page" and print again
Expected result: The document is scaled to the full page size, i.e. ignoring
the printer's hardware margins.
5) Try steps 1-4 with other document formats supported by Okular and
observe that they behave the same (except for the PDF case, where
there's a combobox with three options that has been implemented
independent of this change).
Reviewers: #okular, ngraham
Reviewed By: ngraham
Subscribers: fvogt, rkflx, arthurpeters, ltoscano, okular-devel, aacid, ngraham
Tags: #okular
Differential Revision: https://phabricator.kde.org/D10974
2019-04-03 13:58:21 +00:00
core/printoptionswidget.cpp
2019-01-05 22:30:25 +00:00
core/signatureutils.cpp
2018-02-21 22:54:16 +00:00
core/script/event.cpp
2014-10-08 22:17:53 +00:00
core/synctex/synctex_parser.c
core/synctex/synctex_parser_utils.c
2006-03-26 15:22:05 +00:00
)
2018-02-21 22:56:51 +00:00
qt5_add_resources(okularcore_SRCS
core/script/builtin.qrc
)
2014-08-13 09:26:37 +00:00
ki18n_wrap_ui(okularcore_SRCS
2020-11-18 19:32:56 +00:00
part/textdocumentsettings.ui
2013-05-18 11:57:46 +00:00
)
2007-01-03 14:30:48 +00:00
install( FILES
2007-04-20 11:26:05 +00:00
core/action.h
2007-01-03 14:30:48 +00:00
core/annotations.h
core/area.h
core/document.h
2007-07-08 16:21:53 +00:00
core/fontinfo.h
2007-03-18 19:25:04 +00:00
core/form.h
2007-01-03 14:30:48 +00:00
core/generator.h
2007-04-22 10:23:59 +00:00
core/global.h
2007-01-03 14:30:48 +00:00
core/page.h
2007-01-05 23:12:06 +00:00
core/pagesize.h
2007-01-03 14:30:48 +00:00
core/pagetransition.h
2019-01-05 22:30:25 +00:00
core/signatureutils.h
2007-01-03 14:30:48 +00:00
core/sound.h
core/sourcereference.h
2007-01-13 23:15:28 +00:00
core/textdocumentgenerator.h
2013-05-18 11:57:46 +00:00
core/textdocumentsettings.h
2007-01-03 14:30:48 +00:00
core/textpage.h
2012-11-08 20:29:09 +00:00
core/tile.h
2007-01-03 14:30:48 +00:00
core/utils.h
2007-11-26 21:43:54 +00:00
core/fileprinter.h
Add option to ignore print margins for non-PDF generators
Summary:
This adds a combobox in the print dialog of the non-PDF
generators to allow selecting whether or not to take
print margins into account.
For the PDF case and rasterized printing, new print otions have
been implemented in commit 2e97d587508dff08aaf86ff149c8ed6b7658950d
already, which adds an additional option to do no scaling at all.
For consistency reasons, the same terms also used for the PDF
case are used in the combobox (i.e. the two of the three that
apply).
This adds a new abstract class 'PrintOptionsWidget' with a
'ignorePrintMargins()' method to indicate whether print margins
should be ignored or not, and a default implementation.
The existing widget for the PDF generator now derives from this
class.
In order to avoid an ABI breakage, the return value of
'Document::printConfigurationWidget' is left as a 'QWidget *'
and a dynamic_cast is done on use.
FilePrinter is adapted to take into account the value set by
'QPrinter::setFullPage()' and the margin options
are now passed accordingly (either the values set in the dialog or '0').
A big thanks to Albert Astals Cid <aacid@kde.org> for showing how
to extend the initial implementation to cover more generators.
Test Plan:
1) Open a PostScript file in Okular (using a document size that matches
a paper size available on the printer used later makes it easier
to see things behave as expected)
2) open print dialog, go to "Print options" and notice that there is a new
"Scale mode" combobox whose value is set to "Fit to printable area"
by default.
3) don't change any options, print to a printer that has hardware margins
Expected result: the document is scaled to the printable area (e.g.
scaled down so that the printer's hardware margins remain empty) as it
has been without this change.
4) Set the value of the "Print Options" -> "Scale mode" combobox to
"Fit to full page" and print again
Expected result: The document is scaled to the full page size, i.e. ignoring
the printer's hardware margins.
5) Try steps 1-4 with other document formats supported by Okular and
observe that they behave the same (except for the PDF case, where
there's a combobox with three options that has been implemented
independent of this change).
Reviewers: #okular, ngraham
Reviewed By: ngraham
Subscribers: fvogt, rkflx, arthurpeters, ltoscano, okular-devel, aacid, ngraham
Tags: #okular
Differential Revision: https://phabricator.kde.org/D10974
2019-04-03 13:58:21 +00:00
core/printoptionswidget.h
2013-02-24 21:58:53 +00:00
core/observer.h
2015-04-09 19:59:40 +00:00
${CMAKE_CURRENT_BINARY_DIR}/core/version.h
2015-04-15 23:54:32 +00:00
${CMAKE_CURRENT_BINARY_DIR}/core/okularcore_export.h
2012-10-15 22:27:42 +00:00
${CMAKE_CURRENT_BINARY_DIR}/settings_core.h
2015-03-04 06:52:20 +00:00
DESTINATION ${KDE_INSTALL_INCLUDEDIR}/okular/core COMPONENT Devel)
2007-01-03 14:30:48 +00:00
install( FILES
interfaces/configinterface.h
interfaces/guiinterface.h
interfaces/printinterface.h
2012-05-21 21:54:48 +00:00
interfaces/saveinterface.h
2011-09-10 17:15:52 +00:00
interfaces/viewerinterface.h
2015-03-04 06:52:20 +00:00
DESTINATION ${KDE_INSTALL_INCLUDEDIR}/okular/interfaces COMPONENT Devel)
2007-01-03 14:30:48 +00:00
2014-08-13 09:26:37 +00:00
ki18n_wrap_ui(okularcore_SRCS
2006-06-03 09:22:26 +00:00
core/chooseenginewidget.ui
2006-03-26 15:22:05 +00:00
)
2021-05-29 23:08:56 +00:00
kconfig_add_kcfg_files(okularcore_SRCS GENERATE_MOC conf/settings_core.kcfgc)
2006-06-12 21:58:24 +00:00
2014-10-06 06:58:55 +00:00
add_library(okularcore SHARED ${okularcore_SRCS})
2015-04-15 23:54:32 +00:00
generate_export_header(okularcore BASE_NAME okularcore EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/core/okularcore_export.h")
2006-06-12 21:58:24 +00:00
2018-04-18 00:17:24 +00:00
if (ANDROID)
set(fileName ${CMAKE_BINARY_DIR}/Okular5Core-android-dependencies.xml)
file(WRITE "${fileName}" "<rules><dependencies><lib name='Okular5Core'><depends>\n"
"<bundled file='${KDE_INSTALL_PLUGINDIR}/okular/generators' />\n"
"</depends></lib></dependencies></rules>\n")
install(FILES ${fileName} DESTINATION ${KDE_INSTALL_LIBDIR})
endif()
2006-10-29 15:08:18 +00:00
# Special handling for linking okularcore on OSX/Apple
IF(APPLE)
SET(OKULAR_IOKIT "-framework IOKit" CACHE STRING "Apple IOKit framework")
ENDIF(APPLE)
2017-09-13 21:27:39 +00:00
# Extra library needed by imported synctex code on Windows
if(WIN32)
set(SHLWAPI shlwapi)
endif(WIN32)
2014-08-09 14:05:30 +00:00
target_link_libraries(okularcore
2015-04-14 19:04:26 +00:00
PRIVATE
2014-08-09 14:05:30 +00:00
${OKULAR_IOKIT}
2017-09-13 21:27:39 +00:00
${SHLWAPI}
2014-08-09 14:05:30 +00:00
KF5::Archive
KF5::KIOCore
2015-11-28 19:24:41 +00:00
KF5::KIOWidgets
KF5::I18n
2014-08-09 14:05:30 +00:00
KF5::ThreadWeaver
2015-11-28 19:24:41 +00:00
KF5::Bookmarks
2014-08-09 14:05:30 +00:00
Phonon::phonon4qt5
2021-10-01 16:04:50 +00:00
Qt5::Svg
2014-08-09 14:05:30 +00:00
${MATH_LIB}
2020-12-02 17:57:49 +00:00
ZLIB::ZLIB
2015-04-14 19:04:26 +00:00
PUBLIC # these are included from the installed headers
KF5::CoreAddons
KF5::XmlGui
KF5::ConfigGui
Qt5::PrintSupport
Qt5::Widgets
2014-08-09 14:05:30 +00:00
)
2006-06-12 21:58:24 +00:00
2018-04-16 20:35:40 +00:00
if (KF5Wallet_FOUND)
target_link_libraries(okularcore PRIVATE KF5::Wallet)
endif()
if (KF5JS_FOUND)
target_sources(okularcore PRIVATE
core/script/executor_kjs.cpp
core/script/kjs_app.cpp
core/script/kjs_console.cpp
core/script/kjs_data.cpp
2019-05-23 13:28:53 +00:00
core/script/kjs_display.cpp
2018-04-16 20:35:40 +00:00
core/script/kjs_document.cpp
core/script/kjs_field.cpp
core/script/kjs_fullscreen.cpp
core/script/kjs_field.cpp
core/script/kjs_spell.cpp
core/script/kjs_util.cpp
core/script/kjs_event.cpp
2019-05-31 20:03:54 +00:00
core/script/kjs_ocg.cpp
2018-04-16 20:35:40 +00:00
)
target_link_libraries(okularcore PRIVATE KF5::JS KF5::JSApi)
endif()
2022-03-01 15:21:29 +00:00
set_target_properties(okularcore PROPERTIES VERSION 10.0.0 SOVERSION 10 OUTPUT_NAME Okular5Core EXPORT_NAME Core)
2007-04-20 16:12:05 +00:00
2015-07-18 15:28:05 +00:00
install(TARGETS okularcore EXPORT Okular5Targets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
2006-06-12 21:58:24 +00:00
2015-03-04 06:52:20 +00:00
install(FILES conf/okular.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
install(FILES conf/okular_core.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
install(FILES core/okularGenerator.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR})
2007-01-25 18:06:53 +00:00
2020-02-01 10:02:33 +00:00
if(BUILD_DESKTOP)
# okularpart
set(okularpart_SRCS
2022-01-26 16:27:42 +00:00
gui/certificatemodel.cpp
gui/debug_ui.cpp
gui/guiutils.cpp
gui/pagepainter.cpp
gui/signatureguiutils.cpp
gui/signaturemodel.cpp
gui/tocmodel.cpp
2020-11-18 19:32:56 +00:00
part/preferencesdialog.cpp
part/dlgaccessibility.cpp
part/dlgdebug.cpp
part/dlgeditor.cpp
part/dlggeneral.cpp
part/dlgannotations.cpp
part/dlgperformance.cpp
part/dlgpresentation.cpp
part/editannottooldialog.cpp
part/editdrawingtooldialog.cpp
part/widgetannottools.cpp
part/widgetconfigurationtoolsbase.cpp
part/widgetdrawingtools.cpp
part/part.cpp
part/xmlgui_helper.cpp
part/extensions.cpp
part/embeddedfilesdialog.cpp
2020-09-28 05:44:26 +00:00
part/actionbar.cpp
2020-11-18 19:32:56 +00:00
part/annotationactionhandler.cpp
part/annotwindow.cpp
part/annotationmodel.cpp
part/annotationpopup.cpp
part/annotationpropertiesdialog.cpp
part/annotationproxymodels.cpp
part/annotationtools.cpp
part/annotationwidgets.cpp
part/bookmarklist.cpp
part/certificateviewer.cpp
2021-05-29 23:08:56 +00:00
part/colormodemenu.cpp
2021-03-25 12:22:19 +00:00
part/cursorwraphelper.cpp
2020-11-18 19:32:56 +00:00
part/drawingtoolactions.cpp
part/fileprinterpreview.cpp
part/findbar.cpp
part/formwidgets.cpp
part/ktreeviewsearchline.cpp
part/latexrenderer.cpp
part/minibar.cpp
part/okmenutitle.cpp
part/pageitemdelegate.cpp
part/pagesizelabel.cpp
part/pageviewannotator.cpp
part/pageviewmouseannotation.cpp
part/pageview.cpp
part/magnifierview.cpp
part/pageviewutils.cpp
part/presentationsearchbar.cpp
part/presentationwidget.cpp
part/propertiesdialog.cpp
part/revisionviewer.cpp
part/searchlineedit.cpp
part/searchwidget.cpp
part/sidebar.cpp
part/side_reviews.cpp
part/snapshottaker.cpp
part/thumbnaillist.cpp
part/toc.cpp
part/toggleactionmenu.cpp
part/videowidget.cpp
part/layers.cpp
2022-01-26 16:27:42 +00:00
part/signaturepartutils.cpp
2020-11-18 19:32:56 +00:00
part/signaturepropertiesdialog.cpp
part/signaturepanel.cpp
2020-02-01 10:02:33 +00:00
)
2006-03-26 12:19:40 +00:00
2014-11-08 04:33:23 +00:00
if (Qt5TextToSpeech_FOUND)
set(okularpart_SRCS ${okularpart_SRCS}
2020-11-18 19:32:56 +00:00
part/tts.cpp)
2014-11-08 04:33:23 +00:00
endif()
2020-10-24 15:53:01 +00:00
kconfig_add_kcfg_files(okularpart_SRCS GENERATE_MOC conf/settings.kcfgc)
2012-10-15 22:27:42 +00:00
2015-10-25 13:56:47 +00:00
add_library(okularpart SHARED ${okularpart_SRCS})
2014-10-27 21:35:06 +00:00
generate_export_header(okularpart BASE_NAME okularpart)
2006-03-26 12:19:40 +00:00
2016-07-11 17:40:49 +00:00
target_link_libraries(okularpart okularcore
${MATH_LIB}
Qt5::Svg
Phonon::phonon4qt5
KF5::Archive
2016-07-15 19:05:38 +00:00
KF5::Bookmarks
2016-07-21 19:53:54 +00:00
KF5::I18n
2016-07-11 17:40:49 +00:00
KF5::IconThemes
2016-07-17 00:28:57 +00:00
KF5::ItemViews
2016-08-03 14:01:30 +00:00
KF5::KIOCore
KF5::KIOFileWidgets
KF5::KIOWidgets
2016-07-11 17:40:49 +00:00
KF5::Parts
KF5::Solid
KF5::WindowSystem
2021-04-26 11:49:43 +00:00
KF5::TextWidgets
2016-07-11 17:40:49 +00:00
)
2018-04-16 20:35:40 +00:00
if(KF5Wallet_FOUND)
target_link_libraries(okularpart KF5::Wallet)
endif()
2019-01-06 23:51:04 +00:00
if (KF5Purpose_FOUND)
target_link_libraries(okularpart KF5::PurposeWidgets)
2017-10-11 15:45:02 +00:00
endif()
2016-03-16 09:57:34 +00:00
set_target_properties(okularpart PROPERTIES PREFIX "")
2006-03-26 12:19:40 +00:00
2014-11-08 04:33:23 +00:00
if (Qt5TextToSpeech_FOUND)
target_link_libraries(okularpart Qt5::TextToSpeech)
endif()
2015-03-04 06:52:20 +00:00
install(TARGETS okularpart DESTINATION ${KDE_INSTALL_PLUGINDIR})
2021-08-13 13:37:53 +00:00
endif()
2006-03-26 12:19:40 +00:00
########### install files ###############
Overhaul annotations UX
Create a new new annotation toolbar to replace the current one as discussed in the task T8076.
Fixes:
BUG: 386578
BUG: 374728
BUG: 352310
BUG: 330518
BUG: 341914
BUG: 157289
BUG: 358057
BUG: 412767
BUG: 413595
BUG: 420462
FIXED-IN: 1.11.0
Test Plan
Before testing this revision
Delete or Temporary move aside the following files:
~/.config/okularpartrc
~/.config/okularrc
~/.local/share/kxmlgui5/okular/part.rc
~/.local/share/kxmlgui5/okular/shell.rc
Nomenclature
Actions in the main toolbar:
Quick annotations
Actions in the annotation toolbar:
Annotation actions Highlighter, Underline, Squiggle, Strike out, Typewriter,
Inline note, Popup note, Freehand line, Arrow, Straight line, Rectangle, Ellipse,
Polygon, Stamp
Annotation config actions Line width, Color, Inner color, Opacity, Font, Annotation settings
Other actions Add to Quick Annotations, Pin
Autotests
First run: annotation toolbar is not visible
Selecting Tools > Annotations shows the annotation toolbar (below the main toolbar by default)
Select an annotation > toolbar is shown
Select a quick annotation > toolbar is shown
Hide action (red cross) on the toolbar hides the toolbar
Keys 1-9,0 select the (builtin) Annotation actions (one case tested)
Keys Alt+1-9,0 select the quick annotation actions (one case tested)
No annotation action selected: Quick Annotations is enabled, Add to quick annotations is disabled, Annotation config actions are disabled, Pin is enabled
The current document is an image: Highlighter, Underline, Squiggle, Strike out are disabled (also in Quick annotations)
The current document is protected: All actions are disabled
Select annotation: the Annotation config actions are enabled and their values set to the ones for the current annotation (taken from okularpartrc)
Click an annotation action when none selected: browse mode is selected
Click the currently selected annotation action: the action is unchecked and the tool disabled (back to browse mode)
Click ESC: the currently selected annotation action is unchecked
If Pin unchecked the selected annotation is unchecked after it has be used once and we are back to Browse mode
The annotation systems works when multiple Okular tabs are open (the selected annotation is per-tab)
Manual tests
(TODO) Check that kconf_update updates the key AnnotationTools to QuickAnnotationTools in ~/.config/okularpartrc
Color icon is a format-text-color (if inline note or typewriter) or format-stroke-color for all other annotations
All actions have tooltips (some change based on the fact that the icon is enabled or not)
If a custom Line Width or Opacity is set through the Annotation Settings dialog, its value appears as a new checked action in the Line width or Opacity menu
If a custom stamp is selected through the Annotation Settings dialog, its name or filename (without path) appears as a new checked action in the Stamp menu
In Configure Okular > Annotations it is only possible to configure the quick annotations. Modifying them here updates the Quick annotations list after clicking Apply
The current document is an image: Highlighter, Underline, Squiggle, Strike out are disabled in Quick annotations
The state of Pin action is remembered across Okular launches
Selecting a quick action selects the corresponding action and loads its config values (color, line width, ...)
Setting the color and fill color works for all annotations (to be tested carefully, can be problematic for typewriter and inline note given the different internal mechanism to store the color in the settings)
Test stamp annotation (handled differently from the rest of the annotations)
Merge Request: https://invent.kde.org/graphics/okular/-/merge_requests/105
2020-06-04 13:01:31 +00:00
install(FILES okular.upd DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR})
2012-10-15 22:27:42 +00:00
2015-03-04 06:52:20 +00:00
install( FILES okular_part.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} )
2020-11-18 19:32:56 +00:00
install( FILES part/part.rc part/part-viewermode.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/okular )
2006-03-26 12:19:40 +00:00
2019-06-12 04:58:00 +00:00
if (${ECM_VERSION} STRGREATER "5.58.0")
install(FILES okular.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
else()
install(FILES okular.categories DESTINATION ${KDE_INSTALL_CONFDIR})
endif()
2016-01-03 08:13:06 +00:00
2022-05-22 10:00:39 +00:00
ki18n_install(po)
if(KF5DocTools_FOUND)
kdoctools_install(po)
endif()
2010-09-26 17:31:31 +00:00
########### cmake files #################
2015-07-18 15:28:05 +00:00
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/Okular5")
2017-09-05 08:58:58 +00:00
configure_package_config_file(
2015-07-18 15:28:05 +00:00
"${CMAKE_CURRENT_SOURCE_DIR}/Okular5Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/Okular5Config.cmake"
2015-04-09 19:59:40 +00:00
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
PATH_VARS INCLUDE_INSTALL_DIR CMAKE_INSTALL_PREFIX
)
install(FILES
2015-07-18 15:28:05 +00:00
"${CMAKE_CURRENT_BINARY_DIR}/Okular5Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/Okular5ConfigVersion.cmake"
2015-04-09 19:59:40 +00:00
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
2015-07-18 15:28:05 +00:00
install(EXPORT Okular5Targets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE Okular5Targets.cmake NAMESPACE Okular::)
2010-09-26 17:31:31 +00:00
2021-10-01 16:04:50 +00:00
install(FILES
core/stamps.svg
DESTINATION ${KDE_INSTALL_DATADIR}/okular/pics)
2015-04-09 19:59:40 +00:00
########### summary #################
2011-05-29 09:27:07 +00:00
2014-08-06 20:51:03 +00:00
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
2011-05-29 09:27:07 +00:00
2020-02-13 09:47:51 +00:00
message("-- Building Desktop User Interface: ${BUILD_DESKTOP}")
2020-02-01 10:02:33 +00:00
message("-- Building Mobile Interface: ${BUILD_MOBILE}")
message("")