Update help window to auto select xbox or vive controller tab on availability of device

This commit is contained in:
Ryan Huffman 2016-11-01 13:43:55 -07:00
parent 16d91833e8
commit 3147ea9e33
2 changed files with 28 additions and 6 deletions

View file

@ -50,21 +50,33 @@
function showKbm() {
document.getElementById("main_image").setAttribute("src", "img/controls-help-keyboard.png");
}
function showHandControllers() {
function showViveControllers() {
document.getElementById("main_image").setAttribute("src", "img/controls-help-vive.png");
}
function showGameController() {
function showXboxController() {
document.getElementById("main_image").setAttribute("src", "img/controls-help-gamepad.png");
}
function load() {
console.log("In help.html: ", window.location.href);
parts = window.location.href.split("?");
if (parts.length > 0) {
var defaultTab = parts[1];
if (defaultTab == "xbox") {
showXboxController();
} else if (defaultTab == "vive") {
showViveControllers();
}
}
}
</script>
</head>
<body>
<body onload="load()">
<div id="image_area">
<img id="main_image" src="img/controls-help-keyboard.png" width="1024px" height="720px"></img>
<a href="#" id="kbm_button" onmousedown="showKbm()"></a>
<a href="#" id="hand_controllers_button" onmousedown="showHandControllers()"></a>
<a href="#" id="game_controller_button" onmousedown="showGameController()"></a>
<a href="#" id="hand_controllers_button" onmousedown="showViveControllers()"></a>
<a href="#" id="game_controller_button" onmousedown="showXboxController()"></a>
</div>
</body>

View file

@ -2155,7 +2155,17 @@ void Application::aboutApp() {
}
void Application::showHelp() {
InfoView::show(INFO_HELP_PATH);
static const QString QUERY_STRING_XBOX = "xbox";
static const QString QUERY_STRING_VIVE = "vive";
QString queryString = "";
if (PluginUtils::isViveControllerAvailable()) {
queryString = QUERY_STRING_VIVE;
} else if (PluginUtils::isXboxControllerAvailable()) {
queryString = QUERY_STRING_XBOX;
}
InfoView::show(INFO_HELP_PATH, false, queryString);
}
void Application::resizeEvent(QResizeEvent* event) {