mirror of
https://github.com/Keyitdev/sddm-astronaut-theme.git
synced 2026-09-24 02:22:09 +00:00
296 lines
11 KiB
QML
296 lines
11 KiB
QML
// Config created by Keyitdev https://github.com/Keyitdev/sddm-astronaut-theme
|
|
// Copyright (C) 2022-2024 Keyitdev
|
|
// Based on https://github.com/MarianArlt/sddm-sugar-dark
|
|
// Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html
|
|
|
|
import QtQuick 2.15
|
|
import QtQuick.Layouts 1.15
|
|
import QtQuick.Controls 2.15
|
|
import QtQuick.Effects
|
|
|
|
import "Components"
|
|
|
|
Pane {
|
|
id: root
|
|
|
|
height: config.ScreenHeight || Screen.height
|
|
width: config.ScreenWidth || Screen.ScreenWidth
|
|
padding: config.ScreenPadding
|
|
|
|
LayoutMirroring.enabled: config.RightToLeftLayout == "true" ? true : Qt.application.layoutDirection === Qt.RightToLeft
|
|
LayoutMirroring.childrenInherit: true
|
|
|
|
palette.window: config.BackgroundColor
|
|
palette.highlight: config.HighlightBackgroundColor
|
|
palette.highlightedText: config.HighlightTextColor
|
|
palette.buttonText: config.HoverSystemButtonsIconsColor
|
|
|
|
font.family: config.Font
|
|
font.pointSize: config.FontSize !== "" ? config.FontSize : parseInt(height / 80) || 13
|
|
|
|
focus: true
|
|
|
|
property bool leftleft: config.HaveFormBackground == "true" &&
|
|
config.PartialBlur == "false" &&
|
|
config.FormPosition == "left" &&
|
|
config.BackgroundHorizontalAlignment == "left"
|
|
|
|
property bool leftcenter: config.HaveFormBackground == "true" &&
|
|
config.PartialBlur == "false" &&
|
|
config.FormPosition == "left" &&
|
|
config.BackgroundHorizontalAlignment == "center"
|
|
|
|
property bool rightright: config.HaveFormBackground == "true" &&
|
|
config.PartialBlur == "false" &&
|
|
config.FormPosition == "right" &&
|
|
config.BackgroundHorizontalAlignment == "right"
|
|
|
|
property bool rightcenter: config.HaveFormBackground == "true" &&
|
|
config.PartialBlur == "false" &&
|
|
config.FormPosition == "right" &&
|
|
config.BackgroundHorizontalAlignment == "center"
|
|
|
|
Item {
|
|
id: sizeHelper
|
|
|
|
anchors.fill: parent
|
|
height: parent.height
|
|
width: parent.width
|
|
|
|
Rectangle {
|
|
id: tintLayer
|
|
anchors.fill: parent
|
|
width: parent.width
|
|
height: parent.height
|
|
opacity: config.DimBackground
|
|
z: 1
|
|
}
|
|
|
|
Rectangle {
|
|
id: formBackground
|
|
anchors.fill: form
|
|
anchors.centerIn: form
|
|
color: config.FormBackgroundColor
|
|
visible: config.HaveFormBackground == "true" ? true : false
|
|
opacity: config.PartialBlur == "true" ? 0.3 : 1
|
|
z: 1
|
|
}
|
|
|
|
LoginForm {
|
|
id: form
|
|
height: parent.height
|
|
width: parent.width / 2.5
|
|
anchors.horizontalCenter: config.FormPosition == "center" ? parent.horizontalCenter : undefined
|
|
anchors.left: config.FormPosition == "left" ? parent.left : undefined
|
|
anchors.right: config.FormPosition == "right" ? parent.right : undefined
|
|
z: 1
|
|
}
|
|
|
|
Button {
|
|
id: vkb
|
|
checkable: true
|
|
onClicked: virtualKeyboard.switchState()
|
|
|
|
Keys.onReturnPressed: {
|
|
toggle();
|
|
virtualKeyboard.switchState();
|
|
}
|
|
Keys.onEnterPressed: {
|
|
toggle();
|
|
virtualKeyboard.switchState();
|
|
}
|
|
visible: virtualKeyboard.status == Loader.Ready && config.HideVirtualKeyboard == "false"
|
|
anchors.bottom: parent.bottom
|
|
anchors.bottomMargin: implicitHeight
|
|
anchors.horizontalCenter: form.horizontalCenter
|
|
z: 1
|
|
contentItem: Text {
|
|
id: buttonVirtualKeyboard
|
|
text: config.TranslateVirtualKeyboardButtonOff || "Virtual Keyboard (off)"
|
|
color: parent.visualFocus ? config.HoverVirtualKeyboardButtonTextColor : config.VirtualKeyboardButtonTextColor
|
|
font.pointSize: root.font.pointSize * 0.8
|
|
font.family: root.font.family
|
|
}
|
|
background: Rectangle {
|
|
id: vkbbg
|
|
color: "transparent"
|
|
}
|
|
states: [
|
|
State {
|
|
name: "HoveredAndChecked"
|
|
when: vkb.checked && vkb.hovered
|
|
PropertyChanges {
|
|
target: buttonVirtualKeyboard
|
|
text: config.TranslateVirtualKeyboardButtonOn || "Virtual Keyboard (on)"
|
|
color: config.HoverVirtualKeyboardButtonTextColor
|
|
}
|
|
},
|
|
State {
|
|
name: "checked"
|
|
when: vkb.checked
|
|
PropertyChanges {
|
|
target: buttonVirtualKeyboard
|
|
text: config.TranslateVirtualKeyboardButtonOn || "Virtual Keyboard (on)"
|
|
}
|
|
},
|
|
State {
|
|
name: "hovered"
|
|
when: vkb.hovered
|
|
PropertyChanges {
|
|
target: buttonVirtualKeyboard
|
|
text: config.TranslateVirtualKeyboardButtonOff || "Virtual Keyboard (off)"
|
|
color: config.HoverVirtualKeyboardButtonTextColor
|
|
}
|
|
}
|
|
]
|
|
}
|
|
|
|
Loader {
|
|
id: virtualKeyboard
|
|
source: "Components/VirtualKeyboard.qml"
|
|
state: "hidden"
|
|
property bool keyboardActive: item ? item.active : false
|
|
// x * 0.4 = x / 2.5
|
|
width: config.KeyboardSize == "" ? parent.width * 0.4 : parent.width * config.KeyboardSize
|
|
anchors.bottom: parent.bottom
|
|
anchors.left: config.VirtualKeyboardPosition == "left" ? parent.left : undefined;
|
|
anchors.horizontalCenter: config.VirtualKeyboardPosition == "center" ? parent.horizontalCenter : undefined;
|
|
anchors.right: config.VirtualKeyboardPosition == "right" ? parent.right : undefined;
|
|
|
|
z: 1
|
|
function switchState() { state = state == "hidden" ? "visible" : "hidden"}
|
|
states: [
|
|
State {
|
|
name: "visible"
|
|
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: {
|
|
virtualKeyboard.item.activated = false;
|
|
Qt.inputMethod.hide();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
|
|
Image {
|
|
id: backgroundImage
|
|
|
|
height: parent.height
|
|
width: config.HaveFormBackground == "true" && config.FormPosition != "center" && config.PartialBlur != "true" ? parent.width - formBackground.width : parent.width
|
|
anchors.left: leftleft ||
|
|
leftcenter ?
|
|
formBackground.right : undefined
|
|
|
|
anchors.right: rightright ||
|
|
rightcenter ?
|
|
formBackground.left : undefined
|
|
|
|
horizontalAlignment: config.BackgroundHorizontalAlignment == "left" ?
|
|
Image.AlignLeft :
|
|
config.BackgroundHorizontalAlignment == "right" ?
|
|
Image.AlignRight : Image.AlignHCenter
|
|
|
|
verticalAlignment: config.BackgroundVerticalAlignment == "top" ?
|
|
Image.AlignTop :
|
|
config.BackgroundVerticalAlignment == "bottom" ?
|
|
Image.AlignBottom : Image.AlignVCenter
|
|
|
|
source: config.background || config.Background
|
|
fillMode: config.CropBackground == "true" ? Image.PreserveAspectCrop : Image.PreserveAspectFit
|
|
asynchronous: true
|
|
cache: true
|
|
clip: true
|
|
mipmap: true
|
|
}
|
|
|
|
MouseArea {
|
|
anchors.fill: backgroundImage
|
|
onClicked: parent.forceActiveFocus()
|
|
}
|
|
|
|
ShaderEffectSource {
|
|
id: blurMask
|
|
|
|
sourceItem: backgroundImage
|
|
width: form.width
|
|
height: parent.height
|
|
anchors.centerIn: form
|
|
sourceRect: Qt.rect(x,y,width,height)
|
|
visible: config.FullBlur == "true" || config.PartialBlur == "true" ? true : false
|
|
}
|
|
|
|
MultiEffect {
|
|
id: blur
|
|
|
|
height: parent.height
|
|
width: config.FullBlur == "true" ? parent.width : form.width
|
|
source: config.FullBlur == "true" ? backgroundImage : blurMask
|
|
blurEnabled: true
|
|
autoPaddingEnabled: false
|
|
blur: config.Blur == "" ? 2.0 : config.Blur
|
|
blurMax: config.BlurMax == "" ? 48 : config.BlurMax
|
|
anchors.centerIn: config.FullBlur == "true" ? parent : form
|
|
visible: config.FullBlur == "true" || config.PartialBlur == "true" ? true : false
|
|
}
|
|
}
|
|
}
|