From 13663ad5f894f035a47efd5704e84f07d68b3df2 Mon Sep 17 00:00:00 2001 From: redsky17 Date: Fri, 8 Feb 2019 01:58:00 +0000 Subject: Improve color generation performance Colors are generated asynchronously now and the TimelineItem is updated when the color generation finishes. This allows the UI to stay responsive while new colors are being generated. --- src/timeline/TimelineItem.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/timeline/TimelineItem.h') diff --git a/src/timeline/TimelineItem.h b/src/timeline/TimelineItem.h index f81aa658..7bf6a076 100644 --- a/src/timeline/TimelineItem.h +++ b/src/timeline/TimelineItem.h @@ -26,6 +26,8 @@ #include #include +#include + #include "AvatarProvider.h" #include "RoomInfoListItem.h" #include "Utils.h" @@ -204,6 +206,8 @@ public: const QString &room_id, QWidget *parent); + ~TimelineItem(); + void setBackgroundColor(const QColor &color) { backgroundColor_ = color; } QColor backgroundColor() const { return backgroundColor_; } @@ -229,6 +233,7 @@ signals: public slots: void refreshAuthorColor(); + void finishedGeneratingColor(); protected: void paintEvent(QPaintEvent *event) override; @@ -264,6 +269,8 @@ private: //! has been acknowledged by the server. bool isReceived_ = false; + QFutureWatcher *colorGenerating_; + QString replaceEmoji(const QString &body); QString event_id_; QString room_id_; -- cgit 1.5.1