166 lines
5.7 KiB
Diff
166 lines
5.7 KiB
Diff
From bb0c1a9b4940f3f6b52c0df535289ec8a3bc9e03 Mon Sep 17 00:00:00 2001
|
|
From: Dmitri Ovodok <dmitrio95@yandex.ru>
|
|
Date: Mon, 4 Feb 2019 21:35:25 +0300
|
|
Subject: [PATCH] Fix build without USE_WEBENGINE and SCRIPT_INTERFACE
|
|
|
|
Old-style login dialog is used if USE_WEBENGINE is turned off
|
|
---
|
|
mscore/logindialog.h | 2 ++
|
|
mscore/musescore.cpp | 4 +++-
|
|
mscore/network/loginmanager.cpp | 13 +++++++++++--
|
|
mscore/network/loginmanager.h | 4 ++++
|
|
mscore/network/loginmanager_p.h | 4 ++++
|
|
5 files changed, 24 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/mscore/logindialog.h b/mscore/logindialog.h
|
|
index 4e86ae7985..f44511d8c0 100644
|
|
--- a/mscore/logindialog.h
|
|
+++ b/mscore/logindialog.h
|
|
@@ -21,6 +21,8 @@ class LoginManager;
|
|
|
|
//---------------------------------------------------------
|
|
// LoginDialog
|
|
+// Old-style login dialog in case QtWebEngine is
|
|
+// unavailable.
|
|
//---------------------------------------------------------
|
|
|
|
class LoginDialog : public QDialog, public Ui::LoginDialog
|
|
diff --git a/mscore/musescore.cpp b/mscore/musescore.cpp
|
|
index 80c712aea9..5bb8354992 100644
|
|
--- a/mscore/musescore.cpp
|
|
+++ b/mscore/musescore.cpp
|
|
@@ -7572,12 +7572,14 @@ bool MuseScore::exportPartsPdfsToJSON(const QString& inFilePath, const QString&
|
|
}
|
|
|
|
//---------------------------------------------------------
|
|
-// getQmlEngine
|
|
+// getPluginEngine
|
|
//---------------------------------------------------------
|
|
|
|
+#ifdef SCRIPT_INTERFACE
|
|
QmlPluginEngine* MuseScore::getPluginEngine()
|
|
{
|
|
if (!_qmlEngine)
|
|
_qmlEngine = new QmlPluginEngine(this);
|
|
return _qmlEngine;
|
|
}
|
|
+#endif
|
|
diff --git a/mscore/network/loginmanager.cpp b/mscore/network/loginmanager.cpp
|
|
index a53d7fe811..664786ccc8 100644
|
|
--- a/mscore/network/loginmanager.cpp
|
|
+++ b/mscore/network/loginmanager.cpp
|
|
@@ -18,7 +18,9 @@
|
|
#include "kQOAuth/kqoauthrequest.h"
|
|
#include "kQOAuth/kqoauthrequest_xauth.h"
|
|
|
|
+#ifdef USE_WEBENGINE
|
|
#include <QWebEngineCookieStore>
|
|
+#endif
|
|
|
|
namespace Ms {
|
|
|
|
@@ -286,8 +288,11 @@ void LoginManager::onTryLoginError(const QString& error)
|
|
disconnect(this, SIGNAL(getUserError(QString)), this, SLOT(onTryLoginError(QString)));
|
|
connect(this, SIGNAL(loginSuccess()), this, SLOT(tryLogin()));
|
|
logout();
|
|
+#ifdef USE_WEBENGINE
|
|
loginInteractive();
|
|
-// mscore->showLoginDialog(); // TODO: switch depending on USE_WEBENGINE
|
|
+#else
|
|
+ mscore->showLoginDialog();
|
|
+#endif
|
|
}
|
|
/*------- END - TRY LOGIN ROUTINES ----------------------------*/
|
|
|
|
@@ -295,6 +300,7 @@ void LoginManager::onTryLoginError(const QString& error)
|
|
// loginInteractive
|
|
//---------------------------------------------------------
|
|
|
|
+#ifdef USE_WEBENGINE
|
|
void LoginManager::loginInteractive()
|
|
{
|
|
QWebEngineView* webView = new QWebEngineView;
|
|
@@ -326,6 +332,7 @@ void LoginManager::loginInteractive()
|
|
webView->load(ApiInfo::loginUrl);
|
|
webView->show();
|
|
}
|
|
+#endif
|
|
|
|
//---------------------------------------------------------
|
|
// login
|
|
@@ -346,7 +353,7 @@ void LoginManager::login(QString login, QString password)
|
|
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
|
onReplyFinished(reply, RequestType::LOGIN);
|
|
});
|
|
- }
|
|
+ }
|
|
|
|
//---------------------------------------------------------
|
|
// onLoginSuccessReply
|
|
@@ -874,6 +881,7 @@ ApiRequest ApiRequestBuilder::build() const
|
|
// musescore.com
|
|
//---------------------------------------------------------
|
|
|
|
+#ifdef USE_WEBENGINE
|
|
void ApiWebEngineRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo& request)
|
|
{
|
|
const ApiInfo& apiInfo = ApiInfo::instance();
|
|
@@ -881,4 +889,5 @@ void ApiWebEngineRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo&
|
|
request.setHttpHeader(apiInfo.clientIdHeader, apiInfo.clientId);
|
|
request.setHttpHeader(apiInfo.apiKeyHeader, apiInfo.apiKey);
|
|
}
|
|
+#endif
|
|
}
|
|
diff --git a/mscore/network/loginmanager.h b/mscore/network/loginmanager.h
|
|
index 584eeea30d..327d9fc966 100644
|
|
--- a/mscore/network/loginmanager.h
|
|
+++ b/mscore/network/loginmanager.h
|
|
@@ -13,6 +13,8 @@
|
|
#ifndef __LOGINMANAGER_H__
|
|
#define __LOGINMANAGER_H__
|
|
|
|
+#include "config.h"
|
|
+
|
|
namespace Ms {
|
|
|
|
//---------------------------------------------------------
|
|
@@ -83,7 +85,9 @@ class LoginManager : public QObject
|
|
public:
|
|
LoginManager(QAction* uploadAudioMenuAction, QObject* parent = 0);
|
|
void login(QString login, QString password);
|
|
+#ifdef USE_WEBENGINE
|
|
void loginInteractive();
|
|
+#endif
|
|
void upload(const QString& path, int nid, const QString& title, const QString& description, const QString& priv, const QString& license, const QString& tags, const QString& changes);
|
|
bool hasAccessToken();
|
|
void getUser();
|
|
diff --git a/mscore/network/loginmanager_p.h b/mscore/network/loginmanager_p.h
|
|
index 88228a3958..2848dde35a 100644
|
|
--- a/mscore/network/loginmanager_p.h
|
|
+++ b/mscore/network/loginmanager_p.h
|
|
@@ -20,6 +20,8 @@
|
|
#ifndef __LOGINMANAGER_P_H__
|
|
#define __LOGINMANAGER_P_H__
|
|
|
|
+#include "config.h"
|
|
+
|
|
namespace Ms {
|
|
|
|
//---------------------------------------------------------
|
|
@@ -102,6 +104,7 @@ class ApiRequestBuilder
|
|
// ApiWebEngineRequestInterceptor
|
|
//---------------------------------------------------------
|
|
|
|
+#ifdef USE_WEBENGINE
|
|
class ApiWebEngineRequestInterceptor : public QWebEngineUrlRequestInterceptor
|
|
{
|
|
Q_OBJECT
|
|
@@ -109,6 +112,7 @@ class ApiWebEngineRequestInterceptor : public QWebEngineUrlRequestInterceptor
|
|
ApiWebEngineRequestInterceptor(QObject* parent) : QWebEngineUrlRequestInterceptor(parent) {}
|
|
void interceptRequest(QWebEngineUrlRequestInfo& info) override;
|
|
};
|
|
+#endif
|
|
|
|
//---------------------------------------------------------
|
|
// HttpStatus
|