-
Notifications
You must be signed in to change notification settings - Fork 1
/
CirclePic.qml
110 lines (97 loc) · 2.52 KB
/
CirclePic.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import QtQuick 2.8
import QtGraphicalEffects 1.0
import IO 1.0
import QtQuick.LocalStorage 2.0 as Sql
import "circlepic.js" as Scripts
Item {
id: card_avatar_backing
property string whichPic: ""
property string where: ""
property string thesource: ""
property string fixpic: ""
property int badge: 1000
clip: true
Component.onCompleted: {
Scripts.returnImage(whichPic, where, thesource)
}
onWhichPicChanged: {
Scripts.returnImage(whichPic, where, thesource)
}
onWhereChanged: {
Scripts.returnImage(whichPic, where, thesource)
}
Image {
id: cardsava
anchors.fill: parent
anchors.margins: 4
visible: false
source: if (fixpic === 'undefined') {
"./img/default_avatar.png"
} else {
fixpic
}
fillMode: Image.PreserveAspectCrop
Image {
anchors.fill: parent
visible: true
source: "./img/default_avatar.png"
z: -1
}
}
OpacityMask {
anchors.fill: cardsava
source: cardsava
maskSource: mask
}
Image {
id: thebadge
width: parent.width * 0.25
height: parent.width * 0.25
fillMode: Image.PreserveAspectFit
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.rightMargin: parent.width * 0.04
source: switch (badge) {
case 0:
"./icons/help.svg"
break
case 1:
"./icons/ok.svg"
break
case 2:
"./icons/cancel.svg"
break
default:
"./img/gold-badge.png"
break
}
visible: if (badge == 1000) {
false
} else {
true
}
}
ColorOverlay {
anchors.fill: thebadge
source: thebadge
visible: if (badge > 2) {
false
} else {
true
}
color: switch (badge) {
case 0:
"yellow"
break
case 1:
"green"
break
case 2:
"red"
break
default:
"black"
break
}
}
}