Robert C. Helling e7977ee280 desktop: re-add WebEngine support
This reverts commit 643f4a5726 and finishes the task of adding WebEngine as an
alternate backend to be used in printing.

The ultimate goal is to be able to build without QtWebKit (as that is no longer
supported in Qt6). WebKit was used in two places: The user manual and printing.
This patch makes printing work with WebEngine.

The main obstacle is that WebEngine no longer allows accessing HTML elements
from C++ code and rendering the page to a QPainter.

The old version used this to figure out dimensions and page breaks for the
pages and then in the QPainter placed the profile images. With WebEninge, you
need to access the elements using JavaScript which is now used to place the
profile in the html proplerly as an <img> tag. To this end, both html and
profile images are written to a temporary directory on disk.

This image replacement by JavaScript is only necessary to make old templates
still work. It could be replaced by actually putting <img> tags in the
templates (but this would break user edited templates).

In my experiments, the page breaking was done great by html/css, so the
additional magic seems superflous.

What remains to be done:
* remove empty page at the end of printout
* make preview great again (in particlar needed for template editing)

Note: since QtWebEngine currently cannot be built with our toolchain on
Windows, this patch keeps QtWebKit support around by making the QtWebEngine
compile-time conditional via #ifdefs.

[Dirk Hohndel: merged a few commits to make this more logical - the resulting
commit is fairly big, but IMHO preferrable]

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-11-26 12:32:10 -08:00

196 lines
4.3 KiB
CMake

# create the libraries
file(GLOB SUBSURFACE_UI *.ui)
qt5_wrap_ui(SUBSURFACE_UI_HDRS ${SUBSURFACE_UI})
source_group("Subsurface Interface Files" FILES ${SUBSURFACE_UI})
if(BTSUPPORT)
set(BT_SRC_FILES btdeviceselectiondialog.cpp)
endif()
include_directories(.
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}
)
add_subdirectory(preferences)
set (SUBSURFACE_UI
about.ui
addfilterpreset.ui
btdeviceselectiondialog.ui
configuredivecomputerdialog.ui
divecomponentselection.ui
divelogexportdialog.ui
divelogimportdialog.ui
divesiteimportdialog.ui
diveplanner.ui
diveshareexportdialog.ui
downloadfromdivecomputer.ui
filterwidget.ui
findmovedimagesdialog.ui
importgps.ui
listfilter.ui
locationinformation.ui
mainwindow.ui
plannerDetails.ui
plannerSettings.ui
printoptions.ui
renumber.ui
searchbar.ui
setpoint.ui
shiftimagetimes.ui
shifttimes.ui
statswidget.ui
tableview.ui
templateedit.ui
tripselectiodialog.ui
urldialog.ui
webservices.ui
tab-widgets/maintab.ui
tab-widgets/TabDiveStatistics.ui
tab-widgets/TabDiveInformation.ui
tab-widgets/TabDivePhotos.ui
tab-widgets/TabDiveExtraInfo.ui
tab-widgets/TabDiveEquipment.ui
tab-widgets/TabDiveSite.ui
)
# the interface, in C++
set(SUBSURFACE_INTERFACE
about.cpp
about.h
configuredivecomputerdialog.cpp
configuredivecomputerdialog.h
divelistview.cpp
divelistview.h
divelogexportdialog.cpp
divelogexportdialog.h
divelogimportdialog.cpp
divelogimportdialog.h
divepicturewidget.cpp
divepicturewidget.h
diveplanner.cpp
diveplanner.h
diveshareexportdialog.cpp
diveshareexportdialog.h
divesiteimportdialog.cpp
divesiteimportdialog.h
downloadfromdivecomputer.cpp
downloadfromdivecomputer.h
filterconstraintwidget.cpp
filterconstraintwidget.h
filterwidget.cpp
filterwidget.h
findmovedimagesdialog.cpp
findmovedimagesdialog.h
groupedlineedit.cpp
groupedlineedit.h
importgps.cpp
importgps.h
kmessagewidget.cpp
kmessagewidget.h
locationinformation.cpp
locationinformation.h
mainwindow.cpp
mainwindow.h
mapwidget.cpp
mapwidget.h
modeldelegates.cpp
modeldelegates.h
notificationwidget.cpp
notificationwidget.h
qtwaitingspinner.cpp
qtwaitingspinner.h
simplewidgets.cpp
simplewidgets.h
starwidget.cpp
statswidget.h
statswidget.cpp
starwidget.h
subsurfacewebservices.cpp
subsurfacewebservices.h
tab-widgets/TabBase.cpp
tab-widgets/TabBase.h
tab-widgets/TabDiveExtraInfo.cpp
tab-widgets/TabDiveExtraInfo.h
tab-widgets/TabDiveEquipment.cpp
tab-widgets/TabDiveEquipment.h
tab-widgets/TabDiveInformation.cpp
tab-widgets/TabDiveInformation.h
tab-widgets/TabDivePhotos.cpp
tab-widgets/TabDivePhotos.h
tab-widgets/TabDiveStatistics.cpp
tab-widgets/TabDiveStatistics.h
tab-widgets/TabDiveSite.cpp
tab-widgets/TabDiveSite.h
tab-widgets/maintab.cpp
tab-widgets/maintab.h
tableview.cpp
tableview.h
tagwidget.cpp
tagwidget.h
textedit.cpp
textedit.h
tripselectiondialog.cpp
tripselectiondialog.h
updatemanager.cpp
updatemanager.h
)
if(NOT NO_USERMANUAL)
set(SUBSURFACE_INTERFACE ${SUBSURFACE_INTERFACE}
usermanual.cpp
usermanual.h
)
endif()
if(NOT NO_PRINTING)
set(SUBSURFACE_INTERFACE ${SUBSURFACE_INTERFACE}
printdialog.cpp
printdialog.h
printoptions.cpp
printoptions.h
templateedit.cpp
templateedit.h
templatelayout.cpp
templatelayout.h
)
endif()
if(USE_WEBENGINE)
set(SUBSURFACE_INTERFACE ${SUBSURFACE_INTERFACE}
printerwebengine.cpp
printerwebengine.h
)
else()
set(SUBSURFACE_INTERFACE ${SUBSURFACE_INTERFACE}
printer.cpp
printer.h
)
endif()
if (BTSUPPORT)
set(SUBSURFACE_INTERFACE ${SUBSURFACE_INTERFACE}
btdeviceselectiondialog.cpp
btdeviceselectiondialog.h
)
endif()
source_group("Subsurface Interface" FILES ${SUBSURFACE_INTERFACE})
# the yearly statistics widget.
set(SUBSURFACE_STATISTICS_LIB_SRCS
statistics/statisticswidget.cpp
statistics/statisticswidget.h
)
source_group("Subsurface Statistics" FILES ${SUBSURFACE_STATISTICS_LIB_SRCS})
qt5_wrap_ui(SUBSURFACE_UI_SRCS ${SUBSURFACE_UI})
add_library(subsurface_statistics STATIC ${SUBSURFACE_STATISTICS_LIB_SRCS})
target_link_libraries(subsurface_statistics ${QT_LIBRARIES})
add_library(subsurface_generated_ui STATIC ${SUBSURFACE_UI_HDRS})
target_link_libraries(subsurface_generated_ui ${QT_LIBRARIES})
add_library(subsurface_interface STATIC ${SUBSURFACE_INTERFACE} ${SUBSURFACE_UI_SRCS})
target_link_libraries(subsurface_interface ${QT_LIBRARIES} subsurface_desktop_preferences)