corrected bug in networkview

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3775 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-11-10 20:18:53 +00:00
parent ae4f43d9e8
commit e5ce0c5877
3 changed files with 23 additions and 5 deletions

View File

@ -45,6 +45,9 @@ NetworkView::NetworkView(QWidget *parent)
ui.setupUi(this); ui.setupUi(this);
mScene = new QGraphicsScene(); mScene = new QGraphicsScene();
mScene->setItemIndexMethod(QGraphicsScene::NoIndex);
mScene->setSceneRect(-200, -200, 1200, 1200);
ui.graphicsView->setScene(mScene); ui.graphicsView->setScene(mScene);
ui.graphicsView->setEdgeLength(ui.edgeLengthSB->value()) ; ui.graphicsView->setEdgeLength(ui.edgeLengthSB->value()) ;
@ -242,6 +245,20 @@ void NetworkView::updateDisplay()
nodes_to_treat.push_front( NodeInfo("unknown",*sit,info.friend_level + 1) ) ; nodes_to_treat.push_front( NodeInfo("unknown",*sit,info.friend_level + 1) ) ;
nodes_considered.insert(*sit) ; nodes_considered.insert(*sit) ;
} }
// now insert in list the GPG signers that are not our friends, to get 2nd order peers in the network.
//
for(std::list<std::string>::const_iterator sit(detail.gpgSigners.begin()); sit != detail.gpgSigners.end(); ++sit)
if(nodes_considered.find(*sit) == nodes_considered.end() && gpg_friends.find(*sit) == gpg_friends.end())
{
#ifdef DEBUG_NETWORKVIEW
std::cerr << " adding to queue: " << *sit << ", with level " << info.friend_level+1 << std::endl ;
#endif
nodes_to_treat.push_front( NodeInfo(*sit,*sit,info.friend_level + 1) ) ;
nodes_considered.insert(*sit) ;
gpg_friends.insert(*sit) ;
}
} }
} }

View File

@ -123,11 +123,11 @@ void fourn(double data[],unsigned long nn[],unsigned long ndim,int isign)
GraphWidget::GraphWidget(QWidget *) GraphWidget::GraphWidget(QWidget *)
: timerId(0) : timerId(0)
{ {
QGraphicsScene *scene = new QGraphicsScene(QRectF(0,0,500,500),this); // QGraphicsScene *scene = new QGraphicsScene(QRectF(0,0,500,500),this);
scene->setItemIndexMethod(QGraphicsScene::NoIndex); // scene->setItemIndexMethod(QGraphicsScene::NoIndex);
scene->clear() ; // scene->clear() ;
setScene(scene); // setScene(scene);
scene->setSceneRect(0, 0, 500, 500); // scene->setSceneRect(0, 0, 500, 500);
setCacheMode(CacheBackground); setCacheMode(CacheBackground);
setViewportUpdateMode(BoundingRectViewportUpdate); setViewportUpdateMode(BoundingRectViewportUpdate);

View File

@ -65,6 +65,7 @@
Node::Node(const std::string& node_string,GraphWidget::NodeType type,GraphWidget::AuthType auth,GraphWidget *graphWidget,const std::string& ssl_id,const std::string& gpg_id) Node::Node(const std::string& node_string,GraphWidget::NodeType type,GraphWidget::AuthType auth,GraphWidget *graphWidget,const std::string& ssl_id,const std::string& gpg_id)
: graph(graphWidget),_desc_string(node_string),_type(type),_auth(auth),_ssl_id(ssl_id),_gpg_id(gpg_id) : graph(graphWidget),_desc_string(node_string),_type(type),_auth(auth),_ssl_id(ssl_id),_gpg_id(gpg_id)
{ {
std::cerr << "Created node type " << type << ", string=" << node_string << std::endl ;
setFlag(ItemIsMovable); setFlag(ItemIsMovable);
#if QT_VERSION >= 0x040600 #if QT_VERSION >= 0x040600
setFlag(ItemSendsGeometryChanges); setFlag(ItemSendsGeometryChanges);