From 1e5e6a12db4a369c334fb06f90d243404c0c6369 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Mon, 19 Dec 2016 19:34:24 -0800 Subject: [PATCH] add support for an HMD script debug log window --- scripts/developer/debugging/debugWindow.js | 25 +++++++++++++++ scripts/developer/debugging/debugWindow.qml | 35 +++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 scripts/developer/debugging/debugWindow.js create mode 100644 scripts/developer/debugging/debugWindow.qml diff --git a/scripts/developer/debugging/debugWindow.js b/scripts/developer/debugging/debugWindow.js new file mode 100644 index 0000000000..c5d600458d --- /dev/null +++ b/scripts/developer/debugging/debugWindow.js @@ -0,0 +1,25 @@ +// +// debugWindow.js +// +// Brad Hefta-Gaub, created on 12/19/2016. +// Copyright 2016 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + + +// Set up the qml ui +var qml = Script.resolvePath('debugWindow.qml'); +var window = new OverlayWindow({ + title: 'Debug Window', + source: qml, + width: 400, height: 900, +}); +window.setPosition(25, 50); +window.closed.connect(function() { Script.stop(); }); + +// Demonstrate sending a message to the QML window +ScriptDiscoveryService.printedMessage.connect(function(message, scriptFileName) { + window.sendToQml("[" + scriptFileName + "] " + message); +}); diff --git a/scripts/developer/debugging/debugWindow.qml b/scripts/developer/debugging/debugWindow.qml new file mode 100644 index 0000000000..867e5bca47 --- /dev/null +++ b/scripts/developer/debugging/debugWindow.qml @@ -0,0 +1,35 @@ +// +// InfoView.qml +// +// Created by Bradley Austin Davis on 27 Apr 2015 +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +import QtQuick 2.5 +import QtQuick.Controls 1.4 +import Hifi 1.0 as Hifi + + +Rectangle { + id: root + width: parent ? parent.width : 100 + height: parent ? parent.height : 100 + + property var channel; + + TextArea { + id: textArea + width: parent.width + height: parent.height + text:"" + } + + function fromScript(message) { + textArea.text += message + "\n"; + } +} + +