Remove sync timer
This commit is contained in:
parent
3eafa34c60
commit
1d7b7a8221
@ -38,7 +38,6 @@
|
|||||||
|
|
||||||
constexpr int CONSENSUS_TIMEOUT = 1000;
|
constexpr int CONSENSUS_TIMEOUT = 1000;
|
||||||
constexpr int SHOW_CONTENT_TIMEOUT = 3000;
|
constexpr int SHOW_CONTENT_TIMEOUT = 3000;
|
||||||
constexpr int SYNC_INTERVAL = 2000;
|
|
||||||
|
|
||||||
class ChatPage : public QWidget
|
class ChatPage : public QWidget
|
||||||
{
|
{
|
||||||
@ -68,7 +67,6 @@ private slots:
|
|||||||
void syncCompleted(const SyncResponse &response);
|
void syncCompleted(const SyncResponse &response);
|
||||||
void syncFailed(const QString &msg);
|
void syncFailed(const QString &msg);
|
||||||
void changeTopRoomInfo(const QString &room_id);
|
void changeTopRoomInfo(const QString &room_id);
|
||||||
void startSync();
|
|
||||||
void logout();
|
void logout();
|
||||||
void addRoom(const QString &room_id);
|
void addRoom(const QString &room_id);
|
||||||
void removeRoom(const QString &room_id);
|
void removeRoom(const QString &room_id);
|
||||||
@ -112,7 +110,6 @@ private:
|
|||||||
// Safety net if consensus is not possible or too slow.
|
// Safety net if consensus is not possible or too slow.
|
||||||
QTimer *showContentTimer_;
|
QTimer *showContentTimer_;
|
||||||
QTimer *consensusTimer_;
|
QTimer *consensusTimer_;
|
||||||
QTimer *syncTimer_;
|
|
||||||
|
|
||||||
QString current_room_;
|
QString current_room_;
|
||||||
QString current_community_;
|
QString current_community_;
|
||||||
|
@ -122,10 +122,6 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent)
|
|||||||
user_info_widget_ = new UserInfoWidget(sideBarTopWidget_);
|
user_info_widget_ = new UserInfoWidget(sideBarTopWidget_);
|
||||||
sideBarTopWidgetLayout_->addWidget(user_info_widget_);
|
sideBarTopWidgetLayout_->addWidget(user_info_widget_);
|
||||||
|
|
||||||
syncTimer_ = new QTimer(this);
|
|
||||||
syncTimer_->setSingleShot(true);
|
|
||||||
connect(syncTimer_, SIGNAL(timeout()), this, SLOT(startSync()));
|
|
||||||
|
|
||||||
connect(user_info_widget_, SIGNAL(logout()), client_.data(), SLOT(logout()));
|
connect(user_info_widget_, SIGNAL(logout()), client_.data(), SLOT(logout()));
|
||||||
connect(client_.data(), SIGNAL(loggedOut()), this, SLOT(logout()));
|
connect(client_.data(), SIGNAL(loggedOut()), this, SLOT(logout()));
|
||||||
|
|
||||||
@ -292,8 +288,6 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent)
|
|||||||
void
|
void
|
||||||
ChatPage::logout()
|
ChatPage::logout()
|
||||||
{
|
{
|
||||||
syncTimer_->stop();
|
|
||||||
|
|
||||||
// Delete all config parameters.
|
// Delete all config parameters.
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.beginGroup("auth");
|
settings.beginGroup("auth");
|
||||||
@ -352,12 +346,6 @@ ChatPage::bootstrap(QString userid, QString homeserver, QString token)
|
|||||||
client_->initialSync();
|
client_->initialSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ChatPage::startSync()
|
|
||||||
{
|
|
||||||
client_->sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ChatPage::setOwnAvatar(const QPixmap &img)
|
ChatPage::setOwnAvatar(const QPixmap &img)
|
||||||
{
|
{
|
||||||
@ -372,7 +360,7 @@ ChatPage::syncFailed(const QString &msg)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
qWarning() << "Sync error:" << msg;
|
qWarning() << "Sync error:" << msg;
|
||||||
syncTimer_->start(SYNC_INTERVAL);
|
client_->sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Should be moved in another class that manages this global list.
|
// TODO: Should be moved in another class that manages this global list.
|
||||||
@ -469,7 +457,7 @@ ChatPage::syncCompleted(const SyncResponse &response)
|
|||||||
room_list_->sync(state_manager_);
|
room_list_->sync(state_manager_);
|
||||||
view_manager_->sync(response.rooms());
|
view_manager_->sync(response.rooms());
|
||||||
|
|
||||||
syncTimer_->start(SYNC_INTERVAL);
|
client_->sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -522,7 +510,7 @@ ChatPage::initialSyncCompleted(const SyncResponse &response)
|
|||||||
// Initialize room list.
|
// Initialize room list.
|
||||||
room_list_->setInitialRooms(settingsManager_, state_manager_);
|
room_list_->setInitialRooms(settingsManager_, state_manager_);
|
||||||
|
|
||||||
syncTimer_->start(SYNC_INTERVAL);
|
client_->sync();
|
||||||
|
|
||||||
emit contentLoaded();
|
emit contentLoaded();
|
||||||
}
|
}
|
||||||
@ -647,7 +635,7 @@ ChatPage::loadStateFromCache()
|
|||||||
showContentTimer_->start(SHOW_CONTENT_TIMEOUT);
|
showContentTimer_->start(SHOW_CONTENT_TIMEOUT);
|
||||||
|
|
||||||
// Start receiving events.
|
// Start receiving events.
|
||||||
syncTimer_->start(SYNC_INTERVAL);
|
client_->sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -744,7 +732,4 @@ ChatPage::updateTypingUsers(const QString &roomid, const QList<QString> &user_id
|
|||||||
typingUsers_.insert(roomid, users);
|
typingUsers_.insert(roomid, users);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatPage::~ChatPage()
|
ChatPage::~ChatPage() {}
|
||||||
{
|
|
||||||
syncTimer_->stop();
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user