2 * Copyright 2012 Ruediger Gad
4 * This file is part of QZeeControl.
6 * QZeeControl is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * QZeeControl is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with QZeeControl. If not, see <http://www.gnu.org/licenses/>.
21 import com.nokia.meego 1.0
22 import "settingsstorage.js" as SettingsStorage
25 id: keyBindingSettings
27 visualParent: mainPage
30 acceptButtonText: "Save"
31 rejectButtonText: "Cancel"
33 property string currentRemote: "none"
35 function loadBindings(){
36 if(currentRemote === "none"){
37 console.log("Current remote is none. Not going to load key bindings.")
41 console.log("Loading stored key bindings for " + currentRemote + ".")
42 fieldA.text = SettingsStorage.getSetting(currentRemote + "A")
43 fieldB.text = SettingsStorage.getSetting(currentRemote + "B")
44 fieldC.text = SettingsStorage.getSetting(currentRemote + "C")
45 fieldD.text = SettingsStorage.getSetting(currentRemote + "D")
47 fieldUp.text = SettingsStorage.getSetting(currentRemote + "Up")
48 fieldDown.text = SettingsStorage.getSetting(currentRemote + "Down")
49 fieldLeft.text = SettingsStorage.getSetting(currentRemote + "Left")
50 fieldRight.text = SettingsStorage.getSetting(currentRemote + "Right")
53 function saveBindings(){
54 if(currentRemote === "none"){
55 console.log("Current remote is none. Not going to save key bindings.")
59 console.log("Saving new key bindings for " + currentRemote + ".")
60 SettingsStorage.setSetting(currentRemote + "A", fieldA.text)
61 SettingsStorage.setSetting(currentRemote + "B", fieldB.text)
62 SettingsStorage.setSetting(currentRemote + "C", fieldC.text)
63 SettingsStorage.setSetting(currentRemote + "D", fieldD.text)
65 SettingsStorage.setSetting(currentRemote + "Up", fieldUp.text)
66 SettingsStorage.setSetting(currentRemote + "Down", fieldDown.text)
67 SettingsStorage.setSetting(currentRemote + "Left", fieldLeft.text)
68 SettingsStorage.setSetting(currentRemote + "Right", fieldRight.text)
71 onAccepted: saveBindings()
74 if(status === DialogStatus.Opening){
82 contentHeight: contentGrid.height + explanationLabel.height
87 anchors{top: parent.top}
166 anchors{top: contentGrid.bottom; left: parent.left; right: parent.right; margins: 20}
167 horizontalAlignment: Text.AlignHCenter
168 wrapMode: Text.WordWrap
170 text: "Some possibly useful key names are:\nUp, Down, Left, Right, Return, space\n" +
171 "If you don't need any of these special keys just enter a single character for each key binding. " +
172 "Upper- and lowercase characters are allowed."