Merge pull request #15856 from PrestonB1123/defaultShortcuts

DEV-173: Re-enable shortcuts
This commit is contained in:
Shannon Romano 2019-06-28 15:29:53 -07:00 committed by GitHub
commit 89f654175c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 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 a web browser 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,29 @@
"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) {
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