readded ctrl+n and ctrl+b as shortcuts with a default script

This commit is contained in:
Preston Bezos 2019-06-28 14:33:03 -07:00
parent 6e4b9c1723
commit d1470d3323
4 changed files with 50 additions and 1 deletions

View file

@ -638,3 +638,13 @@ void WindowScriptingInterface::setActiveDisplayPlugin(int index) {
auto name = PluginManager::getInstance()->getDisplayPlugins().at(index)->getName();
qApp->setActiveDisplayPlugin(name);
}
void WindowScriptingInterface::openWebBrowser() {
if (QThread::currentThread() != thread()) {
QMetaObject::invokeMethod(this, "openWebBrowser", Qt::QueuedConnection);
return;
}
auto offscreenUi = DependencyManager::get<OffscreenUi>();
offscreenUi->load("Browser.qml");
}

View file

@ -608,6 +608,12 @@ public slots:
*/
void setActiveDisplayPlugin(int index);
/**jsdoc
* Opens `Browser.qml` in a pop-up window.
* @function Window.openWebBrowser
*/
void openWebBrowser();
private slots:
void onWindowGeometryChanged(const QRect& geometry);

View file

@ -33,7 +33,8 @@ var DEFAULT_SCRIPTS_COMBINED = [
"system/tablet-ui/tabletUI.js",
"system/emote.js",
"system/miniTablet.js",
"system/audioMuteOverlay.js"
"system/audioMuteOverlay.js",
"system/keyboardShortcuts/keyboardShortcuts.js"
];
var DEFAULT_SCRIPTS_SEPARATE = [
"system/controllers/controllerScripts.js",

View file

@ -0,0 +1,32 @@
"use strict";
//
// keyboardShortcuts.js
// scripts/system/keyboardShortcuts
//
// Created by Preston Bezos on 06/28/2019
// Copyright 2019 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
function keyPressEvent(event) {
if (event.text.toUpperCase() === "B" && event.isControl) {
console.log("TEST B");
Window.openWebBrowser();
}
else if (event.text.toUpperCase() === "N" && event.isControl) {
Users.toggleIgnoreRadius();
}
}
function scriptEnding() {
Controller.keyPressEvent.disconnect(keyPressEvent);
}
Controller.keyPressEvent.connect(keyPressEvent);
Script.scriptEnding.connect(scriptEnding);
}()); // END LOCAL_SCOPE