removed regular update of node info in friend list model as it does not seem to be needed

This commit is contained in:
csoler 2021-02-21 20:55:38 +01:00
parent 5f705686fa
commit 3356509044
2 changed files with 23 additions and 28 deletions

View file

@ -54,7 +54,7 @@ static const uint16_t UNDEFINED_PROFILE_INDEX_VALUE = (sizeof(uintptr_t)==4)?0xf
const QString RsFriendListModel::FilterString("filtered"); const QString RsFriendListModel::FilterString("filtered");
const uint32_t MAX_INTERNAL_DATA_UPDATE_DELAY = 300 ; // re-update the internal data every 5 mins. Should properly cover sleep/wake-up changes. const uint32_t MAX_INTERNAL_DATA_UPDATE_DELAY = 300 ; // re-update the internal data every 5 mins. Should properly cover sleep/wake-up changes.
const uint32_t MAX_NODE_UPDATE_DELAY = 1 ; // re-update the internal data every 5 mins. Should properly cover sleep/wake-up changes. const uint32_t MAX_NODE_UPDATE_DELAY = 10 ; // re-update the internal data every 5 mins. Should properly cover sleep/wake-up changes.
static const uint32_t NODE_DETAILS_UPDATE_DELAY = 5; // update each node every 5 secs. static const uint32_t NODE_DETAILS_UPDATE_DELAY = 5; // update each node every 5 secs.
@ -768,24 +768,29 @@ void RsFriendListModel::checkInternalData(bool force)
{ {
rstime_t now = time(NULL); rstime_t now = time(NULL);
if(mLastInternalDataUpdate + MAX_INTERNAL_DATA_UPDATE_DELAY < now || force) if( (mLastInternalDataUpdate + MAX_INTERNAL_DATA_UPDATE_DELAY < now) || force)
updateInternalData(); updateInternalData();
// else
if(mLastNodeUpdate + MAX_NODE_UPDATE_DELAY < now) // {
{ // preMods();
for(uint32_t i=0;i<mLocations.size();++i) //
if(mLocations[i].last_update_ts + NODE_DETAILS_UPDATE_DELAY < now) // if(mLastNodeUpdate + MAX_NODE_UPDATE_DELAY < now)
{ // {
#ifdef DEBUG_MODEL // for(uint32_t i=0;i<mLocations.size();++i)
std::cerr << "Updating ID " << mLocations[i].node_info.id << std::endl; // if(mLocations[i].last_update_ts + NODE_DETAILS_UPDATE_DELAY < now)
#endif // {
RsPeerId id(mLocations[i].node_info.id); // this avoids zeroing the id field when writing the node data //#ifdef DEBUG_MODEL
rsPeers->getPeerDetails(id,mLocations[i].node_info); // std::cerr << "Updating ID " << mLocations[i].node_info.id << std::endl;
mLocations[i].last_update_ts = now; //#endif
} // RsPeerId id(mLocations[i].node_info.id); // this avoids zeroing the id field when writing the node data
// rsPeers->getPeerDetails(id,mLocations[i].node_info);
mLastNodeUpdate = now; // mLocations[i].last_update_ts = now;
} // }
//
// mLastNodeUpdate = now;
// }
// postMods();
// }
} }
const RsFriendListModel::HierarchicalGroupInformation *RsFriendListModel::getGroupInfo(const EntryIndex& e) const const RsFriendListModel::HierarchicalGroupInformation *RsFriendListModel::getGroupInfo(const EntryIndex& e) const

View file

@ -239,11 +239,6 @@ NewFriendList::NewFriendList(QWidget */*parent*/) : /* RsAutoUpdatePage(5000,par
connect(mActionSortByState, SIGNAL(toggled(bool)), this, SLOT(toggleSortByState(bool))); connect(mActionSortByState, SIGNAL(toggled(bool)), this, SLOT(toggleSortByState(bool)));
connect(ui->peerTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(peerTreeWidgetCustomPopupMenu())); connect(ui->peerTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(peerTreeWidgetCustomPopupMenu()));
// Using Queued connections here is pretty important since the notifications may come from a different thread.
// connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()) , this, SLOT(forceUpdateDisplay()),Qt::QueuedConnection);
// connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)) , this, SLOT(forceUpdateDisplay()),Qt::QueuedConnection);
connect(ui->actionShowOfflineFriends, SIGNAL(triggered(bool)), this, SLOT(setShowUnconnected(bool))); connect(ui->actionShowOfflineFriends, SIGNAL(triggered(bool)), this, SLOT(setShowUnconnected(bool)));
connect(ui->actionShowState, SIGNAL(triggered(bool)), this, SLOT(setShowState(bool)) ); connect(ui->actionShowState, SIGNAL(triggered(bool)), this, SLOT(setShowState(bool)) );
connect(ui->actionShowGroups, SIGNAL(triggered(bool)), this, SLOT(setShowGroups(bool)) ); connect(ui->actionShowGroups, SIGNAL(triggered(bool)), this, SLOT(setShowGroups(bool)) );
@ -1030,11 +1025,6 @@ void NewFriendList::forceUpdateDisplay()
checkInternalData(true); checkInternalData(true);
} }
// void NewFriendList::updateDisplay()
// {
// checkInternalData(false);
// }
void NewFriendList::moveToGroup() void NewFriendList::moveToGroup()
{ {
RsFriendListModel::RsProfileDetails pinfo; RsFriendListModel::RsProfileDetails pinfo;