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 function loadBindings(){
34 console.log("Loading stored key bindings.")
35 fieldA.text = SettingsStorage.getSetting("A")
36 fieldB.text = SettingsStorage.getSetting("B")
37 fieldC.text = SettingsStorage.getSetting("C")
38 fieldD.text = SettingsStorage.getSetting("D")
40 fieldUp.text = SettingsStorage.getSetting("Up")
41 fieldDown.text = SettingsStorage.getSetting("Down")
42 fieldLeft.text = SettingsStorage.getSetting("Left")
43 fieldRight.text = SettingsStorage.getSetting("Right")
46 function saveBindings(){
47 console.log("Saving new key bindings.")
48 SettingsStorage.setSetting("A", fieldA.text)
49 SettingsStorage.setSetting("B", fieldB.text)
50 SettingsStorage.setSetting("C", fieldC.text)
51 SettingsStorage.setSetting("D", fieldD.text)
53 SettingsStorage.setSetting("Up", fieldUp.text)
54 SettingsStorage.setSetting("Down", fieldDown.text)
55 SettingsStorage.setSetting("Left", fieldLeft.text)
56 SettingsStorage.setSetting("Right", fieldRight.text)
59 onAccepted: saveBindings()
62 if(status === DialogStatus.Opening){
70 contentHeight: contentGrid.height
75 anchors{top: parent.top}
153 anchors{top: contentGrid.bottom; left: parent.left; right: parent.right; margins: 20}
154 horizontalAlignment: Text.AlignHCenter
155 wrapMode: Text.WordWrap
157 text: "Some possibly useful key names are:\nUp, Down, Left, Right, Return, Space\n" +
158 "If you don't need any of these special keys just enter a single character for each key binding. " +
159 "Upper- and lowercase characters are allowed."