Changeset View
Changeset View
Standalone View
Standalone View
lookandfeel/contents/components/UserDelegate.qml
Show All 13 Lines | |||||
14 | * | 14 | * | ||
15 | * You should have received a copy of the GNU Library General Public | 15 | * You should have received a copy of the GNU Library General Public | ||
16 | * License along with this program; if not, write to the | 16 | * License along with this program; if not, write to the | ||
17 | * Free Software Foundation, Inc., | 17 | * Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | import QtQuick 2.8 | 21 | import QtQuick 2.8 | ||
22 | import QtGraphicalEffects 1.0 | ||||
22 | 23 | | |||
23 | import org.kde.plasma.core 2.0 as PlasmaCore | 24 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
24 | import org.kde.plasma.components 2.0 as PlasmaComponents | 25 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
25 | 26 | | |||
26 | Item { | 27 | Item { | ||
27 | id: wrapper | 28 | id: wrapper | ||
28 | 29 | | |||
29 | property bool isCurrent: true | 30 | property bool isCurrent: true | ||
Show All 11 Lines | |||||
41 | opacity: isCurrent ? 1.0 : 0.5 | 42 | opacity: isCurrent ? 1.0 : 0.5 | ||
42 | 43 | | |||
43 | Behavior on opacity { | 44 | Behavior on opacity { | ||
44 | OpacityAnimator { | 45 | OpacityAnimator { | ||
45 | duration: units.longDuration | 46 | duration: units.longDuration | ||
46 | } | 47 | } | ||
47 | } | 48 | } | ||
48 | 49 | | |||
50 | // Draw a translucent background circle under the user picture | ||||
51 | Rectangle { | ||||
52 | anchors.centerIn: imageSource | ||||
53 | | ||||
54 | width: imageSource.width + 2 | ||||
55 | height: width | ||||
56 | radius: width / 2 | ||||
57 | | ||||
58 | color: PlasmaCore.ColorScope.backgroundColor | ||||
59 | opacity: 0.9 | ||||
60 | } | ||||
61 | | ||||
49 | Item { | 62 | Item { | ||
50 | id: imageSource | 63 | id: imageSource | ||
51 | anchors.horizontalCenter: parent.horizontalCenter | 64 | anchors.horizontalCenter: parent.horizontalCenter | ||
52 | width: faceSize | 65 | width: faceSize | ||
53 | height: faceSize | 66 | height: faceSize | ||
54 | 67 | | |||
55 | //Image takes priority, taking a full path to a file, if that doesn't exist we show an icon | 68 | //Image takes priority, taking a full path to a file, if that doesn't exist we show an icon | ||
56 | Image { | 69 | Image { | ||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | 138 | else | |||
126 | gl_FragColor = colorEmpty ; | 139 | gl_FragColor = colorEmpty ; | ||
127 | 140 | | |||
128 | gl_FragColor = gl_FragColor * qt_Opacity; | 141 | gl_FragColor = gl_FragColor * qt_Opacity; | ||
129 | } | 142 | } | ||
130 | " | 143 | " | ||
131 | } | 144 | } | ||
132 | 145 | | |||
133 | 146 | | |||
134 | 147 | DropShadow { | |||
148 | id: labelShadow | ||||
149 | anchors.fill: usernameDelegate | ||||
150 | source: usernameDelegate | ||||
151 | horizontalOffset: 0 | ||||
152 | verticalOffset: 1 | ||||
153 | radius: 12 | ||||
154 | samples: 32 | ||||
155 | spread: 0.35 | ||||
156 | color: PlasmaCore.ColorScope.backgroundColor | ||||
157 | } | ||||
135 | PlasmaComponents.Label { | 158 | PlasmaComponents.Label { | ||
136 | id: usernameDelegate | 159 | id: usernameDelegate | ||
137 | anchors { | 160 | anchors { | ||
138 | bottom: parent.bottom | 161 | bottom: parent.bottom | ||
139 | horizontalCenter: parent.horizontalCenter | 162 | horizontalCenter: parent.horizontalCenter | ||
140 | } | 163 | } | ||
141 | height: implicitHeight // work around stupid bug in Plasma Components that sets the height | 164 | height: implicitHeight // work around stupid bug in Plasma Components that sets the height | ||
142 | width: constrainText ? parent.width : implicitWidth | 165 | width: constrainText ? parent.width : implicitWidth | ||
Show All 18 Lines |