2017-06-07 08:56:42 +03:00
|
|
|
import QtQuick 2.0
|
|
|
|
import Sailfish.Silica 1.0
|
|
|
|
|
2020-05-29 21:05:05 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
Item {
|
2020-05-29 21:05:05 +03:00
|
|
|
id: profileHeader
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2020-05-29 21:05:05 +03:00
|
|
|
property int value: 0
|
|
|
|
property string title: ""
|
|
|
|
property string description: ""
|
|
|
|
property string image: ""
|
|
|
|
property string bg: ""
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
width: parent.width
|
2020-06-29 16:31:05 +03:00
|
|
|
height: isPortrait ? (avatarImage.height + Theme.paddingLarge*3 + infoLbl.height) : (avatarImage.height + Theme.paddingLarge*2.5 + infoLbl.height)
|
2020-05-25 18:54:02 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
Rectangle {
|
2020-05-25 18:54:02 +03:00
|
|
|
id: bgImage
|
2020-07-06 11:28:42 +03:00
|
|
|
opacity: 0.7
|
2017-06-07 08:56:42 +03:00
|
|
|
gradient: Gradient {
|
2020-07-06 11:28:42 +03:00
|
|
|
GradientStop { position: 0.0; color: Theme.highlightDimmerColor }
|
|
|
|
GradientStop { position: 2.0; color: Theme.highlightBackgroundColor }
|
2020-05-25 18:54:02 +03:00
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
anchors.fill: parent
|
|
|
|
|
2020-05-25 18:54:02 +03:00
|
|
|
Image {
|
|
|
|
asynchronous: true
|
|
|
|
fillMode: Image.PreserveAspectCrop
|
|
|
|
source: bg
|
2020-07-06 11:28:42 +03:00
|
|
|
opacity: 0.6
|
2020-06-03 08:34:33 +03:00
|
|
|
anchors.fill: parent
|
2017-06-07 08:56:42 +03:00
|
|
|
}
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
Image {
|
2020-06-10 12:44:58 +03:00
|
|
|
id: avatarImage
|
2020-06-03 08:34:33 +03:00
|
|
|
asynchronous: true
|
2020-06-18 09:32:52 +03:00
|
|
|
source: if (avatarImage.status === Image.Error)
|
2020-06-29 11:48:06 +03:00
|
|
|
source = "../../images/icon-l-profile.svg?" + Theme.primaryColor
|
2020-06-18 09:32:52 +03:00
|
|
|
else image
|
2020-06-29 16:31:05 +03:00
|
|
|
width: isPortrait ? Theme.iconSizeLarge : Theme.iconSizeExtraLarge
|
2020-06-03 08:34:33 +03:00
|
|
|
height: width
|
2017-06-07 08:56:42 +03:00
|
|
|
anchors {
|
|
|
|
left: parent.left
|
2020-06-18 19:40:24 +03:00
|
|
|
leftMargin: Theme.horizontalPageMargin
|
2017-06-07 08:56:42 +03:00
|
|
|
top: parent.top
|
2020-06-18 09:32:52 +03:00
|
|
|
topMargin: Theme.paddingLarge * 1.5
|
2017-06-07 08:56:42 +03:00
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
|
|
|
Button {
|
|
|
|
id: imageButton
|
|
|
|
opacity: 0
|
|
|
|
width: Theme.iconSizeExtraLarge * 1.2
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
left: parent.left
|
|
|
|
bottom: parent.bottom
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
pageStack.push(Qt.resolvedUrl("ProfileImage.qml"), {
|
|
|
|
"image": image
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2017-06-07 08:56:42 +03:00
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
Column {
|
|
|
|
anchors {
|
2020-06-10 14:26:16 +03:00
|
|
|
top: parent.top
|
2020-06-18 19:40:24 +03:00
|
|
|
topMargin: Theme.paddingLarge
|
2020-06-10 12:44:58 +03:00
|
|
|
left: avatarImage.right
|
2020-06-18 19:40:24 +03:00
|
|
|
leftMargin: Theme.horizontalPageMargin
|
2017-06-07 08:56:42 +03:00
|
|
|
right: parent.right
|
2020-06-18 19:40:24 +03:00
|
|
|
rightMargin: Theme.horizontalPageMargin
|
2017-06-07 08:56:42 +03:00
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
Label {
|
2020-06-10 14:26:16 +03:00
|
|
|
id: profileTitle
|
2020-06-18 09:32:52 +03:00
|
|
|
text: title ? title : description.split('@')[0]
|
2017-06-07 08:56:42 +03:00
|
|
|
font.pixelSize: Theme.fontSizeLarge
|
|
|
|
font.family: Theme.fontFamilyHeading
|
2020-06-03 08:34:33 +03:00
|
|
|
color: Theme.highlightColor
|
2017-06-07 08:56:42 +03:00
|
|
|
truncationMode: TruncationMode.Fade
|
|
|
|
width: parent.width
|
2020-06-03 08:34:33 +03:00
|
|
|
height: contentHeight
|
|
|
|
horizontalAlignment: Text.AlignRight
|
2017-06-07 08:56:42 +03:00
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
Label {
|
2020-06-10 14:26:16 +03:00
|
|
|
id: profileDescription
|
2020-05-11 13:24:44 +03:00
|
|
|
text: "@"+description
|
2017-06-07 08:56:42 +03:00
|
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
|
|
font.family: Theme.fontFamilyHeading
|
2020-06-03 08:34:33 +03:00
|
|
|
color: Theme.secondaryHighlightColor
|
2017-06-07 08:56:42 +03:00
|
|
|
truncationMode: TruncationMode.Fade
|
|
|
|
width: parent.width
|
2020-06-29 16:31:05 +03:00
|
|
|
height: contentHeight
|
2020-06-03 08:34:33 +03:00
|
|
|
horizontalAlignment: Text.AlignRight
|
2017-06-07 08:56:42 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-10 14:26:16 +03:00
|
|
|
Row {
|
|
|
|
id: infoLbl
|
|
|
|
spacing: Theme.paddingLarge
|
|
|
|
layoutDirection: Qt.RightToLeft
|
2020-06-18 19:40:24 +03:00
|
|
|
height: followed_by || locked || bot || group ? Theme.iconSizeSmall + Theme.paddingSmall : 0
|
2020-06-10 14:26:16 +03:00
|
|
|
anchors {
|
|
|
|
top: avatarImage.bottom
|
2020-06-29 16:31:05 +03:00
|
|
|
topMargin: isPortrait ? Theme.paddingMedium : 0
|
2020-06-10 14:26:16 +03:00
|
|
|
left: parent.left
|
2020-06-18 19:40:24 +03:00
|
|
|
leftMargin: Theme.horizontalPageMargin
|
2020-06-10 14:26:16 +03:00
|
|
|
right: parent.right
|
2020-06-18 19:40:24 +03:00
|
|
|
rightMargin: Theme.horizontalPageMargin
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: groupBg
|
|
|
|
visible: (group ? true : false)
|
|
|
|
radius: Theme.paddingSmall
|
|
|
|
color: Theme.secondaryHighlightColor
|
|
|
|
width: groupLbl.width + 2*Theme.paddingLarge
|
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: groupLbl
|
|
|
|
text: qsTr("Group")
|
|
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
|
|
|
color: Theme.primaryColor
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2020-06-10 14:26:16 +03:00
|
|
|
}
|
|
|
|
|
2020-06-15 11:42:10 +03:00
|
|
|
Rectangle {
|
2020-06-10 14:26:16 +03:00
|
|
|
id: followingBg
|
2020-06-15 11:42:10 +03:00
|
|
|
visible: (followed_by ? true : false)
|
2020-06-10 14:26:16 +03:00
|
|
|
radius: Theme.paddingSmall
|
|
|
|
color: Theme.secondaryHighlightColor
|
2020-06-10 15:33:23 +03:00
|
|
|
width: followingLbl.width + 2*Theme.paddingLarge
|
2020-06-10 14:26:16 +03:00
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: followingLbl
|
|
|
|
text: qsTr("Follows you")
|
|
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
|
|
|
color: Theme.primaryColor
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2020-06-15 11:42:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: lockedBg
|
|
|
|
visible: (locked ? true : false)
|
|
|
|
radius: Theme.paddingSmall
|
|
|
|
color: Theme.secondaryHighlightColor
|
|
|
|
width: lockedImg.width + 2*Theme.paddingLarge
|
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
HighlightImage {
|
|
|
|
id: lockedImg
|
|
|
|
source: "image://theme/icon-s-secure?"
|
|
|
|
width: Theme.fontSizeExtraSmall
|
|
|
|
height: width
|
|
|
|
color: Theme.primaryColor
|
|
|
|
anchors.horizontalCenter: lockedBg.horizontalCenter
|
|
|
|
anchors.verticalCenter: lockedBg.verticalCenter
|
|
|
|
}
|
|
|
|
}
|
2020-06-10 14:26:16 +03:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: botBg
|
|
|
|
visible: (bot ? true : false)
|
|
|
|
radius: Theme.paddingSmall
|
|
|
|
color: Theme.secondaryHighlightColor
|
2020-06-10 15:33:23 +03:00
|
|
|
width: botLbl.width + 2*Theme.paddingLarge
|
2020-06-10 14:26:16 +03:00
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: botLbl
|
|
|
|
text: qsTr("Bot")
|
|
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
|
|
|
color: Theme.primaryColor
|
2020-07-03 11:45:30 +03:00
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2020-06-10 14:26:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-06-07 08:56:42 +03:00
|
|
|
}
|