Commit 2ea3c8ae authored by Jimmy HUGUET's avatar Jimmy HUGUET

Support landscape and improve layout definition

parent c41557cf
......@@ -36,9 +36,19 @@ KeyBase {
id: aCharKey
height: width
property string captionShifted
property string symView
property string symView2
property var keyValue: {
"caption": "",
"captionShifted": "",
"swipeCaption": ["", "", "", "", "", "", "", ""],
"swipeCaptionShifted": ["", "", "", "", "", "", "", ""],
"swipeSpecial": ["", "", "", "", "", "", "", ""],
"symView": ""
}
caption: keyValue["caption"]
property string captionShifted: keyValue["captionShifted"]
property string symView: keyValue["symView"]
property string symView2: caption
property int separator: SeparatorState.AutomaticSeparator
property bool implicitSeparator: true // set by layouting
property bool showHighlight: true
......@@ -52,9 +62,9 @@ KeyBase {
property alias fontSizeMode: textItem.fontSizeMode
property alias textAnchors: textItem.anchors
property var swipeCaption: ["", "", "", "", "", "", "", ""]
property var swipeCaptionShifted: ["", "", "", "", "", "", "", ""]
property var swipeSpecial: ["", "", "", "", "", "", "", ""]
property var swipeCaption: keyValue["swipeCaption"]
property var swipeCaptionShifted: keyValue["swipeCaptionShifted"]
property var swipeSpecial: keyValue["swipeSpecial"]
property int swipeValue: -1
property point tempPoint: Qt.point(0,0)
property point startPoint:Qt.point(0,0)
......
/*
* Copyright (C) 2012-2013 Jolla ltd and/or its subsidiary(-ies). All rights reserved.
*
* Contact: Pekka Vuorela <pekka.vuorela@jollamobile.com>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*l'orario
* 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 Jolla Ltd 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.
*
*/
import QtQuick 2.0
import com.jolla.keyboard 1.0
import Sailfish.Silica 1.0
KeyboardEaseLayout {
id: mylay
splitSupported: true
useTopItem: !mylay.isLandscape
height: portraitMode ? width * .75 : width * .32
accentMap: {
"´": {"e": "é", "E": "É", "a": "á", "A": "Á", "o": "ó", "O": "Ó", "i": "í", "I": "Í", "u": "ú", "U": "Ú", "y": "ý", "Y": "Ý" },
"^": {"e": "ê", "E": "Ê", "a": "â", "A": "Â", "o": "ô", "O": "Ô", "i": "î", "I": "Î", "u": "û", "U": "Û" },
"¨": {"e": "ë", "E": "Ë", "a": "ä", "A": "Ä", "o": "ö", "O": "Ö", "i": "ï", "I": "Ï", "u": "ü", "U": "Ü", "y": "ÿ", "Y": "Ϋ" },
"`": {"e": "è", "E": "È", "a": "à", "A": "À", "o": "ò", "O": "Ò", "i": "ì", "I": "Ì", "u": "ù", "U": "Ù" },
"°": { "a": "å", "A": "Å" },
"~": { "a": "ã", "A": "Ã", "o": "õ", "O": "Õ" , "n": "ñ", "N": "Ñ"},
"¸": {"c": "ç", "C": "Ç"}
}
property var easeLayout: ({})
KeyboardRow {
splitIndex: 3
CharacterEaseKey { keyValue: easeLayout["topLeft"] }
CharacterEaseKey { keyValue: easeLayout["top"] }
CharacterEaseKey { keyValue: easeLayout["topRight"] }
BackspaceKey { implicitWidth: symbol.width; active: !mylay.isLandscape }
KeyBase {
implicitWidth: symbol.width * 3
active: mylay.isLandscape
clip: true
Loader {
id: topItem
sourceComponent: mylay.isLandscape && keyboard.inputHandler ? keyboard.inputHandler.topItem : null
anchors.fill: parent
anchors.leftMargin: symbol.width / 2
}
}
}
KeyboardRow {
splitIndex: 3
CharacterEaseKey { keyValue: easeLayout["left"] }
CharacterEaseKey { keyValue: easeLayout["center"] }
CharacterEaseKey { keyValue: easeLayout["right"] }
SpecialEaseKey { active: mylay.isLandscape}
ShiftEaseKey { implicitWidth: symbol.width; active: !mylay.isLandscape }
SymbolKey { active: mylay.isLandscape}
BackspaceKey { implicitWidth: symbol.width; active: mylay.isLandscape }
}
KeyboardRow {
splitIndex: 3
CharacterEaseKey { keyValue: easeLayout["bottomLeft"] }
CharacterEaseKey { keyValue: easeLayout["bottom"] }
CharacterEaseKey { keyValue: easeLayout["bottomRight"] }
SymbolKey {
id: symbol
active: !mylay.isLandscape
}
ShiftEaseKey { active: mylay.isLandscape && !splitActive}
SpacebarKey { active: mylay.isLandscape }
FunctionKey { // copied EnterKey: i don't know why but it doesn't like as an element
active: mylay.isLandscape
icon.source: MInputMethodQuick.actionKeyOverride.icon
caption: MInputMethodQuick.actionKeyOverride.label
key: Qt.Key_Return
implicitWidth: symbol.width
enabled: MInputMethodQuick.actionKeyOverride.enabled
background.opacity: pressed ? 0.6 : MInputMethodQuick.actionKeyOverride.highlighted ? 0.4 : 0.17
}
}
SpacebarEaseRow {visible: portraitMode ? true : false}
}
......@@ -8,6 +8,7 @@ Column {
property string type
property bool portraitMode
property int rowHeight
property int keyHeight
property int punctuationKeyWidth
property int punctuationKeyWidthNarrow
......@@ -24,6 +25,7 @@ Column {
property bool useTopItem: !splitActive
property bool capsLockSupported: true
property bool isLandscape
property bool isEase: true
property var accentMap: ({})
property string lastAccentMerge: ""
......@@ -48,7 +50,9 @@ Column {
}
if (portraitMode) {
keyHeight = geometry.keyHeightPortrait
isLandscape = false
rowHeight = width * 0.75 / 4
keyHeight = rowHeight * 0.9 // geometry.keyHeightPortrait
punctuationKeyWidth = geometry.punctuationKeyPortait
punctuationKeyWidthNarrow = geometry.punctuationKeyPortraitNarrow
shiftKeyWidth = geometry.shiftKeyWidthPortrait
......@@ -58,7 +62,9 @@ Column {
avoidanceWidth = 0
splitActive = false
} else {
keyHeight = geometry.keyHeightLandscape
isLandscape = true
rowHeight = width * 0.32 / 3
keyHeight = rowHeight * 0.88 // geometry.keyHeightLandscape
punctuationKeyWidth = geometry.punctuationKeyLandscape
punctuationKeyWidthNarrow = geometry.punctuationKeyLandscapeNarrow
functionKeyWidth = geometry.functionKeyWidthLandscape
......@@ -86,7 +92,7 @@ Column {
child = children[i]
child.width = width
if (child.hasOwnProperty("followRowHeight") && child.followRowHeight) {
child.height = width / 5
child.height = rowHeight
}
if (child.maximumBasicButtonWidth !== undefined) {
......
......@@ -31,56 +31,35 @@ import QtQuick 2.0
import ".."
import Sailfish.Silica 1.0
KeyboardEaseLayout {
accentMap: {
"´": {"e": "é", "E": "É", "a": "á", "A": "Á", "o": "ó", "O": "Ó", "i": "í", "I": "Í", "u": "ú", "U": "Ú", "y": "ý", "Y": "Ý" },
"^": {"e": "ê", "E": "Ê", "a": "â", "A": "Â", "o": "ô", "O": "Ô", "i": "î", "I": "Î", "u": "û", "U": "Û" },
"¨": {"e": "ë", "E": "Ë", "a": "ä", "A": "Ä", "o": "ö", "O": "Ö", "i": "ï", "I": "Ï", "u": "ü", "U": "Ü", "y": "ÿ", "Y": "Ϋ" },
"`": {"e": "è", "E": "È", "a": "à", "A": "À", "o": "ò", "O": "Ò", "i": "ì", "I": "Ì", "u": "ù", "U": "Ù" },
"°": { "a": "å", "A": "Å" },
"~": { "a": "ã", "A": "Ã", "o": "õ", "O": "Õ" , "n": "ñ", "N": "Ñ"},
"¸": {"c": "ç", "C": "Ç"}
}
KeyboardRow {
CharacterEaseKey {
caption: "a"; swipeCaption: ["", "", "", "", "", "", "", "v"]; swipeSpecial: ["", "", "", "", "-", "", "", ""];
captionShifted: "A"; swipeCaptionShifted: ["", "", "", "", "", "", "", "V"]; symView: "1"; symView2: caption }
CharacterEaseKey {
caption: "n"; swipeCaption: ["", "", "", "", "", "", "l", ""]; swipeSpecial: ["`", "^", "´", "+", "!", "/", "", "\\"];
captionShifted: "N"; swipeCaptionShifted: ["", "", "", "", "", "", "L", ""]; symView: "2"; symView2: caption }
CharacterEaseKey {
caption: "i"; swipeCaption: ["", "", "", "", "", "x", "", ""]; swipeSpecial: ["¨", "°", "¸", "?", "", "", "=", "£"];
captionShifted: "I"; swipeCaptionShifted: ["", "", "", "", "", "X", "", ""]; symView: "3"; symView2: caption }
BackspaceKey {implicitWidth: symbol.width}
}
KeyboardRow {
CharacterEaseKey {
caption: "h"; swipeCaption: ["", "", "", "", "k", "", "", ""]; swipeSpecial: ["{", "", "%", "(", "", "[", "", "_"];
captionShifted: "H"; swipeCaptionShifted: ["", "", "", "", "K", "", "", ""]; symView: "4"; symView2: caption }
CharacterEaseKey {
caption: "o"; swipeCaption: ["q", "u", "p", "c", "b", "g", "d", "j"]; swipeSpecial: ["", "", "", "", "", "", "", ""];
captionShifted: "O"; swipeCaptionShifted: ["Q", "U", "P", "C", "B", "G", "D", "J"]; symView: "5"; symView2: caption }
CharacterEaseKey {
caption: "r"; swipeCaption: ["", "", "", "m", "", "", "", ""]; swipeSpecial: ["|", "", "}", "", ")", "@", "", "]"];
captionShifted: "R"; swipeCaptionShifted: ["", "", "", "M", "", "", "", ""]; symView: "6"; symView2: caption }
EaseBase {
ShiftEaseKey {implicitWidth: symbol.width}
easeLayout: {
"topLeft": {
"caption": "a", "swipeCaption": ["", "", "", "", "", "", "", "v"], "swipeSpecial": ["", "", "", "", "-", "", "", ""],
"captionShifted": "A", "swipeCaptionShifted": ["", "", "", "", "", "", "", "V"], "symView": "1" },
"top": {
"caption": "n", "swipeCaption": ["", "", "", "", "", "", "l", ""], "swipeSpecial": ["`", "^", "´", "+", "!", "/", "", "\\"],
"captionShifted": "N", "swipeCaptionShifted": ["", "", "", "", "", "", "L", ""], "symView": "2" },
"topRight": {
"caption": "i", "swipeCaption": ["", "", "", "", "", "x", "", ""], "swipeSpecial": ["¨", "°", "¸", "?", "", "", "=", "£"],
"captionShifted": "I", "swipeCaptionShifted": ["", "", "", "", "", "X", "", ""], "symView": "3" },
"left": {
"caption": "h", "swipeCaption": ["", "", "", "", "k", "", "", ""], "swipeSpecial": ["{", "", "%", "(", "", "[", "", "_"],
"captionShifted": "H", "swipeCaptionShifted": ["", "", "", "", "K", "", "", ""], "symView": "4" },
"center": {
"caption": "o", "swipeCaption": ["q", "u", "p", "c", "b", "g", "d", "j"], "swipeSpecial": ["", "", "", "", "", "", "", ""],
"captionShifted": "O", "swipeCaptionShifted": ["Q", "U", "P", "C", "B", "G", "D", "J"], "symView": "5" },
"right": {
"caption": "r", "swipeCaption": ["", "", "", "m", "", "", "", ""], "swipeSpecial": ["|", "", "}", "", ")", "@", "", "]"],
"captionShifted": "R", "swipeCaptionShifted": ["", "", "", "M", "", "", "", ""], "symView": "6" },
"bottomLeft": {
"caption": "t", "swipeCaption": ["", "", "y", "", "", "", "", ""], "swipeSpecial": ["~", "", "", "<", "*", "", "", ""],
"captionShifted": "T", "swipeCaptionShifted": ["", "", "Y", "", "", "", "", ""], "symView": "7" },
"bottom": {
"caption": "e", "swipeCaption": ["", "w", "", "", "z", "", "", ""], "swipeSpecial": ["\"", "", "'", "", "", ",", ".", ":"],
"captionShifted": "E", "swipeCaptionShifted": ["", "W", "", "", "Z", "", "", ""], "symView": "8" },
"bottomRight": {
"caption": "s", "swipeCaption": ["f", "", "", "", "", "", "", ""], "swipeSpecial": ["", "&", "", "#", ">", ";", "", ""],
"captionShifted": "S", "swipeCaptionShifted": ["F", "", "", "", "", "", "", ""], "symView": "9" }
}
KeyboardRow {
CharacterEaseKey {
caption: "t"; swipeCaption: ["", "", "y", "", "", "", "", ""]; swipeSpecial: ["~", "", "", "<", "*", "", "", ""];
captionShifted: "T"; swipeCaptionShifted: ["", "", "Y", "", "", "", "", ""]; symView: "7"; symView2: caption }
CharacterEaseKey {
caption: "e"; swipeCaption: ["", "w", "", "", "z", "", "", ""]; swipeSpecial: ["\"", "", "'", "", "", ",", ".", ":"];
captionShifted: "E"; swipeCaptionShifted: ["", "W", "", "", "Z", "", "", ""]; symView: "8"; symView2: caption }
CharacterEaseKey {
caption: "s"; swipeCaption: ["f", "", "", "", "", "", "", ""]; swipeSpecial: ["", "&", "", "#", ">", ";", "", ""];
captionShifted: "S"; swipeCaptionShifted: ["F", "", "", "", "", "", "", ""]; symView: "9"; symView2: caption }
SymbolKey {id: symbol}
}
SpacebarEaseRow {}
}
......@@ -32,55 +32,33 @@ import ".."
import Sailfish.Silica 1.0
KeyboardEaseLayout {
accentMap: {
"´": {"e": "é", "E": "É", "a": "á", "A": "Á", "o": "ó", "O": "Ó", "i": "í", "I": "Í", "u": "ú", "U": "Ú", "y": "ý", "Y": "Ý" },
"^": {"e": "ê", "E": "Ê", "a": "â", "A": "Â", "o": "ô", "O": "Ô", "i": "î", "I": "Î", "u": "û", "U": "Û" },
"¨": {"e": "ë", "E": "Ë", "a": "ä", "A": "Ä", "o": "ö", "O": "Ö", "i": "ï", "I": "Ï", "u": "ü", "U": "Ü", "y": "ÿ", "Y": "Ϋ" },
"`": {"e": "è", "E": "È", "a": "à", "A": "À", "o": "ò", "O": "Ò", "i": "ì", "I": "Ì", "u": "ù", "U": "Ù" },
"°": { "a": "å", "A": "Å" },
"~": { "a": "ã", "A": "Ã", "o": "õ", "O": "Õ" , "n": "ñ", "N": "Ñ"},
"¸": {"c": "ç", "C": "Ç"}
easeLayout: {
"topLeft": {
"caption": "a", "swipeCaption": ["", "", "", "", "", "", "", "v"], "swipeSpecial": ["", "", "", "", "-", "£", "", ""],
"captionShifted": "A", "swipeCaptionShifted": ["", "", "", "", "", "", "", "V"], "symView": "1" },
"top": {
"caption": "n", "swipeCaption": ["", "", "", "", "", "", "h", ""], "swipeSpecial": ["`", "^", "´", "+", "!", "/", "", "\\"],
"captionShifted": "N", "swipeCaptionShifted": ["", "", "", "", "", "", "H", ""], "symView": "2" },
"topRight": {
"caption": "i", "swipeCaption": ["", "", "", "", "", "x", "", ""], "swipeSpecial": ["¨", "°", "¸", "?", "", "", "=", ""],
"captionShifted": "I", "swipeCaptionShifted": ["", "", "", "", "", "X", "", ""], "symView": "3" },
"left": {
"caption": "l", "swipeCaption": ["", "", "", "", "k", "", "", ""], "swipeSpecial": ["{", "", "%", "(", "", "[", "", "_"],
"captionShifted": "L", "swipeCaptionShifted": ["", "", "", "", "K", "", "", ""], "symView": "4" },
"center": {
"caption": "o", "swipeCaption": ["q", "u", "p", "c", "b", "g", "d", "j"], "swipeSpecial": ["", "", "", "", "", "", "", ""],
"captionShifted": "O", "swipeCaptionShifted": ["Q", "U", "P", "C", "B", "G", "D", "J"], "symView": "5" },
"right": {
"caption": "r", "swipeCaption": ["", "", "", "m", "", "", "", ""], "swipeSpecial": ["|", "", "}", "", ")", "@", "", "]"],
"captionShifted": "R", "swipeCaptionShifted": ["", "", "", "M", "", "", "", ""], "symView": "6" },
"bottomLeft": {
"caption": "t", "swipeCaption": ["", "", "y", "", "", "", "", ""], "swipeSpecial": ["~", "", "", "<", "*", "", "", ""],
"captionShifted": "T", "swipeCaptionShifted": ["", "", "Y", "", "", "", "", ""], "symView": "7" },
"bottom": {
"caption": "e", "swipeCaption": ["", "w", "", "", "z", "", "", ""], "swipeSpecial": ["\"", "", "'", "", "", ",", ".", ":"],
"captionShifted": "E", "swipeCaptionShifted": ["", "W", "", "", "Z", "", "", ""], "symView": "8" },
"bottomRight": {
"caption": "s", "swipeCaption": ["f", "", "", "", "", "", "", ""], "swipeSpecial": ["", "&", "", "#", ">", ";", "", ""],
"captionShifted": "S", "swipeCaptionShifted": ["F", "", "", "", "", "", "", ""], "symView": "9" }
}
KeyboardRow {
CharacterEaseKey {
caption: "a"; swipeCaption: ["", "", "", "", "", "", "", "v"]; swipeSpecial: ["", "", "", "", "-", "£", "", ""];
captionShifted: "A"; swipeCaptionShifted: ["", "", "", "", "", "", "", "V"]; symView: "1"; symView2: caption }
CharacterEaseKey {
caption: "n"; swipeCaption: ["", "", "", "", "", "", "h", ""]; swipeSpecial: ["`", "^", "´", "+", "!", "/", "", "\\"];
captionShifted: "N"; swipeCaptionShifted: ["", "", "", "", "", "", "H", ""]; symView: "2"; symView2: caption }
CharacterEaseKey {
caption: "i"; swipeCaption: ["", "", "", "", "", "x", "", ""]; swipeSpecial: ["¨", "°", "¸", "?", "", "", "=", ""];
captionShifted: "I"; swipeCaptionShifted: ["", "", "", "", "", "X", "", ""]; symView: "3"; symView2: caption }
BackspaceKey {implicitWidth: symbol.width}
}
KeyboardRow {
CharacterEaseKey {
caption: "l"; swipeCaption: ["", "", "", "", "k", "", "", ""]; swipeSpecial: ["{", "", "%", "(", "", "[", "", "_"];
captionShifted: "L"; swipeCaptionShifted: ["", "", "", "", "K", "", "", ""]; symView: "4"; symView2: caption }
CharacterEaseKey {
caption: "o"; swipeCaption: ["q", "u", "p", "c", "b", "g", "d", "j"]; swipeSpecial: ["", "", "", "", "", "", "", ""];
captionShifted: "O"; swipeCaptionShifted: ["Q", "U", "P", "C", "B", "G", "D", "J"]; symView: "5"; symView2: caption }
CharacterEaseKey {
caption: "r"; swipeCaption: ["", "", "", "m", "", "", "", ""]; swipeSpecial: ["|", "", "}", "", ")", "@", "", "]"];
captionShifted: "R"; swipeCaptionShifted: ["", "", "", "M", "", "", "", ""]; symView: "6"; symView2: caption }
ShiftEaseKey {implicitWidth: symbol.width}
}
KeyboardRow {
CharacterEaseKey {
caption: "t"; swipeCaption: ["", "", "y", "", "", "", "", ""]; swipeSpecial: ["~", "", "", "<", "*", "", "", ""];
captionShifted: "T"; swipeCaptionShifted: ["", "", "Y", "", "", "", "", ""]; symView: "7"; symView2: caption }
CharacterEaseKey {
caption: "e"; swipeCaption: ["", "w", "", "", "z", "", "", ""]; swipeSpecial: ["\"", "", "'", "", "", ",", ".", ":"];
captionShifted: "E"; swipeCaptionShifted: ["", "W", "", "", "Z", "", "", ""]; symView: "8"; symView2: caption }
CharacterEaseKey {
caption: "s"; swipeCaption: ["f", "", "", "", "", "", "", ""]; swipeSpecial: ["", "&", "", "#", ">", ";", "", ""];
captionShifted: "S"; swipeCaptionShifted: ["F", "", "", "", "", "", "", ""]; symView: "9"; symView2: caption }
SymbolKey {id: symbol}
}
SpacebarEaseRow {}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment