mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-29 14:18:49 +03:00
add translations and actually add changes to TimelineModel
This commit is contained in:
parent
384c9c91e3
commit
12d600db97
4 changed files with 21 additions and 9 deletions
|
@ -252,7 +252,7 @@ ScrollView {
|
||||||
topPadding: 4
|
topPadding: 4
|
||||||
bottomPadding: 4
|
bottomPadding: 4
|
||||||
spacing: 8
|
spacing: 8
|
||||||
visible: (previousMessageUserId !== userId || previousMessageDay !== day || previousMessageIsStateEvent) && !isStateEvent
|
visible: (previousMessageUserId !== userId || previousMessageDay !== day || isStateEvent !== previousMessageIsStateEvent)
|
||||||
width: parentWidth
|
width: parentWidth
|
||||||
height: ((previousMessageDay !== day) ? dateBubble.height : 0) + (isStateEvent? 0 : userName.height +8 )
|
height: ((previousMessageDay !== day) ? dateBubble.height : 0) + (isStateEvent? 0 : userName.height +8 )
|
||||||
|
|
||||||
|
@ -278,6 +278,7 @@ ScrollView {
|
||||||
Row {
|
Row {
|
||||||
height: userName_.height
|
height: userName_.height
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
visible: !isStateEvent
|
||||||
|
|
||||||
Avatar {
|
Avatar {
|
||||||
id: messageUserAvatar
|
id: messageUserAvatar
|
||||||
|
|
|
@ -186,7 +186,7 @@ Item {
|
||||||
roleValue: MtxEvent.Redaction
|
roleValue: MtxEvent.Redaction
|
||||||
|
|
||||||
Pill {
|
Pill {
|
||||||
text: qsTr("removed")
|
text: qsTr("%1 removed a message").arg(d.userName)
|
||||||
isStateEvent: d.isStateEvent
|
isStateEvent: d.isStateEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ Item {
|
||||||
roleValue: MtxEvent.Encryption
|
roleValue: MtxEvent.Encryption
|
||||||
|
|
||||||
Pill {
|
Pill {
|
||||||
text: qsTr("Encryption enabled")
|
text: qsTr("%1 enabled encryption").arg(d.userName)
|
||||||
isStateEvent: d.isStateEvent
|
isStateEvent: d.isStateEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ Item {
|
||||||
isOnlyEmoji: false
|
isOnlyEmoji: false
|
||||||
isReply: d.isReply
|
isReply: d.isReply
|
||||||
isStateEvent: d.isStateEvent
|
isStateEvent: d.isStateEvent
|
||||||
formatted: d.roomName ? qsTr("room name changed to: %1").arg(d.roomName) : qsTr("removed room name")
|
formatted: d.roomName ? qsTr("%2 changed the room name to: %1").arg(d.roomName).arg(d.userName) : qsTr("%1 removed the room name").arg(d.userName)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ Item {
|
||||||
isOnlyEmoji: false
|
isOnlyEmoji: false
|
||||||
isReply: d.isReply
|
isReply: d.isReply
|
||||||
isStateEvent: d.isStateEvent
|
isStateEvent: d.isStateEvent
|
||||||
formatted: d.roomTopic ? qsTr("topic changed to: %1").arg(d.roomTopic) : qsTr("removed topic")
|
formatted: d.roomTopic ? qsTr("%2 changed the topic to: %1").arg(d.roomTopic).arg(d.userName): qsTr("%1 removed the topic").arg(d.userName)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,7 @@ Item {
|
||||||
isOnlyEmoji: false
|
isOnlyEmoji: false
|
||||||
isReply: d.isReply
|
isReply: d.isReply
|
||||||
isStateEvent: d.isStateEvent
|
isStateEvent: d.isStateEvent
|
||||||
formatted: qsTr("Negotiating call...")
|
formatted: qsTr("% is negotiating the call...").arg(d.userName)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -453,6 +453,7 @@ TimelineModel::roleNames() const
|
||||||
{UserId, "userId"},
|
{UserId, "userId"},
|
||||||
{UserName, "userName"},
|
{UserName, "userName"},
|
||||||
{PreviousMessageDay, "previousMessageDay"},
|
{PreviousMessageDay, "previousMessageDay"},
|
||||||
|
{PreviousMessageIsStateEvent, "previousMessageIsStateEvent"},
|
||||||
{Day, "day"},
|
{Day, "day"},
|
||||||
{Timestamp, "timestamp"},
|
{Timestamp, "timestamp"},
|
||||||
{Url, "url"},
|
{Url, "url"},
|
||||||
|
@ -469,6 +470,7 @@ TimelineModel::roleNames() const
|
||||||
{IsEdited, "isEdited"},
|
{IsEdited, "isEdited"},
|
||||||
{IsEditable, "isEditable"},
|
{IsEditable, "isEditable"},
|
||||||
{IsEncrypted, "isEncrypted"},
|
{IsEncrypted, "isEncrypted"},
|
||||||
|
{IsStateEvent, "isStateEvent"},
|
||||||
{Trustlevel, "trustlevel"},
|
{Trustlevel, "trustlevel"},
|
||||||
{EncryptionError, "encryptionError"},
|
{EncryptionError, "encryptionError"},
|
||||||
{ReplyTo, "replyTo"},
|
{ReplyTo, "replyTo"},
|
||||||
|
@ -666,6 +668,9 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r
|
||||||
std::holds_alternative<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(
|
std::holds_alternative<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(
|
||||||
*encrypted_event);
|
*encrypted_event);
|
||||||
}
|
}
|
||||||
|
case IsStateEvent: {
|
||||||
|
return is_state_event(event);
|
||||||
|
}
|
||||||
|
|
||||||
case Trustlevel: {
|
case Trustlevel: {
|
||||||
auto encrypted_event = events.get(event_id(event), "", false);
|
auto encrypted_event = events.get(event_id(event), "", false);
|
||||||
|
@ -730,6 +735,7 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r
|
||||||
m.insert(names[IsEdited], data(event, static_cast<int>(IsEdited)));
|
m.insert(names[IsEdited], data(event, static_cast<int>(IsEdited)));
|
||||||
m.insert(names[IsEditable], data(event, static_cast<int>(IsEditable)));
|
m.insert(names[IsEditable], data(event, static_cast<int>(IsEditable)));
|
||||||
m.insert(names[IsEncrypted], data(event, static_cast<int>(IsEncrypted)));
|
m.insert(names[IsEncrypted], data(event, static_cast<int>(IsEncrypted)));
|
||||||
|
m.insert(names[IsStateEvent], data(event, static_cast<int>(IsStateEvent)));
|
||||||
m.insert(names[ReplyTo], data(event, static_cast<int>(ReplyTo)));
|
m.insert(names[ReplyTo], data(event, static_cast<int>(ReplyTo)));
|
||||||
m.insert(names[RoomName], data(event, static_cast<int>(RoomName)));
|
m.insert(names[RoomName], data(event, static_cast<int>(RoomName)));
|
||||||
m.insert(names[RoomTopic], data(event, static_cast<int>(RoomTopic)));
|
m.insert(names[RoomTopic], data(event, static_cast<int>(RoomTopic)));
|
||||||
|
@ -762,7 +768,8 @@ TimelineModel::data(const QModelIndex &index, int role) const
|
||||||
if (!event)
|
if (!event)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
if (role == PreviousMessageDay || role == PreviousMessageUserId) {
|
if (role == PreviousMessageDay || role == PreviousMessageUserId ||
|
||||||
|
role == PreviousMessageIsStateEvent) {
|
||||||
int prevIdx = rowCount() - index.row() - 2;
|
int prevIdx = rowCount() - index.row() - 2;
|
||||||
if (prevIdx < 0)
|
if (prevIdx < 0)
|
||||||
return {};
|
return {};
|
||||||
|
@ -771,8 +778,10 @@ TimelineModel::data(const QModelIndex &index, int role) const
|
||||||
return {};
|
return {};
|
||||||
if (role == PreviousMessageUserId)
|
if (role == PreviousMessageUserId)
|
||||||
return data(*tempEv, UserId);
|
return data(*tempEv, UserId);
|
||||||
else
|
else if (role == PreviousMessageDay)
|
||||||
return data(*tempEv, Day);
|
return data(*tempEv, Day);
|
||||||
|
else
|
||||||
|
return data(*tempEv, IsStateEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
return data(*event, role);
|
return data(*event, role);
|
||||||
|
|
|
@ -205,6 +205,7 @@ public:
|
||||||
UserId,
|
UserId,
|
||||||
UserName,
|
UserName,
|
||||||
PreviousMessageDay,
|
PreviousMessageDay,
|
||||||
|
PreviousMessageIsStateEvent,
|
||||||
Day,
|
Day,
|
||||||
Timestamp,
|
Timestamp,
|
||||||
Url,
|
Url,
|
||||||
|
@ -221,6 +222,7 @@ public:
|
||||||
IsEdited,
|
IsEdited,
|
||||||
IsEditable,
|
IsEditable,
|
||||||
IsEncrypted,
|
IsEncrypted,
|
||||||
|
IsStateEvent,
|
||||||
Trustlevel,
|
Trustlevel,
|
||||||
EncryptionError,
|
EncryptionError,
|
||||||
ReplyTo,
|
ReplyTo,
|
||||||
|
|
Loading…
Reference in a new issue