From be5b2d49be88e3d3a5d2ba3919cb7bb8fd397e78e9f19e8524005d9765f85ac8 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Mon, 22 Oct 2018 09:23:39 +0000 Subject: [PATCH] Accepting request 643651 from home:wolfi323:branches:KDE:Applications - Add Port-to-QtWebEngine.patch and build with QtWebEngine instead of QtWebKit where possible - Drop QtWebKit BuildRequires, no longer supported - Add Fix-MarbleConfig.cmake-to-find-QtWebEngine.patch to fix building against marble when QtWebEngine is used - Add necessary requirements to the devel package OBS-URL: https://build.opensuse.org/request/show/643651 OBS-URL: https://build.opensuse.org/package/show/KDE:Applications/marble?expand=0&rev=165 --- ...rbleConfig.cmake-to-find-QtWebEngine.patch | 34 + Port-to-QtWebEngine.patch | 799 ++++++++++++++++++ marble.changes | 10 + marble.spec | 45 +- 4 files changed, 872 insertions(+), 16 deletions(-) create mode 100644 Fix-MarbleConfig.cmake-to-find-QtWebEngine.patch create mode 100644 Port-to-QtWebEngine.patch diff --git a/Fix-MarbleConfig.cmake-to-find-QtWebEngine.patch b/Fix-MarbleConfig.cmake-to-find-QtWebEngine.patch new file mode 100644 index 0000000..c1a1475 --- /dev/null +++ b/Fix-MarbleConfig.cmake-to-find-QtWebEngine.patch @@ -0,0 +1,34 @@ +From b8db30a58396060034ac76aa5f7d408b6c467d5f Mon Sep 17 00:00:00 2001 +From: "Friedrich W. H. Kossebau" +Date: Fri, 19 Oct 2018 17:40:43 +0200 +Subject: Fix MarbleConfig.cmake file to update to port to QtWebEngine + +--- + src/lib/marble/MarbleConfig.cmake.in | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/lib/marble/MarbleConfig.cmake.in b/src/lib/marble/MarbleConfig.cmake.in +index 4f6fc17..ec39b79 100644 +--- a/src/lib/marble/MarbleConfig.cmake.in ++++ b/src/lib/marble/MarbleConfig.cmake.in +@@ -8,13 +8,15 @@ if (_CMakeFindDependencyMacro_FOUND) + find_dependency(Qt5Xml @REQUIRED_QT_VERSION@) + find_dependency(Qt5Widgets @REQUIRED_QT_VERSION@) + if (NOT MARBLE_NO_WEBKITWIDGETS) +- find_dependency(Qt5WebKitWidgets @REQUIRED_QT_VERSION@) ++ find_dependency(Qt5WebEngine @REQUIRED_QT_VERSION@) ++ find_dependency(Qt5WebEngineWidgets @REQUIRED_QT_VERSION@) + endif() + else() + find_package(Qt5Xml REQUIRED) + find_package(Qt5Widgets REQUIRED) + if (NOT MARBLE_NO_WEBKITWIDGETS) +- find_package(Qt5WebKitWidgets REQUIRED) ++ find_package(Qt5WebEngine REQUIRED) ++ find_package(Qt5WebEngineWidgets REQUIRED) + endif() + endif() + +-- +cgit v0.11.2 + diff --git a/Port-to-QtWebEngine.patch b/Port-to-QtWebEngine.patch new file mode 100644 index 0000000..37599b8 --- /dev/null +++ b/Port-to-QtWebEngine.patch @@ -0,0 +1,799 @@ +From b42ee5c83d77761ef7d8bf8635662159bc2884bb Mon Sep 17 00:00:00 2001 +From: Torsten Rahn +Date: Wed, 17 Oct 2018 15:21:28 +0200 +Subject: Differential Revision: https://phabricator.kde.org/D698 + +Port to QtWebEngine (finally!) +--- + CMakeLists.txt | 6 +- + src/apps/behaim/CMakeLists.txt | 2 + + src/apps/marble-maps/CMakeLists.txt | 2 + + src/lib/marble/CMakeLists.txt | 3 +- + src/lib/marble/LegendWidget.cpp | 2 - + src/lib/marble/LegendWidget.ui | 2 +- + src/lib/marble/MarbleLegendBrowser.cpp | 108 ++++++++++----------- + src/lib/marble/MarbleLegendBrowser.h | 31 ++++-- + src/lib/marble/MarbleWebView.cpp | 4 +- + src/lib/marble/MarbleWebView.h | 25 ++++- + src/lib/marble/PopupItem.cpp | 47 ++++----- + src/lib/marble/PopupItem.h | 6 +- + src/lib/marble/TinyWebBrowser.cpp | 23 +++-- + src/lib/marble/TinyWebBrowser.h | 10 +- + src/lib/marble/WebPopupWidget.ui | 14 ++- + src/lib/marble/cloudsync/RouteItemDelegate.cpp | 2 +- + .../geodata/handlers/dgml/DgmlIconTagHandler.cpp | 4 +- + 17 files changed, 165 insertions(+), 126 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2ea05eb..dd13e4c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -130,11 +130,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL Android) + else() + find_package(Qt5 ${REQUIRED_QT_VERSION} + COMPONENTS +- WebKit +- WebKitWidgets ++ WebEngine ++ WebEngineWidgets + ) + +- if ( NOT Qt5WebKitWidgets_FOUND ) ++ if ( NOT Qt5WebEngineWidgets_FOUND ) + set ( MARBLE_NO_WEBKITWIDGETS TRUE ) + endif() + endif() +diff --git a/src/apps/behaim/CMakeLists.txt b/src/apps/behaim/CMakeLists.txt +index b8ad26c..bbed8a9 100644 +--- a/src/apps/behaim/CMakeLists.txt ++++ b/src/apps/behaim/CMakeLists.txt +@@ -25,6 +25,8 @@ if (CMAKE_SYSTEM_NAME STREQUAL Android) + Qt5::Positioning + Qt5::AndroidExtras + Qt5::Multimedia ++ Qt5::WebEngineWidgets ++ Qt5::WebEngine + ) + else() + set(TARGET marble-behaim) +diff --git a/src/apps/marble-maps/CMakeLists.txt b/src/apps/marble-maps/CMakeLists.txt +index 14be2c0..a52818c 100644 +--- a/src/apps/marble-maps/CMakeLists.txt ++++ b/src/apps/marble-maps/CMakeLists.txt +@@ -30,6 +30,8 @@ if (CMAKE_SYSTEM_NAME STREQUAL Android) + Qt5::AndroidExtras + Qt5::Multimedia + Qt5::QuickControls2 ++ Qt5::WebEngineWidgets ++ Qt5::WebEngine + ) + else() + set(TARGET marble-maps) +diff --git a/src/lib/marble/CMakeLists.txt b/src/lib/marble/CMakeLists.txt +index 3f1afa7..64d0cec 100644 +--- a/src/lib/marble/CMakeLists.txt ++++ b/src/lib/marble/CMakeLists.txt +@@ -394,7 +394,8 @@ target_link_libraries(marblewidget + if (NOT MARBLE_NO_WEBKITWIDGETS) + target_link_libraries(marblewidget + LINK_PUBLIC +- Qt5::WebKitWidgets ++ Qt5::WebEngineWidgets ++ Qt5::WebEngine + ) + endif () + if (NOT MARBLE_NO_DBUS) +diff --git a/src/lib/marble/LegendWidget.cpp b/src/lib/marble/LegendWidget.cpp +index c6949ae..8f9c237 100644 +--- a/src/lib/marble/LegendWidget.cpp ++++ b/src/lib/marble/LegendWidget.cpp +@@ -22,8 +22,6 @@ using namespace Marble; + #include "ui_LegendWidget.h" + #endif + +-#include "MarbleLegendBrowser.h" +- + namespace Marble + { + +diff --git a/src/lib/marble/LegendWidget.ui b/src/lib/marble/LegendWidget.ui +index 5a41ffd..14c7633 100644 +--- a/src/lib/marble/LegendWidget.ui ++++ b/src/lib/marble/LegendWidget.ui +@@ -28,7 +28,7 @@ + + + MarbleLegendBrowser +- QWebView ++ QWebEngineView +
MarbleLegendBrowser.h
+
+
+diff --git a/src/lib/marble/MarbleLegendBrowser.cpp b/src/lib/marble/MarbleLegendBrowser.cpp +index c06fe9a..d5a4a87 100644 +--- a/src/lib/marble/MarbleLegendBrowser.cpp ++++ b/src/lib/marble/MarbleLegendBrowser.cpp +@@ -24,8 +24,9 @@ + #include + + #ifndef MARBLE_NO_WEBKITWIDGETS +-#include +-#include ++#include ++#include ++#include "MarbleWebView.h" + #endif + + #include +@@ -49,10 +50,11 @@ namespace Marble + class MarbleLegendBrowserPrivate + { + public: +- MarbleModel *m_marbleModel; ++ MarbleModel *m_marbleModel; + QMap m_checkBoxMap; + QMap m_symbolMap; + QString m_currentThemeId; ++ MarbleJsWrapper *m_jsWrapper; + }; + + +@@ -64,14 +66,7 @@ MarbleLegendBrowser::MarbleLegendBrowser( QWidget *parent ) + d( new MarbleLegendBrowserPrivate ) + { + d->m_marbleModel = nullptr; +- +-#ifndef MARBLE_NO_WEBKITWIDGETS +- QWebFrame *frame = page()->mainFrame(); +- connect(frame, SIGNAL(javaScriptWindowObjectCleared()), +- this, SLOT(injectCheckBoxChecker())); +- page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks ); +- connect( this, SIGNAL(linkClicked(QUrl)), this, SLOT(openLinkExternally(QUrl)) ); +-#endif ++ d->m_jsWrapper = new MarbleJsWrapper(this); + } + + MarbleLegendBrowser::~MarbleLegendBrowser() +@@ -92,7 +87,7 @@ void MarbleLegendBrowser::setMarbleModel( MarbleModel *marbleModel ) + + QSize MarbleLegendBrowser::sizeHint() const + { +- return QSize( 180, 320 ); ++ return QSize( 320, 320 ); + } + + void MarbleLegendBrowser::initTheme() +@@ -153,6 +148,7 @@ void MarbleLegendBrowser::loadLegend() + TemplateDocument doc(finalHtml); + finalHtml = doc.finalText(); + ++ injectWebChannel(finalHtml); + reverseSupportCheckboxes(finalHtml); + + // Generate some parts of the html from the MapTheme tag. +@@ -166,18 +162,20 @@ void MarbleLegendBrowser::loadLegend() + QUrl baseUrl = QUrl::fromLocalFile( legendPath ); + + // Set the html string in the QTextBrowser. +- setHtml(finalHtml, baseUrl); ++ MarbleWebPage * page = new MarbleWebPage(this); ++ connect( page, SIGNAL(linkClicked(QUrl)), this, SLOT(openLinkExternally(QUrl)) ); ++ page->setHtml(finalHtml, baseUrl); ++ setPage(page); + +- QTextDocument *document = new QTextDocument(page()->mainFrame()->toHtml()); +- d->m_marbleModel->setLegend( document ); +-#endif +-} ++ QWebChannel *channel = new QWebChannel(page); ++ channel->registerObject(QStringLiteral("Marble"), d->m_jsWrapper); ++ page->setWebChannel(channel); + +-void MarbleLegendBrowser::injectCheckBoxChecker() +-{ +-#ifndef MARBLE_NO_WEBKITWIDGETS +- QWebFrame *frame = page()->mainFrame(); +- frame->addToJavaScriptWindowObject( "Marble", this ); ++ if ( d->m_marbleModel ) { ++ page->toHtml([=]( QString document ) { ++ d->m_marbleModel->setLegend( new QTextDocument(document) ); ++ }); ++ } + #endif + } + +@@ -194,6 +192,7 @@ bool MarbleLegendBrowser::event( QEvent * event ) + { + // "Delayed initialization": legend gets created only + if ( event->type() == QEvent::Show ) { ++ setVisible(true); + loadLegend(); + return true; + } +@@ -218,8 +217,7 @@ QString MarbleLegendBrowser::readHtml( const QUrl & name ) + void MarbleLegendBrowser::translateHtml( QString & html ) + { + // must match string extraction in Messages.sh +- // TODO: html.remove also changes html, is that intended? +- QString s = html.remove(0, html.indexOf(QLatin1String(""))); ++ QString s = html; + QRegExp rx( "\\s]+))?)+\\s*|\\s*)/?>" ); + rx.setMinimal( true ); + s.replace( rx, "\n" ); +@@ -232,6 +230,18 @@ void MarbleLegendBrowser::translateHtml( QString & html ) + html.replace(*i, QCoreApplication::translate("Legends", (*i).toUtf8().constData())); + } + ++void MarbleLegendBrowser::injectWebChannel(QString &html) ++{ ++ QString webChannelCode = ""; ++ webChannelCode += "" ++ ""; ++ html.replace("", webChannelCode); ++} ++ + void MarbleLegendBrowser::reverseSupportCheckboxes(QString &html) + { + const QString old = ""; +@@ -241,7 +251,7 @@ void MarbleLegendBrowser::reverseSupportCheckboxes(QString &html) + checked = "checked"; + + const QString repair = QLatin1String( +- ""); + + html.replace(old, repair); +@@ -283,7 +293,7 @@ QString MarbleLegendBrowser::generateSectionsHtml() + if(!section->radio().isEmpty()) { + checkBoxString = QLatin1String( + "