summaryrefslogtreecommitdiff
blob: 0ffff1b4a3845d2bedc8458c53de7101357f6583 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
From 51feccf3cc0939d42c3ff237eb17f9a6091f1dd8 Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <asturm@gentoo.org>
Date: Fri, 23 Oct 2020 15:32:39 +0200
Subject: [PATCH] Port to QtWebEngineWidgets

Fixes https://invent.kde.org/multimedia/kdenlive/-/issues/775

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
 CMakeLists.txt                   |  2 +-
 src/CMakeLists.txt               | 12 ++++++------
 src/qt-oauth-lib/logindialog.cpp |  4 ++--
 src/qt-oauth-lib/logindialog.h   |  3 +--
 src/qt-oauth-lib/oauth2.h        |  4 ++--
 src/ui/logindialog_ui.ui         |  6 +++---
 src/utils/resourcewidget.cpp     | 14 +++++++-------
 7 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d434f1e31..a3f838433 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,7 +71,7 @@ if(WIN32)
     set(MLT_PREFIX "..")
 else()
     set(MLT_PREFIX ${MLT_ROOT_DIR})
-    find_package(Qt5 OPTIONAL_COMPONENTS WebKitWidgets QUIET)
+    find_package(Qt5 OPTIONAL_COMPONENTS WebEngineWidgets QUIET)
 endif()
 
 if(KF5FileMetaData_FOUND)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 551178133..8356d4e47 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -65,7 +65,7 @@ add_subdirectory(transitions)
 add_subdirectory(utils)
 add_subdirectory(widgets)
 add_subdirectory(xml)
-if(Qt5WebKitWidgets_FOUND)
+if(Qt5WebEngineWidgets_FOUND)
     add_subdirectory(qt-oauth-lib)
 endif()
 ## top_SRCS
@@ -178,12 +178,12 @@ if(KF5_PURPOSE)
     target_link_libraries(kdenliveLib KF5::Purpose KF5::PurposeWidgets)
 endif()
 
-if(Qt5WebKitWidgets_FOUND)
-    message(STATUS "Found Qt5 WebKitWidgets. You can use your Freesound.org credentials to download files")
-    target_compile_definitions(kdenliveLib PRIVATE -DQT5_USE_WEBKIT)
-    target_link_libraries(kdenliveLib Qt5::WebKitWidgets)
+if(Qt5WebEngineWidgets_FOUND)
+    message(STATUS "Found Qt5 WebEngineWidgets. You can use your Freesound.org credentials to download files")
+    target_compile_definitions(kdenliveLib PRIVATE -DQT5_USE_WEBENGINE)
+    target_link_libraries(kdenliveLib Qt5::WebEngineWidgets)
 else()
-    message(STATUS "Qt5 WebKitWidgets not found. You cannot use your Freesound.org credentials, only preview files can be downloaded from the Online Resources Widget")
+    message(STATUS "Qt5 WebEngineWidgets not found. You cannot use your Freesound.org credentials, only preview files can be downloaded from the Online Resources Widget")
 endif()
 
 if(Q_WS_X11)
diff --git a/src/qt-oauth-lib/logindialog.cpp b/src/qt-oauth-lib/logindialog.cpp
index a41aa420b..111978831 100644
--- a/src/qt-oauth-lib/logindialog.cpp
+++ b/src/qt-oauth-lib/logindialog.cpp
@@ -38,7 +38,7 @@
 #include "ui_logindialog_ui.h"
 
 #include "kdenlive_debug.h"
-#include <QWebView>
+#include <QWebEngineView>
 
 LoginDialog::LoginDialog(QWidget *parent)
     : QDialog(parent)
@@ -54,7 +54,7 @@ LoginDialog::LoginDialog(QWidget *parent)
         i18n("Enter your freesound account details to download the highest quality version of this file. Or use the High Quality "
              "preview file instead (no freesound account required)."));
     // m_ui->textBrowser
-    connect(m_ui->webView, &QWebView::urlChanged, this, &LoginDialog::urlChanged);
+    connect(m_ui->webView, &QWebEngineView::urlChanged, this, &LoginDialog::urlChanged);
 }
 
 LoginDialog::~LoginDialog()
diff --git a/src/qt-oauth-lib/logindialog.h b/src/qt-oauth-lib/logindialog.h
index 963b38ec5..c34383bf2 100644
--- a/src/qt-oauth-lib/logindialog.h
+++ b/src/qt-oauth-lib/logindialog.h
@@ -47,11 +47,10 @@ class LoginDialog;
 
 /**
   \brief This is the dialog that is used to login to freesound
- \details It contains a QWebView object to display the freesound web page. I did try using a QTextBrowser
+ \details It contains a QWebEngineView object to display the freesound web page. I did try using a QTextBrowser
  for this purpose but it responds to the URL that is used to connect with
  "No document for
  https://www.freesound.org/apiv2/oauth2/authorize/?client_id=3duhagdr874c&redirect_uri=https://www.freesound.org/home/app_permissions/permission_granted/&response_type=code"
- The use of QWebView adds a dependency on the KF5WebKit to kdenlive. Need install libkf5webkit5-dev package on ubuntu
  */
 class LoginDialog : public QDialog
 {
diff --git a/src/qt-oauth-lib/oauth2.h b/src/qt-oauth-lib/oauth2.h
index f28724455..03993a214 100644
--- a/src/qt-oauth-lib/oauth2.h
+++ b/src/qt-oauth-lib/oauth2.h
@@ -45,7 +45,7 @@
 const QLatin1String OAuth2_strClientSecret("441d88374716e7a3503997151e4780566f007313"); // obtained when ttguy registered the kdenlive application with freesound
 #endif
 
-#ifdef QT5_USE_WEBKIT
+#ifdef QT5_USE_WEBENGINE
 
 class LoginDialog;
 
@@ -135,6 +135,6 @@ private:
     void buildLoginDialog();
 };
 
-#endif // QT5_USE_WEBKIT
+#endif // QT5_USE_WEBENGINE
 
 #endif // OAUTH2_H
diff --git a/src/ui/logindialog_ui.ui b/src/ui/logindialog_ui.ui
index 20827d686..e98a68ed2 100644
--- a/src/ui/logindialog_ui.ui
+++ b/src/ui/logindialog_ui.ui
@@ -15,7 +15,7 @@
   </property>
   <layout class="QGridLayout" name="gridLayout">
    <item row="1" column="0">
-    <widget class="QWebView" name="webView">
+    <widget class="QWebEngineView" name="webView">
      <property name="url">
       <url>
        <string>about:blank</string>
@@ -51,9 +51,9 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>QWebView</class>
+   <class>QWebEngineView</class>
    <extends>QWidget</extends>
-   <header>QtWebKitWidgets/QWebView</header>
+   <header>QtWebEngineWidgets/QWebEngineView</header>
   </customwidget>
  </customwidgets>
  <resources/>
diff --git a/src/utils/resourcewidget.cpp b/src/utils/resourcewidget.cpp
index 79bb48898..d0eaa225b 100644
--- a/src/utils/resourcewidget.cpp
+++ b/src/utils/resourcewidget.cpp
@@ -49,7 +49,7 @@
 #include <QPixmap>
 #include <klocalizedstring.h>
 
-#ifdef QT5_USE_WEBKIT
+#ifdef QT5_USE_WEBENGINE
 #include "qt-oauth-lib/oauth2.h"
 #endif
 
@@ -103,7 +103,7 @@ ResourceWidget::ResourceWidget(QString folder, QWidget *parent)
     search_text->setFocus();
     connect(search_text, SIGNAL(returnPressed()), this, SLOT(slotStartSearch()));
 
-#ifdef QT5_USE_WEBKIT
+#ifdef QT5_USE_WEBENGINE
     m_pOAuth2 = new OAuth2(this);
     connect(m_pOAuth2, &OAuth2::accessTokenReceived, this, &ResourceWidget::slotAccessTokenReceived);
     connect(m_pOAuth2, &OAuth2::accessDenied, this, &ResourceWidget::slotFreesoundAccessDenied);
@@ -375,7 +375,7 @@ void ResourceWidget::slotSaveItem(const QString &originalUrl)
         path.append(m_currentService->getDefaultDownloadName(item));
 
         if (m_currentService->serviceType == AbstractService::FREESOUND) {
-#ifdef QT5_USE_WEBKIT
+#ifdef QT5_USE_WEBENGINE
             sFileExt = m_currentService->getExtension(search_results->currentItem());
 #else
             sFileExt = QStringLiteral("*.") + m_currentInfo.HQpreview.section(QLatin1Char('.'), -1);
@@ -402,7 +402,7 @@ void ResourceWidget::slotSaveItem(const QString &originalUrl)
     }
     slotSetDescription(QString());
     button_import->setEnabled(false); // disable buttons while download runs. enabled in slotGotFile
-#ifdef QT5_USE_WEBKIT
+#ifdef QT5_USE_WEBENGINE
     if (m_currentService->serviceType == AbstractService::FREESOUND) { // open a dialog to authenticate with free sound and download the file
         m_pOAuth2->obtainAccessToken();                                // when  job finished   ResourceWidget::slotAccessTokenReceived will be called
     } else {                                                           // not freesound - do file download via a KIO file copy job
@@ -841,7 +841,7 @@ void ResourceWidget::DownloadRequestFinished(QNetworkReply *reply)
                 m_desc.append(m_saveLocation);
                 updateLayout();
             } else {
-#ifdef QT5_USE_WEBKIT
+#ifdef QT5_USE_WEBENGINE
                 m_pOAuth2->ForgetAccessToken();
 #endif
                 m_desc.append(QStringLiteral("<br>") + i18n("Error Saving File"));
@@ -850,11 +850,11 @@ void ResourceWidget::DownloadRequestFinished(QNetworkReply *reply)
         } else {
 
             if (reply->error() == QNetworkReply::AuthenticationRequiredError) {
-#ifdef QT5_USE_WEBKIT
+#ifdef QT5_USE_WEBENGINE
                 m_pOAuth2->obtainNewAccessToken();
 #endif
             } else {
-#ifdef QT5_USE_WEBKIT
+#ifdef QT5_USE_WEBENGINE
                 m_pOAuth2->ForgetAccessToken();
 #endif
                 m_desc.append(QStringLiteral("<br>") + i18n("Error Downloading File. Error code: %1", reply->error()) + QStringLiteral("<br>"));
-- 
2.29.1