|
|
|
|
@ -21,6 +21,9 @@ |
|
|
|
|
#include "mainapplication.h" |
|
|
|
|
#include "html5permissionsmanager.h" |
|
|
|
|
|
|
|
|
|
#include <QtWebEngineWidgetsVersion> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HTML5PermissionsDialog::HTML5PermissionsDialog(QWidget* parent) |
|
|
|
|
: QDialog(parent) |
|
|
|
|
, ui(new Ui::HTML5PermissionsDialog) |
|
|
|
|
@ -37,6 +40,12 @@ HTML5PermissionsDialog::HTML5PermissionsDialog(QWidget* parent) |
|
|
|
|
connect(ui->feature, SIGNAL(currentIndexChanged(int)), this, SLOT(featureIndexChanged())); |
|
|
|
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &HTML5PermissionsDialog::saveSettings); |
|
|
|
|
|
|
|
|
|
/* Hide unsupported HTML5 permissions */ |
|
|
|
|
#if QTWEBENGINEWIDGETS_VERSION < QT_VERSION_CHECK(5, 10, 0) |
|
|
|
|
ui->feature->removeItem(7); |
|
|
|
|
ui->feature->removeItem(6); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
showFeaturePermissions(currentFeature()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -110,6 +119,12 @@ QWebEnginePage::Feature HTML5PermissionsDialog::currentFeature() const |
|
|
|
|
return QWebEnginePage::MediaAudioVideoCapture; |
|
|
|
|
case 5: |
|
|
|
|
return QWebEnginePage::MouseLock; |
|
|
|
|
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0) |
|
|
|
|
case 6: |
|
|
|
|
return QWebEnginePage::DesktopVideoCapture; |
|
|
|
|
case 7: |
|
|
|
|
return QWebEnginePage::DesktopAudioVideoCapture; |
|
|
|
|
#endif |
|
|
|
|
default: |
|
|
|
|
Q_UNREACHABLE(); |
|
|
|
|
return QWebEnginePage::Notifications; |
|
|
|
|
@ -139,6 +154,14 @@ void HTML5PermissionsDialog::loadSettings() |
|
|
|
|
m_granted[QWebEnginePage::MouseLock] = settings.value("MouseLockGranted", QStringList()).toStringList(); |
|
|
|
|
m_denied[QWebEnginePage::MouseLock] = settings.value("MouseLockDenied", QStringList()).toStringList(); |
|
|
|
|
|
|
|
|
|
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0) |
|
|
|
|
m_granted[QWebEnginePage::DesktopVideoCapture] = settings.value("DesktopVideoCaptureGranted", QStringList()).toStringList(); |
|
|
|
|
m_denied[QWebEnginePage::DesktopVideoCapture] = settings.value("DesktopVideoCaptureDenied", QStringList()).toStringList(); |
|
|
|
|
|
|
|
|
|
m_granted[QWebEnginePage::DesktopAudioVideoCapture] = settings.value("DesktopAudioVideoCaptureGranted", QStringList()).toStringList(); |
|
|
|
|
m_denied[QWebEnginePage::DesktopAudioVideoCapture] = settings.value("DesktopAudioVideoCaptureDenied", QStringList()).toStringList(); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
settings.endGroup(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -165,6 +188,14 @@ void HTML5PermissionsDialog::saveSettings() |
|
|
|
|
settings.setValue("MouseLockGranted", m_granted[QWebEnginePage::MouseLock]); |
|
|
|
|
settings.setValue("MouseLockDenied", m_denied[QWebEnginePage::MouseLock]); |
|
|
|
|
|
|
|
|
|
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0) |
|
|
|
|
settings.setValue("DesktopVideoCaptureGranted", m_granted[QWebEnginePage::DesktopVideoCapture]); |
|
|
|
|
settings.setValue("DesktopVideoCaptureDenied", m_denied[QWebEnginePage::DesktopVideoCapture]); |
|
|
|
|
|
|
|
|
|
settings.setValue("DesktopAudioVideoCaptureGranted", m_granted[QWebEnginePage::DesktopAudioVideoCapture]); |
|
|
|
|
settings.setValue("DesktopAudioVideoCaptureDenied", m_denied[QWebEnginePage::DesktopAudioVideoCapture]); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
settings.endGroup(); |
|
|
|
|
|
|
|
|
|
mApp->html5PermissionsManager()->loadSettings(); |
|
|
|
|
|