summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-10-07 20:50:32 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-10-07 20:51:35 +0300
commit6e1285bb0e1f1d2b4aa443c72521c9b1f3255bfb (patch)
treebc107bf979c8f3c796f6e95e9c106d55ddc171a0 /src
parentUse shared pointer for the modals (diff)
downloadnheko-6e1285bb0e1f1d2b4aa443c72521c9b1f3255bfb.tar.xz
Prevent FOUC
Diffstat (limited to 'src')
-rw-r--r--src/ChatPage.cc13
-rw-r--r--src/TimelineViewManager.cc10
2 files changed, 21 insertions, 2 deletions
diff --git a/src/ChatPage.cc b/src/ChatPage.cc

index dbffc6d0..d3f60494 100644 --- a/src/ChatPage.cc +++ b/src/ChatPage.cc
@@ -213,6 +213,15 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent) this, SLOT(removeRoom(const QString &))); + consensusTimer_ = new QTimer(this); + connect(consensusTimer_, &QTimer::timeout, this, [=]() { + if (view_manager_->hasLoaded()) { + // Remove the spinner overlay. + emit contentLoaded(); + consensusTimer_->stop(); + } + }); + AvatarProvider::init(client); } @@ -554,8 +563,8 @@ ChatPage::loadStateFromCache() // Initialize room list from the restored state and settings. room_list_->setInitialRooms(settingsManager_, state_manager_); - // Remove the spinner overlay. - emit contentLoaded(); + // Check periodically if the timelines have been loaded. + consensusTimer_->start(500); sync_timer_->start(sync_interval_); } diff --git a/src/TimelineViewManager.cc b/src/TimelineViewManager.cc
index 1969ae5b..9f8137fc 100644 --- a/src/TimelineViewManager.cc +++ b/src/TimelineViewManager.cc
@@ -256,3 +256,13 @@ TimelineViewManager::displayName(const QString &userid) return userid; } + +bool +TimelineViewManager::hasLoaded() const +{ + for (const auto &view : views_) + if (!view->hasLoaded()) + return false; + + return true; +}