summary refs log tree commit diff
path: root/src/timeline/widgets/FileItem.cc
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-12-04 18:41:19 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-12-04 18:41:19 +0200
commita605e4486f4b9d90d668d6d1844ba5f0d58bbc26 (patch)
treec82001904cb120d975361edb38a62b5b77fa0644 /src/timeline/widgets/FileItem.cc
parentRun tests only with gcc (diff)
downloadnheko-a605e4486f4b9d90d668d6d1844ba5f0d58bbc26.tar.xz
Migrate to matrix-structs for event and response parsing
Diffstat (limited to 'src/timeline/widgets/FileItem.cc')
-rw-r--r--src/timeline/widgets/FileItem.cc15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/timeline/widgets/FileItem.cc b/src/timeline/widgets/FileItem.cc
index e4cc02b2..3c38dc31 100644
--- a/src/timeline/widgets/FileItem.cc
+++ b/src/timeline/widgets/FileItem.cc
@@ -26,9 +26,6 @@
 
 #include "timeline/widgets/FileItem.h"
 
-namespace events = matrix::events;
-namespace msgs   = matrix::events::messages;
-
 constexpr int MaxWidth           = 400;
 constexpr int Height             = 70;
 constexpr int IconRadius         = 22;
@@ -64,15 +61,15 @@ FileItem::init()
 }
 
 FileItem::FileItem(QSharedPointer<MatrixClient> client,
-                   const events::MessageEvent<msgs::File> &event,
+                   const mtx::events::RoomEvent<mtx::events::msg::File> &event,
                    QWidget *parent)
   : QWidget(parent)
-  , url_{event.msgContent().url()}
-  , text_{event.content().body()}
+  , url_{QString::fromStdString(event.content.url)}
+  , text_{QString::fromStdString(event.content.body)}
   , event_{event}
   , client_{client}
 {
-        readableFileSize_ = calculateFileSize(event.msgContent().info().size);
+        readableFileSize_ = calculateFileSize(event.content.info.size);
 
         init();
 }
@@ -138,7 +135,7 @@ FileItem::mousePressEvent(QMouseEvent *event)
                 if (filenameToSave_.isEmpty())
                         return;
 
-                client_->downloadFile(event_.eventId(), url_);
+                client_->downloadFile(QString::fromStdString(event_.event_id), url_);
         } else {
                 openUrl();
         }
@@ -147,7 +144,7 @@ FileItem::mousePressEvent(QMouseEvent *event)
 void
 FileItem::fileDownloaded(const QString &event_id, const QByteArray &data)
 {
-        if (event_id != event_.eventId())
+        if (event_id != QString::fromStdString(event_.event_id))
                 return;
 
         try {