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)); 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 setMenuEnabled(const QString& menuName, bool isEnabled);
void closeInfoView(const QString& path);
signals: signals:
/**jsdoc /**jsdoc
* This is a signal that is emitted when a menu item is clicked. * 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; return false;
} }
void Menu::closeInfoView(const QString& path) {
auto offscreenUi = DependencyManager::get<OffscreenUi>();
offscreenUi->hide(path);
}
void Menu::triggerOption(const QString& menuOption) { void Menu::triggerOption(const QString& menuOption) {
QAction* action = _actionHash.value(menuOption); QAction* action = _actionHash.value(menuOption);
if (action) { if (action) {

View file

@ -115,6 +115,8 @@ public slots:
void toggleDeveloperMenus(); void toggleDeveloperMenus();
void toggleAdvancedMenus(); void toggleAdvancedMenus();
void closeInfoView(const QString& path);
void triggerOption(const QString& menuOption); void triggerOption(const QString& menuOption);
static bool isSomeSubmenuShown() { return _isSomeSubmenuShown; } static bool isSomeSubmenuShown() { return _isSomeSubmenuShown; }

View file

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