diff --git a/retroshare-gui/src/gui/NetworkView.cpp b/retroshare-gui/src/gui/NetworkView.cpp index 402e14063..f301981c5 100644 --- a/retroshare-gui/src/gui/NetworkView.cpp +++ b/retroshare-gui/src/gui/NetworkView.cpp @@ -47,19 +47,20 @@ NetworkView::NetworkView(QWidget *parent) ui.graphicsView->setScene(mScene); ui.graphicsView->setEdgeLength(ui.edgeLengthSB->value()) ; - setMaxFriendLevel(ui.maxFriendLevelSB->value()) ; + setMaxFriendLevel(1) ; /* add button */ connect( ui.refreshButton, SIGNAL( clicked( void ) ), this, SLOT( redraw( void ) ) ); connect( mScene, SIGNAL( changed ( const QList & ) ), this, SLOT ( changedScene( void ) ) ); /* Hide Settings frame */ - connect( ui.maxFriendLevelSB, SIGNAL(valueChanged(int)), this, SLOT(setMaxFriendLevel(int))); + connect(ui.viewCB,SIGNAL(currentIndexChanged(int)),this,SLOT(setMaxFriendLevel(int))); connect( ui.edgeLengthSB, SIGNAL(valueChanged(int)), this, SLOT(setEdgeLength(int))); connect( ui.freezeCheckBox, SIGNAL(toggled(bool)), this, SLOT(setFreezeState(bool))); connect( ui.nameBox, SIGNAL(textChanged(QString)), this, SLOT(setNameSearch(QString))); - + _should_update = true ; + hideoffline = false; } NetworkView::~NetworkView() @@ -80,13 +81,23 @@ void NetworkView::setMaxFriendLevel(int m) { ui.graphicsView->snapshotNodesPositions() ; clear() ; - _max_friend_level = m ; + switch(m) + { + case 0: // online + hideoffline = true; + _max_friend_level = 1 ; + break; + case 1: // all + hideoffline = false; + _max_friend_level = 1 ; + break; + case 2: // FoF + hideoffline = false; + _max_friend_level = 2 ; + break; + } updateDisplay() ; } -void NetworkView::changedFoFCheckBox( ) -{ - updateDisplay(); -} void NetworkView::redraw() { ui.graphicsView->clearNodesPositions() ; @@ -169,7 +180,21 @@ void NetworkView::updateDisplay() RsPeerDetails detail ; if(!rsPeers->getGPGDetails(info.gpg_id, detail)) continue ; - + + bool gpg_connected = false; + std::list sslContacts; + rsPeers->getAssociatedSSLIds(detail.gpg_id, sslContacts); + for (std::list::iterator sslIt = sslContacts.begin(); sslIt != sslContacts.end(); ++sslIt) + { + RsPeerDetails sslDetail; + if (!rsPeers->getPeerDetails(*sslIt, sslDetail)) + continue; + if (sslDetail.state & RS_PEER_STATE_CONNECTED) + { gpg_connected = true; + break; + } + } + switch(detail.trustLvl) { case RS_TRUST_LVL_MARGINAL: auth = GraphWidget::ELASTIC_NODE_AUTH_MARGINAL ; break; @@ -183,6 +208,9 @@ void NetworkView::updateDisplay() if(info.friend_level <= _max_friend_level && _node_ids.find(info.gpg_id) == _node_ids.end()) { + if(hideoffline && !gpg_connected && detail.gpg_id != ownGPGId) + { } + else _node_ids[info.gpg_id] = ui.graphicsView->addNode(" "+detail.name, detail.name+"@"+detail.gpg_id.toStdString(),type,auth,RsPeerId(),info.gpg_id); #ifdef DEBUG_NETWORKVIEW std::cerr << " inserted node " << info.gpg_id << ", type=" << type << ", auth=" << auth << std::endl ; diff --git a/retroshare-gui/src/gui/NetworkView.h b/retroshare-gui/src/gui/NetworkView.h index f6fcfe0b1..320437a15 100644 --- a/retroshare-gui/src/gui/NetworkView.h +++ b/retroshare-gui/src/gui/NetworkView.h @@ -48,7 +48,6 @@ class NetworkView : public RsAutoUpdatePage void setEdgeLength(int) ; void setNameSearch(QString) ; - void changedFoFCheckBox( ); void redraw(); void setFreezeState(bool); @@ -65,6 +64,7 @@ class NetworkView : public RsAutoUpdatePage std::map _node_ids ; bool _should_update ; + bool hideoffline; }; #endif diff --git a/retroshare-gui/src/gui/NetworkView.ui b/retroshare-gui/src/gui/NetworkView.ui index c62e05881..9ef4521a7 100644 --- a/retroshare-gui/src/gui/NetworkView.ui +++ b/retroshare-gui/src/gui/NetworkView.ui @@ -11,24 +11,15 @@ - - 0 - - - 0 - - - 0 - - - 0 - 6 2 + + 0 + @@ -40,21 +31,43 @@ 6 - + + + + 1 + + + + Online friends only + + + + + All friends + + + + + Friends + friends of friends + + + + + Edge length: - + Freeze - + Qt::Horizontal @@ -67,27 +80,7 @@ - - - - 0 - - - 2 - - - 1 - - - - - - - Friendship level: - - - - + 10 @@ -107,7 +100,7 @@ - +