Commit 97c66ce8 authored by Vincent Pinon's avatar Vincent Pinon
Browse files

Move Qt-OAuth-Lib to a lib

parent 3095789a
Pipeline #50359 passed with stage
in 10 minutes and 32 seconds
......@@ -65,9 +65,6 @@ add_subdirectory(transitions)
add_subdirectory(utils)
add_subdirectory(widgets)
add_subdirectory(xml)
if(Qt5WebEngineWidgets_FOUND)
add_subdirectory(qt-oauth-lib)
endif()
## top_SRCS
file(GLOB top_SRCS "*.cpp")
if(NOT CRASH_AUTO_TEST)
......@@ -187,7 +184,7 @@ endif()
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)
target_link_libraries(kdenliveLib Qt5::WebEngineWidgets qt-oauth-lib)
else()
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()
......
add_subdirectory(kiss_fft)
add_subdirectory(media_ctrl)
set(kdenlive_SRCS
${kdenlive_SRCS}
PARENT_SCOPE
)
add_subdirectory(qt-oauth-lib)
# Create a static library from oauth2
if(Qt5WebEngineWidgets_FOUND)
ki18n_wrap_ui(login_UI logindialog_ui.ui)
add_library(qt-oauth-lib STATIC oauth2.cpp logindialog.cpp ${login_UI})
target_link_libraries(qt-oauth-lib Qt5::WebEngineWidgets KF5::I18n KF5::ConfigGui)
target_compile_definitions(qt-oauth-lib PRIVATE -DQT5_USE_WEBENGINE)
endif()
......@@ -37,7 +37,6 @@
#include "logindialog.h"
#include "ui_logindialog_ui.h"
#include "kdenlive_debug.h"
#include <QWebEngineView>
LoginDialog::LoginDialog(QWidget *parent)
......@@ -55,7 +54,6 @@ LoginDialog::LoginDialog(QWidget *parent)
// m_ui->textBrowser
connect(m_ui->webView, &QWebEngineView::urlChanged, this, &LoginDialog::urlChanged);
connect(m_ui->webView, &QWebEngineView::loadFinished, this, [&](){
qDebug() << "LoginDialog: loadFinished";
this->setEnabled(true);
});
}
......@@ -91,7 +89,6 @@ void LoginDialog::slotRejected()
*/
void LoginDialog::urlChanged(const QUrl &url)
{
// qCDebug(KDENLIVE_LOG) << "URL =" << url;
const QString str = url.query(QUrl::FullyDecoded);
const int posCode = str.indexOf(QLatin1String("code="));
const int posErr = str.indexOf(QLatin1String("error="));
......
......@@ -36,7 +36,6 @@
*********************************************************************************************************/
#include "oauth2.h"
#include "kdenlive_debug.h"
#include "logindialog.h"
#include <KConfigGroup>
......@@ -44,6 +43,7 @@
#include <QJsonParseError>
#include <QUrl>
#include <QUrlQuery>
#include <QDebug>
OAuth2::OAuth2(QWidget *parent)
......@@ -132,7 +132,6 @@ QString OAuth2::loginUrl()
{
QString str = QStringLiteral("%1?client_id=%2&redirect_uri=%3&response_type=%4").arg(m_strEndPoint, m_strClientID, m_strRedirectURI, m_strResponseType);
// qCDebug(KDENLIVE_LOG) << "Login URL" << str;
return str;
}
......@@ -161,7 +160,7 @@ void OAuth2::obtainAccessToken()
*/
void OAuth2::SlotAccessDenied()
{
qCDebug(KDENLIVE_LOG) << "access denied";
qDebug() << "access denied";
emit accessDenied();
m_pLoginDialog = nullptr;
}
......@@ -236,7 +235,7 @@ void OAuth2::serviceRequestFinished(QNetworkReply *reply)
QJsonParseError jsonError;
QJsonDocument doc = QJsonDocument::fromJson(sReply, &jsonError);
if (jsonError.error != QJsonParseError::NoError) {
qCDebug(KDENLIVE_LOG) << "OAuth2::serviceRequestFinished jsonError.error: " << jsonError.errorString();
qDebug() << "OAuth2::serviceRequestFinished jsonError.error: " << jsonError.errorString();
ForgetAccessToken();
emit accessTokenReceived(QString()); // notifies ResourceWidget::slotAccessTokenReceived - empty string in access token indicates error
......@@ -259,7 +258,7 @@ void OAuth2::serviceRequestFinished(QNetworkReply *reply)
if (map.contains(QStringLiteral("error"))) {
m_bAccessTokenRec = false;
sErrorText = map.value(QStringLiteral("error")).toString();
qCDebug(KDENLIVE_LOG) << "OAuth2::serviceRequestFinished map error: " << sErrorText;
qDebug() << "OAuth2::serviceRequestFinished map error: " << sErrorText;
ForgetAccessToken();
emit accessTokenReceived(QString()); // notifies ResourceWidget::slotAccessTokenReceived - empty string in access token indicates error
}
......
......@@ -34,8 +34,8 @@
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*********************************************************************************************************/
#ifndef OAUTH2_H
#define OAUTH2_H
#ifndef QTOAUTHLIB_H
#define QTOAUTHLIB_H
#include <QNetworkReply>
#include <QObject>
......
set(kdenlive_SRCS
${kdenlive_SRCS}
qt-oauth-lib/logindialog.cpp
qt-oauth-lib/oauth2.cpp
PARENT_SCOPE)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment