diff options
author | Michael Bohlender <michael.bohlender@kdemail.net> | 2016-04-03 02:17:25 +0200 |
---|---|---|
committer | Michael Bohlender <michael.bohlender@kdemail.net> | 2016-04-03 02:17:25 +0200 |
commit | 5f2a3aa64cedc7f5517a1047dd699a286faf1898 (patch) | |
tree | 69a7cdd7b30c2966318c0e444b5cd39f3a46d292 /applications/mail-mobile/Avatar.qml | |
parent | db8d420485fe75ebbb45f4b6db978311c0dbf8c1 (diff) | |
download | kube-5f2a3aa64cedc7f5517a1047dd699a286faf1898.tar.gz kube-5f2a3aa64cedc7f5517a1047dd699a286faf1898.zip |
port mail mobile to kirigami components + implement VDG Mockups
Diffstat (limited to 'applications/mail-mobile/Avatar.qml')
-rw-r--r-- | applications/mail-mobile/Avatar.qml | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/applications/mail-mobile/Avatar.qml b/applications/mail-mobile/Avatar.qml new file mode 100644 index 00000000..592a3f99 --- /dev/null +++ b/applications/mail-mobile/Avatar.qml | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2015 Michael Bohlender <michael.bohlender@kdemail.net> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 3 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | import QtQuick 2.4 | ||
19 | |||
20 | Rectangle { | ||
21 | |||
22 | property string name; | ||
23 | |||
24 | //TODO should we make this themeable ? | ||
25 | function calcColor(x) | ||
26 | { | ||
27 | switch (x % 5) { | ||
28 | case 0: | ||
29 | return "#16a085" | ||
30 | case 1: | ||
31 | return "#27ae60" | ||
32 | case 2: | ||
33 | return "#2980b9" | ||
34 | case 3: | ||
35 | return "#8e44ad" | ||
36 | case 4: | ||
37 | return "#c0392b" | ||
38 | } | ||
39 | } | ||
40 | |||
41 | radius: 100 | ||
42 | |||
43 | color: calcColor(name.length) | ||
44 | |||
45 | Text { | ||
46 | anchors.centerIn: parent | ||
47 | |||
48 | text: name.charAt(0) | ||
49 | |||
50 | color: "#ecf0f1" | ||
51 | |||
52 | font.capitalization: Font.AllUppercase | ||
53 | } | ||
54 | } | ||