Added basic PeerItems to NewsFeed for AUTH_DENIED and FAILED_CONNECTION case.

* This will need to be fixed up - but the basic logic is there!
 * Improved DhtWindow display of peers.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-netupgrade@4426 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2011-07-11 01:08:01 +00:00
parent 53c71daca0
commit 1cf790990f
6 changed files with 161 additions and 26 deletions

View File

@ -101,10 +101,23 @@ void NewsFeed::updateFeed()
if (flags & RS_FEED_TYPE_PEER) if (flags & RS_FEED_TYPE_PEER)
addFeedItemPeerNew(fi); addFeedItemPeerNew(fi);
break; break;
case RS_FEED_ITEM_PEER_HELLO: case RS_FEED_ITEM_PEER_HELLO:
if (flags & RS_FEED_TYPE_PEER) if (flags & RS_FEED_TYPE_PEER)
addFeedItemPeerHello(fi); addFeedItemPeerHello(fi);
break; break;
case RS_FEED_ITEM_PEER_AUTH_DENIED:
if (flags & RS_FEED_TYPE_PEER)
addFeedItemPeerAuthDenied(fi);
break;
case RS_FEED_ITEM_PEER_UNKNOWN_IN:
if (flags & RS_FEED_TYPE_PEER)
addFeedItemPeerUnknownIn(fi);
break;
case RS_FEED_ITEM_PEER_UNKNOWN_OUT:
if (flags & RS_FEED_TYPE_PEER)
addFeedItemPeerUnknownOut(fi);
break;
case RS_FEED_ITEM_CHAN_NEW: case RS_FEED_ITEM_CHAN_NEW:
if (flags & RS_FEED_TYPE_CHAN) if (flags & RS_FEED_TYPE_CHAN)
@ -243,6 +256,60 @@ void NewsFeed::addFeedItemPeerNew(RsFeedItem &fi)
} }
void NewsFeed::addFeedItemPeerAuthDenied(RsFeedItem &fi)
{
/* make new widget */
PeerItem *pi = new PeerItem(this, NEWSFEED_PEERLIST, fi.mId1, PEER_TYPE_AUTH_DENIED, false);
/* store */
/* add to layout */
addFeedItem(pi);
#ifdef NEWS_DEBUG
std::cerr << "NewsFeed::addFeedItemPeerAuthDenied()";
std::cerr << std::endl;
#endif
}
void NewsFeed::addFeedItemPeerUnknownIn(RsFeedItem &fi)
{
/* make new widget */
PeerItem *pi = new PeerItem(this, NEWSFEED_PEERLIST, fi.mId1, PEER_TYPE_UNKNOWN_IN, false);
/* store */
/* add to layout */
addFeedItem(pi);
#ifdef NEWS_DEBUG
std::cerr << "NewsFeed::addFeedItemPeerUnknownIn()";
std::cerr << std::endl;
#endif
}
void NewsFeed::addFeedItemPeerUnknownOut(RsFeedItem &fi)
{
/* make new widget */
PeerItem *pi = new PeerItem(this, NEWSFEED_PEERLIST, fi.mId1, PEER_TYPE_UNKNOWN_OUT, false);
/* store */
/* add to layout */
addFeedItem(pi);
#ifdef NEWS_DEBUG
std::cerr << "NewsFeed::addFeedItemPeerUnknownOut()";
std::cerr << std::endl;
#endif
}
void NewsFeed::addFeedItemChanNew(RsFeedItem &fi) void NewsFeed::addFeedItemChanNew(RsFeedItem &fi)
{ {
/* make new widget */ /* make new widget */

View File

@ -63,6 +63,10 @@ private:
void addFeedItemPeerDisconnect(RsFeedItem &fi); void addFeedItemPeerDisconnect(RsFeedItem &fi);
void addFeedItemPeerNew(RsFeedItem &fi); void addFeedItemPeerNew(RsFeedItem &fi);
void addFeedItemPeerHello(RsFeedItem &fi); void addFeedItemPeerHello(RsFeedItem &fi);
void addFeedItemPeerAuthDenied(RsFeedItem &fi);
void addFeedItemPeerUnknownIn(RsFeedItem &fi);
void addFeedItemPeerUnknownOut(RsFeedItem &fi);
void addFeedItemChanNew(RsFeedItem &fi); void addFeedItemChanNew(RsFeedItem &fi);
void addFeedItemChanUpdate(RsFeedItem &fi); void addFeedItemChanUpdate(RsFeedItem &fi);
void addFeedItemChanMsg(RsFeedItem &fi); void addFeedItemChanMsg(RsFeedItem &fi);

View File

@ -32,7 +32,7 @@
#include "gui/RsAutoUpdatePage.h" #include "gui/RsAutoUpdatePage.h"
#include "retroshare/rsdht.h" #include "retroshare/rsdht.h"
#include "retroshare/rspeers.h"
/********************************************** STATIC WINDOW *************************************/ /********************************************** STATIC WINDOW *************************************/
DhtWindow * DhtWindow::mInstance = NULL; DhtWindow * DhtWindow::mInstance = NULL;
@ -104,6 +104,14 @@ void DhtWindow::changeEvent(QEvent *e)
void DhtWindow::update() void DhtWindow::update()
{ {
if (!isVisible())
{
#ifdef DEBUG_DHTWINDOW
//std::cerr << "DhtWindow::update() !Visible" << std::endl;
#endif
return;
}
/* do nothing if locked, or not visible */ /* do nothing if locked, or not visible */
if (RsAutoUpdatePage::eventsLocked() == true) if (RsAutoUpdatePage::eventsLocked() == true)
{ {
@ -113,14 +121,6 @@ void DhtWindow::update()
return; return;
} }
if (!isVisible())
{
#ifdef DEBUG_DHTWINDOW
//std::cerr << "DhtWindow::update() !Visible" << std::endl;
#endif
return;
}
if (!rsDht) if (!rsDht)
{ {
#ifdef DEBUG_DHTWINDOW #ifdef DEBUG_DHTWINDOW
@ -129,11 +129,15 @@ void DhtWindow::update()
return; return;
} }
RsAutoUpdatePage::lockAllEvents();
//std::cerr << "DhtWindow::update()" << std::endl; //std::cerr << "DhtWindow::update()" << std::endl;
updateNetStatus(); updateNetStatus();
updateNetPeers(); updateNetPeers();
updateDhtPeers(); updateDhtPeers();
updateRelays(); updateRelays();
RsAutoUpdatePage::unlockAllEvents() ;
} }
@ -312,17 +316,18 @@ void DhtWindow::updateNetPeers()
int nRelayPeers = 0; int nRelayPeers = 0;
#define PTW_COL_PEERID 0 #define PTW_COL_RSNAME 0
#define PTW_COL_DHT_STATUS 1 #define PTW_COL_PEERID 1
#define PTW_COL_DHT_STATUS 2
#define PTW_COL_PEER_CONNECTLOGIC 2 #define PTW_COL_PEER_CONNECTLOGIC 3
#define PTW_COL_PEER_CONNECT_STATUS 3 #define PTW_COL_PEER_CONNECT_STATUS 4
#define PTW_COL_PEER_CONNECT_MODE 4 #define PTW_COL_PEER_CONNECT_MODE 5
#define PTW_COL_PEER_REQ_STATUS 5 #define PTW_COL_PEER_REQ_STATUS 6
#define PTW_COL_PEER_CB_MSG 6 #define PTW_COL_PEER_CB_MSG 7
#define PTW_COL_RSID 7 #define PTW_COL_RSID 8
#if 0 #if 0
/* clear old entries */ /* clear old entries */
@ -375,7 +380,10 @@ void DhtWindow::updateNetPeers()
RsDhtNetPeer status; RsDhtNetPeer status;
rsDht->getNetPeerStatus(*it, status); rsDht->getNetPeerStatus(*it, status);
std::string name = rsPeers->getPeerName(*it);
peer_item -> setData(PTW_COL_PEERID, Qt::DisplayRole, QString::fromStdString(status.mDhtId)); peer_item -> setData(PTW_COL_PEERID, Qt::DisplayRole, QString::fromStdString(status.mDhtId));
peer_item -> setData(PTW_COL_RSNAME, Qt::DisplayRole, QString::fromStdString(name));
peer_item -> setData(PTW_COL_RSID, Qt::DisplayRole, QString::fromStdString(status.mRsId)); peer_item -> setData(PTW_COL_RSID, Qt::DisplayRole, QString::fromStdString(status.mRsId));
std::ostringstream dhtstate; std::ostringstream dhtstate;
@ -383,7 +391,7 @@ void DhtWindow::updateNetPeers()
{ {
default: default:
case RSDHT_PEERDHT_NOT_ACTIVE: case RSDHT_PEERDHT_NOT_ACTIVE:
dhtstate << "Unknown"; dhtstate << "Not Active (Maybe Connected!)";
break; break;
case RSDHT_PEERDHT_SEARCHING: case RSDHT_PEERDHT_SEARCHING:
dhtstate << "Searching"; dhtstate << "Searching";

View File

@ -133,6 +133,11 @@
</item> </item>
<item> <item>
<widget class="QTreeWidget" name="peerTreeWidget"> <widget class="QTreeWidget" name="peerTreeWidget">
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column> <column>
<property name="text"> <property name="text">
<string>PeerId</string> <string>PeerId</string>

View File

@ -102,11 +102,20 @@ void PeerItem::updateItemStatic()
case PEER_TYPE_CONNECT: case PEER_TYPE_CONNECT:
title = tr("Friend Connected"); title = tr("Friend Connected");
break; break;
case PEER_TYPE_NEW_FOF:
title = tr("Friend of Friend");
break;
case PEER_TYPE_HELLO: case PEER_TYPE_HELLO:
title = tr("Connect Attempt"); title = tr("Connect Attempt");
break; break;
case PEER_TYPE_NEW_FOF: case PEER_TYPE_AUTH_DENIED:
title = tr("Friend of Friend"); title = tr("Not Yet Friends");
break;
case PEER_TYPE_UNKNOWN_IN:
title = tr("Unknown (Incoming) Connect Attempt");
break;
case PEER_TYPE_UNKNOWN_OUT:
title = tr("Unknown (Outgoing) Connect Attempt");
break; break;
default: default:
title = tr("Peer"); title = tr("Peer");
@ -134,15 +143,53 @@ void PeerItem::updateItemStatic()
} }
else else
{ {
/* it is very likely that we will end up here for some of the
* Unknown peer cases.... so allow them here
*/
QString title;
switch(mType)
{
case PEER_TYPE_STD:
title = tr("Friend");
break;
case PEER_TYPE_CONNECT:
title = tr("Friend Connected");
break;
case PEER_TYPE_NEW_FOF:
title = tr("Friend of Friend");
break;
case PEER_TYPE_HELLO:
title = tr("Connect Attempt");
break;
case PEER_TYPE_AUTH_DENIED:
title = tr("Not Yet Friends");
break;
case PEER_TYPE_UNKNOWN_IN:
title = tr("Unknown (Incoming) Connect Attempt");
break;
case PEER_TYPE_UNKNOWN_OUT:
title = tr("Unknown (Outgoing) Connect Attempt");
break;
default:
title = tr("Peer");
break;
}
titleLabel->setText(title);
QDateTime date = QDateTime::fromTime_t(time(NULL));
QString stime = date.toString(Qt::LocalDate);
lastLabel-> setText(stime);
nameLabel->setText(QString::fromStdString(mPeerId));
idLabel->setText(QString::fromStdString(mPeerId));
statusLabel->setText(tr("Unknown Peer")); statusLabel->setText(tr("Unknown Peer"));
titleLabel->setText(tr("Unknown Peer"));
trustLabel->setText(tr("Unknown Peer")); trustLabel->setText(tr("Unknown Peer"));
nameLabel->setText(tr("Unknown Peer"));
idLabel->setText(tr("Unknown Peer"));
locLabel->setText(tr("Unknown Peer")); locLabel->setText(tr("Unknown Peer"));
ipLabel->setText(tr("Unknown Peer")); ipLabel->setText(tr("Unknown Peer"));
connLabel->setText(tr("Unknown Peer")); connLabel->setText(tr("Unknown Peer"));
lastLabel->setText(tr("Unknown Peer"));
chatButton->setEnabled(false); chatButton->setEnabled(false);

View File

@ -27,8 +27,12 @@
const uint32_t PEER_TYPE_STD = 0x0001; const uint32_t PEER_TYPE_STD = 0x0001;
const uint32_t PEER_TYPE_CONNECT = 0x0002; const uint32_t PEER_TYPE_CONNECT = 0x0002;
const uint32_t PEER_TYPE_HELLO = 0x0003; /* failed Connect Attempt */ const uint32_t PEER_TYPE_NEW_FOF = 0x0003; /* new Friend of Friend */
const uint32_t PEER_TYPE_NEW_FOF = 0x0004; /* new Friend of Friend */
const uint32_t PEER_TYPE_HELLO = 0x0004; /* failed Connect Attempt */
const uint32_t PEER_TYPE_AUTH_DENIED = 0x0005; /* failed outgoing attempt */
const uint32_t PEER_TYPE_UNKNOWN_IN = 0x0006; /* failed incoming with unknown peer */
const uint32_t PEER_TYPE_UNKNOWN_OUT = 0x0007; /* failed outgoing with unknown peer */
class FeedHolder; class FeedHolder;