Fix message_type not being initialized correctly

Fixes "sent an audio file" replies, that were actually replies to text
messages.
This commit is contained in:
Nicolas Werner 2019-07-28 16:50:04 +02:00
parent dbb8eecf29
commit b28115eb37
2 changed files with 13 additions and 1 deletions

View file

@ -282,6 +282,7 @@ TimelineItem::TimelineItem(mtx::events::MessageType ty,
const QString &room_id, const QString &room_id,
QWidget *parent) QWidget *parent)
: QWidget(parent) : QWidget(parent)
, message_type_(ty)
, room_id_{room_id} , room_id_{room_id}
{ {
init(); init();
@ -341,6 +342,7 @@ TimelineItem::TimelineItem(ImageItem *image,
const QString &room_id, const QString &room_id,
QWidget *parent) QWidget *parent)
: QWidget{parent} : QWidget{parent}
, message_type_(mtx::events::MessageType::Image)
, room_id_{room_id} , room_id_{room_id}
{ {
init(); init();
@ -356,6 +358,7 @@ TimelineItem::TimelineItem(FileItem *file,
const QString &room_id, const QString &room_id,
QWidget *parent) QWidget *parent)
: QWidget{parent} : QWidget{parent}
, message_type_(mtx::events::MessageType::File)
, room_id_{room_id} , room_id_{room_id}
{ {
init(); init();
@ -369,6 +372,7 @@ TimelineItem::TimelineItem(AudioItem *audio,
const QString &room_id, const QString &room_id,
QWidget *parent) QWidget *parent)
: QWidget{parent} : QWidget{parent}
, message_type_(mtx::events::MessageType::Audio)
, room_id_{room_id} , room_id_{room_id}
{ {
init(); init();
@ -382,6 +386,7 @@ TimelineItem::TimelineItem(VideoItem *video,
const QString &room_id, const QString &room_id,
QWidget *parent) QWidget *parent)
: QWidget{parent} : QWidget{parent}
, message_type_(mtx::events::MessageType::Video)
, room_id_{room_id} , room_id_{room_id}
{ {
init(); init();
@ -395,6 +400,7 @@ TimelineItem::TimelineItem(ImageItem *image,
const QString &room_id, const QString &room_id,
QWidget *parent) QWidget *parent)
: QWidget(parent) : QWidget(parent)
, message_type_(mtx::events::MessageType::Image)
, room_id_{room_id} , room_id_{room_id}
{ {
setupWidgetLayout<mtx::events::RoomEvent<mtx::events::msg::Image>, ImageItem>( setupWidgetLayout<mtx::events::RoomEvent<mtx::events::msg::Image>, ImageItem>(
@ -426,6 +432,7 @@ TimelineItem::TimelineItem(FileItem *file,
const QString &room_id, const QString &room_id,
QWidget *parent) QWidget *parent)
: QWidget(parent) : QWidget(parent)
, message_type_(mtx::events::MessageType::File)
, room_id_{room_id} , room_id_{room_id}
{ {
setupWidgetLayout<mtx::events::RoomEvent<mtx::events::msg::File>, FileItem>( setupWidgetLayout<mtx::events::RoomEvent<mtx::events::msg::File>, FileItem>(
@ -440,6 +447,7 @@ TimelineItem::TimelineItem(AudioItem *audio,
const QString &room_id, const QString &room_id,
QWidget *parent) QWidget *parent)
: QWidget(parent) : QWidget(parent)
, message_type_(mtx::events::MessageType::Audio)
, room_id_{room_id} , room_id_{room_id}
{ {
setupWidgetLayout<mtx::events::RoomEvent<mtx::events::msg::Audio>, AudioItem>( setupWidgetLayout<mtx::events::RoomEvent<mtx::events::msg::Audio>, AudioItem>(
@ -454,6 +462,7 @@ TimelineItem::TimelineItem(VideoItem *video,
const QString &room_id, const QString &room_id,
QWidget *parent) QWidget *parent)
: QWidget(parent) : QWidget(parent)
, message_type_(mtx::events::MessageType::Video)
, room_id_{room_id} , room_id_{room_id}
{ {
setupWidgetLayout<mtx::events::RoomEvent<mtx::events::msg::Video>, VideoItem>( setupWidgetLayout<mtx::events::RoomEvent<mtx::events::msg::Video>, VideoItem>(
@ -470,6 +479,7 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Notice
const QString &room_id, const QString &room_id,
QWidget *parent) QWidget *parent)
: QWidget(parent) : QWidget(parent)
, message_type_(mtx::events::MessageType::Notice)
, room_id_{room_id} , room_id_{room_id}
{ {
init(); init();
@ -517,6 +527,7 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Emote>
const QString &room_id, const QString &room_id,
QWidget *parent) QWidget *parent)
: QWidget(parent) : QWidget(parent)
, message_type_(mtx::events::MessageType::Emote)
, room_id_{room_id} , room_id_{room_id}
{ {
init(); init();
@ -565,6 +576,7 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Text>
const QString &room_id, const QString &room_id,
QWidget *parent) QWidget *parent)
: QWidget(parent) : QWidget(parent)
, message_type_(mtx::events::MessageType::Text)
, room_id_{room_id} , room_id_{room_id}
{ {
init(); init();

View file

@ -277,7 +277,7 @@ private:
QFutureWatcher<QString> *colorGenerating_; QFutureWatcher<QString> *colorGenerating_;
QString event_id_; QString event_id_;
mtx::events::MessageType message_type_; mtx::events::MessageType message_type_ = mtx::events::MessageType::Unknown;
QString room_id_; QString room_id_;
DescInfo descriptionMsg_; DescInfo descriptionMsg_;