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/PinnedMessageItem.qml \
qml/components/PollPreview.qml \ qml/components/PollPreview.qml \
qml/components/PressEffect.qml \ qml/components/PressEffect.qml \
qml/components/ProfilePictureList.qml \
qml/components/ReplyMarkupButtons.qml \ qml/components/ReplyMarkupButtons.qml \
qml/components/StickerPicker.qml \ qml/components/StickerPicker.qml \
qml/components/PhotoTextsListItem.qml \ qml/components/PhotoTextsListItem.qml \
@ -70,7 +71,6 @@ DISTFILES += qml/harbour-fernschreiber.qml \
qml/components/VoiceNoteOverlay.qml \ qml/components/VoiceNoteOverlay.qml \
qml/components/chatInformationPage/ChatInformationPageContent.qml \ qml/components/chatInformationPage/ChatInformationPageContent.qml \
qml/components/chatInformationPage/ChatInformationProfilePicture.qml \ qml/components/chatInformationPage/ChatInformationProfilePicture.qml \
qml/components/chatInformationPage/ChatInformationProfilePictureList.qml \
qml/components/chatInformationPage/ChatInformationTabItemBase.qml \ qml/components/chatInformationPage/ChatInformationTabItemBase.qml \
qml/components/chatInformationPage/ChatInformationTabItemDebug.qml \ qml/components/chatInformationPage/ChatInformationTabItemDebug.qml \
qml/components/chatInformationPage/ChatInformationTabItemMembersGroups.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. This file is part of Fernschreiber.
@ -18,25 +18,24 @@
*/ */
import QtQuick 2.6 import QtQuick 2.6
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
import "../"
Item { Item {
visible: imageContainer.tweenFactor > 0.8 && bigProfilePictureList.count > 0 id: profilePictureListItem
property bool isActive: imageContainer.tweenFactor === 1.0 visible: imageContainer.thumbnailVisible && bigProfilePictureList.count > 0
property bool isActive: imageContainer.thumbnailActive
opacity: isActive ? 1.0 : 0.0 opacity: isActive ? 1.0 : 0.0
Behavior on opacity { FadeAnimation {} } Behavior on opacity { FadeAnimation {} }
SlideshowView { SlideshowView {
id: bigProfilePictureList id: bigProfilePictureList
property bool isActive: imageContainer.tweenFactor === 1.0
width: parent.width width: parent.width
height: parent.height height: parent.height
clip: true clip: true
itemWidth: width itemWidth: width
itemHeight: height itemHeight: height
interactive: parent.isActive interactive: parent.isActive
model: chatInformationPage.chatPartnerProfilePhotos model: imageContainer.thumbnailModel
delegate: Item { delegate: Item {
width: bigProfilePictureList.itemWidth width: bigProfilePictureList.itemWidth
height: bigProfilePictureList.itemHeight height: bigProfilePictureList.itemHeight
@ -44,13 +43,13 @@ Item {
id: chatPictureDetail id: chatPictureDetail
photoData: modelData.sizes[modelData.sizes.length - 1].photo photoData: modelData.sizes[modelData.sizes.length - 1].photo
replacementStringHint: "" replacementStringHint: ""
radius: chatPictureThumbnail.radius radius: imageContainer.thumbnailRadius
anchors.fill: parent anchors.fill: parent
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { 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)) 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) { function getEased(min,max,factor) {
return min + (max-min)*factor return min + (max-min)*factor
@ -271,17 +275,18 @@ SilicaFlickable {
replacementStringHint: headerItem.title replacementStringHint: headerItem.title
width: parent.width width: parent.width
height: width height: width
radius: imageContainer.minDimension / 2 radius: imageContainer.thumbnailRadius
opacity: profilePictureLoader.status !== Loader.Ready || profilePictureLoader.item.opacity < 1 ? 1.0 : 0.0 opacity: profilePictureLoader.status !== Loader.Ready || profilePictureLoader.item.opacity < 1 ? 1.0 : 0.0
optimizeImageSize: false optimizeImageSize: false
} }
Loader { Loader {
id: profilePictureLoader id: profilePictureLoader
active: imageContainer.hasImage active: imageContainer.hasImage
asynchronous: true asynchronous: true
anchors.fill: chatPictureThumbnail anchors.fill: chatPictureThumbnail
source: ( chatInformationPage.isPrivateChat || chatInformationPage.isSecretChat) source: ( chatInformationPage.isPrivateChat || chatInformationPage.isSecretChat)
? "ChatInformationProfilePictureList.qml" ? "../ProfilePictureList.qml"
: "ChatInformationProfilePicture.qml" : "ChatInformationProfilePicture.qml"
} }
} }

View file

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

View file

@ -28,6 +28,13 @@ Page {
allowedOrientations: Orientation.All allowedOrientations: Orientation.All
readonly property bool landscapeLayout: (width > height && Screen.sizeCategory > Screen.Small) || Screen.sizeCategory > Screen.Medium 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 { Connections {
target: tdLibWrapper target: tdLibWrapper
@ -36,6 +43,11 @@ Page {
lastNameEditArea.text = userInformation.last_name; lastNameEditArea.text = userInformation.last_name;
userNameEditArea.text = userInformation.username; userNameEditArea.text = userInformation.username;
} }
onUserProfilePhotosReceived: {
if (extra === userInformation.id.toString()) {
imageContainer.thumbnailModel = photos;
}
}
} }
SilicaFlickable { SilicaFlickable {
@ -68,7 +80,7 @@ Page {
visible: true visible: true
canEdit: true canEdit: true
headerText: qsTr("First Name", "first name of the logged-in profile - header") headerText: qsTr("First Name", "first name of the logged-in profile - header")
text: tdLibWrapper.getUserInformation().first_name text: userInformation.first_name
width: parent.columnWidth width: parent.columnWidth
headerLeftAligned: true headerLeftAligned: true
@ -98,7 +110,7 @@ Page {
visible: true visible: true
canEdit: true canEdit: true
headerText: qsTr("Last Name", "last name of the logged-in profile - header") headerText: qsTr("Last Name", "last name of the logged-in profile - header")
text: tdLibWrapper.getUserInformation().last_name text: userInformation.last_name
width: parent.columnWidth width: parent.columnWidth
headerLeftAligned: true headerLeftAligned: true
@ -128,7 +140,7 @@ Page {
visible: true visible: true
canEdit: true canEdit: true
headerText: qsTr("Username", "user name of the logged-in profile - header") headerText: qsTr("Username", "user name of the logged-in profile - header")
text: tdLibWrapper.getUserInformation().username text: userInformation.username
width: parent.columnWidth width: parent.columnWidth
headerLeftAligned: true 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 { Grid {
width: parent.width width: parent.width
columns: landscapeLayout ? 2 : 1 columns: landscapeLayout ? 2 : 1

View file

@ -1616,6 +1616,22 @@
<source>Privacy setting for managing whether your online status is visible.</source> <source>Privacy setting for managing whether your online status is visible.</source>
<translation>Privatsphären-Einstellung zur Regelung, ob Ihr Onlinestatus sichtbar ist.</translation> <translation>Privatsphären-Einstellung zur Regelung, ob Ihr Onlinestatus sichtbar ist.</translation>
</message> </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>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1616,6 +1616,22 @@
<source>Privacy setting for managing whether your online status is visible.</source> <source>Privacy setting for managing whether your online status is visible.</source>
<translation>Privacy setting for managing whether your online status is visible.</translation> <translation>Privacy setting for managing whether your online status is visible.</translation>
</message> </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>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1616,6 +1616,22 @@
<source>Privacy setting for managing whether your online status is visible.</source> <source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </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>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1617,6 +1617,22 @@
<source>Privacy setting for managing whether your online status is visible.</source> <source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </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>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1591,6 +1591,22 @@
<source>Privacy setting for managing whether your online status is visible.</source> <source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </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>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1616,6 +1616,22 @@
<source>Privacy setting for managing whether your online status is visible.</source> <source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </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>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1641,6 +1641,22 @@
<source>Privacy setting for managing whether your online status is visible.</source> <source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </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>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1641,6 +1641,22 @@
<source>Privacy setting for managing whether your online status is visible.</source> <source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </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>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1616,6 +1616,22 @@
<source>Privacy setting for managing whether your online status is visible.</source> <source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </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>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1591,6 +1591,22 @@
<source>Privacy setting for managing whether your online status is visible.</source> <source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </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>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>

View file

@ -1616,6 +1616,22 @@
<source>Privacy setting for managing whether your online status is visible.</source> <source>Privacy setting for managing whether your online status is visible.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </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>
<context> <context>
<name>StickerPicker</name> <name>StickerPicker</name>