summaryrefslogtreecommitdiffstats
path: root/virtualkeyboard/content
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-03-20 16:57:03 +0100
committerGunnar Sletta <gunnar.sletta@digia.com>2013-03-20 16:58:12 +0100
commita8fcedc9f795b5d8aef04a2bffe359e981e6e580 (patch)
tree76b6edec19293c9ad61d0ac16fab92ba28617fef /virtualkeyboard/content
parentd35a7d2901e6d2f2bec4669fb610104e02abfa53 (diff)
Virtual keyboard code
Diffstat (limited to 'virtualkeyboard/content')
-rw-r--r--virtualkeyboard/content/Keyboard.qml241
-rw-r--r--virtualkeyboard/content/ScrollBar.qml66
-rw-r--r--virtualkeyboard/content/TextArea.qml88
-rw-r--r--virtualkeyboard/content/TextBase.qml95
-rw-r--r--virtualkeyboard/content/TextField.qml93
-rw-r--r--virtualkeyboard/content/components/AlternativeKeys.qml122
-rw-r--r--virtualkeyboard/content/components/AutoScroller.qml116
-rw-r--r--virtualkeyboard/content/components/BackspaceKey.qml54
-rw-r--r--virtualkeyboard/content/components/BaseKey.qml77
-rw-r--r--virtualkeyboard/content/components/ChangeLanguageKey.qml52
-rw-r--r--virtualkeyboard/content/components/CharacterPreviewBubble.qml87
-rw-r--r--virtualkeyboard/content/components/EnterKey.qml74
-rw-r--r--virtualkeyboard/content/components/HideKeyboardKey.qml51
-rw-r--r--virtualkeyboard/content/components/Icon.qml64
-rw-r--r--virtualkeyboard/content/components/InputEngine.qml179
-rw-r--r--virtualkeyboard/content/components/Key.qml64
-rw-r--r--virtualkeyboard/content/components/NumberKey.qml47
-rw-r--r--virtualkeyboard/content/components/PressedKey.qml66
-rw-r--r--virtualkeyboard/content/components/ShiftKey.qml73
-rw-r--r--virtualkeyboard/content/components/SpaceKey.qml63
-rw-r--r--virtualkeyboard/content/components/SymbolModeKey.qml50
-rw-r--r--virtualkeyboard/content/images/arrow.pngbin0 -> 264 bytes
-rw-r--r--virtualkeyboard/content/images/background.pngbin0 -> 34931 bytes
-rw-r--r--virtualkeyboard/content/images/backspace.pngbin0 -> 515 bytes
-rw-r--r--virtualkeyboard/content/images/enter.pngbin0 -> 584 bytes
-rw-r--r--virtualkeyboard/content/images/hidekeyboard.pngbin0 -> 251 bytes
-rw-r--r--virtualkeyboard/content/images/keypad.pngbin0 -> 14899 bytes
-rw-r--r--virtualkeyboard/content/images/shift.pngbin0 -> 310 bytes
-rw-r--r--virtualkeyboard/content/images/space.pngbin0 -> 240 bytes
-rw-r--r--virtualkeyboard/content/layouts/ar_AR.qml85
-rw-r--r--virtualkeyboard/content/layouts/en_GB.qml184
-rw-r--r--virtualkeyboard/content/layouts/fi_FI.qml203
-rw-r--r--virtualkeyboard/content/layouts/numbers.qml103
-rw-r--r--virtualkeyboard/content/layouts/symbols.qml186
34 files changed, 2583 insertions, 0 deletions
diff --git a/virtualkeyboard/content/Keyboard.qml b/virtualkeyboard/content/Keyboard.qml
new file mode 100644
index 0000000..7ceb0bf
--- /dev/null
+++ b/virtualkeyboard/content/Keyboard.qml
@@ -0,0 +1,241 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "components"
+import Example.PlatformInputContext 1.0
+import Qt.labs.folderlistmodel 2.0
+
+Image {
+ id: keyboard
+
+ property var activeKey: 0
+ property int localeIndex: 1
+ property string locale: layoutsModel.count > 0 ? layoutsModel.get(localeIndex, "fileBaseName") : "en_GB"
+ property bool active: Qt.inputMethod.visible
+ property bool uppercased: uppercaseOnly ? true : (lowercaseOnly ? false : InputContext.shift || InputContext.capsLock)
+ property bool uppercaseOnly: InputContext.inputMethodHints & Qt.ImhUppercaseOnly
+ property bool lowercaseOnly: InputContext.inputMethodHints & Qt.ImhLowercaseOnly
+ property bool numberMode: InputContext.inputMethodHints & (Qt.ImhDialableCharactersOnly | Qt.ImhFormattedNumbersOnly | Qt.ImhDigitsOnly)
+ property bool symbolMode
+
+ z: 1
+ source: "images/keypad.png"
+ fillMode: Image.Stretch
+ width: parent.width
+ height: keyboardLayout.height+10
+ y: Qt.inputMethod.visible ? parent.height - height : parent.height
+
+ onLocaleChanged: InputContext.setLocale(locale)
+ onUppercasedChanged: if (Qt.inputMethod.visible) InputContext.handleUppercasing(uppercased)
+
+ function changeInputLanguage() {
+ localeIndex = (localeIndex+1) % layoutsModel.count
+ }
+
+ Behavior on y {
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ if (Qt.inputMethod.visible) {
+ keyboard.symbolMode = false
+ InputContext.handleUppercasing(uppercased)
+ }
+ InputContext.setAnimating(true)
+ }
+ }
+ NumberAnimation { duration: 300; easing.type: Easing.InOutQuad }
+ ScriptAction { script: InputContext.setAnimating(false) }
+ }
+ }
+ AutoScroller {}
+ FolderListModel {
+ id: layoutsModel
+ folder: "layouts"
+ nameFilters: ["*_*.qml"]
+ }
+ PressedKey {}
+ InputEngine { id: inputEngine }
+ AlternativeKeys { id: alternativeKeys }
+ Timer { id: releaseInaccuracyTimer; interval: 500 }
+ CharacterPreviewBubble { enabled: keyboardMouse.pressed && !alternativeKeys.active }
+ Binding {
+ target: InputContext
+ property: "keyboardRectangle"
+ value: Qt.rect(keyboard.x, keyboard.y, keyboard.width, keyboard.height)
+ }
+ Column {
+ id: keyboardLayout
+ anchors.centerIn: parent
+ Loader {
+ active: false
+ visible: keyboard.symbolMode && !keyboard.numberMode
+ source: "layouts/symbols.qml"
+ onVisibleChanged: if (visible) active = true
+ Component.onCompleted: if (visible) active = true
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Loader {
+ active: false
+ visible: keyboard.numberMode
+ source: "layouts/numbers.qml"
+ onVisibleChanged: if (visible) active = true
+ Component.onCompleted: if (visible) active = true
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Loader {
+ visible: !keyboard.symbolMode && !keyboard.numberMode
+ source: "layouts/" + keyboard.locale +".qml"
+ }
+ }
+ MouseArea {
+ id: keyboardMouse
+
+ property var initialKey
+ property var previousKey
+ property bool dragSymbolMode
+ property real pressAndHoldMargin: 6
+ property real releaseMargin: 18
+
+ anchors.fill: keyboardLayout
+
+ function press(key) {
+ if (key && key.enabled) {
+ if (key.key != Qt.Key_unknown || key.text.length > 0)
+ inputEngine.sendKeyPress(key.key, keyboard.uppercased ? key.text.toUpperCase() : key.text, keyboard.uppercased ? Qt.ShiftModifier : 0, key.repeat)
+ }
+ }
+ function release(key) {
+ if (key && key.enabled) {
+ if (key.key != Qt.Key_unknown || key.text.length > 0)
+ inputEngine.sendKeyRelease(key.key, keyboard.uppercased ? key.text.toUpperCase() : key.text, keyboard.uppercased ? Qt.ShiftModifier : 0)
+ key.clicked()
+ } else if (initialKey !== undefined) // rollback
+ InputContext.preeditText = InputContext.preeditText.substr(0, InputContext.preeditText.length-1)
+ }
+ function click(key) {
+ if (key && key.enabled) {
+ if (key.key != Qt.Key_unknown || key.text.length > 0)
+ inputEngine.sendKeyClick(key.key, keyboard.uppercased ? key.text.toUpperCase() : key.text, keyboard.uppercased ? Qt.ShiftModifier : 0, key.repeat)
+ key.clicked()
+ }
+ }
+ function setActiveKey(activeKey) {
+ if (keyboard.activeKey)
+ keyboard.activeKey.active = false
+ keyboard.activeKey = activeKey
+ if (keyboard.activeKey)
+ keyboard.activeKey.active = true
+ }
+ function keyOnMouse(mx, my) {
+ var parentItem = keyboardLayout
+ var child = parentItem.childAt(mx, my)
+ while (child != null) {
+ var position = parentItem.mapToItem(child, mx, my)
+ mx = position.x; my = position.y
+ parentItem = child
+ child = parentItem.childAt(mx, my)
+ if (child && child.key != undefined)
+ return child
+ }
+ return undefined
+ }
+ function hitInitialKey(mouseX, mouseY, margin) {
+ if (!initialKey)
+ return false
+ var position = initialKey.mapFromItem(keyboardMouse, mouseX, mouseY)
+ return (position.x > -margin
+ && position.y > -margin
+ && position.x < initialKey.width + margin
+ && position.y < initialKey.height + margin)
+ }
+ function reset() {
+ alternativeKeys.close()
+ previousKey = keyboard.activeKey
+ setActiveKey(0)
+ if (dragSymbolMode)
+ keyboard.symbolMode = false
+ dragSymbolMode = false
+ }
+
+ onPressed: {
+ releaseInaccuracyTimer.start()
+ initialKey = keyOnMouse(mouseX, mouseY)
+ setActiveKey(initialKey ? initialKey : 0)
+ press(initialKey)
+ }
+ onPositionChanged: {
+ if (alternativeKeys.active) {
+ alternativeKeys.move(mouseX)
+ } else {
+ var key = keyOnMouse(mouseX, mouseY)
+ if (key !== keyboard.activeKey) {
+ setActiveKey(key ? key : 0)
+ }
+ }
+ }
+ onPressAndHold: {
+ var key = hitInitialKey(mouseX, mouseY, pressAndHoldMargin) ? initialKey : keyboard.activeKey
+ if (key != undefined && key == initialKey) {
+ alternativeKeys.open(key)
+ if (!alternativeKeys.active && key.key == Qt.Key_Context1) {
+ dragSymbolMode = true
+ keyboard.symbolMode = true
+ }
+ }
+ }
+ onClicked: {}
+ onReleased: {
+ var key = keyOnMouse(mouseX, mouseY)
+ if (alternativeKeys.active) {
+ alternativeKeys.move(mouseX)
+ alternativeKeys.clicked()
+ } else if (dragSymbolMode) {
+ var key = keyOnMouse(mouseX, mouseY)
+ release(initialKey)
+ click(key)
+ } else {
+ release(releaseInaccuracyTimer.running && hitInitialKey(mouseX, mouseY, releaseMargin) ? initialKey : keyOnMouse(mouseX, mouseY))
+ }
+ reset()
+ }
+ onCanceled: reset()
+ }
+}
diff --git a/virtualkeyboard/content/ScrollBar.qml b/virtualkeyboard/content/ScrollBar.qml
new file mode 100644
index 0000000..7937038
--- /dev/null
+++ b/virtualkeyboard/content/ScrollBar.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ property var scrollArea: parent
+
+ width: 6
+ opacity: scrollArea && scrollArea.movingVertically ? 1.0 : 0.0
+ visible: scrollArea && scrollArea.contentHeight >= scrollArea.height
+ anchors { right: parent.right; top: parent.top; bottom: parent.bottom; margins: 2 }
+
+ Behavior on opacity { NumberAnimation { properties: "opacity"; duration: 600 } }
+
+ function size() {
+ var nh = scrollArea.visibleArea.heightRatio * height
+ var ny = scrollArea.visibleArea.yPosition * height
+ return ny > 3 ? Math.min(nh, Math.ceil(height - 3 - ny)) : nh + ny
+ }
+ Rectangle {
+ x: 1
+ y: scrollArea ? Math.max(2, scrollArea.visibleArea.yPosition * parent.height) : 0
+ height: scrollArea ? size() : 0
+ width: parent.width - 2
+ color: Qt.rgba(1.0, 1.0, 1.0, 0.5)
+ radius: 1
+ }
+}
diff --git a/virtualkeyboard/content/TextArea.qml b/virtualkeyboard/content/TextArea.qml
new file mode 100644
index 0000000..b00c4d2
--- /dev/null
+++ b/virtualkeyboard/content/TextArea.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+TextBase {
+ id: textArea
+
+ property alias color: textEdit.color
+ property alias text: textEdit.text
+ property alias textWidth: textEdit.width
+ property alias readOnly: textEdit.readOnly
+ property alias inputMethodHints: textEdit.inputMethodHints
+
+ editor: textEdit
+
+ Repeater {
+ model: Math.floor((parent.height - 30) / editor.cursorRectangle.height)
+ Rectangle {
+ x: 8
+ y: (index+1)*editor.cursorRectangle.height+6
+ height: 1; width: textArea.width-24
+ color: Qt.rgba(1.0, 1.0, 1.0, 0.5)
+ }
+ }
+ TextEdit {
+ id: textEdit
+
+ property alias enterKeyText: textArea.enterKeyText
+ property alias enterKeyEnabled: textArea.enterKeyEnabled
+
+ y: 6
+ focus: true
+ color: "#EEEEEE"
+ wrapMode: TextEdit.Wrap
+ cursorVisible: activeFocus
+ height: Math.max(implicitHeight, 60)
+ font.pixelSize: textArea.fontPixelSize
+ selectionColor: Qt.rgba(1.0, 1.0, 1.0, 0.5)
+ selectedTextColor: Qt.rgba(0.0, 0.0, 0.0, 0.8)
+ anchors { left: parent.left; right: parent.right; margins: 12 }
+ cursorDelegate: Rectangle {
+ width: 2
+ opacity: 0.7
+ color: "#EEEEEE"
+ visible: textEdit.activeFocus
+ }
+
+ onActiveFocusChanged: if (!activeFocus) deselect()
+ }
+}
diff --git a/virtualkeyboard/content/TextBase.qml b/virtualkeyboard/content/TextBase.qml
new file mode 100644
index 0000000..fe9bb90
--- /dev/null
+++ b/virtualkeyboard/content/TextBase.qml
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+FocusScope {
+ id: textBase
+
+ property var editor
+ property bool previewTextActive: !editor.activeFocus && text.length === 0
+ property int fontPixelSize: 32
+ property string previewText
+ property string enterKeyText
+ property bool enterKeyEnabled: true
+ property alias mouseParent: mouseArea.parent
+
+ implicitHeight: editor.height + 12
+
+ signal enterKeyClicked
+
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Return)
+ enterKeyClicked()
+ }
+
+ Rectangle {
+ // background
+ radius: 5.0
+ anchors.fill: parent
+ color: Qt.rgba(1.0, 1.0, 1.0, 0.2)
+ border { width: editor.activeFocus ? 2 : 0; color: "#CCCCCC" }
+ }
+ Text {
+ id: previewText
+
+ y: 8
+ color: "#CCCCCC"
+ visible: previewTextActive
+ text: textBase.previewText
+ font.pixelSize: 28
+ anchors { left: parent.left; right: parent.right; margins: 12 }
+
+ }
+ MouseArea {
+ id: mouseArea
+
+ z: 1
+ parent: textBase
+ anchors.fill: parent
+ onClicked: {
+ var positionInEditor = mapToItem(editor, mouseX, mouseY)
+ var cursorPosition = editor.positionAt(positionInEditor.x, positionInEditor.y)
+ editor.cursorPosition = cursorPosition
+ editor.forceActiveFocus()
+ Qt.inputMethod.show()
+ }
+ }
+}
diff --git a/virtualkeyboard/content/TextField.qml b/virtualkeyboard/content/TextField.qml
new file mode 100644
index 0000000..8f1a46c
--- /dev/null
+++ b/virtualkeyboard/content/TextField.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+TextBase {
+ id: textField
+
+ property alias color: textInput.color
+ property alias text: textInput.text
+ property alias textWidth: textInput.width
+ property alias readOnly: textInput.readOnly
+ property alias inputMethodHints: textInput.inputMethodHints
+ property alias validator: textInput.validator
+ property alias echoMode: textInput.echoMode
+
+ editor: textInput
+ mouseParent: flickable
+
+ Flickable {
+ id: flickable
+
+ x: 12
+ clip: true
+ width: parent.width-24
+ height: parent.height
+ flickableDirection: Flickable.HorizontalFlick
+ interactive: contentWidth - 4 > width
+
+ contentWidth: textInput.width+2
+ contentHeight: textInput.height
+ TextInput {
+ id: textInput
+
+ property alias enterKeyText: textField.enterKeyText
+ property alias enterKeyEnabled: textField.enterKeyEnabled
+
+ y: 6
+ focus: true
+ color: "#EEEEEE"
+ cursorVisible: activeFocus
+ passwordCharacter: "\u2022"
+ font.pixelSize: textField.fontPixelSize
+ selectionColor: Qt.rgba(1.0, 1.0, 1.0, 0.5)
+ selectedTextColor: Qt.rgba(0.0, 0.0, 0.0, 0.8)
+ width: Math.max(flickable.width, implicitWidth)-2
+ cursorDelegate: Rectangle {
+ width: 2
+ opacity: 0.7
+ color: "#EEEEEE"
+ visible: textInput.activeFocus
+ }
+ onActiveFocusChanged: if (!activeFocus) deselect()
+ }
+ }
+}
diff --git a/virtualkeyboard/content/components/AlternativeKeys.qml b/virtualkeyboard/content/components/AlternativeKeys.qml
new file mode 100644
index 0000000..45f8ed2
--- /dev/null
+++ b/virtualkeyboard/content/components/AlternativeKeys.qml
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ property bool active: activeKey != null
+ property string keys
+ property int primaryKeyCode
+ property var activeKey: null
+ property real keyWidth: 36
+ property real keyMargin: 5
+
+ z: 1
+ radius: 4
+ height: 60
+ parent: keyboard
+ visible: active
+ width: keyRow.width
+
+ signal clicked
+
+ onClicked: {
+ if (active)
+ inputEngine.sendKeyRelease(primaryKeyCode,
+ keyboard.uppercased ? activeKey.text.toUpperCase() : activeKey.text,
+ keyboard.uppercased ? Qt.ShiftModifier : 0)
+ }
+
+ function open(key) {
+ keys = key.alternativeKeys
+ primaryKeyCode = key.key
+ if (keys.length > 0) {
+ var position = keyboard.mapFromItem(key, 0, -23)
+ var primaryKeyIndex = 0
+ while (primaryKeyIndex < keys.length) {
+ if (keys.charAt(primaryKeyIndex) == key.text) {
+ break
+ }
+ primaryKeyIndex++
+ }
+ if (primaryKeyIndex == keys.length) {
+ console.log("AlternativeKeys: active key \"" + key.text + "\" not found in alternativeKeys \"" + keys + ".\"")
+ primaryKeyIndex = 0
+ }
+ x = Math.min(Math.max(keyMargin, position.x-primaryKeyIndex*keyWidth+(key.width-keyWidth)/2-1), keyboard.width-width-keyMargin)
+ y = Math.min(position.y-height+keyMargin, keyboard.height-height-keyMargin)
+ activeKey = keyRow.children[primaryKeyIndex]
+ arrow.x = mapFromItem(key, key.width/2, 0).x - arrow.width/2
+ }
+ }
+ function close() {
+ activeKey = null
+ }
+ function move(mouseX) {
+ var oldKey = activeKey
+ activeKey = keyRow.children[Math.max(0, Math.min(keys.length-1, Math.floor((mouseX-keyRow.x-x)/keyWidth)))]
+ }
+
+ Image {
+ id: arrow
+ source: "../images/arrow.png"
+ anchors.top: parent.bottom
+ }
+ Row {
+ id: keyRow
+ anchors.centerIn: parent
+ Repeater {
+ model: keys.length
+ Text {
+ id: key
+ color: activeKey === key ? "#f04b67" : "black"
+ width: keyWidth
+ height: keyWidth + 5
+ text: keys.charAt(index)
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+ font {
+ pixelSize: 40
+ capitalization: keyboard.uppercased ? Font.AllUppercase : Font.MixedCase
+ }
+ }
+ }
+ }
+}
diff --git a/virtualkeyboard/content/components/AutoScroller.qml b/virtualkeyboard/content/components/AutoScroller.qml
new file mode 100644
index 0000000..7432670
--- /dev/null
+++ b/virtualkeyboard/content/components/AutoScroller.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Example.PlatformInputContext 1.0
+
+Item {
+ property var innerFlickable
+ property var outerFlickable
+ property var inputItem: Qt.inputMethod.inputItem
+
+ onInputItemChanged: {
+ flickable = null
+ if (inputItem) {
+ var parent_ = inputItem.parent
+ while (parent_) {
+ if (parent_.maximumFlickVelocity) {
+ if (innerFlickable) {
+ outerFlickable = parent_
+ break
+ } else {
+ innerFlickable = parent_
+ }
+ }
+ parent_ = parent_.parent
+ }
+ delayedLoading.triggered()
+ }
+ }
+
+ function ensureVisible(flickable) {
+ if (Qt.inputMethod.visible && inputItem && flickable && flickable.visible && flickable.interactive) {
+
+ var verticallyFlickable = (flickable.flickableDirection == Flickable.HorizontalAndVerticalFlick || flickable.flickableDirection == Flickable.VerticalFlick
+ || (flickable.flickableDirection == Flickable.AutoFlickDirection && flickable.contentHeight > flickable.height))
+ var horizontallyFlickable = (flickable.flickableDirection == Flickable.HorizontalAndVerticalFlick || flickable.flickableDirection == Flickable.HorizontalFlick
+ || (flickable.flickableDirection == Flickable.AutoFlickDirection && flickable.contentWidth > flickable.width))
+
+ if (!verticallyFlickable && !horizontallyFlickable)
+ return
+
+ var cursorRectangle = flickable.contentItem.mapFromItem(inputItem, inputItem.cursorRectangle.x, inputItem.cursorRectangle.y)
+
+ var oldContentY = flickable.contentY
+ if (verticallyFlickable) {
+ var scrollMarginVertical = (flickable && flickable.scrollMarginVertical) ? flickable.scrollMarginVertical : 10
+ if (flickable.contentY >= cursorRectangle.y - scrollMarginVertical)
+ flickable.contentY = Math.max(0, cursorRectangle.y - scrollMarginVertical)
+ else if (flickable.contentY + flickable.height <= cursorRectangle.y + inputItem.cursorRectangle.height + scrollMarginVertical)
+ flickable.contentY = Math.min(flickable.contentHeight - flickable.height, cursorRectangle.y + inputItem.cursorRectangle.height - flickable.height + scrollMarginVertical)
+ }
+ if (horizontallyFlickable) {
+ var scrollMarginHorizontal = (flickable && flickable.scrollMarginHorizontal) ? flickable.scrollMarginHorizontal : 10
+ if (flickable.contentX >= cursorRectangle.x - scrollMarginHorizontal)
+ flickable.contentX = Math.max(0, cursorRectangle.x - scrollMarginHorizontal)
+ else if (flickable.contentX + flickable.width <= cursorRectangle.x + inputItem.cursorRectangle.width + scrollMarginHorizontal)
+ flickable.contentX = Math.min(flickable.contentWidth - flickable.width, cursorRectangle.x + inputItem.cursorRectangle.width - flickable.width + scrollMarginHorizontal)
+ }
+ }
+ }
+ Timer {
+ id: delayedLoading
+ interval: 10
+ onTriggered: {
+ ensureVisible(innerFlickable)
+ ensureVisible(outerFlickable)
+ }
+ }
+ Connections {
+ ignoreUnknownSignals: true
+ target: Qt.inputMethod.inputItem && Qt.inputMethod.animating ? Qt.inputMethod : null
+ onKeyboardRectangleChanged: delayedLoading.triggered()
+ }
+ Connections {
+ ignoreUnknownSignals: true
+ target: Qt.inputMethod.inputItem && Qt.inputMethod.inputItem.activeFocus ? Qt.inputMethod.inputItem : null
+ onCursorRectangleChanged: delayedLoading.triggered()
+ }
+}
diff --git a/virtualkeyboard/content/components/BackspaceKey.qml b/virtualkeyboard/content/components/BackspaceKey.qml
new file mode 100644
index 0000000..f52a711
--- /dev/null
+++ b/virtualkeyboard/content/components/BackspaceKey.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+BaseKey {
+ key: Qt.Key_Backspace
+ width: 47
+ repeat: true
+ functionKey: true
+ Icon {
+ invert: pressed
+ opacity: parent.enabled ? 1.0 : 0.6
+ source: "../images/backspace.png"
+ anchors { centerIn: parent; verticalCenterOffset: 1 }
+ }
+}
diff --git a/virtualkeyboard/content/components/BaseKey.qml b/virtualkeyboard/content/components/BaseKey.qml
new file mode 100644
index 0000000..5b99c21
--- /dev/null
+++ b/virtualkeyboard/content/components/BaseKey.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: keyItem
+
+ property string text
+ property string displayText: text
+ property string alternativeKeys
+ property int key: Qt.Key_unknown
+ property bool active
+ property bool repeat
+ property bool highlighted
+ property bool functionKey
+ property bool showPreview: !functionKey
+ property bool enabled: true
+ property bool pressed: enabled && active
+ property color textColor: pressed ? "#EEEEEE" : (enabled ? "black" : "black")
+
+ width: 31
+ height: 55
+ z: pressed ? 1 : 0
+ y: pressed ? 1 : 0
+ scale: pressed ? (width > 40 ? 0.98 : 0.96) : 1.0
+
+ signal clicked
+
+ Rectangle {
+ id: background
+
+ z: -1
+ radius: 4
+ visible: !pressed
+ opacity: highlighted ? 0.6 : 0.2
+ color: keyItem.enabled ? "#EEEEEE" : "black"
+ anchors { fill: parent; topMargin: 3; bottomMargin: 3; leftMargin: 2; rightMargin: 2 }
+ }
+}
diff --git a/virtualkeyboard/content/components/ChangeLanguageKey.qml b/virtualkeyboard/content/components/ChangeLanguageKey.qml
new file mode 100644
index 0000000..220f36c
--- /dev/null
+++ b/virtualkeyboard/content/components/ChangeLanguageKey.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+BaseKey {
+ functionKey: true
+ Text {
+ text: keyboard.locale.split("_")[0]
+ color: textColor
+ font { pixelSize: 16; capitalization: Font.AllUppercase }
+ anchors { centerIn: parent; verticalCenterOffset: parent.textPixelSize > 35 ? 2 : 0 }
+ }
+ onClicked: keyboard.changeInputLanguage()
+}
diff --git a/virtualkeyboard/content/components/CharacterPreviewBubble.qml b/virtualkeyboard/content/components/CharacterPreviewBubble.qml
new file mode 100644
index 0000000..880c145
--- /dev/null
+++ b/virtualkeyboard/content/components/CharacterPreviewBubble.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ property bool enabled
+ property bool sideBackground
+ property real sideMargin: 46
+ property real sideBackgroundOffset: 10
+ property var activeKey: keyboard.activeKey
+
+ z: 1
+ radius: 4
+ height: 60
+ width: Math.max(previewCharacter.width+20, 55)
+ visible: false
+ parent: keyboard
+ opacity: (activeKey && enabled) ? 1.0 : 0.0
+
+ onActiveKeyChanged: {
+ visible = activeKey && activeKey.showPreview
+ if (activeKey) {
+ previewCharacter.text = activeKey.text
+ var position = keyboard.mapFromItem(activeKey, activeKey.width/2, 10)
+ var onLeft = position.x < sideMargin
+ var onRight = position.x > keyboard.width - sideMargin
+ x = position.x - width/2
+ + (onLeft ? sideBackgroundOffset : 0)
+ - (onRight ? sideBackgroundOffset : 0)
+ y = position.y - height - 25
+ arrow.anchors.horizontalCenterOffset = onLeft ? -sideBackgroundOffset
+ : (onRight ? sideBackgroundOffset : 0)
+ }
+ }
+ Image {
+ id: arrow
+ source: "../images/arrow.png"
+ anchors { top: parent.bottom; horizontalCenter: parent.horizontalCenter }
+ }
+ Text {
+ id: previewCharacter
+ color: "black"
+ font {
+ pixelSize: previewCharacter.text.length == 1 ? 50 : 40
+ capitalization: keyboard.uppercased ? Font.AllUppercase : Font.MixedCase
+ }
+ anchors { centerIn: parent; verticalCenterOffset: -2 }
+ }
+}
diff --git a/virtualkeyboard/content/components/EnterKey.qml b/virtualkeyboard/content/components/EnterKey.qml
new file mode 100644
index 0000000..985e281
--- /dev/null
+++ b/virtualkeyboard/content/components/EnterKey.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+BaseKey {
+
+ property string enterKeyText: Qt.inputMethod.inputItem ? Qt.inputMethod.inputItem.enterKeyText : ""
+
+ width: 78
+ text: "\n"
+ key: Qt.Key_Return
+ functionKey: true
+ highlighted: enabled && enterKeyText.length > 0
+ enabled: Qt.inputMethod.inputItem ? Qt.inputMethod.inputItem.enterKeyEnabled : true
+
+ Icon {
+ invert: pressed
+ visible: enterKeyText.length == 0
+ source: "../images/enter.png"
+ anchors { centerIn: parent; verticalCenterOffset: 2 }
+ }
+ Text {
+ visible: enterKeyText.length > 0
+ text: enterKeyText
+ fontSizeMode: Text.HorizontalFit
+ color: textColor
+ font { pixelSize: 20; capitalization: Font.AllUppercase }
+ horizontalAlignment: Text.AlignHCenter
+ anchors {
+ left: parent.left
+ right: parent.right
+ verticalCenter: parent.verticalCenter
+ margins: 5
+ }
+ }
+}
diff --git a/virtualkeyboard/content/components/HideKeyboardKey.qml b/virtualkeyboard/content/components/HideKeyboardKey.qml
new file mode 100644
index 0000000..f286b1a
--- /dev/null
+++ b/virtualkeyboard/content/components/HideKeyboardKey.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+BaseKey {
+ functionKey: true
+ onClicked: Qt.inputMethod.inputItem.focus = false
+ Icon {
+ invert: pressed
+ source: "../images/hidekeyboard.png"
+ anchors { centerIn: parent; verticalCenterOffset: 4 }
+ }
+}
diff --git a/virtualkeyboard/content/components/Icon.qml b/virtualkeyboard/content/components/Icon.qml
new file mode 100644
index 0000000..0ed7606
--- /dev/null
+++ b/virtualkeyboard/content/components/Icon.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+ShaderEffect {
+ property bool invert
+ property alias source: image.source
+ property variant texture: Image { id: image }
+
+ width: image.implicitWidth
+ height: image.implicitHeight
+
+ fragmentShader: "
+ uniform lowp bool invert;
+ uniform lowp float qt_Opacity;
+ uniform lowp sampler2D texture;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ vec4 color = texture2D(texture, qt_TexCoord0) * qt_Opacity;
+ if (invert)
+ gl_FragColor = vec4(vec3(1.0) - color.rgb, 1.0) * color.a;
+ else
+ gl_FragColor = color;
+ }
+ "
+}
diff --git a/virtualkeyboard/content/components/InputEngine.qml b/virtualkeyboard/content/components/InputEngine.qml
new file mode 100644
index 0000000..9da5150
--- /dev/null
+++ b/virtualkeyboard/content/components/InputEngine.qml
@@ -0,0 +1,179 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Example.PlatformInputContext 1.0
+
+Item {
+ property int lastKey
+ property string sentenceEndingCharacters: ".;!?"
+
+ Timer {
+ // key repeater
+ repeat: true
+ interval: 600
+ running: keyboard.activeKey !== 0 && keyboard.activeKey.repeat
+
+ onRunningChanged: if (!running) interval = 600
+ onTriggered: {
+ interval = 150
+ keyboardMouse.click(keyboard.activeKey)
+ }
+ }
+ Timer {
+ id: multiTapTimer
+
+ property int index
+
+ interval: 1200
+ onTriggered: {
+ index = 0
+ InputContext.commit(InputContext.preeditText)
+ }
+ }
+ Item {
+ id: shiftHandling
+
+ property bool autoCapitalization: !(InputContext.inputMethodHints & (Qt.ImhNoAutoUppercase | Qt.ImhUppercaseOnly
+ | Qt.ImhLowercaseOnly | Qt.ImhEmailCharactersOnly
+ | Qt.ImhUrlCharactersOnly | Qt.ImhDialableCharactersOnly
+ | Qt.ImhFormattedNumbersOnly | Qt.ImhDigitsOnly))
+ function reset() {
+ if (Qt.inputMethod.inputItem) {
+ var preferUpperCase = InputContext.inputMethodHints & Qt.ImhPreferUppercase
+ InputContext.shift = preferUpperCase
+ InputContext.capsLock = preferUpperCase
+ }
+ }
+ function autoCapitalize() {
+ if (!Qt.inputMethod.inputItem || !autoCapitalization || InputContext.capsLock)
+ return
+ var preferLowerCase = InputContext.inputMethodHints & Qt.ImhPreferLowercase
+ if (InputContext.cursorPosition == 0)
+ InputContext.shift = !preferLowerCase
+ else {
+ var text = (InputContext.surroundingText + InputContext.preeditText).substr(0, InputContext.cursorPosition).trim()
+ if (text.length == 0)
+ InputContext.shift = !preferLowerCase
+ else if (text.length > 1 && sentenceEndingCharacters.indexOf(text.charAt(text.length-1)) >= 0)
+ InputContext.shift = !preferLowerCase
+ else
+ InputContext.shift = false
+ }
+ }
+ Timer {
+ id: delayedLoading
+ interval: 10
+ onTriggered: {
+ shiftHandling.reset()
+ shiftHandling.autoCapitalize()
+ }
+ }
+ Connections {
+ target: InputContext
+ onInputMethodHintsChanged: delayedLoading.restart()
+ onFocusEditorChanged: {
+ keyboard.symbolMode = false
+ delayedLoading.restart()
+ }
+ onPreeditTextChanged: {
+ if (shiftHandling.autoCapitalization && !InputContext.capsLock)
+ InputContext.shift = false
+ }
+ onCursorPositionChanged: shiftHandling.autoCapitalize()
+ }
+ }
+ function sendKeyClick(key, text, modifiers) {
+ sendKeyPress(key, text, modifiers)
+ sendKeyRelease(key, text, modifiers)
+ }
+ function sendKeyPress(key, text, modifiers) {
+ lastKey = key
+ }
+ function sendKeyRelease(key, text, modifiers) {
+ var accept = false
+ switch (key) {
+ case Qt.Key_Enter:
+ case Qt.Key_Return:
+ break
+ case Qt.Key_Space:
+ InputContext.commit(" ")
+ var text = InputContext.surroundingText.trim()
+ if (sentenceEndingCharacters.indexOf(text.charAt(text.length-1)) >= 0)
+ keyboard.symbolMode = false
+ accept = true
+ break
+ case Qt.Key_Tab:
+ case Qt.Key_Backspace:
+ if (InputContext.cursorPosition > 0) {
+ if (InputContext.selectedText.length == 0)
+ InputContext.commit("", -1, 1)
+ else
+ InputContext.commit("")
+ }
+ break
+ default:
+ if (key === Qt.Key_Asterisk && InputContext.inputMethodHints & Qt.ImhDialableCharactersOnly) {
+ if (key != lastKey) {
+ multiTapTimer.index = 0
+ InputContext.commit(InputContext.preeditText)
+ multiTapTimer.running = false
+ }
+ multiTapTimer.index = multiTapTimer.running ? (multiTapTimer.index+1) % text.length : 0
+ var character = text.charAt(multiTapTimer.index)
+ if (multiTapTimer.running)
+ InputContext.preeditText = InputContext.preeditText.substr(0, InputContext.preeditText.length - 1) + character
+ else
+ InputContext.preeditText += character
+ multiTapTimer.restart()
+ } else if (multiTapTimer.running) {
+ InputContext.commit(InputContext.preeditText)
+ multiTapTimer.stop()
+ }
+ if (!multiTapTimer.running)
+ InputContext.commit(text)
+ accept = true
+ break
+ }
+ if (!accept) {
+ InputContext.sendKeyClick(key, text, modifiers)
+ }
+ }
+}
diff --git a/virtualkeyboard/content/components/Key.qml b/virtualkeyboard/content/components/Key.qml
new file mode 100644
index 0000000..56b750f
--- /dev/null
+++ b/virtualkeyboard/content/components/Key.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Example.PlatformInputContext 1.0
+
+BaseKey {
+ id: keyItem
+
+ property bool uppercased
+ property int textPixelSize: 24
+
+ Component.onCompleted: InputContext.registerCharacterKey(keyItem)
+ Component.onDestruction: InputContext.unregisterCharacterKey(keyItem)
+
+ Text {
+ id: text
+
+ text: displayText
+ color: textColor
+ anchors { centerIn: parent; verticalCenterOffset: pressed ? 1 : 0 }
+ font {
+ pixelSize: textPixelSize
+ capitalization: uppercased ? Font.AllUppercase : Font.MixedCase
+ }
+ }
+}
diff --git a/virtualkeyboard/content/components/NumberKey.qml b/virtualkeyboard/content/components/NumberKey.qml
new file mode 100644
index 0000000..44bc220
--- /dev/null
+++ b/virtualkeyboard/content/components/NumberKey.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Key {
+ width: 77
+ showPreview: false
+ textPixelSize: 38
+}
diff --git a/virtualkeyboard/content/components/PressedKey.qml b/virtualkeyboard/content/components/PressedKey.qml
new file mode 100644
index 0000000..54755d6
--- /dev/null
+++ b/virtualkeyboard/content/components/PressedKey.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ property bool active
+ property var activeKey: keyboard.activeKey
+
+ visible: active
+
+ onActiveKeyChanged: {
+ var activeKey = keyboard.activeKey
+ active = activeKey !== 0 && activeKey.enabled
+ if (active) {
+ var position = parent.mapFromItem(activeKey, 0, 0)
+ width = activeKey.width
+ height = activeKey.height
+ x = position.x
+ y = position.y + 1
+ }
+ }
+
+ Rectangle {
+ radius: 6
+ color: "#f13c57"
+ anchors { fill: parent; topMargin: 3; bottomMargin: 3; leftMargin: 2; rightMargin: 2 }
+ }
+}
diff --git a/virtualkeyboard/content/components/ShiftKey.qml b/virtualkeyboard/content/components/ShiftKey.qml
new file mode 100644
index 0000000..95c4baf
--- /dev/null
+++ b/virtualkeyboard/content/components/ShiftKey.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Example.PlatformInputContext 1.0
+
+BaseKey {
+ id: shiftKey
+ width: 47
+ key: Qt.Key_Shift
+ enabled: !keyboard.uppercaseOnly && !keyboard.lowercaseOnly
+ visible: enabled
+ highlighted: InputContext.capsLock
+ functionKey: true
+ property bool shiftChanged: true
+ onClicked: {
+ if (InputContext.inputMethodHints & Qt.ImhNoAutoUppercase) {
+ InputContext.capsLock = !InputContext.capsLock
+ InputContext.shift = !InputContext.shift
+ } else {
+ InputContext.capsLock = !InputContext.capsLock && (InputContext.shift && !shiftChanged)
+ InputContext.shift = InputContext.capsLock || !InputContext.shift ? true : false
+ shiftChanged = false
+ }
+ }
+ Connections {
+ target: keyboard
+ onUppercasedChanged: shiftKey.shiftChanged = true
+ }
+ Icon {
+ invert: pressed
+ smooth: shiftKey.pressed
+ anchors.centerIn: parent
+ source: "../images/shift.png"
+ }
+}
diff --git a/virtualkeyboard/content/components/SpaceKey.qml b/virtualkeyboard/content/components/SpaceKey.qml
new file mode 100644
index 0000000..abd48b9
--- /dev/null
+++ b/virtualkeyboard/content/components/SpaceKey.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Key {
+ id: spaceKey
+
+ text: " "
+ repeat: true
+ width: keyboard.symbolMode ? 124 : 93
+ showPreview: false
+ key: Qt.Key_Space
+
+ Rectangle {
+ color: pressed ? "white" : "black"
+ height: 4
+ visible: spaceKey.displayText === " "
+ width: parent.width-30
+ anchors {
+ horizontalCenter: spaceKey.horizontalCenter
+ bottom: spaceKey.bottom
+ bottomMargin: 18
+ }
+ }
+}
diff --git a/virtualkeyboard/content/components/SymbolModeKey.qml b/virtualkeyboard/content/components/SymbolModeKey.qml
new file mode 100644
index 0000000..2a8517d
--- /dev/null
+++ b/virtualkeyboard/content/components/SymbolModeKey.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Key {
+ width: 78
+ key: Qt.Key_Context1
+ displayText: "&123"
+ textPixelSize: 20
+ functionKey: true
+ onClicked: keyboard.symbolMode = !keyboard.symbolMode
+}
diff --git a/virtualkeyboard/content/images/arrow.png b/virtualkeyboard/content/images/arrow.png
new file mode 100644
index 0000000..8d01aa2
--- /dev/null
+++ b/virtualkeyboard/content/images/arrow.png
Binary files differ
diff --git a/virtualkeyboard/content/images/background.png b/virtualkeyboard/content/images/background.png
new file mode 100644
index 0000000..d85f6ee
--- /dev/null
+++ b/virtualkeyboard/content/images/background.png
Binary files differ
diff --git a/virtualkeyboard/content/images/backspace.png b/virtualkeyboard/content/images/backspace.png
new file mode 100644
index 0000000..4141872
--- /dev/null
+++ b/virtualkeyboard/content/images/backspace.png
Binary files differ
diff --git a/virtualkeyboard/content/images/enter.png b/virtualkeyboard/content/images/enter.png
new file mode 100644
index 0000000..c611ebe
--- /dev/null
+++ b/virtualkeyboard/content/images/enter.png
Binary files differ
diff --git a/virtualkeyboard/content/images/hidekeyboard.png b/virtualkeyboard/content/images/hidekeyboard.png
new file mode 100644
index 0000000..aecdfe5
--- /dev/null
+++ b/virtualkeyboard/content/images/hidekeyboard.png
Binary files differ
diff --git a/virtualkeyboard/content/images/keypad.png b/virtualkeyboard/content/images/keypad.png
new file mode 100644
index 0000000..fd8fa55
--- /dev/null
+++ b/virtualkeyboard/content/images/keypad.png
Binary files differ
diff --git a/virtualkeyboard/content/images/shift.png b/virtualkeyboard/content/images/shift.png
new file mode 100644
index 0000000..eded926
--- /dev/null
+++ b/virtualkeyboard/content/images/shift.png
Binary files differ
diff --git a/virtualkeyboard/content/images/space.png b/virtualkeyboard/content/images/space.png
new file mode 100644
index 0000000..4a5e847
--- /dev/null
+++ b/virtualkeyboard/content/images/space.png
Binary files differ
diff --git a/virtualkeyboard/content/layouts/ar_AR.qml b/virtualkeyboard/content/layouts/ar_AR.qml
new file mode 100644
index 0000000..eac277b
--- /dev/null
+++ b/virtualkeyboard/content/layouts/ar_AR.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Example.PlatformInputContext 1.0
+import "../components"
+
+Column {
+ property var keys: ["ضصقفغعهخحج", "شسيبلاتنمك", "ظطذدزوةث"]
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ Repeater {
+ model: keys[0].length
+ Key {
+ text: keys[0][index]
+ textPixelSize: index > 1 ? 24 : 22
+ }
+ }
+ }
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ Repeater {
+ model: keys[1].length
+ Key {
+ text: keys[1][index]
+ textPixelSize: index > 0 ? 24 : 23
+ }
+ }
+ }
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ Repeater {
+ model: keys[2].length
+ Key {
+ text: keys[2][index]
+ }
+ }
+ BackspaceKey { width: 62 }
+ }
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ SymbolModeKey {}
+ ChangeLanguageKey {}
+ SpaceKey {}
+ HideKeyboardKey {}
+ EnterKey {}
+ }
+}
diff --git a/virtualkeyboard/content/layouts/en_GB.qml b/virtualkeyboard/content/layouts/en_GB.qml
new file mode 100644
index 0000000..267679a
--- /dev/null
+++ b/virtualkeyboard/content/layouts/en_GB.qml
@@ -0,0 +1,184 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Example.PlatformInputContext 1.0
+import "../components"
+
+Column {
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "êeëèé"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ alternativeKeys: "ŕrř"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ alternativeKeys: "ţtŧť"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ alternativeKeys: "ÿyýŷ"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "űūũûüuùú"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "îïīĩiìí"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "œøõôöòóo"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aäåãâàá"
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "šsşś"
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ alternativeKeys: "đdƌď"
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ alternativeKeys: "ġǥgģǧĝğ"
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ }
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ alternativeKeys: "ĺŀłļľl"
+ }
+ }
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ ShiftKey {}
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ alternativeKeys: "zžż"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "çcċčć"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ alternativeKeys: "ņńnň"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {}
+ }
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ SymbolModeKey {}
+ ChangeLanguageKey {}
+ SpaceKey {}
+ HideKeyboardKey {}
+ EnterKey {}
+ }
+}
diff --git a/virtualkeyboard/content/layouts/fi_FI.qml b/virtualkeyboard/content/layouts/fi_FI.qml
new file mode 100644
index 0000000..4cd20d9
--- /dev/null
+++ b/virtualkeyboard/content/layouts/fi_FI.qml
@@ -0,0 +1,203 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Example.PlatformInputContext 1.0
+import "../components"
+
+Column {
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ Key {
+ key: Qt.Key_Q
+ text: "q"
+ }
+ Key {
+ key: Qt.Key_W
+ text: "w"
+ }
+ Key {
+ key: Qt.Key_E
+ text: "e"
+ alternativeKeys: "êeëèé"
+ }
+ Key {
+ key: Qt.Key_R
+ text: "r"
+ alternativeKeys: "ŕrř"
+ }
+ Key {
+ key: Qt.Key_T
+ text: "t"
+ alternativeKeys: "ţtŧť"
+ }
+ Key {
+ key: Qt.Key_Y
+ text: "y"
+ alternativeKeys: "ÿyýŷ"
+ }
+ Key {
+ key: Qt.Key_U
+ text: "u"
+ alternativeKeys: "űūũûüuùú"
+ }
+ Key {
+ key: Qt.Key_I
+ text: "i"
+ alternativeKeys: "îïīĩiìí"
+ }
+ Key {
+ key: Qt.Key_O
+ text: "o"
+ alternativeKeys: "œøõôöòóo"
+ }
+ Key {
+ key: Qt.Key_P
+ text: "p"
+ }
+ }
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ Key {
+ key: Qt.Key_A
+ text: "a"
+ alternativeKeys: "aäåãâàá"
+ width: 28
+ }
+ Key {
+ key: Qt.Key_S
+ text: "s"
+ alternativeKeys: "šsşś"
+ width: 28
+ }
+ Key {
+ key: Qt.Key_D
+ text: "d"
+ alternativeKeys: "đdƌď"
+ width: 28
+ }
+ Key {
+ key: Qt.Key_F
+ text: "f"
+ width: 28
+ }
+ Key {
+ key: Qt.Key_G
+ text: "g"
+ alternativeKeys: "ġgģǧĝğ"
+ width: 28
+ }
+ Key {
+ key: Qt.Key_H
+ text: "h"
+ width: 28
+ }
+ Key {
+ key: Qt.Key_J
+ text: "j"
+ width: 28
+ }
+ Key {
+ key: Qt.Key_K
+ text: "k"
+ width: 28
+ }
+ Key {
+ key: Qt.Key_L
+ text: "l"
+ alternativeKeys: "ĺŀłļľl"
+ width: 28
+ }
+ Key {
+ key: Qt.Key_Adiaeresis
+ text: "ä"
+ width: 28
+ }
+ Key {
+ key: Qt.Key_Odiaeresis
+ text: "ö"
+ width: 28
+ }
+ }
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ ShiftKey {}
+ Key {
+ key: Qt.Key_Z
+ text: "z"
+ alternativeKeys: "zžż"
+ }
+ Key {
+ key: Qt.Key_X
+ text: "x"
+ }
+ Key {
+ key: Qt.Key_C
+ text: "c"
+ alternativeKeys: "çcċčć"
+ }
+ Key {
+ key: Qt.Key_V
+ text: "v"
+ }
+ Key {
+ key: Qt.Key_B
+ text: "b"
+ }
+ Key {
+ key: Qt.Key_N
+ text: "n"
+ alternativeKeys: "ņńnň"
+ }
+ Key {
+ key: Qt.Key_M
+ text: "m"
+ }
+ BackspaceKey {}
+ }
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ SymbolModeKey {}
+ ChangeLanguageKey {}
+ SpaceKey {}
+ HideKeyboardKey {}
+ EnterKey {}
+ }
+}
diff --git a/virtualkeyboard/content/layouts/numbers.qml b/virtualkeyboard/content/layouts/numbers.qml
new file mode 100644
index 0000000..6b81fdf
--- /dev/null
+++ b/virtualkeyboard/content/layouts/numbers.qml
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import ".."
+import "../components"
+import Example.PlatformInputContext 1.0
+
+Column {
+ Row {
+ Repeater {
+ model: 3
+ NumberKey { key: Qt.Key_1 + index; text: 1 + index }
+ }
+ BackspaceKey { width: 78 }
+ }
+ Row {
+ Repeater {
+ model: 3
+ NumberKey { key: Qt.Key_4 + index; text: 4 + index }
+ }
+ SpaceKey {
+ width: 78
+ displayText: "_"
+ }
+ }
+ Row {
+ Repeater {
+ model: 3
+ NumberKey { key: Qt.Key_7 + index; text: 7 + index }
+ }
+ HideKeyboardKey { width: 78 }
+ }
+ Row {
+ NumberKey {
+ key: Qt.Key_Asterisk
+ displayText: "*+"
+ text: "*+"
+ textPixelSize: 40
+ visible: InputContext.inputMethodHints & Qt.ImhDialableCharactersOnly
+ }
+ NumberKey {
+ key: Qt.Key_0
+ text: "0"
+ width: InputContext.inputMethodHints & Qt.ImhDigitsOnly ? 270 : (InputContext.inputMethodHints & Qt.ImhFormattedNumbersOnly ? 180 : 77)
+ textPixelSize: 38
+ }
+ NumberKey {
+ id: signKey
+ text: "#"
+ key: Qt.Key_NumberSign
+ visible: !(InputContext.inputMethodHints & Qt.ImhDigitsOnly)
+ states: State {
+ when: InputContext.inputMethodHints & Qt.ImhFormattedNumbersOnly
+ PropertyChanges {
+ target: signKey
+
+ text: "."
+ key: Qt.Key_Period
+ enabled: InputContext.surroundingText.indexOf(".") == -1
+ }
+ }
+ }
+ EnterKey { width: 78 }
+ }
+}
diff --git a/virtualkeyboard/content/layouts/symbols.qml b/virtualkeyboard/content/layouts/symbols.qml
new file mode 100644
index 0000000..f8a30a6
--- /dev/null
+++ b/virtualkeyboard/content/layouts/symbols.qml
@@ -0,0 +1,186 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../components"
+
+Column {
+ property bool secondPage
+ onVisibleChanged: if (!visible) secondPage = false
+
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ Key {
+ key: secondPage ? Qt.Key_unknown : Qt.Key_1
+ text: secondPage ? ":)" : "1"
+ textPixelSize: secondPage ? 20 : 24
+ }
+ Key {
+ key: secondPage ? Qt.Key_unknown : Qt.Key_2
+ text: secondPage ? ":D" : "2"
+ textPixelSize: secondPage ? 20 : 24
+ }
+ Key {
+ key: secondPage ? Qt.Key_Dollar : Qt.Key_3
+ text: secondPage ? ":(" : "3"
+ textPixelSize: secondPage ? 20 : 24
+ }
+ Key {
+ key: secondPage ? Qt.Key_yen : Qt.Key_4
+ text: secondPage ? "<3": "4"
+ textPixelSize: secondPage ? 18 : 24
+ }
+ Key {
+ key: Qt.Key_5
+ text: secondPage ? "½" : "5"
+ }
+ Key {
+ key: secondPage ? Qt.Key_Percent : Qt.Key_6
+ text: secondPage ? "%": "6"
+ }
+ Key {
+ key: secondPage ? Qt.Key_Less : Qt.Key_7
+ text: secondPage ? "<": "7"
+ }
+ Key {
+ key: secondPage ? Qt.Key_Greater : Qt.Key_8
+ text: secondPage ? ">" : "8"
+ }
+ Key {
+ key: secondPage ? Qt.Key_BracketLeft : Qt.Key_9
+ text: secondPage ? "[" : "9"
+ }
+ Key {
+ key: secondPage ? Qt.Key_BracketRight : Qt.Key_0
+ text: secondPage ? "]" : "0"
+ }
+ }
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ Key {
+ key: secondPage ? Qt.Key_AsciiTilde : Qt.Key_At
+ text: secondPage ? "~" : "@"
+ }
+ Key {
+ key: secondPage ? Qt.Key_Agrave : Qt.Key_Asterisk
+ text: secondPage ? "`" : "*"
+ }
+ Key {
+ key: secondPage ? Qt.Key_AsciiCircum : Qt.Key_NumberSign
+ text: secondPage ? "^" : "#"
+ }
+ Key {
+ key: secondPage ? Qt.Key_Bar : Qt.Key_Plus
+ text: secondPage ? "|" : "+"
+ }
+ Key {
+ key: secondPage ? Qt.Key_Underscore : Qt.Key_Minus
+ text: secondPage ? "_" : "-"
+ }
+ Key {
+ key: secondPage ? Qt.Key_section : Qt.Key_Equal
+ text: secondPage ? "§" : "="
+ }
+ Key {
+ key: secondPage ? Qt.Key_BraceLeft : Qt.Key_ParenLeft
+ text: secondPage ? "{" : "("
+ }
+ Key {
+ key: secondPage ? Qt.Key_BraceRight : Qt.Key_ParenRight
+ text: secondPage ? "}" : ")"
+ }
+ Key {
+ key: secondPage ? Qt.Key_questiondown : Qt.Key_Question
+ text: secondPage ? "¿" : "?"
+ }
+ Key {
+ key: secondPage ? Qt.Key_exclamdown : Qt.Key_Apostrophe
+ text: secondPage ? "¡" : "!"
+ }
+ }
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ Key {
+ width: 47
+ displayText: secondPage ? " 2/2" : " 1/2"
+ textPixelSize: 20
+ functionKey: true
+ onClicked: secondPage = !secondPage
+ }
+ Key {
+ key: secondPage ? Qt.Key_guillemotleft : Qt.Key_Period
+ text: secondPage ? '«' : "."
+ }
+ Key {
+ key: secondPage ? Qt.Key_guillemotright : Qt.Key_Comma
+ text: secondPage ? '»' : ","
+ }
+ Key {
+ key: secondPage ? Qt.Key_QuoteDbl : Qt.Key_Slash
+ text: secondPage ? '"' : "/"
+ }
+ Key {
+ key: secondPage ? Qt.Key_unknown : Qt.Key_Backslash
+ text: secondPage ? '“' : "\\"
+ }
+ Key {
+ key: secondPage ? Qt.Key_unknown : Qt.Key_Exclam
+ text: secondPage ? '”' : "'"
+ }
+ Key {
+ key: secondPage ? Qt.Key_unknown : Qt.Key_Colon
+ text: secondPage ? '„' : ":"
+ }
+ Key {
+ key: secondPage ? Qt.Key_Ampersand : Qt.Key_Semicolon
+ text: secondPage ? "&" : ";"
+ }
+ BackspaceKey {
+
+ }
+ }
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ SymbolModeKey { displayText: "ABC" }
+ SpaceKey {}
+ HideKeyboardKey {}
+ EnterKey {}
+ }
+}