2020-05-19 19:49:52 +00:00
|
|
|
import QtGraphicalEffects 1.0
|
|
|
|
import QtQuick 2.7
|
|
|
|
import QtQuick.Controls 2.4
|
|
|
|
import QtQuick.Controls.Material 2.0
|
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import CustomQmlTypes 1.0
|
2020-05-19 20:25:56 +00:00
|
|
|
import "theme"
|
2020-05-19 19:49:52 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: imgProfile
|
|
|
|
|
|
|
|
property string source
|
|
|
|
property alias badgeColor: badge.color
|
|
|
|
|
2020-12-15 01:16:49 +00:00
|
|
|
height: Theme.contactPortraitSize
|
|
|
|
width: Theme.contactPortraitSize
|
|
|
|
implicitWidth: Theme.contactPortraitSize
|
|
|
|
implicitHeight: Theme.contactPortraitSize
|
2020-05-19 19:49:52 +00:00
|
|
|
|
|
|
|
property alias portraitBorderColor: mainImage.color
|
|
|
|
property alias portraitColor: imageInner.color
|
|
|
|
property alias badgeVisible: badge.visible
|
|
|
|
property alias badgeContent: badge.content
|
|
|
|
|
2020-10-19 22:20:38 +00:00
|
|
|
property bool performTransform: false
|
|
|
|
property alias overlayColor: iconColorOverlay.color
|
|
|
|
property real rotationAngle: 0.0
|
|
|
|
|
2020-05-19 19:49:52 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: mainImage
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2020-12-15 01:16:49 +00:00
|
|
|
width: parent.width * 0.8
|
|
|
|
height: width
|
2020-05-19 19:49:52 +00:00
|
|
|
color: Theme.portraitOfflineBorderColor
|
|
|
|
radius: width / 2
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: imageInner
|
|
|
|
width: parent.width - 4
|
|
|
|
height: width
|
|
|
|
color: Theme.portraitOfflineBorderColor
|
|
|
|
radius: width / 2
|
|
|
|
anchors.centerIn:parent
|
|
|
|
|
|
|
|
Image { // PROFILE IMAGE
|
|
|
|
id: img
|
2020-05-19 23:58:31 +00:00
|
|
|
source: imgProfile.source == "" ? "" : gcd.assetPath + imgProfile.source
|
2020-05-19 19:49:52 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
visible: false
|
2020-06-23 23:58:11 +00:00
|
|
|
|
|
|
|
sourceSize.width: imageInner.width*2
|
|
|
|
sourceSize.height: imageInner.height*2
|
2020-05-19 19:49:52 +00:00
|
|
|
}
|
|
|
|
|
2020-10-19 22:20:38 +00:00
|
|
|
ColorOverlay{
|
|
|
|
id: iconColorOverlay
|
|
|
|
anchors.fill: img
|
|
|
|
|
|
|
|
source: img
|
|
|
|
visible: false
|
|
|
|
|
|
|
|
antialiasing: true
|
|
|
|
smooth: true
|
|
|
|
transform: Rotation { origin.x: width/2; origin.y: height / 2; angle: rotationAngle}
|
|
|
|
}
|
|
|
|
|
2020-05-19 19:49:52 +00:00
|
|
|
Image { // CIRCLE MASK
|
|
|
|
id: mask
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
visible: false
|
2020-07-14 22:31:49 +00:00
|
|
|
source: "qrc:/qml/opaque/images/clipcircle.png"
|
2020-05-19 19:49:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OpacityMask {
|
|
|
|
anchors.fill: img
|
2020-10-19 22:20:38 +00:00
|
|
|
source: performTransform ? iconColorOverlay : img
|
2020-05-19 19:49:52 +00:00
|
|
|
maskSource: mask
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Badge {
|
|
|
|
id: badge
|
2020-09-04 23:59:33 +00:00
|
|
|
size: parent.width * 0.25
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.margins: parent.width * 0.09
|
2020-05-19 19:49:52 +00:00
|
|
|
}
|
|
|
|
}
|