diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp index 0d393a6fe..18fee9607 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -451,6 +451,9 @@ IdDialog::IdDialog(QWidget *parent) updateIdTimer.setSingleShot(true); connect(&updateIdTimer, SIGNAL(timeout()), this, SLOT(updateIdList())); + updateCirclesTimer.setSingleShot(true); + connect(&updateCirclesTimer, SIGNAL(timeout()), this, SLOT(updateCircles())); + mFontSizeHandler.registerFontSize(ui->idTreeWidget, 0, [this] (QAbstractItemView*, int fontSize) { // Set new font size on all items mIdListModel->setFontSize(fontSize); @@ -540,7 +543,10 @@ void IdDialog::handleEvent_main_thread(std::shared_ptr event) case RsGxsCircleEventCode::CACHE_DATA_UPDATED: if (isVisible()) - updateCircles(); + { + if(!updateCirclesTimer.isActive()) + updateCirclesTimer.start(200); + } else needUpdateCirclesOnNextShow = true; default: @@ -1426,13 +1432,11 @@ void IdDialog::updateIdListRequest() { if(updateIdTimer.isActive()) { - std::cerr << "updateIdListRequest(): restarting timer"<< std::endl; updateIdTimer.stop(); updateIdTimer.start(1000); } else { - std::cerr << "updateIdListRequest(): starting timer"<< std::endl; updateIdTimer.start(1000); } } diff --git a/retroshare-gui/src/gui/Identity/IdDialog.h b/retroshare-gui/src/gui/Identity/IdDialog.h index d4629a5af..fe6f27a99 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.h +++ b/retroshare-gui/src/gui/Identity/IdDialog.h @@ -181,6 +181,7 @@ private: RsEventsHandlerId_t mEventHandlerId_circles; QTimer updateIdTimer; + QTimer updateCirclesTimer; bool needUpdateIdsOnNextShow; bool needUpdateCirclesOnNextShow; diff --git a/retroshare-gui/src/gui/Posted/PostedDialog.cpp b/retroshare-gui/src/gui/Posted/PostedDialog.cpp index 3bd30264c..030852d2c 100644 --- a/retroshare-gui/src/gui/Posted/PostedDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedDialog.cpp @@ -51,6 +51,9 @@ PostedDialog::PostedDialog(QWidget *parent): [this](std::shared_ptr event) { RsQThreadUtils::postToObject( [=]() { handleEvent_main_thread(event); }, this ); }, mEventHandlerId, RsEventType::GXS_POSTED ); + mUpdateTimer = new QTimer(this); + mUpdateTimer->setSingleShot(true); + connect(mUpdateTimer, SIGNAL(timeout()), this, SLOT(timerUpdate())); } void PostedDialog::handleEvent_main_thread(std::shared_ptr event) @@ -72,10 +75,11 @@ void PostedDialog::handleEvent_main_thread(std::shared_ptr event) case RsPostedEventCode::NEW_POSTED_GROUP: // [[fallthrough]]; case RsPostedEventCode::BOARD_DELETED: // [[fallthrough]]; case RsPostedEventCode::SUBSCRIBE_STATUS_CHANGED: // [[fallthrough]]; - updateDisplay(true); + if(!mUpdateTimer->isActive()) mUpdateTimer->start(200); break; case RsPostedEventCode::STATISTICS_CHANGED: + if(!mUpdateTimer->isActive()) mUpdateTimer->start(200); updateGroupStatistics(e->mPostedGroupId); break; diff --git a/retroshare-gui/src/gui/Posted/PostedDialog.h b/retroshare-gui/src/gui/Posted/PostedDialog.h index 433adbe93..9f764dff6 100644 --- a/retroshare-gui/src/gui/Posted/PostedDialog.h +++ b/retroshare-gui/src/gui/Posted/PostedDialog.h @@ -65,6 +65,11 @@ private: void handleEvent_main_thread(std::shared_ptr event); RsEventsHandlerId_t mEventHandlerId; + + QTimer *mUpdateTimer; + +private slots: + void timerUpdate() { updateDisplay(true); } }; #endif diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp index 035d2778e..f29960a4e 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp @@ -57,6 +57,9 @@ GxsChannelDialog::GxsChannelDialog(QWidget *parent): [this](std::shared_ptr event) { RsQThreadUtils::postToObject([=]() { handleEvent_main_thread(event); }, this ); }, mEventHandlerId, RsEventType::GXS_CHANNELS ); + mUpdateTimer = new QTimer(this); + mUpdateTimer->setSingleShot(true); + connect(mUpdateTimer, SIGNAL(timeout()), this, SLOT(timerUpdate())); } void GxsChannelDialog::handleEvent_main_thread(std::shared_ptr event) @@ -67,7 +70,7 @@ void GxsChannelDialog::handleEvent_main_thread(std::shared_ptr ev switch(e->mChannelEventCode) { case RsChannelEventCode::STATISTICS_CHANGED: // [[fallthrough]]; - updateDisplay(true); // no breaks, on purpose! + if(!mUpdateTimer->isActive()) mUpdateTimer->start(200); Q_FALLTHROUGH(); case RsChannelEventCode::NEW_MESSAGE: // [[fallthrough]]; @@ -82,7 +85,7 @@ void GxsChannelDialog::handleEvent_main_thread(std::shared_ptr ev case RsChannelEventCode::NEW_CHANNEL: // [[fallthrough]]; case RsChannelEventCode::DELETED_CHANNEL: // [[fallthrough]]; case RsChannelEventCode::SUBSCRIBE_STATUS_CHANGED:// reloads group summary (calling GxsGroupFrameDialog parent method) - updateDisplay(true); + if(!mUpdateTimer->isActive()) mUpdateTimer->start(200); break; default: diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h index 7dab607be..285afaa9d 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h @@ -86,6 +86,11 @@ private: std::set mSearchResults; RsEventsHandlerId_t mEventHandlerId; + + QTimer *mUpdateTimer; + +private slots: + void timerUpdate() { updateDisplay(true); } }; #endif diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp index 541a52c23..f312436a3 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp @@ -47,6 +47,9 @@ GxsForumsDialog::GxsForumsDialog(QWidget *parent) : [this](std::shared_ptr event) { RsQThreadUtils::postToObject( [=]() { handleEvent_main_thread(event); }, this ); }, mEventHandlerId, RsEventType::GXS_FORUMS ); + mUpdateTimer = new QTimer(this); + mUpdateTimer->setSingleShot(true); + connect(mUpdateTimer, SIGNAL(timeout()), this, SLOT(timerUpdate())); } void GxsForumsDialog::handleEvent_main_thread(std::shared_ptr event) @@ -70,11 +73,11 @@ void GxsForumsDialog::handleEvent_main_thread(std::shared_ptr eve case RsForumEventCode::UPDATED_FORUM: // [[fallthrough]]; case RsForumEventCode::DELETED_FORUM: // [[fallthrough]]; case RsForumEventCode::SUBSCRIBE_STATUS_CHANGED: - updateDisplay(true); + if(!mUpdateTimer->isActive()) mUpdateTimer->start(200); break; case RsForumEventCode::STATISTICS_CHANGED: - updateDisplay(true); + if(!mUpdateTimer->isActive()) mUpdateTimer->start(200); updateGroupStatisticsReal(e->mForumGroupId); break; diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.h b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.h index 75d10a1e1..98297e712 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.h +++ b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.h @@ -65,6 +65,11 @@ private: void handleEvent_main_thread(std::shared_ptr event); RsEventsHandlerId_t mEventHandlerId; + + QTimer *mUpdateTimer; + +private slots: + void timerUpdate() { updateDisplay(true); } }; #endif