Commit 358860f2 authored by Marian's avatar Marian

Support for Qt Virtual Keyboard

parent 4248d37d
...@@ -292,11 +292,10 @@ Column { ...@@ -292,11 +292,10 @@ Column {
id: indicatorLabel id: indicatorLabel
text: config.TranslateShowPassword || "Show Password" text: config.TranslateShowPassword || "Show Password"
anchors.verticalCenter: indicator.verticalCenter anchors.verticalCenter: indicator.verticalCenter
anchors.verticalCenterOffset: -1
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
anchors.left: indicator.right anchors.left: indicator.right
anchors.leftMargin: indicator.width / 2 anchors.leftMargin: indicator.width / 2
font.pointSize: root.font.pointSize * 0.75 font.pointSize: root.font.pointSize * 0.8
color: root.palette.text color: root.palette.text
} }
......
...@@ -27,6 +27,9 @@ ColumnLayout { ...@@ -27,6 +27,9 @@ ColumnLayout {
property int p: config.ScreenPadding property int p: config.ScreenPadding
property string a: config.FormPosition property string a: config.FormPosition
property alias systemButtonVisibility: systemButtons.visible
property alias clockVisibility: clock.visible
property bool virtualKeyboardActive
Clock { Clock {
id: clock id: clock
...@@ -37,9 +40,10 @@ ColumnLayout { ...@@ -37,9 +40,10 @@ ColumnLayout {
Input { Input {
id: input id: input
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignVCenter
Layout.preferredHeight: root.height / 10 Layout.preferredHeight: root.height / 10
Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0 Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0
Layout.topMargin: virtualKeyboardActive ? -height * 1.5 : 0
} }
SystemButtons { SystemButtons {
......
//
// This file is part of Sugar Dark, a theme for the Simple Display Desktop Manager.
//
// Copyright 2018 Marian Arlt
//
// Sugar Dark is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Sugar Dark is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Sugar Dark. If not, see <https://www.gnu.org/licenses/>.
//
import QtQuick 2.11
import QtQuick.VirtualKeyboard 2.3
InputPanel {
id: virtualKeyboard
property bool activated: false
active: activated && Qt.inputMethod.visible
visible: active
}
\ No newline at end of file
...@@ -93,12 +93,117 @@ Pane { ...@@ -93,12 +93,117 @@ Pane {
LoginForm { LoginForm {
id: form id: form
height: parent.height height: virtualKeyboard.state == "visible" ? parent.height - virtualKeyboard.implicitHeight : parent.height
width: parent.width / 2.5 width: parent.width / 2.5
anchors.horizontalCenter: config.FormPosition == "center" ? parent.horizontalCenter : undefined anchors.horizontalCenter: config.FormPosition == "center" ? parent.horizontalCenter : undefined
anchors.left: config.FormPosition == "left" ? parent.left : undefined anchors.left: config.FormPosition == "left" ? parent.left : undefined
anchors.right: config.FormPosition == "right" ? parent.right : undefined anchors.right: config.FormPosition == "right" ? parent.right : undefined
virtualKeyboardActive: virtualKeyboard.state == "visible" ? true : false
z: 1
}
Button {
id: vkb
onClicked: virtualKeyboard.switchState()
visible: virtualKeyboard.status == Loader.Ready && config.ForceHideVirtualKeyboardButton == "false"
anchors.bottom: parent.bottom
anchors.bottomMargin: implicitHeight
anchors.horizontalCenter: form.horizontalCenter
z: 1
contentItem: Text {
text: config.TranslateVirtualKeyboardButton || "Virtual Keyboard"
color: parent.visualFocus ? palette.highlight : palette.text
font.pointSize: root.font.pointSize * 0.8
}
background: Rectangle {
id: vkbbg
color: "transparent"
}
}
Loader {
id: virtualKeyboard
source: "Components/VirtualKeyboard.qml"
state: "hidden"
property bool keyboardActive: item ? item.active : false
onKeyboardActiveChanged: keyboardActive ? state = "visible" : state = "hidden"
width: parent.width
z: 1 z: 1
function switchState() { state = state == "hidden" ? "visible" : "hidden" }
states: [
State {
name: "visible"
PropertyChanges {
target: form
systemButtonVisibility: false
clockVisibility: false
}
PropertyChanges {
target: virtualKeyboard
y: root.height - virtualKeyboard.height
opacity: 1
}
},
State {
name: "hidden"
PropertyChanges {
target: virtualKeyboard
y: root.height - root.height/4
opacity: 0
}
}
]
transitions: [
Transition {
from: "hidden"
to: "visible"
SequentialAnimation {
ScriptAction {
script: {
virtualKeyboard.item.activated = true;
Qt.inputMethod.show();
}
}
ParallelAnimation {
NumberAnimation {
target: virtualKeyboard
property: "y"
duration: 100
easing.type: Easing.OutQuad
}
OpacityAnimator {
target: virtualKeyboard
duration: 100
easing.type: Easing.OutQuad
}
}
}
},
Transition {
from: "visible"
to: "hidden"
SequentialAnimation {
ParallelAnimation {
NumberAnimation {
target: virtualKeyboard
property: "y"
duration: 100
easing.type: Easing.InQuad
}
OpacityAnimator {
target: virtualKeyboard
duration: 100
easing.type: Easing.InQuad
}
}
ScriptAction {
script: {
Qt.inputMethod.hide();
}
}
}
}
]
} }
Image { Image {
......
...@@ -87,6 +87,9 @@ ForcePasswordFocus="true" ...@@ -87,6 +87,9 @@ ForcePasswordFocus="true"
ForceHideCompletePassword="false" ForceHideCompletePassword="false"
## If you don't like to see any character at all not even while being entered set this to true. ## If you don't like to see any character at all not even while being entered set this to true.
ForceHideVirtualKeyboardButton="false"
## Do not show the button for the virtual keyboard at all. This will completely disable functionality for the virtual keyboard even if it is installed and activated in sddm.conf
## [Locale Settings] ## [Locale Settings]
...@@ -120,4 +123,5 @@ TranslateSuspend="" ...@@ -120,4 +123,5 @@ TranslateSuspend=""
TranslateHibernate="" TranslateHibernate=""
TranslateReboot="" TranslateReboot=""
TranslateShutdown="" TranslateShutdown=""
TranslateVirtualKeyboardButton=""
## These don't necessarily need to translate anything. You can enter whatever you want here. ## These don't necessarily need to translate anything. You can enter whatever you want here.
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