From c3bb39f229423114f81d79b76a07a9115ca65b03 Mon Sep 17 00:00:00 2001 From: Papoteur Date: Wed, 31 Aug 2022 20:15:37 +0200 Subject: Sync theme with Plasma one --- components/ActionButton.qml | 59 +++++++++++---------------- components/Battery.qml | 21 ++-------- components/Clock.qml | 39 ++++++------------ components/SessionManagementScreen.qml | 44 +++++++++----------- components/UserDelegate.qml | 74 ++++++++++++++-------------------- components/UserList.qml | 30 +++++--------- components/VirtualKeyboard.qml | 20 ++------- components/VirtualKeyboard_wayland.qml | 24 +++++++++++ components/WallpaperFader.qml | 72 ++++++++++++--------------------- 9 files changed, 152 insertions(+), 231 deletions(-) create mode 100644 components/VirtualKeyboard_wayland.qml (limited to 'components') diff --git a/components/ActionButton.qml b/components/ActionButton.qml index 342e0f9..af278f6 100644 --- a/components/ActionButton.qml +++ b/components/ActionButton.qml @@ -1,21 +1,8 @@ /* - * Copyright 2016 David Edmundson - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program 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 Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + SPDX-FileCopyrightText: 2016 David Edmundson + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ import QtQuick 2.8 import org.kde.plasma.core 2.0 as PlasmaCore @@ -36,32 +23,32 @@ Item { activeFocusOnTab: true - property int iconSize: units.gridUnit * 3 + property int iconSize: PlasmaCore.Units.gridUnit * 3 - implicitWidth: Math.max(iconSize + units.largeSpacing * 2, label.contentWidth) - implicitHeight: iconSize + units.smallSpacing + label.implicitHeight + implicitWidth: Math.max(iconSize + PlasmaCore.Units.largeSpacing * 2, label.contentWidth) + implicitHeight: iconSize + PlasmaCore.Units.smallSpacing + label.implicitHeight opacity: activeFocus || containsMouse ? 1 : 0.85 - Behavior on opacity { - PropertyAnimation { // OpacityAnimator makes it turn black at random intervals - duration: units.longDuration - easing.type: Easing.InOutQuad - } + Behavior on opacity { + PropertyAnimation { // OpacityAnimator makes it turn black at random intervals + duration: PlasmaCore.Units.longDuration + easing.type: Easing.InOutQuad + } } Rectangle { id: iconCircle anchors.centerIn: icon - width: iconSize + units.smallSpacing + width: iconSize + PlasmaCore.Units.smallSpacing height: width radius: width / 2 color: softwareRendering ? PlasmaCore.ColorScope.backgroundColor : PlasmaCore.ColorScope.textColor - opacity: activeFocus || containsMouse ? (softwareRendering ? 0.8 : 0.15) : (softwareRendering ? 0.6 : 0) + opacity: root.activeFocus || containsMouse ? (softwareRendering ? 0.8 : 0.15) : (softwareRendering ? 0.6 : 0) Behavior on opacity { - PropertyAnimation { // OpacityAnimator makes it turn black at random intervals - duration: units.longDuration - easing.type: Easing.InOutQuad - } + PropertyAnimation { // OpacityAnimator makes it turn black at random intervals + duration: PlasmaCore.Units.longDuration + easing.type: Easing.InOutQuad + } } } @@ -74,10 +61,10 @@ Item { color: PlasmaCore.ColorScope.textColor opacity: 0.15 Behavior on scale { - PropertyAnimation { - duration: units.shortDuration - easing.type: Easing.InOutQuart - } + PropertyAnimation { + duration: PlasmaCore.Units.shortDuration + easing.type: Easing.InOutQuart + } } } @@ -99,7 +86,7 @@ Item { font.pointSize: root.fontSize anchors { top: icon.bottom - topMargin: (softwareRendering ? 1.5 : 1) * units.smallSpacing + topMargin: (softwareRendering ? 1.5 : 1) * PlasmaCore.Units.smallSpacing left: parent.left right: parent.right } diff --git a/components/Battery.qml b/components/Battery.qml index 93796c6..05be535 100644 --- a/components/Battery.qml +++ b/components/Battery.qml @@ -1,21 +1,8 @@ /* - * Copyright 2016 Kai Uwe Broulik - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program 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 Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + SPDX-FileCopyrightText: 2016 Kai Uwe Broulik + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ import QtQuick 2.2 diff --git a/components/Clock.qml b/components/Clock.qml index cece7be..fbe0c7c 100644 --- a/components/Clock.qml +++ b/components/Clock.qml @@ -1,47 +1,34 @@ /* - * Copyright 2016 David Edmundson - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program 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 Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + SPDX-FileCopyrightText: 2016 David Edmundson + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ import QtQuick 2.8 import QtQuick.Layouts 1.1 -import QtQuick.Controls 2.5 -import org.kde.plasma.core 2.0 +import QtQuick.Controls 2.5 as QQC2 +import org.kde.plasma.core 2.0 as PlasmaCore ColumnLayout { readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software - Label { + QQC2.Label { text: Qt.formatTime(timeSource.data["Local"]["DateTime"]) - color: ColorScope.textColor + color: PlasmaCore.ColorScope.textColor style: softwareRendering ? Text.Outline : Text.Normal - styleColor: softwareRendering ? ColorScope.backgroundColor : "transparent" //no outline, doesn't matter + styleColor: softwareRendering ? PlasmaCore.ColorScope.backgroundColor : "transparent" //no outline, doesn't matter font.pointSize: 48 Layout.alignment: Qt.AlignHCenter } - Label { + QQC2.Label { text: Qt.formatDate(timeSource.data["Local"]["DateTime"], Qt.DefaultLocaleLongDate) - color: ColorScope.textColor + color: PlasmaCore.ColorScope.textColor style: softwareRendering ? Text.Outline : Text.Normal - styleColor: softwareRendering ? ColorScope.backgroundColor : "transparent" //no outline, doesn't matter + styleColor: softwareRendering ? PlasmaCore.ColorScope.backgroundColor : "transparent" //no outline, doesn't matter font.pointSize: 24 Layout.alignment: Qt.AlignHCenter } - DataSource { + PlasmaCore.DataSource { id: timeSource engine: "time" connectedSources: ["Local"] diff --git a/components/SessionManagementScreen.qml b/components/SessionManagementScreen.qml index 58110c5..0e87d26 100644 --- a/components/SessionManagementScreen.qml +++ b/components/SessionManagementScreen.qml @@ -1,21 +1,8 @@ /* - * Copyright 2016 David Edmundson - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program 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 Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + SPDX-FileCopyrightText: 2016 David Edmundson + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ import QtQuick 2.2 @@ -25,7 +12,7 @@ import QtQuick.Controls 1.1 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 3.0 as PlasmaComponents3 -Item { +FocusScope { id: root /* @@ -56,7 +43,7 @@ Item { * Self explanatory */ property alias userListCurrentIndex: userListView.currentIndex - property var userListCurrentModelData: userListView.currentItem === null ? [] : userListView.currentItem.m + property alias userListCurrentItem: userListView.currentItem property bool showUserList: true property alias userList: userListView @@ -65,11 +52,18 @@ Item { default property alias _children: innerLayout.children + // FIXME: move this component into a layout, rather than abusing + // anchors and implicitly relying on other components' built-in + // whitespace to avoid items being overlapped. UserList { id: userListView visible: showUserList && y > 0 anchors { bottom: parent.verticalCenter + // We only need an extra bottom margin when text is constrained, + // since only in this case can the username label be a multi-line + // string that would otherwise overflow. + bottomMargin: constrainText ? PlasmaCore.Units.gridUnit * 3 : 0 left: parent.left right: parent.right } @@ -82,14 +76,14 @@ Item { ColumnLayout { id: prompts anchors.top: parent.verticalCenter - anchors.topMargin: units.gridUnit * 0.5 + anchors.topMargin: PlasmaCore.Units.gridUnit * 0.5 anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom PlasmaComponents3.Label { id: notificationsLabel font.pointSize: root.fontSize - Layout.maximumWidth: units.gridUnit * 16 + Layout.maximumWidth: PlasmaCore.Units.gridUnit * 16 Layout.alignment: Qt.AlignHCenter Layout.fillWidth: true horizontalAlignment: Text.AlignHCenter @@ -98,8 +92,8 @@ Item { } ColumnLayout { Layout.minimumHeight: implicitHeight - Layout.maximumHeight: units.gridUnit * 10 - Layout.maximumWidth: units.gridUnit * 16 + Layout.maximumHeight: PlasmaCore.Units.gridUnit * 10 + Layout.maximumWidth: PlasmaCore.Units.gridUnit * 16 Layout.alignment: Qt.AlignHCenter ColumnLayout { id: innerLayout @@ -112,8 +106,8 @@ Item { } Row { //deliberately not rowlayout as I'm not trying to resize child items id: actionItemsLayout - spacing: units.largeSpacing / 2 - Layout.alignment: Qt.AlignHCenter + spacing: PlasmaCore.Units.largeSpacing / 2 + Layout.alignment: Qt.AlignHCenter | Qt.AlignTop } Item { Layout.fillHeight: true diff --git a/components/UserDelegate.qml b/components/UserDelegate.qml index 8658b85..2e1270b 100644 --- a/components/UserDelegate.qml +++ b/components/UserDelegate.qml @@ -1,26 +1,12 @@ /* - * Copyright 2014 David Edmundson - * Copyright 2014 Aleix Pol Gonzalez - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program 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 Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + SPDX-FileCopyrightText: 2014 David Edmundson + SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez -import QtQuick 2.8 -import QtGraphicalEffects 1.0 + SPDX-License-Identifier: LGPL-2.0-or-later +*/ +import QtQuick 2.8 +import QtQuick.Window 2.15 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 3.0 as PlasmaComponents3 @@ -33,23 +19,24 @@ Item { property bool isCurrent: true - readonly property var m: model property string name property string userName property string avatarPath property string iconSource + property bool needsPassword + property var vtNumber property bool constrainText: true property alias nameFontSize: usernameDelegate.font.pointSize property int fontSize: PlasmaCore.Theme.defaultFont.pointSize + 2 signal clicked() - property real faceSize: units.gridUnit * 7 + property real faceSize: PlasmaCore.Units.gridUnit * 7 opacity: isCurrent ? 1.0 : 0.5 Behavior on opacity { OpacityAnimator { - duration: units.longDuration + duration: PlasmaCore.Units.longDuration } } @@ -61,30 +48,28 @@ Item { radius: width / 2 color: PlasmaCore.ColorScope.backgroundColor - opacity: 0.9 + opacity: 0.6 } Item { id: imageSource - anchors { - bottom: usernameDelegate.top - bottomMargin: units.largeSpacing - horizontalCenter: parent.horizontalCenter - } - Behavior on width { + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + + Behavior on width { PropertyAnimation { from: faceSize - duration: units.longDuration; + duration: PlasmaCore.Units.longDuration; } } - width: isCurrent ? faceSize : faceSize - units.largeSpacing + width: isCurrent ? faceSize : faceSize - PlasmaCore.Units.largeSpacing height: width //Image takes priority, taking a full path to a file, if that doesn't exist we show an icon Image { id: face source: wrapper.avatarPath - sourceSize: Qt.size(faceSize, faceSize) + sourceSize: Qt.size(faceSize * Screen.devicePixelRatio, faceSize * Screen.devicePixelRatio) fillMode: Image.PreserveAspectCrop anchors.fill: parent } @@ -94,17 +79,14 @@ Item { source: iconSource visible: (face.status == Image.Error || face.status == Image.Null) anchors.fill: parent - anchors.margins: units.gridUnit * 0.5 // because mockup says so... + anchors.margins: PlasmaCore.Units.gridUnit * 0.5 // because mockup says so... colorGroup: PlasmaCore.ColorScope.colorGroup } } ShaderEffect { - anchors { - bottom: usernameDelegate.top - bottomMargin: units.largeSpacing - horizontalCenter: parent.horizontalCenter - } + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter width: imageSource.width height: imageSource.height @@ -163,15 +145,19 @@ Item { PlasmaComponents3.Label { id: usernameDelegate - font.pointSize: wrapper.fontSize - anchors { - bottom: parent.bottom - horizontalCenter: parent.horizontalCenter - } + + anchors.top: imageSource.bottom + anchors.horizontalCenter: parent.horizontalCenter + + // Make it bigger than other fonts to match the scale of the avatar better + font.pointSize: wrapper.fontSize + 4 + width: constrainText ? parent.width : implicitWidth text: wrapper.name style: softwareRendering ? Text.Outline : Text.Normal styleColor: softwareRendering ? PlasmaCore.ColorScope.backgroundColor : "transparent" //no outline, doesn't matter + wrapMode: Text.WordWrap + maximumLineCount: wrapper.constrainText ? 3 : 1 elide: Text.ElideRight horizontalAlignment: Text.AlignHCenter //make an indication that this has active focus, this only happens when reached with keyboard navigation diff --git a/components/UserList.qml b/components/UserList.qml index dbac102..1f612ec 100644 --- a/components/UserList.qml +++ b/components/UserList.qml @@ -1,21 +1,8 @@ /* - * Copyright 2014 David Edmundson - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) any later version. - * - * This program 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 Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + SPDX-FileCopyrightText: 2014 David Edmundson + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ import QtQuick 2.2 import org.kde.plasma.core 2.0 as PlasmaCore @@ -23,8 +10,9 @@ import org.kde.plasma.core 2.0 as PlasmaCore ListView { id: view readonly property string selectedUser: currentItem ? currentItem.userName : "" - readonly property int userItemWidth: units.gridUnit * 8 - readonly property int userItemHeight: units.gridUnit * 8 + readonly property int userItemWidth: PlasmaCore.Units.gridUnit * 8 + readonly property int userItemHeight: PlasmaCore.Units.gridUnit * 8 + readonly property bool constrainText: count > 1 property int fontSize: PlasmaCore.Theme.defaultFont.pointSize + 2 implicitHeight: userItemHeight @@ -50,6 +38,8 @@ ListView { avatarPath: model.icon || "" iconSource: model.iconName || "user-identity" fontSize: view.fontSize + vtNumber: model.vtNumber + needsPassword: model.needsPassword name: { var displayName = model.realName || model.name @@ -83,7 +73,7 @@ ListView { height: userItemHeight //if we only have one delegate, we don't need to clip the text as it won't be overlapping with anything - constrainText: ListView.view.count > 1 + constrainText: view.constrainText isCurrent: ListView.isCurrentItem diff --git a/components/VirtualKeyboard.qml b/components/VirtualKeyboard.qml index edc7ab4..503a35b 100644 --- a/components/VirtualKeyboard.qml +++ b/components/VirtualKeyboard.qml @@ -1,21 +1,9 @@ -/******************************************************************** - This file is part of the KDE project. +/* + SPDX-FileCopyrightText: 2017 Martin Gräßlin -Copyright (C) 2017 Martin Gräßlin + SPDX-License-Identifier: GPL-2.0-or-later +*/ -This program 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 2 of the License, or -(at your option) any later version. - -This program 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 this program. If not, see . -*********************************************************************/ import QtQuick 2.5 import QtQuick.VirtualKeyboard 2.1 import org.kde.plasma.core 2.0 as PlasmaCore diff --git a/components/VirtualKeyboard_wayland.qml b/components/VirtualKeyboard_wayland.qml new file mode 100644 index 0000000..b15dbf5 --- /dev/null +++ b/components/VirtualKeyboard_wayland.qml @@ -0,0 +1,24 @@ +/* + SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez + + SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL +*/ + +import QtQuick 2.15 +import org.kde.plasma.workspace.keyboardlayout 1.0 as Keyboards + +Item { + id: inputPanel + readonly property bool active: Keyboards.KWinVirtualKeyboard.visible + property bool activated: false + visible: Keyboards.KWinVirtualKeyboard.visible + + x: Qt.inputMethod.keyboardRectangle.x + y: Qt.inputMethod.keyboardRectangle.y + height: Qt.inputMethod.keyboardRectangle.height + width: Qt.inputMethod.keyboardRectangle.width + + onActivatedChanged: if (activated) { + Keyboards.KWinVirtualKeyboard.enabled = true + } +} diff --git a/components/WallpaperFader.qml b/components/WallpaperFader.qml index c695d69..5c885d1 100644 --- a/components/WallpaperFader.qml +++ b/components/WallpaperFader.qml @@ -1,21 +1,8 @@ -/******************************************************************** - This file is part of the KDE project. +/* + SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez -Copyright (C) 2014 Aleix Pol Gonzalez - -This program 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 2 of the License, or -(at your option) any later version. - -This program 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 this program. If not, see . -*********************************************************************/ + SPDX-License-Identifier: GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Controls 1.1 @@ -23,7 +10,6 @@ import QtQuick.Layouts 1.1 import QtGraphicalEffects 1.0 import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.private.sessions 2.0 import "../components" @@ -44,14 +30,14 @@ Item { NumberAnimation { target: wallpaperFader property: "factor" - duration: 1000 + duration: PlasmaCore.Units.veryLongDuration * 2 easing.type: Easing.InOutQuad } } FastBlur { id: wallpaperBlur anchors.fill: parent - radius: -100 * wallpaperFader.factor + radius: 50 * wallpaperFader.factor } ShaderEffect { id: wallpaperShader @@ -121,6 +107,10 @@ Item { target: clock.shadow opacity: 0 } + PropertyChanges { + target: clock + opacity: 1 + } }, State { name: "off" @@ -138,7 +128,11 @@ Item { } PropertyChanges { target: clock.shadow - opacity: 1 + opacity: wallpaperFader.alwaysShowClock ? 1 : 0 + } + PropertyChanges { + target: clock + opacity: wallpaperFader.alwaysShowClock ? 1 : 0 } } ] @@ -147,37 +141,21 @@ Item { from: "off" to: "on" //Note: can't use animators as they don't play well with parallelanimations - ParallelAnimation { - NumberAnimation { - target: mainStack - property: "opacity" - duration: units.longDuration - easing.type: Easing.InOutQuad - } - NumberAnimation { - target: footer - property: "opacity" - duration: units.longDuration - easing.type: Easing.InOutQuad - } + NumberAnimation { + targets: [mainStack, footer, clock] + property: "opacity" + duration: PlasmaCore.Units.veryLongDuration + easing.type: Easing.InOutQuad } }, Transition { from: "on" to: "off" - ParallelAnimation { - NumberAnimation { - target: mainStack - property: "opacity" - duration: 500 - easing.type: Easing.InOutQuad - } - NumberAnimation { - target: footer - property: "opacity" - duration: 500 - easing.type: Easing.InOutQuad - } + NumberAnimation { + targets: [mainStack, footer, clock] + property: "opacity" + duration: PlasmaCore.Units.veryLongDuration + easing.type: Easing.InOutQuad } } ] -- cgit v1.2.1