Prepare adding/deleting profile pictures

This commit is contained in:
Sebastian Wolf 2021-01-25 23:39:54 +01:00
parent 1b653eb554
commit 5e6cd6f4b4
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
16 changed files with 272 additions and 16 deletions

View file

@ -60,6 +60,7 @@ DISTFILES += qml/harbour-fernschreiber.qml \
qml/components/PinnedMessageItem.qml \
qml/components/PollPreview.qml \
qml/components/PressEffect.qml \
qml/components/ProfilePictureList.qml \
qml/components/ReplyMarkupButtons.qml \
qml/components/StickerPicker.qml \
qml/components/PhotoTextsListItem.qml \
@ -70,7 +71,6 @@ DISTFILES += qml/harbour-fernschreiber.qml \
qml/components/VoiceNoteOverlay.qml \
qml/components/chatInformationPage/ChatInformationPageContent.qml \
qml/components/chatInformationPage/ChatInformationProfilePicture.qml \
qml/components/chatInformationPage/ChatInformationProfilePictureList.qml \
qml/components/chatInformationPage/ChatInformationTabItemBase.qml \
qml/components/chatInformationPage/ChatInformationTabItemDebug.qml \
qml/components/chatInformationPage/ChatInformationTabItemMembersGroups.qml \

View file

@ -1,5 +1,5 @@
/*
Copyright (C) 2020 Sebastian J. Wolf and other contributors
Copyright (C) 2020-21 Sebastian J. Wolf and other contributors
This file is part of Fernschreiber.
@ -18,25 +18,24 @@
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
import "../"
Item {
visible: imageContainer.tweenFactor > 0.8 && bigProfilePictureList.count > 0
property bool isActive: imageContainer.tweenFactor === 1.0
id: profilePictureListItem
visible: imageContainer.thumbnailVisible && bigProfilePictureList.count > 0
property bool isActive: imageContainer.thumbnailActive
opacity: isActive ? 1.0 : 0.0
Behavior on opacity { FadeAnimation {} }
SlideshowView {
id: bigProfilePictureList
property bool isActive: imageContainer.tweenFactor === 1.0
width: parent.width
height: parent.height
clip: true
itemWidth: width
itemHeight: height
interactive: parent.isActive
model: chatInformationPage.chatPartnerProfilePhotos
model: imageContainer.thumbnailModel
delegate: Item {
width: bigProfilePictureList.itemWidth
height: bigProfilePictureList.itemHeight
@ -44,13 +43,13 @@ Item {
id: chatPictureDetail
photoData: modelData.sizes[modelData.sizes.length - 1].photo
replacementStringHint: ""
radius: chatPictureThumbnail.radius
radius: imageContainer.thumbnailRadius
anchors.fill: parent
}
MouseArea {
anchors.fill: parent
onClicked: {
pageStack.push(Qt.resolvedUrl("../../pages/ImagePage.qml"), { "photoData" : modelData });
pageStack.push(Qt.resolvedUrl("../pages/ImagePage.qml"), { "photoData" : modelData });
}
}
}

View file

@ -256,6 +256,10 @@ SilicaFlickable {
}
return 1 - Math.max(0, Math.min(1, contentFlickable.contentY / maxDimension))
}
property bool thumbnailVisible: imageContainer.tweenFactor > 0.8
property bool thumbnailActive: imageContainer.tweenFactor === 1.0
property var thumbnailModel: chatInformationPage.chatPartnerProfilePhotos
property int thumbnailRadius: imageContainer.minDimension / 2
function getEased(min,max,factor) {
return min + (max-min)*factor
@ -271,17 +275,18 @@ SilicaFlickable {
replacementStringHint: headerItem.title
width: parent.width
height: width
radius: imageContainer.minDimension / 2
radius: imageContainer.thumbnailRadius
opacity: profilePictureLoader.status !== Loader.Ready || profilePictureLoader.item.opacity < 1 ? 1.0 : 0.0
optimizeImageSize: false
}
Loader {
id: profilePictureLoader
active: imageContainer.hasImage
asynchronous: true
anchors.fill: chatPictureThumbnail
source: ( chatInformationPage.isPrivateChat || chatInformationPage.isSecretChat)
? "ChatInformationProfilePictureList.qml"
? "../ProfilePictureList.qml"
: "ChatInformationProfilePicture.qml"
}
}

View file

@ -22,8 +22,8 @@ import Sailfish.Silica 1.0
import "../"
Item {
visible: imageContainer.tweenFactor > 0.8 && chatPictureDetail.imageStatus === Image.Ready
property bool isActive: imageContainer.tweenFactor === 1.0
visible: parent.thumbnailVisible && chatPictureDetail.imageStatus === Image.Ready
property bool isActive: parent.thumbnailActive
opacity: isActive ? 1.0 : 0.0
Behavior on opacity { FadeAnimation {} }
ProfileThumbnail {

View file

@ -28,6 +28,13 @@ Page {
allowedOrientations: Orientation.All
readonly property bool landscapeLayout: (width > height && Screen.sizeCategory > Screen.Small) || Screen.sizeCategory > Screen.Medium
readonly property var userInformation: tdLibWrapper.getUserInformation()
onStatusChanged: {
if (status === PageStatus.Active) {
tdLibWrapper.getUserProfilePhotos(userInformation.id, 100, 0);
}
}
Connections {
target: tdLibWrapper
@ -36,6 +43,11 @@ Page {
lastNameEditArea.text = userInformation.last_name;
userNameEditArea.text = userInformation.username;
}
onUserProfilePhotosReceived: {
if (extra === userInformation.id.toString()) {
imageContainer.thumbnailModel = photos;
}
}
}
SilicaFlickable {
@ -68,7 +80,7 @@ Page {
visible: true
canEdit: true
headerText: qsTr("First Name", "first name of the logged-in profile - header")
text: tdLibWrapper.getUserInformation().first_name
text: userInformation.first_name
width: parent.columnWidth
headerLeftAligned: true
@ -98,7 +110,7 @@ Page {
visible: true
canEdit: true
headerText: qsTr("Last Name", "last name of the logged-in profile - header")
text: tdLibWrapper.getUserInformation().last_name
text: userInformation.last_name
width: parent.columnWidth
headerLeftAligned: true
@ -128,7 +140,7 @@ Page {
visible: true
canEdit: true
headerText: qsTr("Username", "user name of the logged-in profile - header")
text: tdLibWrapper.getUserInformation().username
text: userInformation.username
width: parent.columnWidth
headerLeftAligned: true
@ -139,6 +151,70 @@ Page {
}
SectionHeader {
horizontalAlignment: Text.AlignLeft
text: qsTr("Profile Pictures")
}
Row {
width: parent.width - ( 2 * Theme.horizontalPageMargin )
spacing: Theme.paddingMedium
Item {
id: imageContainer
anchors.verticalCenter: parent.verticalCenter
width: parent.width / 2
height: profilePictureLoader.height
property var thumbnailModel: ({})
property bool thumbnailVisible: true
property bool thumbnailActive: thumbnailModel.length > 0
property int thumbnailRadius: imageContainer.width / 2
Loader {
id: profilePictureLoader
active: imageContainer.thumbnailActive
asynchronous: true
width: Theme.itemSizeExtraLarge
height: Theme.itemSizeExtraLarge
anchors.horizontalCenter: parent.horizontalCenter
source: "../components/ProfilePictureList.qml"
}
}
Column {
spacing: Theme.paddingSmall
width: parent.width / 2
Button {
id: addProfilePictureButton
text: qsTr("Add Picture")
anchors {
horizontalCenter: parent.horizontalCenter
}
onClicked: {
}
}
Button {
id: removeProfilePictureButton
text: qsTr("Remove Picture")
anchors {
horizontalCenter: parent.horizontalCenter
}
onClicked: {
}
}
}
}
SectionHeader {
horizontalAlignment: Text.AlignLeft
text: qsTr("Privacy Options")
}
Grid {
width: parent.width
columns: landscapeLayout ? 2 : 1

View file

@ -1616,6 +1616,22 @@
<source>Privacy setting for managing whether your online status is visible.</source>
<translation>Privatsphären-Einstellung zur Regelung, ob Ihr Onlinestatus sichtbar ist.</translation>
</message>
<message>
<source>Add Picture</source>
<translation>Bild hinzufügen</translation>
</message>
<message>
<source>Remove Picture</source>
<translation>Bild löschen</translation>
</message>
<message>
<source>Profile Pictures</source>
<translation>Profilbilder</translation>
</message>
<message>
<source>Privacy Options</source>
<translation>Optionen zur Privatsphäre</translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1616,6 +1616,22 @@
<source>Privacy setting for managing whether your online status is visible.</source>
<translation>Privacy setting for managing whether your online status is visible.</translation>
</message>
<message>
<source>Add Picture</source>
<translation>Add Picture</translation>
</message>
<message>
<source>Remove Picture</source>
<translation>Remove Picture</translation>
</message>
<message>
<source>Profile Pictures</source>
<translation>Profile Pictures</translation>
</message>
<message>
<source>Privacy Options</source>
<translation>Privacy Options</translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1616,6 +1616,22 @@
<source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remove Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Profile Pictures</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Privacy Options</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1617,6 +1617,22 @@
<source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remove Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Profile Pictures</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Privacy Options</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1591,6 +1591,22 @@
<source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remove Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Profile Pictures</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Privacy Options</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1616,6 +1616,22 @@
<source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remove Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Profile Pictures</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Privacy Options</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1641,6 +1641,22 @@
<source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remove Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Profile Pictures</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Privacy Options</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1641,6 +1641,22 @@
<source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remove Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Profile Pictures</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Privacy Options</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1616,6 +1616,22 @@
<source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remove Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Profile Pictures</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Privacy Options</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1591,6 +1591,22 @@
<source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remove Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Profile Pictures</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Privacy Options</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>

View file

@ -1616,6 +1616,22 @@
<source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remove Picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Profile Pictures</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Privacy Options</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StickerPicker</name>