Make script launched windows invisible at creation time

This commit is contained in:
Brad Davis 2015-12-30 11:38:34 -08:00
parent d6f5296c3b
commit f4bd2afc8e
5 changed files with 19 additions and 43 deletions

View file

@ -62,8 +62,13 @@ var directory = (function () {
function setUp() {
viewport = Controller.getViewportDimensions();
directoryWindow = new OverlayWebWindow('Directory', DIRECTORY_URL, 900, 700, false);
directoryWindow.setVisible(false);
directoryWindow = new OverlayWebWindow({
title: 'Directory',
source: DIRECTORY_URL,
width: 900,
height: 700,
visible: false
});
directoryButton = Overlays.addOverlay("image", {
imageURL: DIRECTORY_BUTTON_URL,

View file

@ -10,7 +10,8 @@ VrDialog {
HifiConstants { id: hifi }
title: "WebWindow"
resizable: true
enabled: false
enabled: false
visible: false
// Don't destroy on close... otherwise the JS/C++ will have a dangling pointer
destroyOnCloseButton: false
contentImplicitWidth: clientArea.implicitWidth
@ -29,7 +30,7 @@ VrDialog {
console.log("Web Window JS message: " + sourceID + " " + lineNumber + " " + message);
});
// Required to support clicking on "hifi://" links
// Required to support clicking on "hifi://" links
webview.loadingChanged.connect(handleWebviewLoading)
}
@ -54,6 +55,7 @@ VrDialog {
id: webview
url: root.source
anchors.fill: parent
focus: true
onUrlChanged: {
var currentUrl = url.toString();

View file

@ -14,52 +14,16 @@ VrDialog {
title: "QmlWindow"
resizable: true
enabled: false
visible: false
focus: true
property var channel;
// Don't destroy on close... otherwise the JS/C++ will have a dangling pointer
destroyOnCloseButton: false
contentImplicitWidth: clientArea.implicitWidth
contentImplicitHeight: clientArea.implicitHeight
property alias source: pageLoader.source
/*
WebSocket {
id: socket
url: "ws://localhost:51016";
active: false
// the following three properties/functions are required to align the QML WebSocket API with the HTML5 WebSocket API.
property var send: function (arg) {
sendTextMessage(arg);
}
onTextMessageReceived: {
onmessage({data: message});
}
property var onmessage;
onStatusChanged: {
if (socket.status == WebSocket.Error) {
console.error("Error: " + socket.errorString)
} else if (socket.status == WebSocket.Closed) {
console.log("Socket closed");
} else if (socket.status == WebSocket.Open) {
console.log("Connected")
//open the webchannel with the socket as transport
new WebChannel.QWebChannel(socket, function(ch) {
root.channel = ch;
var myUrl = root.source.toString().toLowerCase();
console.log(myUrl);
var bridge = root.channel.objects[myUrl];
console.log(bridge);
});
}
}
}
*/
Keys.onPressed: {
console.log("QmlWindow keypress")
}
@ -73,6 +37,7 @@ VrDialog {
width: root.clientWidth
height: root.clientHeight
focus: true
clip: true
Loader {
id: pageLoader
@ -82,7 +47,6 @@ VrDialog {
onLoaded: {
console.log("Loaded content")
//socket.active = true; //connect
forceActiveFocus()
}

View file

@ -41,6 +41,11 @@ DialogBase {
// modify the visibility
onEnabledChanged: {
opacity = enabled ? 1.0 : 0.0
// If the dialog is initially invisible, setting opacity doesn't
// trigger making it visible.
if (enabled) {
visible = true;
}
}
// The actual animator

View file

@ -122,7 +122,7 @@ QScriptValue QmlWindowClass::internalConstructor(const QString& qmlSource,
height = argumentObject.property(HEIGHT_PROPERTY).toInt32();
}
if (argumentObject.property(VISIBILE_PROPERTY).isBool()) {
visible = argumentObject.property(VISIBILE_PROPERTY).isBool();
visible = argumentObject.property(VISIBILE_PROPERTY).toBool();
}
}