summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-12-23 13:50:11 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-12-23 13:50:11 +0200
commit9d763c4de9d4820361140adcdda3f60977da2950 (patch)
treeb132b8f74653a187274548fe6344af4779964ba4 /include
parentDon't create artifacts when we're not deploying (diff)
downloadnheko-9d763c4de9d4820361140adcdda3f60977da2950.tar.xz
Don't keep fetching history on non-visible timelines
If the user switched to another timeline before the current timeline
filled up with messages, nheko would keep fetching history.

Now it will check periodically if the timeline became visible so
it can decide whether or not to stop fetching history.
Diffstat (limited to 'include')
-rw-r--r--include/timeline/TimelineView.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/timeline/TimelineView.h b/include/timeline/TimelineView.h
index 52bf0165..faada44c 100644
--- a/include/timeline/TimelineView.h
+++ b/include/timeline/TimelineView.h
@@ -27,13 +27,14 @@
 #include <QStyle>
 #include <QStyleOption>
 
-#include <mtx.hpp>
+#include <mtx/events.hpp>
+#include <mtx/responses/messages.hpp>
 
 #include "MatrixClient.h"
+#include "ScrollBar.h"
 #include "TimelineItem.h"
 
 class FloatingButton;
-class ScrollBar;
 struct DescInfo;
 
 // Contains info about a message shown in the history view
@@ -122,6 +123,7 @@ private:
         void updateLastSender(const QString &user_id, TimelineDirection direction);
         void notifyForLastEvent();
         void readLastEvent() const;
+        bool isScrollbarActivated() { return scroll_area_->verticalScrollBar()->value() != 0; }
         QString getLastEventId() const;
         QString getEventSender(const mtx::events::collections::TimelineEvents &event) const;