mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-13 03:22:34 -04:00
added auto update feature to the trust matrix
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@807 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
66bf56207d
commit
de8df4d55b
1 changed files with 14 additions and 26 deletions
|
@ -1,4 +1,5 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <QTimer>
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
#include "rsiface/rsiface.h"
|
#include "rsiface/rsiface.h"
|
||||||
#include "rsiface/rspeers.h"
|
#include "rsiface/rspeers.h"
|
||||||
|
@ -21,6 +22,13 @@ TrustView::TrustView()
|
||||||
QObject::connect(updatePB,SIGNAL(clicked()),this,SLOT(update())) ;
|
QObject::connect(updatePB,SIGNAL(clicked()),this,SLOT(update())) ;
|
||||||
QObject::connect(trustTableTW,SIGNAL(cellClicked(int,int)),this,SLOT(selectCell(int,int))) ;
|
QObject::connect(trustTableTW,SIGNAL(cellClicked(int,int)),this,SLOT(selectCell(int,int))) ;
|
||||||
|
|
||||||
|
updatePB->setToolTip(QString("This table normaly auto-updates every 10 seconds.")) ;
|
||||||
|
|
||||||
|
QTimer *timer = new QTimer ;
|
||||||
|
|
||||||
|
QObject::connect(timer,SIGNAL(timeout()),this,SLOT(update())) ;
|
||||||
|
timer->start(10000) ;
|
||||||
|
|
||||||
update() ;
|
update() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +84,7 @@ void TrustView::updateZoom(int z)
|
||||||
for(int i=0;i<trustTableTW->rowCount();++i)
|
for(int i=0;i<trustTableTW->rowCount();++i)
|
||||||
trustTableTW->setRowHeight(i,row_s) ;
|
trustTableTW->setRowHeight(i,row_s) ;
|
||||||
|
|
||||||
cout << "updated zoom" << endl;
|
// cout << "updated zoom" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TrustView::getRowColId(const string& name)
|
int TrustView::getRowColId(const string& name)
|
||||||
|
@ -89,7 +97,7 @@ int TrustView::getRowColId(const string& name)
|
||||||
if(itpr == nameToRow.end())
|
if(itpr == nameToRow.end())
|
||||||
{
|
{
|
||||||
i = trustTableTW->columnCount() ;
|
i = trustTableTW->columnCount() ;
|
||||||
cout << " -> peer not in table. Creating entry # " << i << endl ;
|
// cout << " -> peer not in table. Creating entry # " << i << endl ;
|
||||||
|
|
||||||
trustTableTW->insertColumn(i) ;
|
trustTableTW->insertColumn(i) ;
|
||||||
trustTableTW->insertRow(i) ;
|
trustTableTW->insertRow(i) ;
|
||||||
|
@ -123,39 +131,19 @@ void TrustView::update()
|
||||||
|
|
||||||
RsPeerDetails details ;
|
RsPeerDetails details ;
|
||||||
|
|
||||||
#ifdef A_VIRER
|
|
||||||
// Build rows and columns
|
|
||||||
//
|
|
||||||
for(list<string>::const_iterator it(neighs.begin()); it != neighs.end(); it++)
|
|
||||||
{
|
|
||||||
cout << "Looking for peer " << *it << endl ;
|
|
||||||
|
|
||||||
if(!rsPeers->getPeerDetails(*it,details))
|
|
||||||
{
|
|
||||||
cout << " -> no details" << endl ;
|
|
||||||
continue ;
|
|
||||||
}
|
|
||||||
|
|
||||||
cout << " -> name = " << details.name << endl ;
|
|
||||||
|
|
||||||
int i = getRowColId( details.name ) ;
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Fill everything
|
// Fill everything
|
||||||
for(list<string>::const_iterator it1(neighs.begin()); it1 != neighs.end(); ++it1)
|
for(list<string>::const_iterator it1(neighs.begin()); it1 != neighs.end(); ++it1)
|
||||||
{
|
{
|
||||||
if(!rsPeers->getPeerDetails(*it1,details))
|
if(!rsPeers->getPeerDetails(*it1,details))
|
||||||
continue ;
|
continue ;
|
||||||
|
|
||||||
cout << "treating neigh = " << details.name << endl ;
|
// cout << "treating neigh = " << details.name << endl ;
|
||||||
cout << " signers = " ;
|
// cout << " signers = " ;
|
||||||
int i = getRowColId(details.name) ;
|
int i = getRowColId(details.name) ;
|
||||||
|
|
||||||
for(list<string>::const_iterator it2(details.signers.begin());it2!=details.signers.end();++it2)
|
for(list<string>::const_iterator it2(details.signers.begin());it2!=details.signers.end();++it2)
|
||||||
{
|
{
|
||||||
cout << *it2 << " " ;
|
// cout << *it2 << " " ;
|
||||||
// Signers are identified by there name, so if we have twice the same signers, this gets crappy.
|
// Signers are identified by there name, so if we have twice the same signers, this gets crappy.
|
||||||
|
|
||||||
int j = getRowColId(*it2) ;
|
int j = getRowColId(*it2) ;
|
||||||
|
@ -167,7 +155,7 @@ void TrustView::update()
|
||||||
else
|
else
|
||||||
trustTableTW->item(i,j)->setText(trr) ;
|
trustTableTW->item(i,j)->setText(trr) ;
|
||||||
}
|
}
|
||||||
cout << endl ;
|
// cout << endl ;
|
||||||
}
|
}
|
||||||
// assign colors
|
// assign colors
|
||||||
for(int i=0;i<trustTableTW->rowCount();++i)
|
for(int i=0;i<trustTableTW->rowCount();++i)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue