Improve location marker
Change location marker to GPS icon, make sure the point is the anchor and colour it with highlight colour m.self \  m.pin \ 
This commit is contained in:
@@ -178,6 +178,7 @@ if(ANDROID)
|
|||||||
"home"
|
"home"
|
||||||
"preferences-desktop-notification"
|
"preferences-desktop-notification"
|
||||||
"computer-symbolic"
|
"computer-symbolic"
|
||||||
|
"gps"
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(neochat PUBLIC Qt::Widgets KF${QT_MAJOR_VERSION}::KIOWidgets)
|
target_link_libraries(neochat PUBLIC Qt::Widgets KF${QT_MAJOR_VERSION}::KIOWidgets)
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ QHash<int, QByteArray> MessageEventModel::roleNames() const
|
|||||||
roles[IsPendingRole] = "isPending";
|
roles[IsPendingRole] = "isPending";
|
||||||
roles[LatitudeRole] = "latitude";
|
roles[LatitudeRole] = "latitude";
|
||||||
roles[LongitudeRole] = "longitude";
|
roles[LongitudeRole] = "longitude";
|
||||||
|
roles[AssetRole] = "asset";
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -835,6 +836,14 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
|
|||||||
return latitude.toFloat();
|
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) {
|
if (role == ReadMarkersRole) {
|
||||||
#ifdef QUOTIENT_07
|
#ifdef QUOTIENT_07
|
||||||
auto userIds = room()->userIdsAtEvent(evt.id());
|
auto userIds = room()->userIdsAtEvent(evt.id());
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ public:
|
|||||||
IsPendingRole,
|
IsPendingRole,
|
||||||
LatitudeRole,
|
LatitudeRole,
|
||||||
LongitudeRole,
|
LongitudeRole,
|
||||||
|
AssetRole,
|
||||||
LastRole, // Keep this last
|
LastRole, // Keep this last
|
||||||
};
|
};
|
||||||
Q_ENUM(EventRoles)
|
Q_ENUM(EventRoles)
|
||||||
|
|||||||
@@ -43,14 +43,37 @@ TimelineContainer {
|
|||||||
id: point
|
id: point
|
||||||
|
|
||||||
anchorPoint.x: sourceItem.width / 2
|
anchorPoint.x: sourceItem.width / 2
|
||||||
anchorPoint.y: sourceItem.height / 2
|
anchorPoint.y: sourceItem.height
|
||||||
coordinate: QtPositioning.coordinate(model.latitude, model.longitude)
|
coordinate: QtPositioning.coordinate(model.latitude, model.longitude)
|
||||||
autoFadeIn: false
|
autoFadeIn: false
|
||||||
|
|
||||||
sourceItem: Kirigami.Icon {
|
sourceItem: Kirigami.Icon {
|
||||||
width: height
|
width: height
|
||||||
height: Kirigami.Units.iconSizes.medium
|
height: Kirigami.Units.iconSizes.huge
|
||||||
source: "flag-blue"
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user