mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-04-21 15:46:27 -04:00
add online filter to NetworkView
This commit is contained in:
parent
4be73b7049
commit
e69d1b894a
@ -48,19 +48,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<QRectF> & ) ), 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()
|
||||
@ -77,17 +78,29 @@ void NetworkView::setNameSearch(QString s)
|
||||
{
|
||||
ui.graphicsView->setNameSearch(s);
|
||||
}
|
||||
|
||||
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,8 +182,24 @@ void NetworkView::updateDisplay()
|
||||
|
||||
RsPeerDetails detail ;
|
||||
if(!rsPeers->getGPGDetails(info.gpg_id, detail))
|
||||
{
|
||||
continue ;
|
||||
|
||||
}
|
||||
|
||||
bool gpg_connected = false;
|
||||
std::list<RsPeerId> sslContacts;
|
||||
rsPeers->getAssociatedSSLIds(detail.gpg_id, sslContacts);
|
||||
for (std::list<RsPeerId>::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;
|
||||
@ -184,6 +213,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 ;
|
||||
|
@ -49,7 +49,6 @@ class NetworkView : public RsAutoUpdatePage
|
||||
void setEdgeLength(int) ;
|
||||
void setNameSearch(QString) ;
|
||||
|
||||
void changedFoFCheckBox( );
|
||||
void redraw();
|
||||
|
||||
void setFreezeState(bool);
|
||||
@ -66,6 +65,7 @@ class NetworkView : public RsAutoUpdatePage
|
||||
std::map<RsPgpId,GraphWidget::NodeId> _node_ids ;
|
||||
|
||||
bool _should_update ;
|
||||
bool hideoffline;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -6,29 +6,20 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>616</width>
|
||||
<width>631</width>
|
||||
<height>499</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="GraphWidget" name="graphicsView"/>
|
||||
</item>
|
||||
@ -40,21 +31,43 @@
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="3">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="viewCB">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Show online friends only</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Show all friends</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Friends + friends of friends</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Edge length:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<item row="0" column="6">
|
||||
<widget class="QCheckBox" name="freezeCheckBox">
|
||||
<property name="text">
|
||||
<string>Freeze</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<item row="0" column="5">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -67,27 +80,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QSpinBox" name="maxFriendLevelSB">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Friendship level:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<item row="0" column="3">
|
||||
<widget class="QSpinBox" name="edgeLengthSB">
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
@ -107,7 +100,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<item row="0" column="4">
|
||||
<widget class="QLineEdit" name="nameBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
|
Loading…
x
Reference in New Issue
Block a user