diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c269d51de..a2db43d12 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -178,6 +178,7 @@ if(ANDROID) "home" "preferences-desktop-notification" "computer-symbolic" + "gps" ) else() target_link_libraries(neochat PUBLIC Qt::Widgets KF${QT_MAJOR_VERSION}::KIOWidgets) diff --git a/src/models/messageeventmodel.cpp b/src/models/messageeventmodel.cpp index 180c360f7..1a042366b 100644 --- a/src/models/messageeventmodel.cpp +++ b/src/models/messageeventmodel.cpp @@ -71,6 +71,7 @@ QHash MessageEventModel::roleNames() const roles[IsPendingRole] = "isPending"; roles[LatitudeRole] = "latitude"; roles[LongitudeRole] = "longitude"; + roles[AssetRole] = "asset"; return roles; } @@ -835,6 +836,14 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const return latitude.toFloat(); } + if (role == AssetRole) { + const auto assetType = evt.contentJson()["org.matrix.msc3488.asset"].toObject()["type"].toString(); + if (assetType.isEmpty()) { + return {}; + } + return assetType; + } + if (role == ReadMarkersRole) { #ifdef QUOTIENT_07 auto userIds = room()->userIdsAtEvent(evt.id()); diff --git a/src/models/messageeventmodel.h b/src/models/messageeventmodel.h index a9ffc7d4f..7f6ba3816 100644 --- a/src/models/messageeventmodel.h +++ b/src/models/messageeventmodel.h @@ -78,6 +78,7 @@ public: IsPendingRole, LatitudeRole, LongitudeRole, + AssetRole, LastRole, // Keep this last }; Q_ENUM(EventRoles) diff --git a/src/qml/Component/Timeline/LocationDelegate.qml b/src/qml/Component/Timeline/LocationDelegate.qml index 192be8254..3501550b0 100644 --- a/src/qml/Component/Timeline/LocationDelegate.qml +++ b/src/qml/Component/Timeline/LocationDelegate.qml @@ -43,14 +43,37 @@ TimelineContainer { id: point anchorPoint.x: sourceItem.width / 2 - anchorPoint.y: sourceItem.height / 2 + anchorPoint.y: sourceItem.height coordinate: QtPositioning.coordinate(model.latitude, model.longitude) autoFadeIn: false sourceItem: Kirigami.Icon { width: height - height: Kirigami.Units.iconSizes.medium - source: "flag-blue" + height: Kirigami.Units.iconSizes.huge + source: "gps" + isMask: true + color: Kirigami.Theme.highlightColor + + Kirigami.Icon { + anchors.centerIn: parent + anchors.verticalCenterOffset: -parent.height / 8 + visible: model.asset === "m.pin" + width: height + height: parent.height / 3 + 1 + source: "pin" + isMask: true + color: Kirigami.Theme.highlightColor + } + Kirigami.Avatar { + anchors.centerIn: parent + anchors.verticalCenterOffset: -parent.height / 8 + visible: model.asset === "m.self" + width: height + height: parent.height / 3 + 1 + name: model.author.name ?? model.author.displayName + source: model.author.avatarMediaId ? ("image://mxc/" + model.author.avatarMediaId) : "" + color: model.author.color + } } }