Remove toolbar from tablet-goto.js

This commit is contained in:
Anthony J. Thibault 2017-02-16 17:36:16 -08:00
parent 345f0519ef
commit 2ea88012f9

View file

@ -13,53 +13,26 @@
(function() { // BEGIN LOCAL_SCOPE (function() { // BEGIN LOCAL_SCOPE
var gotoQmlSource = "TabletAddressDialog.qml"; var gotoQmlSource = "TabletAddressDialog.qml";
var button;
var buttonName = "GOTO"; var buttonName = "GOTO";
var toolBar = null;
var tablet = null;
function onAddressBarShown(visible) {
if (toolBar) {
button.editProperties({isActive: visible});
}
}
function onClicked(){ function onClicked(){
if (toolBar) {
DialogsManager.toggleAddressBar();
} else {
tablet.loadQMLSource(gotoQmlSource); tablet.loadQMLSource(gotoQmlSource);
} }
} var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
if (Settings.getValue("HUDUIEnabled")) { var button = tablet.addButton({
toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
button = toolBar.addButton({
objectName: buttonName,
imageURL: Script.resolvePath("assets/images/tools/directory.svg"),
visible: true,
alpha: 0.9
});
} else {
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
button = tablet.addButton({
icon: "icons/tablet-icons/goto-i.svg", icon: "icons/tablet-icons/goto-i.svg",
activeIcon: "icons/tablet-icons/goto-a.svg", activeIcon: "icons/tablet-icons/goto-a.svg",
text: buttonName, text: buttonName,
sortOrder: 8 sortOrder: 8
}); });
}
button.clicked.connect(onClicked); button.clicked.connect(onClicked);
DialogsManager.addressBarShown.connect(onAddressBarShown);
Script.scriptEnding.connect(function () { Script.scriptEnding.connect(function () {
button.clicked.disconnect(onClicked); button.clicked.disconnect(onClicked);
if (tablet) { if (tablet) {
tablet.removeButton(button); tablet.removeButton(button);
} }
if (toolBar) {
toolBar.removeButton(buttonName);
}
DialogsManager.addressBarShown.disconnect(onAddressBarShown);
}); });
}()); // END LOCAL_SCOPE }()); // END LOCAL_SCOPE