MuseScore  3.4
Music composition and notation
startcenter.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2014-2016 Werner Schweer
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 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __STARTCENTER_H__
14 #define __STARTCENTER_H__
15 
16 #include "config.h"
17 #include "abstractdialog.h"
18 #include "ui_startcenter.h"
19 
20 namespace Ms {
21 
22 #ifdef USE_WEBENGINE
23 
24 class MyWebUrlRequestInterceptor : public QWebEngineUrlRequestInterceptor {
25  Q_OBJECT
26 
27  public:
28  MyWebUrlRequestInterceptor(QObject* p = Q_NULLPTR)
29  : QWebEngineUrlRequestInterceptor(p) {}
30 
31  void interceptRequest(QWebEngineUrlRequestInfo& info)
32  {
33  info.setHttpHeader("Accept-Language",
34  QString("%1;q=0.8,en-US;q=0.6,en;q=0.4").arg(mscore->getLocaleISOCode()).toUtf8());
35  }
36  };
37 
38 //---------------------------------------------------------
39 // MyWebEnginePage
40 //---------------------------------------------------------
41 
42 class MyWebEnginePage : public QWebEnginePage {
43  Q_OBJECT
44 
45  public:
46  MyWebEnginePage(QObject* parent = Q_NULLPTR)
47  : QWebEnginePage(parent) {}
48 
49  bool acceptNavigationRequest(const QUrl& url, QWebEnginePage::NavigationType type, bool isMainFrame);
50  };
51 
52 //---------------------------------------------------------
53 // MyWebEngineView
54 //---------------------------------------------------------
55 
56 class MyWebView : public QWebEngineView {
57  Q_OBJECT
58 
59  public slots:
60 
61  public:
62  MyWebView(QWidget* parent = 0);
63  ~MyWebView();
64  virtual QSize sizeHint() const;
65  };
66 
67 #endif //USE_WEBENGINE
68 
69 //---------------------------------------------------------
70 // Startcenter
71 //---------------------------------------------------------
72 
73 class Startcenter : public AbstractDialog, public Ui::Startcenter {
74  Q_OBJECT
75 #ifdef USE_WEBENGINE
76  MyWebView* _webView;
77 #endif
78  virtual void closeEvent(QCloseEvent*);
79 
80  private slots:
81  void loadScore(QString);
82  void newScore();
83  void openScoreClicked();
84 
85  protected:
86  virtual void retranslate() { retranslateUi(this); }
87 
88  signals:
89  void closed(bool);
90 
91  public:
92  Startcenter(QWidget* parent);
93  ~Startcenter();
94  void updateRecentScores();
95  void writeSettings();
96  void readSettings();
97  void keyPressEvent(QKeyEvent*) override;
98  void keyReleaseEvent(QKeyEvent*) override;
99  };
100 }
101 #endif //__STARTCENTER_H__
Definition: abstractdialog.h:29
Definition: aeolus.cpp:26
Definition: startcenter.h:73
virtual void retranslate()
Definition: startcenter.h:86
MScore * mscore
Definition: musescore.cpp:171