mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 02:24:51 +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 }
|
HifiStyles.HifiConstants { id: hifistyles }
|
||||||
|
|
||||||
height: 600
|
height: 600
|
||||||
property variant permissionsBar: {'securityOrigin':'none','feature':'none'}
|
|
||||||
property alias url: webview.url
|
property alias url: webview.url
|
||||||
|
|
||||||
property bool canGoBack: webview.canGoBack
|
property bool canGoBack: webview.canGoBack
|
||||||
|
@ -30,6 +29,10 @@ Item {
|
||||||
webview.profile = profile;
|
webview.profile = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onUrlChanged: {
|
||||||
|
permissionPopupBackground.visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
WebEngineView {
|
WebEngineView {
|
||||||
id: webview
|
id: webview
|
||||||
objectName: "webEngineView"
|
objectName: "webEngineView"
|
||||||
|
@ -84,7 +87,11 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
onFeaturePermissionRequested: {
|
onFeaturePermissionRequested: {
|
||||||
grantFeaturePermission(securityOrigin, feature, false);
|
permissionPopupBackground.permissionsOptions.securityOrigin = securityOrigin;
|
||||||
|
permissionPopupBackground.permissionsOptions.feature = feature;
|
||||||
|
|
||||||
|
permissionPopupBackground.visible = true;
|
||||||
|
// grantFeaturePermission(securityOrigin, feature, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoadingChanged: {
|
onLoadingChanged: {
|
||||||
|
@ -122,4 +129,11 @@ Item {
|
||||||
break;
|
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 QtQuick.Controls 2.2
|
||||||
|
|
||||||
import stylesUit 1.0 as StylesUIt
|
import stylesUit 1.0 as StylesUIt
|
||||||
import "../hifi" as Controls
|
import controlsUit 1.0 as ControlsUit
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: flick
|
id: flick
|
||||||
|
@ -29,6 +29,10 @@ Item {
|
||||||
|
|
||||||
property bool blurOnCtrlShift: true
|
property bool blurOnCtrlShift: true
|
||||||
|
|
||||||
|
onUrlChanged: {
|
||||||
|
permissionPopupBackground.visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
StylesUIt.HifiConstants {
|
StylesUIt.HifiConstants {
|
||||||
id: hifi
|
id: hifi
|
||||||
}
|
}
|
||||||
|
@ -68,6 +72,12 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLoadingChanged(loadRequest) {
|
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) {
|
if (WebEngineView.LoadStartedStatus === loadRequest.status) {
|
||||||
|
|
||||||
// Required to support clicking on "hifi://" links
|
// Required to support clicking on "hifi://" links
|
||||||
|
@ -142,16 +152,10 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
onFeaturePermissionRequested: {
|
onFeaturePermissionRequested: {
|
||||||
console.log('feature');
|
permissionPopupBackground.permissionsOptions.securityOrigin = securityOrigin;
|
||||||
console.log(JSON.stringify(feature, null, 4));
|
permissionPopupBackground.permissionsOptions.feature = feature;
|
||||||
|
|
||||||
if (feature === 0) return;
|
permissionPopupBackground.visible = true;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//disable popup
|
//disable popup
|
||||||
|
@ -197,13 +201,10 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.PermissionPopupBackground {
|
ControlsUit.PermissionPopupBackground {
|
||||||
id: permissionPopup
|
id: permissionPopupBackground
|
||||||
onSendPermission: {
|
onSendPermission: {
|
||||||
console.log("security origin we are allowing", securityOrigin);
|
webViewCore.grantFeaturePermission(securityOrigin, feature, shouldGivePermission);
|
||||||
console.log("feature we are allowing", securityOrigin);
|
|
||||||
console.log("shouldGivePermission:", shouldGivePermission);
|
|
||||||
webViewCore.grantFeaturePermission(securityOrigin, feature, shouldGivePermission)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,11 @@
|
||||||
|
|
||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtWebEngine 1.5
|
import QtWebEngine 1.5
|
||||||
|
import controlsUit 1.0 as ControlsUit
|
||||||
|
|
||||||
WebEngineView {
|
WebEngineView {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
console.log("Connecting JS messaging to Hifi Logging")
|
console.log("Connecting JS messaging to Hifi Logging")
|
||||||
// Ensure the JS from the web-engine makes it to our logging
|
// Ensure the JS from the web-engine makes it to our logging
|
||||||
|
@ -22,6 +23,10 @@ WebEngineView {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onUrlChanged: {
|
||||||
|
permissionPopupBackground.visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
onLoadingChanged: {
|
onLoadingChanged: {
|
||||||
// Required to support clicking on "hifi://" links
|
// Required to support clicking on "hifi://" links
|
||||||
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
||||||
|
@ -37,6 +42,17 @@ WebEngineView {
|
||||||
WebSpinner { }
|
WebSpinner { }
|
||||||
|
|
||||||
onFeaturePermissionRequested: {
|
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 QtQuick 2.5
|
||||||
|
import QtWebEngine 1.5
|
||||||
import controlsUit 1.0 as HifiControls
|
import controlsUit 1.0 as HifiControls
|
||||||
import stylesUit 1.0 as HifiStyles
|
import stylesUit 1.0 as HifiStyles
|
||||||
import "../windows" as Windows
|
import "../windows" as Windows
|
||||||
|
@ -11,7 +12,26 @@ Item {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
z:100
|
z:100
|
||||||
|
property var permissionLanguage: {
|
||||||
|
"test": "test"
|
||||||
|
}
|
||||||
|
property int currentRequestedPermission
|
||||||
signal permissionButtonPressed(real buttonNumber)
|
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
|
// anchors.top: buttons.bottom
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -25,7 +45,7 @@ Item {
|
||||||
height: root.height * 0.30
|
height: root.height * 0.30
|
||||||
HifiStyles.RalewayBold {
|
HifiStyles.RalewayBold {
|
||||||
id: webAccessHeaderText
|
id: webAccessHeaderText
|
||||||
text: "WEB CAMERA ACCESS REQUEST"
|
text: "REQUEST FOR DEVICE ACCESS"
|
||||||
width: mainContainer.width
|
width: mainContainer.width
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
@ -43,7 +63,7 @@ Item {
|
||||||
width: mainContainer.width
|
width: mainContainer.width
|
||||||
id: webAccessInfoText
|
id: webAccessInfoText
|
||||||
horizontalAlignment: Text.AlignHCenter
|
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
|
size: 15
|
||||||
color: hifi.colors.black
|
color: hifi.colors.black
|
||||||
}
|
}
|
|
@ -5,13 +5,13 @@ import "../windows"
|
||||||
import "../."
|
import "../."
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: permissionPopupBackground
|
id: root
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: Qt.rgba(0, 0, 0, 0.5);
|
color: Qt.rgba(0, 0, 0, 0.5);
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
visible: true
|
visible: false
|
||||||
property variant permissionsOptions: {'securityOrigin':'none','feature':'none'}
|
property variant permissionsOptions: {'securityOrigin':'none','feature': -1}
|
||||||
signal sendPermission(string securityOrigin, string feature, bool shouldGivePermission)
|
signal sendPermission(string securityOrigin, int feature, bool shouldGivePermission)
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
console.log("loaded component");
|
console.log("loaded component");
|
||||||
|
@ -21,6 +21,7 @@ Rectangle {
|
||||||
PermissionPopup {
|
PermissionPopup {
|
||||||
id: permissionPopupItem
|
id: permissionPopupItem
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
permissionPopupItem.currentRequestedPermission = permissionsOptions.feature;
|
||||||
console.log("test");
|
console.log("test");
|
||||||
// console.log("\n\n TESTING!! \n\n")
|
// console.log("\n\n TESTING!! \n\n")
|
||||||
}
|
}
|
||||||
|
@ -28,13 +29,13 @@ Rectangle {
|
||||||
console.log("JUST MADE IT TO ON PERMISSIONS PRESSEED!");
|
console.log("JUST MADE IT TO ON PERMISSIONS PRESSEED!");
|
||||||
console.log(buttonNumber);
|
console.log(buttonNumber);
|
||||||
if (buttonNumber === 0) {
|
if (buttonNumber === 0) {
|
||||||
permissionPopupBackground.sendPermission(permissionsOptions.securityOrigin, permissionsOptions.feature, true)
|
root.sendPermission(permissionsOptions.securityOrigin, permissionsOptions.feature, true)
|
||||||
} else {
|
} 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.securityOrigin = "none";
|
||||||
permissionsOptions.feature = "none";
|
permissionsOptions.feature = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,6 +15,8 @@ Key 1.0 Key.qml
|
||||||
Keyboard 1.0 Keyboard.qml
|
Keyboard 1.0 Keyboard.qml
|
||||||
Label 1.0 Label.qml
|
Label 1.0 Label.qml
|
||||||
QueuedButton 1.0 QueuedButton.qml
|
QueuedButton 1.0 QueuedButton.qml
|
||||||
|
PermissionPopup 1.0 PermissionPopup.qml
|
||||||
|
PermissionPopupBackground 1.0 PermissionPopupBackground.qml
|
||||||
RadioButton 1.0 RadioButton.qml
|
RadioButton 1.0 RadioButton.qml
|
||||||
ScrollBar 1.0 ScrollBar.qml
|
ScrollBar 1.0 ScrollBar.qml
|
||||||
Separator 1.0 Separator.qml
|
Separator 1.0 Separator.qml
|
||||||
|
|
|
@ -140,6 +140,6 @@ InteractiveWindowPointer DesktopScriptingInterface::createWindowOnThread(const Q
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
InteractiveWindowPointer window = new InteractiveWindow(sourceUrl, properties);
|
InteractiveWindowPointer window = new InteractiveWindow(sourceUrl, properties);
|
||||||
window->moveToThread(targetThread);
|
// window->moveToThread(targetThread);
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue