info labels for profile header

adds info labels to profile header ('Following you' / 'Bot')
This commit is contained in:
molan-git 2020-06-10 13:26:16 +02:00
parent 5dad14eafb
commit 52c8f549c0
2 changed files with 66 additions and 7 deletions

View file

@ -23,6 +23,7 @@ Page {
property int reblogs_count property int reblogs_count
property int count_moments property int count_moments
property bool locked: false property bool locked: false
property bool bot: false
property bool following: false property bool following: false
property bool requested: false property bool requested: false
property bool followed_by: false property bool followed_by: false
@ -77,6 +78,9 @@ Page {
case 'locked': case 'locked':
locked = messageObject.data locked = messageObject.data
break; break;
case 'bot':
bot = messageObject.data
break;
case 'created_at': case 'created_at':
created_at = messageObject.data created_at = messageObject.data
break; break;

View file

@ -12,7 +12,9 @@ Item {
property string bg: "" property string bg: ""
width: parent.width width: parent.width
height: avatarImage.height + Theme.paddingLarge*2 height: if (following === true || bot === true) {
avatarImage.height + Theme.paddingLarge*2 + infoLbl.height + Theme.paddingLarge
} else avatarImage.height + Theme.paddingLarge*2
Rectangle { Rectangle {
id: bgImage id: bgImage
@ -69,6 +71,8 @@ Item {
Column { Column {
anchors { anchors {
top: parent.top
topMargin: Theme.paddingLarge
left: avatarImage.right left: avatarImage.right
leftMargin: Theme.paddingLarge leftMargin: Theme.paddingLarge
right: parent.right right: parent.right
@ -77,12 +81,11 @@ Item {
} }
Label { Label {
id: ttl id: profileTitle
text: text: if (title === "") {
if (title === "") { description.split('@')[0]
description.split('@')[0] }
} else title
else title
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
font.family: Theme.fontFamilyHeading font.family: Theme.fontFamilyHeading
color: Theme.highlightColor color: Theme.highlightColor
@ -93,6 +96,7 @@ Item {
} }
Label { Label {
id: profileDescription
text: "@"+description text: "@"+description
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Theme.fontFamilyHeading font.family: Theme.fontFamilyHeading
@ -104,4 +108,55 @@ Item {
} }
} }
Row {
id: infoLbl
spacing: Theme.paddingLarge
layoutDirection: Qt.RightToLeft
height: Theme.iconSizeSmall + Theme.paddingSmall
anchors {
top: avatarImage.bottom
topMargin: Theme.paddingLarge
left: parent.left
leftMargin: Theme.paddingLarge
right: parent.right
rightMargin: Theme.paddingLarge
}
Rectangle {
id: followingBg
visible: (following ? true : false)
radius: Theme.paddingSmall
color: Theme.secondaryHighlightColor
width: Theme.buttonWidthExtraSmall
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
}
}
Rectangle {
id: botBg
visible: (bot ? true : false)
radius: Theme.paddingSmall
color: Theme.secondaryHighlightColor
width: botLabel.width + 2*Theme.paddingLarge
height: parent.height
Label {
id: botLbl
text: qsTr("Bot")
font.pixelSize: Theme.fontSizeExtraSmall
color: Theme.primaryColor
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
}
}
} }