Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Cambra <claudio.cambra@gmail.com>2022-04-29 15:04:39 +0300
committerClaudio Cambra <claudio.cambra@gmail.com>2022-04-29 19:53:08 +0300
commit72a202a54dcf4b5fe04270682008f8c6bc2a92c7 (patch)
treeab2b9ce20f65114a5f743f691e153a28b97ab6b8
parent43b5eaa5bd2a2dd771866e5468eb945343a752c1 (diff)
Add user avatars in talk notifications in activity listfeature/talk-avatar
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
-rw-r--r--src/gui/tray/ActivityItemContent.qml9
-rw-r--r--src/gui/tray/activitylistmodel.cpp18
-rw-r--r--theme.qrc.in1
-rw-r--r--theme/colored/talk-bordered.svg21
4 files changed, 43 insertions, 6 deletions
diff --git a/src/gui/tray/ActivityItemContent.qml b/src/gui/tray/ActivityItemContent.qml
index 8ca4ac82e..079953dea 100644
--- a/src/gui/tray/ActivityItemContent.qml
+++ b/src/gui/tray/ActivityItemContent.qml
@@ -29,6 +29,7 @@ RowLayout {
Layout.preferredHeight: model.thumbnail.isMimeTypeIcon ? Style.trayListItemIconSize * 0.9 : Style.trayListItemIconSize
readonly property int imageWidth: width * (1 - Style.thumbnailImageSizeReduction)
readonly property int imageHeight: height * (1 - Style.thumbnailImageSizeReduction)
+ readonly property int thumbnailRadius: model.thumbnail.isUserAvatar ? width / 2 : 3
Loader {
id: thumbnailImageLoader
@@ -57,7 +58,7 @@ RowLayout {
Rectangle {
id: mask
color: "white"
- radius: 3
+ radius: thumbnailItem.thumbnailRadius
anchors.fill: thumbnailImage
visible: false
width: thumbnailImage.paintedWidth
@@ -81,11 +82,13 @@ RowLayout {
readonly property int negativeLeftMargin: -((width / 2) +
((width - paintedWidth) / 2) +
((thumbnailImageLoader.width - thumbnailItem.imageWidth) / 2) +
- (thumbnailImageLoader.width - thumbnailImageLoader.item.paintedWidth) / 2)
+ ((thumbnailImageLoader.width - thumbnailImageLoader.item.paintedWidth) / 2) +
+ (thumbnailItem.thumbnailRadius / 4))
readonly property int negativeTopMargin: -((height / 2) +
((height - paintedHeight) / 2) +
((thumbnailImageLoader.height - thumbnailItem.imageHeight) / 4) +
- ((thumbnailImageLoader.height - thumbnailImageLoader.item.paintedHeight) / 4))
+ ((thumbnailImageLoader.height - thumbnailImageLoader.item.paintedHeight) / 4) +
+ (thumbnailItem.thumbnailRadius / 4))
anchors.verticalCenter: if(model.thumbnail === undefined) parent.verticalCenter
anchors.left: model.thumbnail === undefined ? parent.left : thumbnailImageLoader.right
anchors.leftMargin: if(model.thumbnail !== undefined) negativeLeftMargin
diff --git a/src/gui/tray/activitylistmodel.cpp b/src/gui/tray/activitylistmodel.cpp
index d01bb1c7e..f3b00e8a1 100644
--- a/src/gui/tray/activitylistmodel.cpp
+++ b/src/gui/tray/activitylistmodel.cpp
@@ -192,14 +192,22 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
{QStringLiteral("view"), preview._view},
{QStringLiteral("isMimeTypeIcon"), preview._isMimeTypeIcon},
{QStringLiteral("filename"), preview._filename},
+ {QStringLiteral("isUserAvatar"), false},
});
};
+ const auto generateAvatarThumbnailMap = [](const QString &avatarThumbnailUrl) {
+ return QVariantMap {
+ {QStringLiteral("source"), avatarThumbnailUrl},
+ {QStringLiteral("isMimeTypeIcon"), false},
+ {QStringLiteral("isUserAvatar"), true},
+ };
+ };
+
const auto generateIconPath = [&]() {
auto colorIconPath = role == DarkIconRole ? QStringLiteral("qrc:///client/theme/white/") : QStringLiteral("qrc:///client/theme/black/");
- if (a._type == Activity::NotificationType) {
- colorIconPath.append("bell.svg");
- return colorIconPath;
+ if (a._type == Activity::NotificationType && !a._talkNotificationData.userAvatar.isEmpty()) {
+ return QStringLiteral("qrc:///client/theme/colored/talk-bordered.svg");
} else if (a._type == Activity::SyncResultType) {
colorIconPath.append("state-error.svg");
return colorIconPath;
@@ -320,6 +328,10 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
case IsCurrentUserFileActivityRole:
return a._isCurrentUserFileActivity;
case ThumbnailRole: {
+ if (a._type == Activity::NotificationType && !a._talkNotificationData.userAvatar.isEmpty()) {
+ return generateAvatarThumbnailMap(a._talkNotificationData.userAvatar);
+ }
+
if(a._previews.empty()) {
return {};
}
diff --git a/theme.qrc.in b/theme.qrc.in
index 1a5df733a..c341ac5a0 100644
--- a/theme.qrc.in
+++ b/theme.qrc.in
@@ -218,6 +218,7 @@
<file>theme/colored/add-bordered.svg</file>
<file>theme/colored/delete.svg</file>
<file>theme/colored/delete-bordered.svg</file>
+ <file>theme/colored/talk-bordered.svg</file>
<file>theme/colored/@APPLICATION_ICON_NAME@-icon.svg</file>
<file>theme/add.svg</file>
<file>theme/share.svg</file>
diff --git a/theme/colored/talk-bordered.svg b/theme/colored/talk-bordered.svg
new file mode 100644
index 000000000..3a51606e9
--- /dev/null
+++ b/theme/colored/talk-bordered.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ height="16"
+ width="16"
+ version="1.1"
+ viewBox="0 0 16 16"
+ id="svg4"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <defs
+ id="defs8" />
+ <path
+ fill="#ffffff"
+ d="M 7.9992,0.999 A 6.9993,6.9994 0 0 0 1,7.9986 6.9993,6.9994 0 0 0 7.9992,14.998 6.9993,6.9994 0 0 0 11.63,13.974 c 0.86024,0.34184 2.7871,1.356 3.2457,0.91794 0.47922,-0.45765 -0.56261,-2.6116 -0.81238,-3.412 a 6.9993,6.9994 0 0 0 0.935,-3.4814 6.9993,6.9994 0 0 0 -6.9991,-6.9993 z M 8,3.6601 A 4.34,4.3401 0 0 1 12.34,8.0002 4.34,4.3401 0 0 1 8,12.34 4.34,4.3401 0 0 1 3.66,8.0002 4.34,4.3401 0 0 1 8,3.6601 Z"
+ id="path2-8"
+ style="stroke:#ffffff;stroke-opacity:1;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;paint-order:normal" />
+ <path
+ fill="#000000"
+ d="M 7.9992,0.999 A 6.9993,6.9994 0 0 0 1,7.9985999 6.9993,6.9994 0 0 0 7.9992,14.998 6.9993,6.9994 0 0 0 11.63,13.974 c 0.86024,0.34184 2.7871,1.356 3.2457,0.91794 0.47922,-0.45765 -0.56261,-2.6116 -0.81238,-3.412 A 6.9993,6.9994 0 0 0 14.99832,7.9985399 6.9993,6.9994 0 0 0 7.99922,0.99924 Z M 8,3.6601 A 4.34,4.3401 0 0 1 12.34,8.0001999 4.34,4.3401 0 0 1 8,12.34 4.34,4.3401 0 0 1 3.66,8.0001999 4.34,4.3401 0 0 1 8,3.6601 Z"
+ id="path886" />
+</svg>