mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-04 04:11:06 -05:00
* Updated rsiface / rspeers.h
* Added correct menu items to the NetworkView. * Tweaked speed of NetworkView to conserve CPU. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1502 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
60349baf9d
commit
b756edd32e
@ -274,21 +274,6 @@ void NetworkDialog::makeFriend()
|
|||||||
/** Shows Peer Information/Auth Dialog */
|
/** Shows Peer Information/Auth Dialog */
|
||||||
void NetworkDialog::peerdetails()
|
void NetworkDialog::peerdetails()
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
#ifdef NET_DEBUG
|
|
||||||
std::cerr << "ConnectionsDialog::peerdetails()" << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QTreeWidgetItem *wi =
|
|
||||||
if (!wi)
|
|
||||||
return;
|
|
||||||
|
|
||||||
RsCertId id = getNeighRsCertId(wi);
|
|
||||||
std::ostringstream out;
|
|
||||||
out << id;
|
|
||||||
|
|
||||||
showpeerdetails(out.str());
|
|
||||||
#endif
|
|
||||||
ConfCertDialog::show(getCurrentNeighbour()->text(9).toStdString());
|
ConfCertDialog::show(getCurrentNeighbour()->text(9).toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@
|
|||||||
#include "arrow.h"
|
#include "arrow.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
|
|
||||||
|
#include "rsiface/rspeers.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
@ -73,8 +75,6 @@ GraphWidget::GraphWidget(QWidget *parent)
|
|||||||
setWindowTitle(tr("Elastic Nodes"));
|
setWindowTitle(tr("Elastic Nodes"));
|
||||||
|
|
||||||
clearGraph();
|
clearGraph();
|
||||||
|
|
||||||
clearGraph();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphWidget::clearGraph()
|
bool GraphWidget::clearGraph()
|
||||||
@ -88,7 +88,7 @@ bool GraphWidget::clearGraph()
|
|||||||
scene->setSceneRect(-200, -200, 1000, 1000);
|
scene->setSceneRect(-200, -200, 1000, 1000);
|
||||||
setScene(scene);
|
setScene(scene);
|
||||||
|
|
||||||
centerNode = new Node(this, 1, "OwnId", "You");
|
centerNode = new Node(this, 1, rsPeers->getPGPOwnId(), "You");
|
||||||
scene->addItem(centerNode);
|
scene->addItem(centerNode);
|
||||||
centerNode->setPos(0, 0);
|
centerNode->setPos(0, 0);
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ void GraphWidget::addArrow(std::string id1, std::string id2)
|
|||||||
void GraphWidget::itemMoved()
|
void GraphWidget::itemMoved()
|
||||||
{
|
{
|
||||||
if (!timerId)
|
if (!timerId)
|
||||||
timerId = startTimer(1000 / 10);
|
timerId = startTimer(1000 / 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphWidget::keyPressEvent(QKeyEvent *event)
|
void GraphWidget::keyPressEvent(QKeyEvent *event)
|
||||||
|
@ -34,11 +34,18 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QtGui>
|
||||||
|
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
|
#include <QContextMenuEvent>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
#include <QCursor>
|
||||||
|
#include <QPoint>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
|
||||||
#include "edge.h"
|
#include "edge.h"
|
||||||
#include "arrow.h"
|
#include "arrow.h"
|
||||||
@ -47,6 +54,10 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "rsiface/rspeers.h"
|
#include "rsiface/rspeers.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "../connect/ConfCertDialog.h"
|
||||||
|
|
||||||
Node::Node(GraphWidget *graphWidget, uint32_t t, std::string id_in, std::string n)
|
Node::Node(GraphWidget *graphWidget, uint32_t t, std::string id_in, std::string n)
|
||||||
: graph(graphWidget), ntype(t), id(id_in), name(n),
|
: graph(graphWidget), ntype(t), id(id_in), name(n),
|
||||||
mDeterminedBB(false)
|
mDeterminedBB(false)
|
||||||
@ -137,7 +148,9 @@ void Node::calculateForces()
|
|||||||
if (qAbs(xvel) < 0.1 && qAbs(yvel) < 0.1)
|
if (qAbs(xvel) < 0.1 && qAbs(yvel) < 0.1)
|
||||||
xvel = yvel = 0;
|
xvel = yvel = 0;
|
||||||
|
|
||||||
newPos = pos() + QPointF(xvel, yvel);
|
//newPos = pos() + QPointF(xvel, yvel);
|
||||||
|
// Increased the velocity for faster settling period.
|
||||||
|
newPos = pos() + QPointF(5 * xvel, 5 * yvel);
|
||||||
newPos.setX(qMin(qMax(newPos.x(), sceneRect.left() + 10), sceneRect.right() - 10));
|
newPos.setX(qMin(qMax(newPos.x(), sceneRect.left() + 10), sceneRect.right() - 10));
|
||||||
newPos.setY(qMin(qMax(newPos.y(), sceneRect.top() + 10), sceneRect.bottom() - 10));
|
newPos.setY(qMin(qMax(newPos.y(), sceneRect.top() + 10), sceneRect.bottom() - 10));
|
||||||
|
|
||||||
@ -284,18 +297,122 @@ void Node::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* no events for self */
|
/* no events for self */
|
||||||
|
#if 0
|
||||||
if (ntype == ELASTIC_NODE_TYPE_OWN)
|
if (ntype == ELASTIC_NODE_TYPE_OWN)
|
||||||
{
|
{
|
||||||
event->accept();
|
event->accept();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QString menuTitle = "Menu for ";
|
QString menuTitle = QString::fromStdString(details.name);
|
||||||
menuTitle += QString::fromStdString(details.name);
|
menuTitle += " : ";
|
||||||
|
|
||||||
|
std::cerr << "Node Menu for " << details.name << std::endl;
|
||||||
|
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
|
|
||||||
|
switch(ntype)
|
||||||
|
{
|
||||||
|
case ELASTIC_NODE_TYPE_OWN:
|
||||||
|
{
|
||||||
|
menuTitle += "Ourselves";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ELASTIC_NODE_TYPE_FRIEND:
|
||||||
|
{
|
||||||
|
menuTitle += "Friend";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ELASTIC_NODE_TYPE_AUTHED:
|
||||||
|
{
|
||||||
|
menuTitle += "Authenticated";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ELASTIC_NODE_TYPE_MARGINALAUTH:
|
||||||
|
{
|
||||||
|
menuTitle += "Friend of a Friend";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
case ELASTIC_NODE_TYPE_FOF:
|
||||||
|
{
|
||||||
|
menuTitle += " Unknown";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QAction *titleAction = menu.addAction(menuTitle);
|
QAction *titleAction = menu.addAction(menuTitle);
|
||||||
titleAction->setEnabled(false);
|
titleAction->setEnabled(false);
|
||||||
|
menu.addSeparator();
|
||||||
|
|
||||||
|
/* find all the peers which have this pgp peer as issuer */
|
||||||
|
std::list<std::string> ids;
|
||||||
|
std::list<std::string>::iterator it;
|
||||||
|
bool haveSSLcerts = false;
|
||||||
|
|
||||||
|
if ((ntype == ELASTIC_NODE_TYPE_AUTHED) ||
|
||||||
|
(ntype == ELASTIC_NODE_TYPE_FRIEND) ||
|
||||||
|
(ntype == ELASTIC_NODE_TYPE_OWN))
|
||||||
|
{
|
||||||
|
rsPeers->getOthersList(ids);
|
||||||
|
|
||||||
|
QAction *addAction = menu.addAction("Add All as Friends");
|
||||||
|
QAction *rmAction = menu.addAction("Remove All as Friends");
|
||||||
|
|
||||||
|
std::cerr << "OthersList looking for ::Issuer " << id << std::endl;
|
||||||
|
int nssl = 0;
|
||||||
|
for(it = ids.begin(); it != ids.end(); it++)
|
||||||
|
{
|
||||||
|
RsPeerDetails d2;
|
||||||
|
if (!rsPeers->getPeerDetails(*it, d2))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
std::cerr << "OthersList::Id " << d2.id;
|
||||||
|
std::cerr << " ::Issuer " << d2.issuer << std::endl;
|
||||||
|
if (d2.issuer == id)
|
||||||
|
{
|
||||||
|
QString sslTitle = " SSL ID: ";
|
||||||
|
sslTitle += QString::fromStdString(d2.location);
|
||||||
|
|
||||||
|
if (RS_PEER_STATE_FRIEND & d2.state)
|
||||||
|
{
|
||||||
|
sslTitle += " Allowed";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sslTitle += " Denied";
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu *sslMenu = menu.addMenu (sslTitle);
|
||||||
|
if (RS_PEER_STATE_FRIEND & d2.state)
|
||||||
|
{
|
||||||
|
QAction *sslAction = sslMenu->addAction("Deny");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QAction *sslAction = sslMenu->addAction("Allow");
|
||||||
|
}
|
||||||
|
nssl++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nssl > 0)
|
||||||
|
{
|
||||||
|
menu.addSeparator();
|
||||||
|
haveSSLcerts = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addAction->setVisible(false);
|
||||||
|
rmAction->setVisible(false);
|
||||||
|
|
||||||
|
QAction *noAction = menu.addAction("No SSL Certificates for Peer");
|
||||||
|
noAction->setEnabled(false);
|
||||||
|
menu.addSeparator();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
switch(ntype)
|
switch(ntype)
|
||||||
{
|
{
|
||||||
@ -305,29 +422,59 @@ void Node::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||||||
}
|
}
|
||||||
case ELASTIC_NODE_TYPE_FRIEND:
|
case ELASTIC_NODE_TYPE_FRIEND:
|
||||||
{
|
{
|
||||||
|
QAction *chatAction = menu.addAction("Chat");
|
||||||
//QAction *rmAction = menu.addAction("Remove Friend");
|
QAction *msgAction = menu.addAction("Msg");
|
||||||
//QAction *chatAction = menu.addAction("Chat");
|
menu.addSeparator();
|
||||||
//QAction *msgAction = menu.addAction("Msg");
|
QAction *connction = menu.addAction("Connect");
|
||||||
|
menu.addSeparator();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ELASTIC_NODE_TYPE_AUTHED:
|
case ELASTIC_NODE_TYPE_AUTHED:
|
||||||
{
|
{
|
||||||
//QAction *addAction = menu.addAction("Add Friend");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ELASTIC_NODE_TYPE_MARGINALAUTH:
|
case ELASTIC_NODE_TYPE_MARGINALAUTH:
|
||||||
{
|
{
|
||||||
//QAction *makeAction = menu.addAction("Make Friend");
|
if (haveSSLcerts)
|
||||||
|
{
|
||||||
|
QAction *makeAction = menu.addAction("Sign Peer and Add Friend");
|
||||||
|
menu.addSeparator();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QAction *makeAction = menu.addAction("Sign Peer to Authenticate");
|
||||||
|
menu.addSeparator();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
case ELASTIC_NODE_TYPE_FOF:
|
case ELASTIC_NODE_TYPE_FOF:
|
||||||
{
|
{
|
||||||
//QAction *makeAction = menu.addAction("Make Friend");
|
if (haveSSLcerts)
|
||||||
|
{
|
||||||
|
QAction *makeAction = menu.addAction("Sign Peer and Add Friend");
|
||||||
|
menu.addSeparator();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QAction *makeAction = menu.addAction("Sign Peer to Authenticate");
|
||||||
|
menu.addSeparator();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QAction *detailAction = menu.addAction("Peer Details");
|
||||||
|
QObject::connect( detailAction , SIGNAL( triggered() ), this, SLOT( peerdetails() ) );
|
||||||
|
connect( detailAction , SIGNAL( triggered() ), this, SLOT( peerdetails() ) );
|
||||||
|
|
||||||
|
QAction *expAction = menu.addAction("Export Certificate");
|
||||||
|
|
||||||
QAction *selectedAction = menu.exec(event->screenPos());
|
QAction *selectedAction = menu.exec(event->screenPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Node::peerdetails()
|
||||||
|
{
|
||||||
|
ConfCertDialog::show(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -54,8 +54,11 @@ class Arrow;
|
|||||||
class GraphWidget;
|
class GraphWidget;
|
||||||
class QGraphicsSceneMouseEvent;
|
class QGraphicsSceneMouseEvent;
|
||||||
|
|
||||||
class Node : public QGraphicsItem
|
class Node : public QObject, public QGraphicsItem
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Node(GraphWidget *graphWidget, uint32_t t, std::string id_in, std::string n);
|
Node(GraphWidget *graphWidget, uint32_t t, std::string id_in, std::string n);
|
||||||
|
|
||||||
@ -75,6 +78,9 @@ public:
|
|||||||
//QPainterPath shape() const;
|
//QPainterPath shape() const;
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void peerdetails();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
jeu. juil. 23 00:09:56 CEST 2009
|
Retroshare Gui version :
|
||||||
Git version :
|
Svn version : Revision: 1498
|
||||||
# On branch master
|
Tue Aug 4 10:34:44 BST 2009
|
||||||
commit 5810b1df6ef9cf29c6bd0bea3dc1236943961429
|
|
||||||
git-svn-id: https://retroshare.svn.sourceforge.net/svnroot/retroshare/trunk@1409 56268a12-702b-0410-a8f4-c53eb35c22f6
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,6 +78,8 @@ class RsPeerDetails
|
|||||||
std::string location;
|
std::string location;
|
||||||
std::string org;
|
std::string org;
|
||||||
|
|
||||||
|
std::string issuer;
|
||||||
|
|
||||||
std::string fpr; /* pgp fingerprint */
|
std::string fpr; /* pgp fingerprint */
|
||||||
std::string authcode;
|
std::string authcode;
|
||||||
std::list<std::string> signers;
|
std::list<std::string> signers;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#define GUI_VERSION "0.5.x"
|
#define GUI_VERSION "Revision: 1498 date : 10:34:44 08.04.09"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user