mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-08 07:02:25 +02:00
Cr changes r1
This commit is contained in:
parent
9f0fc8bd06
commit
2498bf2fd8
4 changed files with 80 additions and 76 deletions
|
@ -87,8 +87,8 @@ Item {
|
|||
}
|
||||
|
||||
onFeaturePermissionRequested: {
|
||||
permissionPopupBackground.permissionsOptions.securityOrigin = securityOrigin;
|
||||
permissionPopupBackground.permissionsOptions.feature = feature;
|
||||
permissionPopupBackground.securityOrigin = securityOrigin;
|
||||
permissionPopupBackground.feature = feature;
|
||||
|
||||
permissionPopupBackground.visible = true;
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ Item {
|
|||
HifiControls.PermissionPopupBackground {
|
||||
id: permissionPopupBackground
|
||||
onSendPermission: {
|
||||
webview.grantFeaturePermission(securityOrigin, feature, shouldGivePermission)
|
||||
webview.grantFeaturePermission(securityOrigin, feature, shouldGivePermission);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import controlsUit 1.0 as ControlsUit
|
|||
|
||||
WebEngineView {
|
||||
id: root
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("Connecting JS messaging to Hifi Logging")
|
||||
// Ensure the JS from the web-engine makes it to our logging
|
||||
|
@ -42,15 +41,15 @@ WebEngineView {
|
|||
WebSpinner { }
|
||||
|
||||
onFeaturePermissionRequested: {
|
||||
permissionPopupBackground.permissionsOptions.securityOrigin = securityOrigin;
|
||||
permissionPopupBackground.permissionsOptions.feature = feature;
|
||||
permissionPopupBackground.securityOrigin = securityOrigin;
|
||||
permissionPopupBackground.feature = feature;
|
||||
|
||||
permissionPopupBackground.visible = true;
|
||||
}
|
||||
|
||||
ControlsUit.PermissionPopupBackground {
|
||||
z: 100
|
||||
id: permissionPopupBackground
|
||||
z: 100
|
||||
onSendPermission: {
|
||||
root.grantFeaturePermission(securityOrigin, feature, shouldGivePermission);
|
||||
}
|
||||
|
|
|
@ -2,94 +2,97 @@ import QtQuick 2.5
|
|||
import QtWebEngine 1.5
|
||||
import controlsUit 1.0 as HifiControls
|
||||
import stylesUit 1.0 as HifiStyles
|
||||
import "../windows" as Windows
|
||||
import "../."
|
||||
|
||||
Item {
|
||||
Rectangle {
|
||||
id: root
|
||||
width: 600
|
||||
width: 600
|
||||
height: 200
|
||||
z:100
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: hifi.colors.white
|
||||
|
||||
anchors.centerIn: parent
|
||||
readonly property var permissionLanguage: ({
|
||||
[WebEngineView.MediaAudioCapture]: "access an audio input device",
|
||||
[WebEngineView.MediaVideoCapture]: "access a video device, like your webcam",
|
||||
[WebEngineView.MediaAudioVideoCapture]: "access an audio input device and video device",
|
||||
[WebEngineView.Geolocation]: "access your location",
|
||||
[WebEngineView.DesktopVideoCapture]: "capture video from your desktop",
|
||||
[WebEngineView.DesktopAudioVideoCapture]: "capture audio and video from your desktop"
|
||||
[WebEngineView.DesktopAudioVideoCapture]: "capture audio and video from your desktop",
|
||||
"none": "Undefined permission being requested"
|
||||
})
|
||||
property string currentRequestedPermission
|
||||
signal permissionButtonPressed(real buttonNumber)
|
||||
|
||||
Rectangle {
|
||||
id: mainContainer
|
||||
width: root.width
|
||||
height: root.height
|
||||
color: hifi.colors.white
|
||||
signal permissionButtonPressed(int buttonNumber)
|
||||
|
||||
Row {
|
||||
id: webAccessHeaderContainer
|
||||
height: root.height * 0.30
|
||||
HifiStyles.RalewayBold {
|
||||
id: webAccessHeaderText
|
||||
text: "REQUEST FOR DEVICE ACCESS"
|
||||
width: mainContainer.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
anchors.bottom: parent.bottom
|
||||
font.bold: true
|
||||
color: hifi.colors.black
|
||||
size: 17
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: webAccessInfoContainer
|
||||
anchors.top: webAccessHeaderContainer.bottom
|
||||
anchors.topMargin: 10
|
||||
HifiStyles.RalewayLight {
|
||||
width: mainContainer.width
|
||||
id: webAccessInfoText
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: "This website is attempting to " + root.permissionLanguage[root.currentRequestedPermission] + "."
|
||||
size: 15
|
||||
color: hifi.colors.black
|
||||
}
|
||||
}
|
||||
Row {
|
||||
id: webAccessHeaderContainer
|
||||
|
||||
height: 60
|
||||
width: parent.width
|
||||
HifiStyles.RalewayBold {
|
||||
id: webAccessHeaderText
|
||||
text: "REQUEST FOR DEVICE ACCESS"
|
||||
anchors.centerIn: parent
|
||||
color: hifi.colors.black
|
||||
size: 17
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: webAccessInfoContainer
|
||||
height: 60
|
||||
width: parent.width
|
||||
anchors.top: webAccessHeaderContainer.bottom
|
||||
HifiStyles.RalewayLight {
|
||||
id: webAccessInfoText
|
||||
wrapMode: Text.WordWrap
|
||||
width: root.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: "This website is attempting to " + root.permissionLanguage[root.currentRequestedPermission] + "."
|
||||
size: 15
|
||||
color: hifi.colors.black
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: permissionsButtonsRow
|
||||
height: 100
|
||||
width: parent.width
|
||||
anchors.top: webAccessInfoContainer.bottom
|
||||
Rectangle {
|
||||
id: permissionsButtonRow
|
||||
color: "#AAAAAA"
|
||||
anchors.topMargin: 35
|
||||
id: permissionsButtonsContainer
|
||||
height: 50
|
||||
width: leftButton.width + rightButton.width + (this.space * 3)
|
||||
width: parent.width
|
||||
anchors.top: webAccessInfoContainer.bottom
|
||||
anchors.horizontalCenter: webAccessInfoContainer.horizontalCenter
|
||||
anchors.verticalCenter: webAccessInfoContainer.verticalCenter
|
||||
property real space: 5
|
||||
property int space: 5
|
||||
color: "#998899"
|
||||
|
||||
HifiControls.Button {
|
||||
anchors.left: permissionsButtonRow.left
|
||||
id: leftButton
|
||||
anchors.leftMargin: permissionsButtonRow.space
|
||||
|
||||
anchors.right: parent.horizontalCenter
|
||||
anchors.horizontalCenterOffset: -parent.space
|
||||
|
||||
text: "Don't Allow"
|
||||
color: hifi.buttons.red
|
||||
enabled: true
|
||||
height: 25
|
||||
onClicked: {
|
||||
root.permissionButtonPressed(0);
|
||||
}
|
||||
}
|
||||
HifiControls.Button {
|
||||
id: rightButton
|
||||
|
||||
anchors.left: parent.horizontalCenter
|
||||
anchors.horizontalCenterOffset: parent.space
|
||||
|
||||
text: "Yes allow access"
|
||||
color: hifi.buttons.blue
|
||||
enabled: true
|
||||
width: 155
|
||||
height: 25
|
||||
onClicked: {
|
||||
root.permissionButtonPressed(0)
|
||||
}
|
||||
}
|
||||
HifiControls.Button {
|
||||
id: rightButton
|
||||
anchors.left: leftButton.right
|
||||
anchors.leftMargin: permissionsButtonRow.space
|
||||
text: "Don't Allow"
|
||||
color: hifi.buttons.red
|
||||
enabled: true
|
||||
onClicked: {
|
||||
root.permissionButtonPressed(1)
|
||||
root.permissionButtonPressed(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
import QtQuick 2.5
|
||||
import controlsUit 1.0
|
||||
import stylesUit 1.0
|
||||
import "../windows"
|
||||
import "../."
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
@ -17,13 +13,19 @@ Rectangle {
|
|||
permissionPopupItem.currentRequestedPermission = feature;
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
propagateComposedEvents: false
|
||||
}
|
||||
|
||||
PermissionPopup {
|
||||
id: permissionPopupItem
|
||||
onPermissionButtonPressed: {
|
||||
if (buttonNumber === 0) {
|
||||
root.sendPermission(securityOrigin, feature, true)
|
||||
root.sendPermission(securityOrigin, feature, false);
|
||||
} else {
|
||||
root.sendPermission(securityOrigin, feature, false)
|
||||
root.sendPermission(securityOrigin, feature, true);
|
||||
}
|
||||
root.visible = false;
|
||||
securityOrigin = 'none';
|
||||
|
|
Loading…
Reference in a new issue