From: Ruediger Gad Date: Mon, 16 Apr 2012 16:51:45 +0000 (+0200) Subject: Fix key binding settings for multi remote version. X-Git-Url: http://vcs.maemo.org/git/?a=commitdiff_plain;h=644e9c3c8c639b57fcbeae9da9e934d946f5c3c4;p=qzeecontrol Fix key binding settings for multi remote version. --- diff --git a/btconnector.cpp b/btconnector.cpp index aeca38a..8f5f97e 100644 --- a/btconnector.cpp +++ b/btconnector.cpp @@ -69,6 +69,7 @@ void BtConnector::disconnect(){ /* * Explicitly set D to false in case the remote was shut off * using the power key, which equals the 'D' key. + * Well, good intention but doesn't seem to work. */ setD(false); } diff --git a/qml/QZeeControl/KeyBindingSettings.qml b/qml/QZeeControl/KeyBindingSettings.qml index 71f43ef..9cc0f22 100644 --- a/qml/QZeeControl/KeyBindingSettings.qml +++ b/qml/QZeeControl/KeyBindingSettings.qml @@ -30,30 +30,42 @@ Sheet { acceptButtonText: "Save" rejectButtonText: "Cancel" + property string currentRemote: "none" + function loadBindings(){ - console.log("Loading stored key bindings.") - fieldA.text = SettingsStorage.getSetting("A") - fieldB.text = SettingsStorage.getSetting("B") - fieldC.text = SettingsStorage.getSetting("C") - fieldD.text = SettingsStorage.getSetting("D") - - fieldUp.text = SettingsStorage.getSetting("Up") - fieldDown.text = SettingsStorage.getSetting("Down") - fieldLeft.text = SettingsStorage.getSetting("Left") - fieldRight.text = SettingsStorage.getSetting("Right") + if(currentRemote === "none"){ + console.log("Current remote is none. Not going to load key bindings.") + return + } + + console.log("Loading stored key bindings for " + currentRemote + ".") + fieldA.text = SettingsStorage.getSetting(currentRemote + "A") + fieldB.text = SettingsStorage.getSetting(currentRemote + "B") + fieldC.text = SettingsStorage.getSetting(currentRemote + "C") + fieldD.text = SettingsStorage.getSetting(currentRemote + "D") + + fieldUp.text = SettingsStorage.getSetting(currentRemote + "Up") + fieldDown.text = SettingsStorage.getSetting(currentRemote + "Down") + fieldLeft.text = SettingsStorage.getSetting(currentRemote + "Left") + fieldRight.text = SettingsStorage.getSetting(currentRemote + "Right") } function saveBindings(){ - console.log("Saving new key bindings.") - SettingsStorage.setSetting("A", fieldA.text) - SettingsStorage.setSetting("B", fieldB.text) - SettingsStorage.setSetting("C", fieldC.text) - SettingsStorage.setSetting("D", fieldD.text) - - SettingsStorage.setSetting("Up", fieldUp.text) - SettingsStorage.setSetting("Down", fieldDown.text) - SettingsStorage.setSetting("Left", fieldLeft.text) - SettingsStorage.setSetting("Right", fieldRight.text) + if(currentRemote === "none"){ + console.log("Current remote is none. Not going to save key bindings.") + return + } + + console.log("Saving new key bindings for " + currentRemote + ".") + SettingsStorage.setSetting(currentRemote + "A", fieldA.text) + SettingsStorage.setSetting(currentRemote + "B", fieldB.text) + SettingsStorage.setSetting(currentRemote + "C", fieldC.text) + SettingsStorage.setSetting(currentRemote + "D", fieldD.text) + + SettingsStorage.setSetting(currentRemote + "Up", fieldUp.text) + SettingsStorage.setSetting(currentRemote + "Down", fieldDown.text) + SettingsStorage.setSetting(currentRemote + "Left", fieldLeft.text) + SettingsStorage.setSetting(currentRemote + "Right", fieldRight.text) } onAccepted: saveBindings() diff --git a/qml/QZeeControl/main.qml b/qml/QZeeControl/main.qml index 783ee85..c675d53 100644 --- a/qml/QZeeControl/main.qml +++ b/qml/QZeeControl/main.qml @@ -46,6 +46,8 @@ PageStackWindow { name: "Zee_2" usedAddresses: zeeTab1.currentAddress } + + onCurrentTabChanged: keyBindingsSettings.currentRemote = currentTab.name } } @@ -100,6 +102,6 @@ PageStackWindow { KeyBindingSettings{ id: keyBindingsSettings - onAccepted: mainPage.loadKeyBindings() + onAccepted: tabGroup.currentTab.loadKeyBindings() } }