summaryrefslogtreecommitdiffstats
path: root/components/UserDelegate.qml
diff options
context:
space:
mode:
Diffstat (limited to 'components/UserDelegate.qml')
-rw-r--r--components/UserDelegate.qml74
1 files changed, 30 insertions, 44 deletions
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 <davidedmundson@kde.org>
- * Copyright 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
- *
- * 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 <davidedmundson@kde.org>
+ SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
-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