@ -1,22 +1,24 @@
|
||||
#include "customwebenginepage.h"
|
||||
|
||||
CustomWebEnginePage::CustomWebEnginePage(QObject *parent/* = Q_NULLPTR*/)
|
||||
: QWebEnginePage(parent)
|
||||
{
|
||||
connect(this, &CustomWebEnginePage::featurePermissionRequested, this, &CustomWebEnginePage::onFeaturePermissionRequested);
|
||||
#include <QWebEngineHistory>
|
||||
CustomWebEnginePage::CustomWebEnginePage(QObject *parent /* = Q_NULLPTR*/)
|
||||
: QWebEnginePage(parent) {
|
||||
connect(this, &CustomWebEnginePage::featurePermissionRequested, this,
|
||||
&CustomWebEnginePage::onFeaturePermissionRequested);
|
||||
}
|
||||
|
||||
bool CustomWebEnginePage::certificateError(const QWebEngineCertificateError &certificateError)
|
||||
{
|
||||
return true;
|
||||
bool CustomWebEnginePage::certificateError(
|
||||
const QWebEngineCertificateError &certificateError) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void CustomWebEnginePage::onFeaturePermissionRequested(const QUrl &securityOrigin, QWebEnginePage::Feature feature)
|
||||
{
|
||||
if (feature == QWebEnginePage::MediaAudioCapture
|
||||
|| feature == QWebEnginePage::MediaVideoCapture
|
||||
|| feature == QWebEnginePage::MediaAudioVideoCapture)
|
||||
setFeaturePermission(securityOrigin, feature, QWebEnginePage::PermissionGrantedByUser);
|
||||
else
|
||||
setFeaturePermission(securityOrigin, feature, QWebEnginePage::PermissionDeniedByUser);
|
||||
void CustomWebEnginePage::onFeaturePermissionRequested(
|
||||
const QUrl &securityOrigin, QWebEnginePage::Feature feature) {
|
||||
if (feature == QWebEnginePage::MediaAudioCapture ||
|
||||
feature == QWebEnginePage::MediaVideoCapture ||
|
||||
feature == QWebEnginePage::MediaAudioVideoCapture)
|
||||
setFeaturePermission(securityOrigin, feature,
|
||||
QWebEnginePage::PermissionGrantedByUser);
|
||||
else
|
||||
setFeaturePermission(securityOrigin, feature,
|
||||
QWebEnginePage::PermissionDeniedByUser);
|
||||
}
|
||||
|
@ -1,26 +1,25 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QFile>
|
||||
#include <QLocale>
|
||||
#include <QTranslator>
|
||||
#include <QFile>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
//QApplication::setAttribute(Qt::AA_UseOpenGLES);
|
||||
|
||||
QApplication a(argc, argv);
|
||||
QTranslator translator;
|
||||
const QStringList uiLanguages = QLocale::system().uiLanguages();
|
||||
for (const QString &locale : uiLanguages) {
|
||||
const QString baseName = "PayloadAPP_" + QLocale(locale).name();
|
||||
if (translator.load(":/i18n/" + baseName)) {
|
||||
a.installTranslator(&translator);
|
||||
break;
|
||||
}
|
||||
int main(int argc, char *argv[]) {
|
||||
// QApplication::setAttribute(Qt::AA_UseOpenGLES);
|
||||
// qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--enable-gpu-rasterization");
|
||||
QApplication a(argc, argv);
|
||||
QTranslator translator;
|
||||
const QStringList uiLanguages = QLocale::system().uiLanguages();
|
||||
for (const QString &locale : uiLanguages) {
|
||||
const QString baseName = "PayloadAPP_" + QLocale(locale).name();
|
||||
if (translator.load(":/i18n/" + baseName)) {
|
||||
a.installTranslator(&translator);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
|
Loading…
Reference in New Issue