From 8eb6699420414d5f604bb85241c444af145d9737 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Wed, 2 Nov 2016 16:50:37 -0700 Subject: [PATCH] help script --- scripts/defaultScripts.js | 3 +- scripts/system/assets/images/tools/help.svg | 110 ++++++++++++++++++++ scripts/system/help.js | 41 ++++++++ 3 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 scripts/system/assets/images/tools/help.svg create mode 100644 scripts/system/help.js diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index 718b5f3d3e..4376960ea5 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -32,7 +32,8 @@ var DEFAULT_SCRIPTS = [ "system/controllers/toggleAdvancedMovementForHandControllers.js", "system/dialTone.js", "system/firstPersonHMD.js", - "system/snapshot.js" + "system/snapshot.js", + "system/help.js" ]; // add a menu item for debugging diff --git a/scripts/system/assets/images/tools/help.svg b/scripts/system/assets/images/tools/help.svg new file mode 100644 index 0000000000..b7fa8ca5cd --- /dev/null +++ b/scripts/system/assets/images/tools/help.svg @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scripts/system/help.js b/scripts/system/help.js new file mode 100644 index 0000000000..e79ed0444c --- /dev/null +++ b/scripts/system/help.js @@ -0,0 +1,41 @@ +"use strict"; + +// +// help.js +// scripts/system/ +// +// Created by Howard Stearns on 2 Nov 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 +// + +(function() { // BEGIN LOCAL_SCOPE + + var toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); + var buttonName = "help"; // matching location reserved in Desktop.qml + var button = toolBar.addButton({ + objectName: buttonName, + imageURL: Script.resolvePath("assets/images/tools/help.svg"), + visible: true, + hoverState: 2, + defaultState: 1, + buttonState: 1, + alpha: 0.9 + }); + + // TODO: make button state reflect whether the window is opened or closed (independently from us). + + function onClicked(){ + Menu.triggerOption('Help...') + } + + button.clicked.connect(onClicked); + + Script.scriptEnding.connect(function () { + toolBar.removeButton(buttonName); + button.clicked.disconnect(onClicked); + }); + +}()); // END LOCAL_SCOPE