mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Show event type string in placeholder
This commit is contained in:
parent
c758cead9e
commit
e9267ffc76
3 changed files with 13 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
import ".."
|
import ".."
|
||||||
|
|
||||||
MatrixText {
|
MatrixText {
|
||||||
text: qsTr("unimplemented event: ") + model.data.type
|
text: qsTr("unimplemented event: ") + model.data.typeString
|
||||||
width: parent ? parent.width : undefined
|
width: parent ? parent.width : undefined
|
||||||
color: inactiveColors.text
|
color: inactiveColors.text
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,13 @@ toRoomEventType(const mtx::events::collections::TimelineEvents &event)
|
||||||
return std::visit(RoomEventType{}, event);
|
return std::visit(RoomEventType{}, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString
|
||||||
|
toRoomEventTypeString(const mtx::events::collections::TimelineEvents &event)
|
||||||
|
{
|
||||||
|
return std::visit([](const auto &e) { return QString::fromStdString(to_string(e.type)); },
|
||||||
|
event);
|
||||||
|
}
|
||||||
|
|
||||||
TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObject *parent)
|
TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObject *parent)
|
||||||
: QAbstractListModel(parent)
|
: QAbstractListModel(parent)
|
||||||
, room_id_(room_id)
|
, room_id_(room_id)
|
||||||
|
@ -206,6 +213,7 @@ TimelineModel::roleNames() const
|
||||||
return {
|
return {
|
||||||
{Section, "section"},
|
{Section, "section"},
|
||||||
{Type, "type"},
|
{Type, "type"},
|
||||||
|
{TypeString, "typeString"},
|
||||||
{Body, "body"},
|
{Body, "body"},
|
||||||
{FormattedBody, "formattedBody"},
|
{FormattedBody, "formattedBody"},
|
||||||
{UserId, "userId"},
|
{UserId, "userId"},
|
||||||
|
@ -265,6 +273,8 @@ TimelineModel::data(const QString &id, int role) const
|
||||||
return QVariant(origin_server_ts(event));
|
return QVariant(origin_server_ts(event));
|
||||||
case Type:
|
case Type:
|
||||||
return QVariant(toRoomEventType(event));
|
return QVariant(toRoomEventType(event));
|
||||||
|
case TypeString:
|
||||||
|
return QVariant(toRoomEventTypeString(event));
|
||||||
case Body:
|
case Body:
|
||||||
return QVariant(utils::replaceEmoji(QString::fromStdString(body(event))));
|
return QVariant(utils::replaceEmoji(QString::fromStdString(body(event))));
|
||||||
case FormattedBody: {
|
case FormattedBody: {
|
||||||
|
@ -327,6 +337,7 @@ TimelineModel::data(const QString &id, int role) const
|
||||||
|
|
||||||
// m.insert(names[Section], data(id, static_cast<int>(Section)));
|
// m.insert(names[Section], data(id, static_cast<int>(Section)));
|
||||||
m.insert(names[Type], data(id, static_cast<int>(Type)));
|
m.insert(names[Type], data(id, static_cast<int>(Type)));
|
||||||
|
m.insert(names[TypeString], data(id, static_cast<int>(TypeString)));
|
||||||
m.insert(names[Body], data(id, static_cast<int>(Body)));
|
m.insert(names[Body], data(id, static_cast<int>(Body)));
|
||||||
m.insert(names[FormattedBody], data(id, static_cast<int>(FormattedBody)));
|
m.insert(names[FormattedBody], data(id, static_cast<int>(FormattedBody)));
|
||||||
m.insert(names[UserId], data(id, static_cast<int>(UserId)));
|
m.insert(names[UserId], data(id, static_cast<int>(UserId)));
|
||||||
|
|
|
@ -130,6 +130,7 @@ public:
|
||||||
{
|
{
|
||||||
Section,
|
Section,
|
||||||
Type,
|
Type,
|
||||||
|
TypeString,
|
||||||
Body,
|
Body,
|
||||||
FormattedBody,
|
FormattedBody,
|
||||||
UserId,
|
UserId,
|
||||||
|
|
Loading…
Reference in a new issue