mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-03 06:31:46 +02:00
readded ctrl+n and ctrl+b as shortcuts with a default script
This commit is contained in:
parent
6e4b9c1723
commit
d1470d3323
4 changed files with 50 additions and 1 deletions
|
@ -638,3 +638,13 @@ void WindowScriptingInterface::setActiveDisplayPlugin(int index) {
|
||||||
auto name = PluginManager::getInstance()->getDisplayPlugins().at(index)->getName();
|
auto name = PluginManager::getInstance()->getDisplayPlugins().at(index)->getName();
|
||||||
qApp->setActiveDisplayPlugin(name);
|
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");
|
||||||
|
}
|
||||||
|
|
|
@ -608,6 +608,12 @@ public slots:
|
||||||
*/
|
*/
|
||||||
void setActiveDisplayPlugin(int index);
|
void setActiveDisplayPlugin(int index);
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Opens `Browser.qml` in a pop-up window.
|
||||||
|
* @function Window.openWebBrowser
|
||||||
|
*/
|
||||||
|
void openWebBrowser();
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onWindowGeometryChanged(const QRect& geometry);
|
void onWindowGeometryChanged(const QRect& geometry);
|
||||||
|
|
|
@ -33,7 +33,8 @@ var DEFAULT_SCRIPTS_COMBINED = [
|
||||||
"system/tablet-ui/tabletUI.js",
|
"system/tablet-ui/tabletUI.js",
|
||||||
"system/emote.js",
|
"system/emote.js",
|
||||||
"system/miniTablet.js",
|
"system/miniTablet.js",
|
||||||
"system/audioMuteOverlay.js"
|
"system/audioMuteOverlay.js",
|
||||||
|
"system/keyboardShortcuts/keyboardShortcuts.js"
|
||||||
];
|
];
|
||||||
var DEFAULT_SCRIPTS_SEPARATE = [
|
var DEFAULT_SCRIPTS_SEPARATE = [
|
||||||
"system/controllers/controllerScripts.js",
|
"system/controllers/controllerScripts.js",
|
||||||
|
|
32
scripts/system/keyboardShortcuts/keyboardShortcuts.js
Normal file
32
scripts/system/keyboardShortcuts/keyboardShortcuts.js
Normal 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
|
Loading…
Reference in a new issue