MuseScore  3.4
Music composition and notation
webpage.h
Go to the documentation of this file.
1 //=============================================================================
2 // MusE Score
3 // Linux Music Score Editor
4 //
5 // Copyright (C) 2011 Werner Schweer and others
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #if 0
21 
22 #ifndef __WEBPAGE_H__
23 #define __WEBPAGE_H__
24 
25 #include "musescore.h"
26 #include "scoreview.h"
27 
28 namespace Ms {
29 
30 class MuseScore;
31 
32 //---------------------------------------------------------
33 // MyNetworkAccessManager
34 //---------------------------------------------------------
35 
36 class MyNetworkAccessManager: public QNetworkAccessManager
37  {
38  //Q_OBJECT
39 
40  public:
41  MyNetworkAccessManager(QObject *parent) : QNetworkAccessManager(parent) {}
42 
43  protected:
44  QNetworkReply * createRequest(Operation op,
45  const QNetworkRequest & req,
46  QIODevice * outgoingData = 0);
47  };
48 
49 // Derive from QWebPage, because a WebPage handles
50 // plugin creation
51 
52 //---------------------------------------------------------
53 // MyWebPage
54 //---------------------------------------------------------
55 
56 class MyWebPage: public QWebPage
57  {
58  //Q_OBJECT
59 
60  protected:
61  QObject *createPlugin(
62  const QString &classid,
63  const QUrl &url,
64  const QStringList &paramNames,
65  const QStringList & paramValues);
66 
67  public:
68  MyWebPage(QObject *parent = 0);
69  };
70 
71 //---------------------------------------------------------
72 // MyWebView
73 // Derive a new class from QWebView for convenience.
74 // Otherwise you'd always have to create a QWebView
75 // and a MyWebPage and assign the MyWebPage object
76 // to the QWebView. This class does that for you
77 // automatically.
78 //---------------------------------------------------------
79 
80 class MyWebView: public QWebView
81  {
82  Q_OBJECT
83 
84  MyWebPage m_page;
85  QProgressBar* progressBar;
86 
87  public slots:
88  void link(const QUrl& url);
89  void setBusy();
90  void stopBusy(bool val);
91 
92 #ifndef QT_NO_OPENSSL
93  void ignoreSSLErrors(QNetworkReply *reply, QList<QSslError> sslErrors);
94 #endif
95 
96  public:
97  MyWebView(QWidget *parent = 0);
98  ~MyWebView();
99  MyWebPage* webPage() { return &m_page;}
100  virtual QSize sizeHint () const;
101  };
102 
103 //---------------------------------------------------------
104 // WebPage
105 //---------------------------------------------------------
106 
107 class WebPageDockWidget : public QDockWidget
108  {
109  //Q_OBJECT
110 
111  MyWebView* web;
112 
113  public slots:
114  void addToJavascript();
115  void saveOnlineFinished();
116 
117  public:
118  WebPageDockWidget(MuseScore* mscore, QWidget* parent = 0);
119  Q_INVOKABLE void load();
120  Q_INVOKABLE bool saveCurrentScoreOnline(QString action, QVariantMap parameters, QString fileFieldName);
121  Q_INVOKABLE bool setCurrentScoreSource(QString source);
122  Q_INVOKABLE QObject* currentScore();
123 
124  QUrl webUrl();
125  };
126 
127 class CookieJar : public QNetworkCookieJar
128  {
129  //Q_OBJECT
130 
131  public:
132  CookieJar(QString path, QObject *parent = 0); //load cookie
133  ~CookieJar(); //save cookies
134 
135  private:
136  QString file; // where to save cookies
137  };
138 
139 #if 0
140 //---------------------------------------------------------
141 // WebScoreView
142 //---------------------------------------------------------
143 
144 class WebScoreView : public ScoreView
145  {
146  //Q_OBJECT
147  QNetworkAccessManager* networkManager;
148 
149  private slots:
150  void networkFinished(QNetworkReply*);
151 
152  public:
153  WebScoreView(QWidget* parent = 0);
154  WebScoreView(const WebScoreView&);
155  void setScore(const QString&);
156  };
157 
158 Q_DECLARE_METATYPE(WebScoreView);
159 #endif
160 }
161 #endif
162 #endif
Definition: aeolus.cpp:26
MScore * mscore
Definition: musescore.cpp:171