diff --git a/app/gui/GamepadMapper.qml b/app/gui/GamepadMapper.qml new file mode 100644 index 00000000..4016724b --- /dev/null +++ b/app/gui/GamepadMapper.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 + +Item { + objectName: "Gamepad Mapping" +} diff --git a/app/gui/PcView.qml b/app/gui/PcView.qml index 8b3bdcde..754f1bd3 100644 --- a/app/gui/PcView.qml +++ b/app/gui/PcView.qml @@ -144,7 +144,7 @@ GridView { var component = Qt.createComponent("AppView.qml") var appView = component.createObject(stackView) appView.computerIndex = index - appView.objectName = "Apps on " + model.name + appView.objectName = model.name stackView.push(appView) } else { diff --git a/app/gui/main.qml b/app/gui/main.qml index 9c5d2e88..da7050c2 100644 --- a/app/gui/main.qml +++ b/app/gui/main.qml @@ -15,6 +15,22 @@ ApplicationWindow { anchors.fill: parent } + function navigateTo(url, objectName) + { + var existingItem = stackView.find(function(item, index) { + return item.objectName === objectName + }) + + if (existingItem !== null) { + // Pop to the existing item + stackView.pop(existingItem) + } + else { + // Create a new item + stackView.push(url) + } + } + header: ToolBar { RowLayout { @@ -45,17 +61,6 @@ ApplicationWindow { Layout.fillWidth: true } - ToolButton { - icon.source: "qrc:/res/settings.png" - onClicked: stackView.push("qrc:/gui/SettingsView.qml") - - Menu { - id: optionsMenu - x: parent.width - transformOrigin: Menu.TopRight - } - } - ToolButton { icon.source: "qrc:/res/question_mark.png" @@ -68,6 +73,28 @@ ApplicationWindow { transformOrigin: Menu.TopRight } } + + ToolButton { + icon.source: "qrc:/res/ic_videogame_asset_white_48px.svg" + onClicked: navigateTo("qrc:/gui/GamepadMapper.qml", "Gamepad Mapping") + + Menu { + id: gamepadMappingMenu + x: parent.width + transformOrigin: Menu.TopRight + } + } + + ToolButton { + icon.source: "qrc:/res/settings.png" + onClicked: navigateTo("qrc:/gui/SettingsView.qml", "Settings") + + Menu { + id: optionsMenu + x: parent.width + transformOrigin: Menu.TopRight + } + } } } } diff --git a/app/qml.qrc b/app/qml.qrc index 73a252e8..dbbd4db0 100644 --- a/app/qml.qrc +++ b/app/qml.qrc @@ -8,5 +8,6 @@ gui/AppView.qml gui/SettingsView.qml gui/StreamSegue.qml + gui/GamepadMapper.qml