toggle help

This commit is contained in:
Dante Ruiz 2017-01-19 01:32:51 +00:00
parent 7389475281
commit 30b57b62da
5 changed files with 25 additions and 2 deletions

View file

@ -147,3 +147,7 @@ void MenuScriptingInterface::triggerOption(const QString& menuOption) {
QMetaObject::invokeMethod(Menu::getInstance(), "triggerOption", Q_ARG(const QString&, menuOption));
}
void MenuScriptingInterface::closeInfoView(const QString& path) {
QMetaObject::invokeMethod(Menu::getInstance(), "closeInfoView", Q_ARG(const QString&, path));
}

View file

@ -182,6 +182,8 @@ public slots:
*/
void setMenuEnabled(const QString& menuName, bool isEnabled);
void closeInfoView(const QString& path);
signals:
/**jsdoc
* This is a signal that is emitted when a menu item is clicked.

View file

@ -256,6 +256,11 @@ bool Menu::isOptionChecked(const QString& menuOption) const {
return false;
}
void Menu::closeInfoView(const QString& path) {
auto offscreenUi = DependencyManager::get<OffscreenUi>();
offscreenUi->hide(path);
}
void Menu::triggerOption(const QString& menuOption) {
QAction* action = _actionHash.value(menuOption);
if (action) {

View file

@ -114,6 +114,8 @@ public slots:
void toggleDeveloperMenus();
void toggleAdvancedMenus();
void closeInfoView(const QString& path);
void triggerOption(const QString& menuOption);

View file

@ -19,7 +19,7 @@
icon: "icons/tablet-icons/help-i.svg",
text: "HELP"
});
var enabled = false;
function onClicked() {
var HELP_URL = Script.resourcesPath() + "html/help.html";
@ -38,7 +38,17 @@
defaultTab = "gamepad";
}
var queryParameters = "handControllerName=" + handControllerName + "&defaultTab=" + defaultTab;
Menu.triggerOption('Help...');
print("Help enabled " + Menu.isMenuEnabled("Help..."))
if (enabled) {
Menu.closeInfoView('InfoView_html/help.html');
enabled = !enabled;
button.editProperties({isActive: enabled});
} else {
Menu.triggerOption('Help...');
enabled = !enabled;
button.editProperties({isActive: enabled});
}
}
button.clicked.connect(onClicked);