Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add assist labels to keyboard layout and a settings config page #8

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion rpm/jolla-kbd-flick-jp.spec
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,10 @@ fi
/usr/sbin/patchmanager -u %{name} || true

%changelog
* Wed Mar 2 2017 Topias Vainio <[email protected]> 0.07-1

* Thu Nov 1 2018 Topias Vainio <[email protected]> 0.07-1
- Fixed patch for Lemmenjoki 3.0.0 update

* Wed Mar 2 2017 Topias Vainio <[email protected]> 0.1-1
- Added assisting labels for flick keys
- Fixed patch for Lapuanjoki 2.1.4 update
29 changes: 29 additions & 0 deletions src/layouts/ja_10key_flick/AssistLabel.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import com.jolla.keyboard 1.0

Text {
property int keyIndex

visible: portraitMode
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors {
verticalCenter: parent.verticalCenter
horizontalCenter: parent.horizontalCenter
}
font.family: Theme.fontFamily
font.pixelSize: !portraitMode && attributes.isShifted
? Theme.fontSizeSmall
: Theme.fontSizeExtraSmall
color: pressed ? Theme.highlightColor : Theme.secondaryColor
text: portraitMode && !attributes.inSymView && flickerIndex == 0
? attributes.isShifted
? (textCaptState && captionShifted !== " "
? captionShifted2.charAt(keyIndex)
: (captionShifted !== " "
? captionShifted.charAt(keyIndex)
: ""))
: flickerText.charAt(keyIndex)
: ""
}
90 changes: 81 additions & 9 deletions src/layouts/ja_10key_flick/TenKey_Flick.qml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ KeyBase {
property string symView2
property int separator: SeparatorState.AutomaticSeparator
property bool implicitSeparator: true // set by layouting
// property bool separator: true
property bool showHighlight: true
property string accents
property string accentsShifted
Expand All @@ -61,13 +60,12 @@ KeyBase {
property bool enableFlicker: true
property bool symbolOnly: false

// showPopper: false

keyType: KeyType.CharacterKey
text: keyText.text.length === 1 ? keyText.text : (keyText.text.charAt(flickerIndex) ? keyText.text.charAt(flickerIndex) : keyText.text.chaAt(0))
text: keyText.text
caption: text

Column {
id: mainLabel
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
Text {
Expand All @@ -76,11 +74,48 @@ KeyBase {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.family: Theme.fontFamily
// font.pixelSize: !pressed && symbolOnly ? Theme.fontSizeExtraSmall : Theme.fontSizeMedium
font.pixelSize: !pressed && symbolOnly ? Theme.fontSizeExtraSmall : (portraitMode === false || attributes.isShifted || attributes.inSymView) ? Theme.fontSizeMedium : Theme.fontSizeLarge
font.pixelSize: !pressed && symbolOnly
? Theme.fontSizeExtraSmall
: (!portraitMode || attributes.isShifted || attributes.inSymView)
? Theme.fontSizeLarge
: (flickerIndex > 0
? Theme.fontSizeExtraLarge
: Theme.fontSizeSmall)
font.letterSpacing: (portraitMode === true && !attributes.isShifted && !attributes.inSymView && symbolOnly && flickerText.length > 3) ? -10 : 0
color: pressed ? Theme.highlightColor : Theme.primaryColor
text: attributes.inSymView && symView.length > 0 ? (!pressed ? (symbolOnly ? symView : symView.charAt(0)) : (symView.charAt(flickerIndex) !== "" ? symView.charAt(flickerIndex) : symView.charAt(0))) : (attributes.isShifted ? (!pressed ? (captionShifted === " " ? "" : (textCaptState && captionShifted2 !== "" ? captionShifted2 : captionShifted)) : (textCaptState && captionShifted2 !== "" ? (captionShifted2.charAt(flickerIndex) !== "" ? captionShifted2.charAt(flickerIndex) : captionShifted2.charAt(0)) : (captionShifted.charAt(flickerIndex) !== "" ? captionShifted.charAt(flickerIndex) : captionShifted.charAt(0)))) : !pressed && symbolOnly ? flickerText : (flickerText.charAt(flickerIndex) !== "" ? flickerText.charAt(flickerIndex) : flickerText.charAt(0)))
text: attributes.inSymView && symView.length > 0
? (!pressed
? (symbolOnly
? symView
: symView.charAt(0))
: (symView.charAt(flickerIndex) !== ""
? symView.charAt(flickerIndex)
: symView.charAt(0)))
: (attributes.isShifted
? (!pressed
? (captionShifted === " "
? ""
: (textCaptState && captionShifted2 !== ""
? !portraitMode
? captionShifted2
: captionShifted2.charAt(0)
: !portraitMode
? captionShifted
: captionShifted.charAt(0)))
: (textCaptState && captionShifted2 !== ""
? (captionShifted2.charAt(flickerIndex) !== ""
? captionShifted2.charAt(flickerIndex)
: captionShifted2.charAt(0))
: (captionShifted.charAt(flickerIndex) !== ""
? captionShifted.charAt(flickerIndex)
: captionShifted.charAt(0))))
: !pressed && symbolOnly
? (!portraitMode
? flickerText
: flickerText.charAt(0))
: (flickerText.charAt(flickerIndex) !== ""
? flickerText.charAt(flickerIndex)
: flickerText.charAt(0)))
}
Text {
id: secondaryLabel
Expand All @@ -92,16 +127,53 @@ KeyBase {
font.pixelSize: !symbolOnly ? Theme.fontSizeExtraSmall : Theme.fontSizeSmall
color: pressed ? Theme.highlightColor : Theme.primaryColor
opacity: (!pressed && attributes.isShifted && captionShifted === " ") ? .8 : .6
text: !pressed && attributes.inSymView && symView.length > 0 ? (symbolOnly ? "" : symView.slice(1)) : (!pressed && attributes.isShifted && captionShifted === " " ? "Space" : "")
text: !pressed && attributes.inSymView && symView.length > 0
? (symbolOnly
? ""
: symView.slice(1))
: (!pressed && attributes.isShifted && captionShifted === " "
? "Space"
: "")
}
}

AssistLabel {
id: keyTextI
anchors {
horizontalCenterOffset: -Theme.paddingMedium * 3
}
keyIndex: 1
}

AssistLabel {
id: keyTextU
anchors {
verticalCenterOffset: -Theme.paddingMedium * 3
}
keyIndex: 2
}

AssistLabel {
id: keyTextE
anchors {
horizontalCenterOffset: Theme.paddingMedium * 3
}
keyIndex: 3
}

AssistLabel {
id: keyTextO
anchors {
verticalCenterOffset: Theme.paddingMedium * 3
}
keyIndex: 4
}

Image {
source: "../../graphic-keyboard-highlight-top.png"
anchors.right: parent.right
visible: (separator === SeparatorState.AutomaticSeparator && implicitSeparator)
|| separator === SeparatorState.VisibleSeparator
// visible: separator
}

Rectangle {
Expand Down