mirror of
https://github.com/overte-org/overte.git
synced 2025-07-22 13:13:54 +02:00
Optimized settings.js
This commit is contained in:
parent
f3a31a7081
commit
f27a52d83e
1 changed files with 16 additions and 18 deletions
|
@ -23,6 +23,7 @@
|
|||
var tablet;
|
||||
var appButton;
|
||||
var active = false;
|
||||
const url = Script.resolvePath("./settings.qml")
|
||||
|
||||
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
appButton = tablet.addButton({
|
||||
|
@ -41,30 +42,27 @@
|
|||
// Overlay button toggle
|
||||
appButton.clicked.connect(toolbarButtonClicked);
|
||||
tablet.fromQml.connect(fromQML);
|
||||
tablet.screenChanged.connect(onTabletScreenChanged);
|
||||
|
||||
function toolbarButtonClicked() {
|
||||
if (active) {
|
||||
tablet.gotoHomeScreen();
|
||||
active = !active;
|
||||
appButton.editProperties({
|
||||
isActive: active,
|
||||
});
|
||||
} else {
|
||||
tablet.loadQMLSource(Script.resolvePath("./settings.qml"));
|
||||
active = !active;
|
||||
appButton.editProperties({
|
||||
isActive: active,
|
||||
});
|
||||
}
|
||||
if (active) tablet.gotoHomeScreen();
|
||||
else tablet.loadQMLSource(url);
|
||||
|
||||
active = !active;
|
||||
appButton.editProperties({
|
||||
isActive: active,
|
||||
});
|
||||
}
|
||||
|
||||
// Functions
|
||||
function getActivePolls(){
|
||||
// Send hello world
|
||||
// Add responses to list
|
||||
function onTabletScreenChanged(type, new_url){
|
||||
if (url == new_url) active = true;
|
||||
else active = false;
|
||||
|
||||
appButton.editProperties({
|
||||
isActive: active,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Communication
|
||||
function fromQML(event) {
|
||||
console.log(`New QML event:\n${JSON.stringify(event)}`);
|
||||
|
|
Loading…
Reference in a new issue