MuseScore/mscore/startcenter.h

102 lines
2.7 KiB
C
Raw Normal View History

2014-11-10 10:10:37 +01:00
//=============================================================================
// MuseScore
// Music Composition & Notation
//
2016-06-30 15:34:02 +02:00
// Copyright (C) 2014-2016 Werner Schweer
2014-11-10 10:10:37 +01:00
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENCE.GPL
//=============================================================================
#ifndef __STARTCENTER_H__
#define __STARTCENTER_H__
#include "config.h"
2016-06-30 15:34:02 +02:00
#include "abstractdialog.h"
#include "ui_startcenter.h"
2014-11-10 12:30:53 +01:00
2014-11-10 10:10:37 +01:00
namespace Ms {
#ifdef USE_WEBENGINE
2014-12-19 16:30:18 +01:00
class MyWebUrlRequestInterceptor : public QWebEngineUrlRequestInterceptor {
Q_OBJECT
2014-12-19 16:30:18 +01:00
public:
MyWebUrlRequestInterceptor(QObject* p = Q_NULLPTR)
: QWebEngineUrlRequestInterceptor(p) {}
void interceptRequest(QWebEngineUrlRequestInfo& info)
{
info.setHttpHeader("Accept-Language",
QString("%1;q=0.8,en-US;q=0.6,en;q=0.4").arg(mscore->getLocaleISOCode()).toUtf8());
}
2014-12-19 16:30:18 +01:00
};
2014-12-19 16:30:18 +01:00
//---------------------------------------------------------
// MyWebEnginePage
2014-12-19 16:30:18 +01:00
//---------------------------------------------------------
class MyWebEnginePage : public QWebEnginePage {
Q_OBJECT
2014-12-19 16:30:18 +01:00
public:
MyWebEnginePage(QObject* parent = Q_NULLPTR)
: QWebEnginePage(parent) {}
2016-03-02 13:20:19 +01:00
bool acceptNavigationRequest(const QUrl& url, QWebEnginePage::NavigationType type, bool isMainFrame);
2014-12-19 16:30:18 +01:00
};
//---------------------------------------------------------
// MyWebEngineView
2014-12-19 16:30:18 +01:00
//---------------------------------------------------------
class MyWebView : public QWebEngineView {
Q_OBJECT
2014-12-19 16:30:18 +01:00
public slots:
2015-03-04 22:06:34 +01:00
public:
MyWebView(QWidget* parent = 0);
~MyWebView();
virtual QSize sizeHint() const;
};
2015-03-04 22:06:34 +01:00
#endif //USE_WEBENGINE
2014-12-19 16:30:18 +01:00
2014-11-10 10:10:37 +01:00
//---------------------------------------------------------
// Startcenter
//---------------------------------------------------------
class Startcenter : public AbstractDialog, public Ui::Startcenter {
2014-11-10 10:10:37 +01:00
Q_OBJECT
#ifdef USE_WEBENGINE
MyWebView* _webView;
#endif
2014-11-10 12:30:53 +01:00
virtual void closeEvent(QCloseEvent*);
2014-11-10 10:10:37 +01:00
private slots:
void loadScore(QString);
void newScore();
void openScoreClicked();
protected:
2016-06-30 15:34:02 +02:00
virtual void retranslate() { retranslateUi(this); }
signals:
2014-11-10 10:10:37 +01:00
void closed(bool);
public:
Startcenter(QWidget* parent);
2014-12-19 16:30:18 +01:00
~Startcenter();
2014-11-12 16:36:40 +01:00
void updateRecentScores();
void writeSettings();
void readSettings();
void keyPressEvent(QKeyEvent*) override;
void keyReleaseEvent(QKeyEvent*) override;
2014-11-10 10:10:37 +01:00
};
2014-12-19 16:30:18 +01:00
}
#endif //__STARTCENTER_H__