aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/musescore-fix-use_webengine.patch
blob: b0b8216a4207de85ad3d12b4792d1e06b4f2c410 (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
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