From 3259133a20921e14d7e6e1ebe6d2644d2987da8b Mon Sep 17 00:00:00 2001 From: Roger Gonzalez Date: Mon, 30 Dec 2019 15:52:33 -0300 Subject: Added sddm themes --- .sddm/themes/sugar-light/Components/Clock.qml | 71 ++++ .sddm/themes/sugar-light/Components/Input.qml | 389 +++++++++++++++++++++ .sddm/themes/sugar-light/Components/LoginForm.qml | 47 +++ .../sugar-light/Components/SessionButton.qml | 161 +++++++++ .../sugar-light/Components/SystemButtons.qml | 118 +++++++ 5 files changed, 786 insertions(+) create mode 100644 .sddm/themes/sugar-light/Components/Clock.qml create mode 100644 .sddm/themes/sugar-light/Components/Input.qml create mode 100644 .sddm/themes/sugar-light/Components/LoginForm.qml create mode 100644 .sddm/themes/sugar-light/Components/SessionButton.qml create mode 100644 .sddm/themes/sugar-light/Components/SystemButtons.qml (limited to '.sddm/themes/sugar-light/Components') diff --git a/.sddm/themes/sugar-light/Components/Clock.qml b/.sddm/themes/sugar-light/Components/Clock.qml new file mode 100644 index 00000000..a8ac7515 --- /dev/null +++ b/.sddm/themes/sugar-light/Components/Clock.qml @@ -0,0 +1,71 @@ +// +// This file is part of Sugar Light, a theme for the Simple Display Desktop Manager. +// +// Copyright 2018 Marian Arlt +// +// Sugar Light 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 Light 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 Light. If not, see . +// + +import QtQuick 2.11 +import QtQuick.Controls 2.4 + +Column { + id: clock + spacing: 0 + width: parent.width / 2 + + Label { + anchors.horizontalCenter: parent.horizontalCenter + font.pointSize: config.HeaderText !=="" ? root.font.pointSize * 5 : 0 + color: root.palette.text + renderType: Text.QtRendering + text: config.HeaderText + } + + Label { + id: timeLabel + anchors.horizontalCenter: parent.horizontalCenter + font.pointSize: root.font.pointSize * 3 + color: root.palette.text + renderType: Text.QtRendering + function updateTime() { + text = new Date().toLocaleTimeString(Qt.locale(config.Locale), config.HourFormat == "long" ? Locale.LongFormat : config.HourFormat !== "" ? config.HourFormat : Locale.ShortFormat) + } + } + + Label { + id: dateLabel + anchors.horizontalCenter: parent.horizontalCenter + color: root.palette.text + renderType: Text.QtRendering + function updateTime() { + text = new Date().toLocaleDateString(Qt.locale(config.Locale), config.DateFormat == "short" ? Locale.ShortFormat : config.DateFormat !== "" ? config.DateFormat : Locale.LongFormat) + } + } + + Timer { + interval: 1000 + repeat: true + running: true + onTriggered: { + dateLabel.updateTime() + timeLabel.updateTime() + } + } + + Component.onCompleted: { + dateLabel.updateTime() + timeLabel.updateTime() + } +} diff --git a/.sddm/themes/sugar-light/Components/Input.qml b/.sddm/themes/sugar-light/Components/Input.qml new file mode 100644 index 00000000..9f93277d --- /dev/null +++ b/.sddm/themes/sugar-light/Components/Input.qml @@ -0,0 +1,389 @@ +// +// This file is part of Sugar Light, a theme for the Simple Display Desktop Manager. +// +// Copyright 2018 Marian Arlt +// +// Sugar Light 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 Light 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 Light. If not, see . +// + +import QtQuick 2.11 +import QtQuick.Layouts 1.11 +import QtQuick.Controls 2.4 + +Column { + id: inputContainer + Layout.fillWidth: true + + property Control exposeLogin: loginButton + + Item { + id: usernameField + height: root.font.pointSize * 3.25 + width: parent.width / 2 + anchors.horizontalCenter: parent.horizontalCenter + + TextField { + id: username + text: config.ForceLastUser == "true" ? userModel.lastUser : "" + anchors.centerIn: parent + height: root.font.pointSize * 3 + width: parent.width + placeholderText: config.TranslateUsernamePlaceholder || textConstants.userName + selectByMouse: true + horizontalAlignment: TextInput.AlignHCenter + renderType: Text.QtRendering + background: Rectangle { + color: "transparent" + border.color: root.palette.text + border.width: parent.activeFocus ? 2 : 1 + radius: config.RoundCorners || 0 + } + Keys.onReturnPressed: loginButton.clicked() + KeyNavigation.down: password + } + + Button { + id: usernameIcon + anchors.horizontalCenter: parent.left + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenterOffset: username.height * 0.6 + icon.height: username.height * 0.4 + icon.width: username.height * 0.4 + enabled: false + icon.color: root.palette.text + icon.source: Qt.resolvedUrl("../Assets/User.svgz") + } + + states: [ + State { + name: "focused" + when: username.activeFocus + PropertyChanges { + target: username.background + border.color: config.AccentColor + } + PropertyChanges { + target: username + color: config.AccentColor + } + } + ] + + transitions: [ + Transition { + PropertyAnimation { + properties: "color, border.color" + duration: 150 + } + } + ] + } + + Item { + id: passwordField + height: root.font.pointSize * 4.5 + width: parent.width / 2 + anchors.horizontalCenter: parent.horizontalCenter + + TextField { + id: password + anchors.centerIn: parent + height: root.font.pointSize * 3 + width: parent.width + focus: config.ForcePasswordFocus == "true" ? true : false + selectByMouse: true + echoMode: revealSecret.checked ? TextInput.Normal : TextInput.Password + placeholderText: config.TranslatePasswordPlaceholder || textConstants.password + horizontalAlignment: TextInput.AlignHCenter + passwordCharacter: "•" + passwordMaskDelay: config.ForceHideCompletePassword == "true" ? undefined : 1000 + renderType: Text.QtRendering + background: Rectangle { + color: "transparent" + border.color: root.palette.text + border.width: parent.activeFocus ? 2 : 1 + radius: config.RoundCorners || 0 + } + Keys.onReturnPressed: loginButton.clicked() + KeyNavigation.down: revealSecret + } + + states: [ + State { + name: "focused" + when: password.activeFocus + PropertyChanges { + target: password.background + border.color: config.AccentColor + } + PropertyChanges { + target: password + color: config.AccentColor + } + } + ] + + transitions: [ + Transition { + PropertyAnimation { + properties: "color, border.color" + duration: 150 + } + } + ] + } + + Item { + id: secretCheckBox + height: root.font.pointSize * 7 + width: parent.width / 2 + anchors.horizontalCenter: parent.horizontalCenter + + CheckBox { + id: revealSecret + width: parent.width + hoverEnabled: true + + indicator: Rectangle { + id: indicator + anchors.left: parent.left + implicitHeight: root.font.pointSize + implicitWidth: root.font.pointSize + color: "transparent" + border.color: root.palette.text + border.width: parent.visualFocus ? 2 : 1 + Rectangle { + id: dot + anchors.centerIn: parent + implicitHeight: parent.width - 6 + implicitWidth: parent.width - 6 + color: root.palette.text + opacity: revealSecret.checked ? 1 : 0 + } + } + + contentItem: Text { + id: indicatorLabel + text: config.TranslateShowPassword || "Show Password" + anchors.verticalCenter: indicator.verticalCenter + horizontalAlignment: Text.AlignLeft + anchors.left: indicator.right + anchors.leftMargin: indicator.width / 2 + font.pointSize: root.font.pointSize * 0.75 + color: root.palette.text + } + + Keys.onReturnPressed: toggle() + KeyNavigation.down: loginButton + } + + states: [ + State { + name: "pressed" + when: revealSecret.down + PropertyChanges { + target: revealSecret.contentItem + color: Qt.darker(config.AccentColor, 1.2) + } + PropertyChanges { + target: dot + color: Qt.darker(config.AccentColor, 1.2) + } + PropertyChanges { + target: indicator + border.color: Qt.darker(config.AccentColor, 1.2) + } + }, + State { + name: "hovered" + when: revealSecret.hovered + PropertyChanges { + target: indicatorLabel + color: Qt.lighter(config.AccentColor, 1.3) + } + PropertyChanges { + target: indicator + border.color: Qt.lighter(config.AccentColor, 1.3) + } + PropertyChanges { + target: dot + color: Qt.lighter(config.AccentColor, 1.3) + } + }, + State { + name: "focused" + when: revealSecret.visualFocus + PropertyChanges { + target: indicatorLabel + color: config.AccentColor + } + PropertyChanges { + target: indicator + border.color: config.AccentColor + } + PropertyChanges { + target: dot + color: config.AccentColor + } + } + ] + + transitions: [ + Transition { + PropertyAnimation { + properties: "color, border.color, opacity" + duration: 150 + } + } + ] + + } + + Item { + height: root.font.pointSize * 2.3 + width: parent.width / 2 + anchors.horizontalCenter: parent.horizontalCenter + Label { + id: errorMessage + width: parent.width + text: config.TranslateLoginFailed || textConstants.loginFailed + "!" + horizontalAlignment: Text.AlignHCenter + font.pointSize: root.font.pointSize * 0.8 + font.italic: true + color: root.palette.text + opacity: 0 + OpacityAnimator on opacity { + id: fadeIn + from: 0; + to: 1; + duration: 200 + running: false + } + OpacityAnimator on opacity { + id: fadeOut + from: 1; + to: 0; + duration: 400 + running: false + } + } + } + + Item { + id: login + height: root.font.pointSize * 3 + width: parent.width / 2 + anchors.horizontalCenter: parent.horizontalCenter + + Button { + id: loginButton + anchors.horizontalCenter: parent.horizontalCenter + text: config.TranslateLogin || textConstants.login + height: root.font.pointSize * 3 + implicitWidth: parent.width + enabled: username.text !== "" && password.text !== "" ? true : false + hoverEnabled: true + + contentItem: Text { + text: parent.text + color: "white" + font.pointSize: root.font.pointSize + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + + background: Rectangle { + id: buttonBackground + color: root.palette.text + radius: config.RoundCorners || 0 + } + + states: [ + State { + name: "disabled" + when: !loginButton.enabled + PropertyChanges { + target: buttonBackground + color: "#888888" + } + }, + State { + name: "pressed" + when: loginButton.down + PropertyChanges { + target: buttonBackground + color: "#444444" + } + }, + State { + name: "hovered" + when: loginButton.hovered + PropertyChanges { + target: buttonBackground + color: Qt.lighter(config.AccentColor, 1.2) || Qt.lighter("orange", 1.2) + } + }, + State { + name: "focused" + when: loginButton.visualFocus + PropertyChanges { + target: buttonBackground + color: config.AccentColor + } + } + ] + + transitions: [ + Transition { + from: "disabled"; to: "" + PropertyAnimation { + properties: "color" + duration: 500 + } + }, + Transition { + PropertyAnimation { + properties: "color" + duration: 100 + } + } + ] + + Keys.onReturnPressed: clicked() + onClicked: username.text !== "" && password.text !== "" ? sddm.login(username.text, password.text, sessionSelector.selectedSession) : sddm.loginFailed() + } + } + + SessionButton { + id: sessionSelector + textConstantSession: textConstants.session + } + + Connections { + target: sddm + onLoginSucceeded: {} + onLoginFailed: { + fadeIn.start() + resetError.running ? resetError.stop() & resetError.start() : resetError.start() + } + } + + Timer { + id: resetError + interval: 2000 + onTriggered: fadeOut.start() + running: false + } + +} diff --git a/.sddm/themes/sugar-light/Components/LoginForm.qml b/.sddm/themes/sugar-light/Components/LoginForm.qml new file mode 100644 index 00000000..dd8eafda --- /dev/null +++ b/.sddm/themes/sugar-light/Components/LoginForm.qml @@ -0,0 +1,47 @@ +// +// This file is part of Sugar Light, a theme for the Simple Display Desktop Manager. +// +// Copyright 2018 Marian Arlt +// +// Sugar Light 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 Light 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 Light. If not, see . +// + +import QtQuick 2.11 +import QtQuick.Layouts 1.11 +import SddmComponents 2.0 as SDDM + +ColumnLayout { + id: formContainer + SDDM.TextConstants { id: textConstants } + + Clock { + id: clock + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.preferredHeight: root.height / 3 + } + + Input { + id: input + Layout.alignment: Qt.AlignTop + Layout.preferredHeight: root.height / 10 + } + + SystemButtons { + id: systemButtons + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.preferredHeight: root.height / 4 + exposedLogin: input.exposeLogin + } + +} diff --git a/.sddm/themes/sugar-light/Components/SessionButton.qml b/.sddm/themes/sugar-light/Components/SessionButton.qml new file mode 100644 index 00000000..b134f332 --- /dev/null +++ b/.sddm/themes/sugar-light/Components/SessionButton.qml @@ -0,0 +1,161 @@ +// +// This file is part of Sugar Light, a theme for the Simple Display Desktop Manager. +// +// Copyright 2018 Marian Arlt +// +// Sugar Light 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 Light 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 Light. If not, see . +// + +import QtQuick 2.11 +import QtQuick.Controls 2.4 + +Item { + id: sessionButton + height: root.font.pointSize + width: parent.width / 2 + anchors.horizontalCenter: parent.horizontalCenter + + property var selectedSession: selectSession.currentIndex + property string textConstantSession + + ComboBox { + id: selectSession + + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width + hoverEnabled: true + + model: sessionModel + currentIndex: model.lastIndex + textRole: "name" + + delegate: ItemDelegate { + width: parent.width + anchors.horizontalCenter: parent.horizontalCenter + contentItem: Text { + text: model.name + font.pointSize: root.font.pointSize * 0.8 + color: selectSession.highlightedIndex === index ? "white" : root.palette.text + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + } + highlighted: parent.highlightedIndex === index + background: Rectangle { + color: selectSession.highlightedIndex === index ? root.palette.text : "transparent" + } + } + + indicator { + visible: false + } + + contentItem: Text { + id: displayedItem + text: (config.TranslateSession || (textConstantSession + ":")) + " " + selectSession.currentText + color: root.palette.text // parent.down ? root.palette.text : parent.hovered ? Qt.lighter(root.palette.text, 1.8) : root.palette.text + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignLeft + font.pointSize: root.font.pointSize * 0.8 + } + + background: Rectangle { + color: "transparent" + border.width: parent.visualFocus ? 1 : 0 + border.color: "transparent" // parent.visualFocus ? root.palette.text : "transparent" + height: parent.visualFocus ? 2 : 0 + width: displayedItem.implicitWidth + anchors.top: parent.bottom + anchors.left: parent.left + } + + popup: Popup { + id: popupHandler + y: parent.height - 1 + width: parent.width + implicitHeight: contentItem.implicitHeight + padding: 1 + + contentItem: ListView { + clip: false + implicitHeight: contentHeight + model: selectSession.popup.visible ? selectSession.delegateModel : null + currentIndex: selectSession.highlightedIndex + ScrollIndicator.vertical: ScrollIndicator { } + } + + background: Rectangle { + width: parent.width + height: parent.height + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + border.width: 1 + border.color: root.palette.text + } + + enter: Transition { + NumberAnimation { property: "opacity"; from: 0; to: 1 } + } + } + + states: [ + State { + name: "pressed" + when: selectSession.down + PropertyChanges { + target: displayedItem + color: Qt.lighter(config.AccentColor, 1.1) + } + PropertyChanges { + target: selectSession.background + border.color: Qt.lighter(config.AccentColor, 1.1) + } + }, + State { + name: "hovered" + when: selectSession.hovered + PropertyChanges { + target: displayedItem + color: Qt.lighter(config.AccentColor, 1.3) + } + PropertyChanges { + target: selectSession.background + border.color: Qt.lighter(config.AccentColor, 1.3) + } + }, + State { + name: "focused" + when: selectSession.visualFocus + PropertyChanges { + target: displayedItem + color: config.AccentColor + } + PropertyChanges { + target: selectSession.background + border.color: config.AccentColor + } + } + ] + + transitions: [ + Transition { + PropertyAnimation { + properties: "color, border.color" + duration: 150 + } + } + ] + + } + +} diff --git a/.sddm/themes/sugar-light/Components/SystemButtons.qml b/.sddm/themes/sugar-light/Components/SystemButtons.qml new file mode 100644 index 00000000..f066a317 --- /dev/null +++ b/.sddm/themes/sugar-light/Components/SystemButtons.qml @@ -0,0 +1,118 @@ +// +// This file is part of Sugar Light, a theme for the Simple Display Desktop Manager. +// +// Copyright 2018 Marian Arlt +// +// Sugar Light 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 Light 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 Light. If not, see . +// + +import QtQuick 2.11 +import QtQuick.Layouts 1.11 +import QtQuick.Controls 2.4 + +RowLayout { + + spacing: root.font.pointSize + + property var suspend: ["Suspend", config.TranslateSuspend || textConstants.suspend, sddm.canSuspend] + property var reboot: ["Reboot", config.TranslateReboot || textConstants.reboot, sddm.canReboot] + property var shutdown: ["Shutdown", config.TranslateShutdown || textConstants.shutdown, sddm.canPowerOff] + + property Control exposedLogin + + Repeater { + + model: [suspend, reboot, shutdown] + + RoundButton { + enabled: modelData[2] + text: modelData[1] + font.pointSize: root.font.pointSize * 0.8 + Layout.alignment: Qt.AlignHCenter + icon.source: modelData ? Qt.resolvedUrl("../Assets/" + modelData[0] + ".svgz") : "" + icon.height: 2 * Math.round((root.font.pointSize * 3) / 2) + icon.width: 2 * Math.round((root.font.pointSize * 3) / 2) + display: AbstractButton.TextUnderIcon + opacity: modelData[2] ? 1 : 0.3 + hoverEnabled: true + palette.buttonText: root.palette.text + background: Rectangle { + height: 2 + color: "transparent" + width: parent.width + border.width: parent.visualFocus ? 1 : 0 + border.color: "transparent" + anchors.top: parent.bottom + } + Keys.onReturnPressed: clicked() + onClicked: { + parent.forceActiveFocus() + index == 0 ? sddm.suspend() : index == 1 ? sddm.reboot() : sddm.powerOff() + } + KeyNavigation.up: exposedLogin + KeyNavigation.left: index == 0 ? exposedLogin : parent.children[index-1] + + states: [ + State { + name: "pressed" + when: parent.children[index].down + PropertyChanges { + target: parent.children[index] + palette.buttonText: Qt.lighter("red", 1.1) + } + PropertyChanges { + target: parent.children[index].background + border.color: Qt.lighter("red", 1.3) + } + }, + State { + name: "hovered" + when: parent.children[index].hovered + PropertyChanges { + target: parent.children[index] + palette.buttonText: Qt.lighter("red", 1.5) + } + PropertyChanges { + target: parent.children[index].background + border.color: Qt.lighter("red", 1.7) + } + }, + State { + name: "focused" + when: parent.children[index].visualFocus + PropertyChanges { + target: parent.children[index] + palette.buttonText: Qt.lighter("red", 1.3) + } + PropertyChanges { + target: parent.children[index].background + border.color: Qt.lighter("red", 1.5) + } + } + ] + + transitions: [ + Transition { + PropertyAnimation { + properties: "palette.buttonText, border.color" + duration: 150 + } + } + ] + + } + + } + +} -- cgit v1.2.3