From 52c8f549c0b6ab5331a1122066e3e6b4c024345c Mon Sep 17 00:00:00 2001 From: molan-git Date: Wed, 10 Jun 2020 13:26:16 +0200 Subject: [PATCH] info labels for profile header adds info labels to profile header ('Following you' / 'Bot') --- qml/pages/ProfilePage.qml | 4 ++ qml/pages/components/ProfileHeader.qml | 69 +++++++++++++++++++++++--- 2 files changed, 66 insertions(+), 7 deletions(-) diff --git a/qml/pages/ProfilePage.qml b/qml/pages/ProfilePage.qml index e2318af..4478e4c 100644 --- a/qml/pages/ProfilePage.qml +++ b/qml/pages/ProfilePage.qml @@ -23,6 +23,7 @@ Page { property int reblogs_count property int count_moments property bool locked: false + property bool bot: false property bool following: false property bool requested: false property bool followed_by: false @@ -77,6 +78,9 @@ Page { case 'locked': locked = messageObject.data break; + case 'bot': + bot = messageObject.data + break; case 'created_at': created_at = messageObject.data break; diff --git a/qml/pages/components/ProfileHeader.qml b/qml/pages/components/ProfileHeader.qml index e79402a..a19c5b8 100644 --- a/qml/pages/components/ProfileHeader.qml +++ b/qml/pages/components/ProfileHeader.qml @@ -12,7 +12,9 @@ Item { property string bg: "" 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 { id: bgImage @@ -69,6 +71,8 @@ Item { Column { anchors { + top: parent.top + topMargin: Theme.paddingLarge left: avatarImage.right leftMargin: Theme.paddingLarge right: parent.right @@ -77,12 +81,11 @@ Item { } Label { - id: ttl - text: - if (title === "") { - description.split('@')[0] - } - else title + id: profileTitle + text: if (title === "") { + description.split('@')[0] + } + else title font.pixelSize: Theme.fontSizeLarge font.family: Theme.fontFamilyHeading color: Theme.highlightColor @@ -93,6 +96,7 @@ Item { } Label { + id: profileDescription text: "@"+description font.pixelSize: Theme.fontSizeSmall 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 + } + } + } + }