improvement of FriendList (Patch from Sehraf)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8065 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-03-21 21:58:05 +00:00
parent 81c3c59266
commit bd2026458e
3 changed files with 58 additions and 3 deletions

View File

@ -928,11 +928,11 @@ void FriendList::insertPeers()
sText += " - " + customStateString;
}
QString connectStateString = StatusDefs::connectStateString(sslDetail);
QString connectStateString = StatusDefs::connectStateWithoutTransportTypeString(sslDetail);
if (!isStatusColumnHidden) {
sslItem->setText(COLUMN_STATE, connectStateString);
} else if (!mHideState && connectStateString.isEmpty() == false) {
sText += " [" + StatusDefs::connectStateString(sslDetail) + "]";
sText += " [" + connectStateString + "]";
}
sslItem->setText( COLUMN_NAME, sText);
@ -956,7 +956,7 @@ void FriendList::insertPeers()
/* IP */
QString sslItemIP = (sslDetail.state & RS_PEER_STATE_CONNECTED)?QString(sslDetail.connectAddr.c_str()):QString("---");
QString sslItemIP = (sslDetail.state & RS_PEER_STATE_CONNECTED) ? StatusDefs::connectStateIpString(sslDetail) : QString("---");
sslItem->setData(COLUMN_IP, Qt::DisplayRole, QVariant(sslItemIP));
sslItem->setData(COLUMN_IP, ROLE_SORT, sslItemIP);

View File

@ -200,3 +200,56 @@ QString StatusDefs::connectStateString(RsPeerDetails &details)
return stateString;
}
QString StatusDefs::connectStateWithoutTransportTypeString(RsPeerDetails &details)
{
QString stateString;
switch (details.connectState) {
case 0:
stateString = peerStateString(details.state);
break;
case RS_PEER_CONNECTSTATE_TRYING_TCP:
stateString = qApp->translate("StatusDefs", "Trying TCP");
break;
case RS_PEER_CONNECTSTATE_TRYING_UDP:
stateString = qApp->translate("StatusDefs", "Trying UDP");
break;
case RS_PEER_CONNECTSTATE_CONNECTED_TCP:
case RS_PEER_CONNECTSTATE_CONNECTED_UDP:
case RS_PEER_CONNECTSTATE_CONNECTED_TOR:
case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN:
stateString = qApp->translate("StatusDefs", "Connected");
break;
}
return stateString;
}
QString StatusDefs::connectStateIpString(RsPeerDetails &details)
{
QString stateString = QString(details.connectAddr.c_str()) + QString(" [");
switch (details.connectState) {
case 0:
stateString = peerStateString(details.state);
break;
case RS_PEER_CONNECTSTATE_TRYING_TCP:
case RS_PEER_CONNECTSTATE_CONNECTED_TCP:
stateString += qApp->translate("StatusDefs", "TCP");
break;
case RS_PEER_CONNECTSTATE_TRYING_UDP:
case RS_PEER_CONNECTSTATE_CONNECTED_UDP:
stateString += qApp->translate("StatusDefs", "UDP");
break;
case RS_PEER_CONNECTSTATE_CONNECTED_TOR:
stateString += qApp->translate("StatusDefs", "TOR");
break;
case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN:
stateString += qApp->translate("StatusDefs", "unkown");
break;
}
stateString += QString("]");
return stateString;
}

View File

@ -41,6 +41,8 @@ public:
static QString peerStateString(int peerState);
static QString connectStateString(RsPeerDetails &details);
static QString connectStateWithoutTransportTypeString(RsPeerDetails &details);
static QString connectStateIpString(RsPeerDetails &details);
};
#endif