mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-08 17:44:17 +02:00
working version for all qml web files
This commit is contained in:
parent
fb7a66b110
commit
cd5df63f51
7 changed files with 85 additions and 31 deletions
|
@ -14,7 +14,6 @@ Item {
|
|||
HifiStyles.HifiConstants { id: hifistyles }
|
||||
|
||||
height: 600
|
||||
property variant permissionsBar: {'securityOrigin':'none','feature':'none'}
|
||||
property alias url: webview.url
|
||||
|
||||
property bool canGoBack: webview.canGoBack
|
||||
|
@ -30,6 +29,10 @@ Item {
|
|||
webview.profile = profile;
|
||||
}
|
||||
|
||||
onUrlChanged: {
|
||||
permissionPopupBackground.visible = false;
|
||||
}
|
||||
|
||||
WebEngineView {
|
||||
id: webview
|
||||
objectName: "webEngineView"
|
||||
|
@ -84,7 +87,11 @@ Item {
|
|||
}
|
||||
|
||||
onFeaturePermissionRequested: {
|
||||
grantFeaturePermission(securityOrigin, feature, false);
|
||||
permissionPopupBackground.permissionsOptions.securityOrigin = securityOrigin;
|
||||
permissionPopupBackground.permissionsOptions.feature = feature;
|
||||
|
||||
permissionPopupBackground.visible = true;
|
||||
// grantFeaturePermission(securityOrigin, feature, false);
|
||||
}
|
||||
|
||||
onLoadingChanged: {
|
||||
|
@ -122,4 +129,11 @@ Item {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
HifiControls.PermissionPopupBackground {
|
||||
id: permissionPopupBackground
|
||||
onSendPermission: {
|
||||
webview.grantFeaturePermission(securityOrigin, feature, shouldGivePermission)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import QtWebChannel 1.0
|
|||
import QtQuick.Controls 2.2
|
||||
|
||||
import stylesUit 1.0 as StylesUIt
|
||||
import "../hifi" as Controls
|
||||
import controlsUit 1.0 as ControlsUit
|
||||
|
||||
Item {
|
||||
id: flick
|
||||
|
@ -29,6 +29,10 @@ Item {
|
|||
|
||||
property bool blurOnCtrlShift: true
|
||||
|
||||
onUrlChanged: {
|
||||
permissionPopupBackground.visible = false;
|
||||
}
|
||||
|
||||
StylesUIt.HifiConstants {
|
||||
id: hifi
|
||||
}
|
||||
|
@ -68,6 +72,12 @@ Item {
|
|||
}
|
||||
|
||||
function onLoadingChanged(loadRequest) {
|
||||
console.log("WebEngineView.LoadStartedStatus", WebEngineView.LoadStartedStatus);
|
||||
console.log("WebEngineView.LoadSucceededStatus", WebEngineView.LoadSucceededStatus);
|
||||
console.log("WebEngineView.LoadFailedStatus", WebEngineView.LoadFailedStatus);
|
||||
|
||||
console.log("status:" + loadRequest.status);
|
||||
|
||||
if (WebEngineView.LoadStartedStatus === loadRequest.status) {
|
||||
|
||||
// Required to support clicking on "hifi://" links
|
||||
|
@ -142,16 +152,10 @@ Item {
|
|||
}
|
||||
|
||||
onFeaturePermissionRequested: {
|
||||
console.log('feature');
|
||||
console.log(JSON.stringify(feature, null, 4));
|
||||
permissionPopupBackground.permissionsOptions.securityOrigin = securityOrigin;
|
||||
permissionPopupBackground.permissionsOptions.feature = feature;
|
||||
|
||||
if (feature === 0) return;
|
||||
console.log("Requesting permissions:")
|
||||
permissionPopup.visible = true;
|
||||
console.log('security origin');
|
||||
console.log(JSON.stringify(securityOrigin, null, 4));
|
||||
permissionPopup.permissionsOptions.securityOrigin = securityOrigin;
|
||||
permissionPopup.permissionsOptions.feature = feature;
|
||||
permissionPopupBackground.visible = true;
|
||||
}
|
||||
|
||||
//disable popup
|
||||
|
@ -197,13 +201,10 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Controls.PermissionPopupBackground {
|
||||
id: permissionPopup
|
||||
ControlsUit.PermissionPopupBackground {
|
||||
id: permissionPopupBackground
|
||||
onSendPermission: {
|
||||
console.log("security origin we are allowing", securityOrigin);
|
||||
console.log("feature we are allowing", securityOrigin);
|
||||
console.log("shouldGivePermission:", shouldGivePermission);
|
||||
webViewCore.grantFeaturePermission(securityOrigin, feature, shouldGivePermission)
|
||||
webViewCore.grantFeaturePermission(securityOrigin, feature, shouldGivePermission);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,10 +10,11 @@
|
|||
|
||||
import QtQuick 2.7
|
||||
import QtWebEngine 1.5
|
||||
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
|
||||
|
@ -22,6 +23,10 @@ WebEngineView {
|
|||
});
|
||||
}
|
||||
|
||||
onUrlChanged: {
|
||||
permissionPopupBackground.visible = false;
|
||||
}
|
||||
|
||||
onLoadingChanged: {
|
||||
// Required to support clicking on "hifi://" links
|
||||
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
||||
|
@ -37,6 +42,17 @@ WebEngineView {
|
|||
WebSpinner { }
|
||||
|
||||
onFeaturePermissionRequested: {
|
||||
grantFeaturePermission(securityOrigin, feature, false);
|
||||
permissionPopupBackground.permissionsOptions.securityOrigin = securityOrigin;
|
||||
permissionPopupBackground.permissionsOptions.feature = feature;
|
||||
|
||||
permissionPopupBackground.visible = true;
|
||||
}
|
||||
|
||||
ControlsUit.PermissionPopupBackground {
|
||||
z: 100
|
||||
id: permissionPopupBackground
|
||||
onSendPermission: {
|
||||
root.grantFeaturePermission(securityOrigin, feature, shouldGivePermission);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import QtQuick 2.5
|
||||
import QtWebEngine 1.5
|
||||
import controlsUit 1.0 as HifiControls
|
||||
import stylesUit 1.0 as HifiStyles
|
||||
import "../windows" as Windows
|
||||
|
@ -11,7 +12,26 @@ Item {
|
|||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
z:100
|
||||
property var permissionLanguage: {
|
||||
"test": "test"
|
||||
}
|
||||
property int currentRequestedPermission
|
||||
signal permissionButtonPressed(real buttonNumber)
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("loaded component");
|
||||
// console.log("\n\n TESTING!! \n\n")
|
||||
console.log("WebEngineView.MediaAudioCapture", WebEngineView.MediaAudioCapture)
|
||||
// root.permissionLanguage["test"] = "test"
|
||||
root.permissionLanguage[WebEngineView.MediaAudioCapture] = "access an audio input device";
|
||||
root.permissionLanguage[WebEngineView.MediaVideoCapture] = "access a video device, like your webcam";
|
||||
root.permissionLanguage[WebEngineView.MediaAudioVideoCapture] = "access an audio input device and video device";
|
||||
root.permissionLanguage[WebEngineView.Geolocation] = "access your location";
|
||||
root.permissionLanguage[WebEngineView.DesktopVideoCapture] = "capture video from your desktop";
|
||||
root.permissionLanguage[WebEngineView.DesktopAudioVideoCapture] = "capture audio and video from your desktop";
|
||||
console.log(JSON.stringify(root.permissionLanguage))
|
||||
|
||||
}
|
||||
|
||||
// anchors.top: buttons.bottom
|
||||
Rectangle {
|
||||
|
@ -25,7 +45,7 @@ Item {
|
|||
height: root.height * 0.30
|
||||
HifiStyles.RalewayBold {
|
||||
id: webAccessHeaderText
|
||||
text: "WEB CAMERA ACCESS REQUEST"
|
||||
text: "REQUEST FOR DEVICE ACCESS"
|
||||
width: mainContainer.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
anchors.bottom: parent.bottom
|
||||
|
@ -43,7 +63,7 @@ Item {
|
|||
width: mainContainer.width
|
||||
id: webAccessInfoText
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: "This domain is requesting access to your web camera and microphone"
|
||||
text: "This website is attempting to " + root.permissionLanguage[root.currentRequestedPermission] + "."
|
||||
size: 15
|
||||
color: hifi.colors.black
|
||||
}
|
|
@ -5,13 +5,13 @@ import "../windows"
|
|||
import "../."
|
||||
|
||||
Rectangle {
|
||||
id: permissionPopupBackground
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
color: Qt.rgba(0, 0, 0, 0.5);
|
||||
HifiConstants { id: hifi }
|
||||
visible: true
|
||||
property variant permissionsOptions: {'securityOrigin':'none','feature':'none'}
|
||||
signal sendPermission(string securityOrigin, string feature, bool shouldGivePermission)
|
||||
visible: false
|
||||
property variant permissionsOptions: {'securityOrigin':'none','feature': -1}
|
||||
signal sendPermission(string securityOrigin, int feature, bool shouldGivePermission)
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("loaded component");
|
||||
|
@ -21,6 +21,7 @@ Rectangle {
|
|||
PermissionPopup {
|
||||
id: permissionPopupItem
|
||||
Component.onCompleted: {
|
||||
permissionPopupItem.currentRequestedPermission = permissionsOptions.feature;
|
||||
console.log("test");
|
||||
// console.log("\n\n TESTING!! \n\n")
|
||||
}
|
||||
|
@ -28,13 +29,13 @@ Rectangle {
|
|||
console.log("JUST MADE IT TO ON PERMISSIONS PRESSEED!");
|
||||
console.log(buttonNumber);
|
||||
if (buttonNumber === 0) {
|
||||
permissionPopupBackground.sendPermission(permissionsOptions.securityOrigin, permissionsOptions.feature, true)
|
||||
root.sendPermission(permissionsOptions.securityOrigin, permissionsOptions.feature, true)
|
||||
} else {
|
||||
permissionPopupBackground.sendPermission(permissionsOptions.securityOrigin, permissionsOptions.feature, false)
|
||||
root.sendPermission(permissionsOptions.securityOrigin, permissionsOptions.feature, false)
|
||||
}
|
||||
permissionPopupBackground.visible = false;
|
||||
root.visible = false;
|
||||
permissionsOptions.securityOrigin = "none";
|
||||
permissionsOptions.feature = "none";
|
||||
permissionsOptions.feature = -1;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,6 +15,8 @@ Key 1.0 Key.qml
|
|||
Keyboard 1.0 Keyboard.qml
|
||||
Label 1.0 Label.qml
|
||||
QueuedButton 1.0 QueuedButton.qml
|
||||
PermissionPopup 1.0 PermissionPopup.qml
|
||||
PermissionPopupBackground 1.0 PermissionPopupBackground.qml
|
||||
RadioButton 1.0 RadioButton.qml
|
||||
ScrollBar 1.0 ScrollBar.qml
|
||||
Separator 1.0 Separator.qml
|
||||
|
|
|
@ -140,6 +140,6 @@ InteractiveWindowPointer DesktopScriptingInterface::createWindowOnThread(const Q
|
|||
return nullptr;
|
||||
}
|
||||
InteractiveWindowPointer window = new InteractiveWindow(sourceUrl, properties);
|
||||
window->moveToThread(targetThread);
|
||||
// window->moveToThread(targetThread);
|
||||
return window;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue