mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Moved strings of RsPeerDetails::autoconnect for translation to the GUI side and added integer constants for it.
Fixed sorting of available friends in MessengerWindow. Recompile of the GUI needed. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3952 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
13ab90e14b
commit
dd55b2bf74
@ -61,6 +61,15 @@ const uint32_t RS_PEER_STATE_ONLINE = 0x0002;
|
||||
const uint32_t RS_PEER_STATE_CONNECTED = 0x0004;
|
||||
const uint32_t RS_PEER_STATE_UNREACHABLE= 0x0008;
|
||||
|
||||
/* Connect state */
|
||||
const uint32_t RS_PEER_CONNECTSTATE_TRYING_TUNNEL = 1;
|
||||
const uint32_t RS_PEER_CONNECTSTATE_TRYING_TCP = 2;
|
||||
const uint32_t RS_PEER_CONNECTSTATE_TRYING_UDP = 3;
|
||||
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TCP = 4;
|
||||
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UDP = 5;
|
||||
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TUNNEL = 6;
|
||||
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN = 7;
|
||||
|
||||
/* Groups */
|
||||
#define RS_GROUP_ID_FRIENDS "Friends"
|
||||
#define RS_GROUP_ID_FAMILY "Family"
|
||||
@ -73,7 +82,6 @@ const uint32_t RS_GROUP_FLAG_STANDARD = 0x0001;
|
||||
/* A couple of helper functions for translating the numbers games */
|
||||
|
||||
std::string RsPeerTrustString(uint32_t trustLvl);
|
||||
std::string RsPeerStateString(uint32_t state);
|
||||
std::string RsPeerNetModeString(uint32_t netModel);
|
||||
std::string RsPeerLastConnectString(uint32_t lastConnect);
|
||||
|
||||
@ -86,9 +94,9 @@ class RsPeerDetails
|
||||
RsPeerDetails();
|
||||
|
||||
/* Auth details */
|
||||
bool isOnlyGPGdetail;
|
||||
bool isOnlyGPGdetail;
|
||||
std::string id;
|
||||
std::string gpg_id;
|
||||
std::string gpg_id;
|
||||
std::string name;
|
||||
std::string email;
|
||||
std::string location;
|
||||
@ -98,24 +106,24 @@ class RsPeerDetails
|
||||
|
||||
std::string fpr; /* pgp fingerprint */
|
||||
std::string authcode;
|
||||
std::list<std::string> gpgSigners;
|
||||
std::list<std::string> gpgSigners;
|
||||
|
||||
uint32_t trustLvl;
|
||||
uint32_t validLvl;
|
||||
|
||||
bool ownsign; /* we have signed the remote peer GPG key */
|
||||
bool hasSignedMe; /* the remote peer has signed my GPG key */
|
||||
bool ownsign; /* we have signed the remote peer GPG key */
|
||||
bool hasSignedMe; /* the remote peer has signed my GPG key */
|
||||
|
||||
bool accept_connection;
|
||||
bool accept_connection;
|
||||
|
||||
/* Network details (only valid if friend) */
|
||||
uint32_t state;
|
||||
|
||||
std::string localAddr;
|
||||
uint16_t localPort;
|
||||
std::string extAddr;
|
||||
uint16_t extPort;
|
||||
std::string dyndns;
|
||||
std::string localAddr;
|
||||
uint16_t localPort;
|
||||
std::string extAddr;
|
||||
uint16_t extPort;
|
||||
std::string dyndns;
|
||||
std::list<std::string> ipAddressList;
|
||||
|
||||
uint32_t netMode;
|
||||
@ -124,8 +132,10 @@ class RsPeerDetails
|
||||
|
||||
/* basic stats */
|
||||
uint32_t lastConnect; /* how long ago */
|
||||
std::string autoconnect;
|
||||
uint32_t connectPeriod;
|
||||
uint32_t connectState; /* RS_PEER_CONNECTSTATE_... */
|
||||
std::string connectStateString; /* Additional string like ip address */
|
||||
uint32_t connectPeriod;
|
||||
bool foundDHT;
|
||||
};
|
||||
|
||||
class RsGroupInfo
|
||||
|
@ -88,34 +88,6 @@ std::string RsPeerTrustString(uint32_t trustLvl)
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::string RsPeerStateString(uint32_t state)
|
||||
{
|
||||
std::string str;
|
||||
if (state & RS_PEER_STATE_CONNECTED)
|
||||
{
|
||||
str = "Connected";
|
||||
}
|
||||
else if (state & RS_PEER_STATE_UNREACHABLE)
|
||||
{
|
||||
str = "Unreachable";
|
||||
}
|
||||
else if (state & RS_PEER_STATE_ONLINE)
|
||||
{
|
||||
str = "Available";
|
||||
}
|
||||
else if (state & RS_PEER_STATE_FRIEND)
|
||||
{
|
||||
str = "Offline";
|
||||
}
|
||||
else
|
||||
{
|
||||
str = "Neighbour";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string RsPeerNetModeString(uint32_t netModel)
|
||||
{
|
||||
std::string str;
|
||||
@ -337,10 +309,8 @@ bool p3Peers::getPeerDetails(const std::string &id, RsPeerDetails &d)
|
||||
d.ipAddressList.push_back("E:" + std::string(rs_inet_ntoa(it->mAddr.sin_addr)) + ":" + toto.str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Translate */
|
||||
|
||||
|
||||
d.state = 0;
|
||||
if (pcs.state & RS_PEER_S_FRIEND)
|
||||
d.state |= RS_PEER_STATE_FRIEND;
|
||||
@ -395,56 +365,49 @@ bool p3Peers::getPeerDetails(const std::string &id, RsPeerDetails &d)
|
||||
|
||||
|
||||
/* Finally determine AutoConnect Status */
|
||||
std::ostringstream autostr;
|
||||
d.foundDHT = pcs.dht.found;
|
||||
|
||||
d.connectState = 0;
|
||||
d.connectStateString.clear();
|
||||
|
||||
/* HACK to display DHT Status info too */
|
||||
if (pcs.dht.found)
|
||||
{
|
||||
autostr << "DHT:CONTACT!!! ";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(pcs.state & RS_PEER_S_CONNECTED))
|
||||
{
|
||||
autostr << "DHT:SEARCHING ";
|
||||
}
|
||||
}
|
||||
|
||||
if (pcs.inConnAttempt)
|
||||
{
|
||||
if (pcs.currentConnAddrAttempt.type & RS_NET_CONN_TUNNEL) {
|
||||
autostr << "Trying tunnel connection";
|
||||
} else if (pcs.currentConnAddrAttempt.type & RS_NET_CONN_TCP_ALL) {
|
||||
autostr << "Trying TCP : " << rs_inet_ntoa(pcs.currentConnAddrAttempt.addr.sin_addr) << ":" << ntohs(pcs.currentConnAddrAttempt.addr.sin_port);
|
||||
} else if (pcs.currentConnAddrAttempt.type & RS_NET_CONN_UDP_ALL) {
|
||||
autostr << "Trying UDP : " << rs_inet_ntoa(pcs.currentConnAddrAttempt.addr.sin_addr) << ":" << ntohs(pcs.currentConnAddrAttempt.addr.sin_port);
|
||||
}
|
||||
if (pcs.currentConnAddrAttempt.type & RS_NET_CONN_TUNNEL) {
|
||||
d.connectState = RS_PEER_CONNECTSTATE_TRYING_TUNNEL;
|
||||
} else if (pcs.currentConnAddrAttempt.type & RS_NET_CONN_TCP_ALL) {
|
||||
d.connectState = RS_PEER_CONNECTSTATE_TRYING_TCP;
|
||||
|
||||
std::ostringstream str;
|
||||
str << rs_inet_ntoa(pcs.currentConnAddrAttempt.addr.sin_addr) << ":" << ntohs(pcs.currentConnAddrAttempt.addr.sin_port);
|
||||
d.connectStateString = str.str();
|
||||
} else if (pcs.currentConnAddrAttempt.type & RS_NET_CONN_UDP_ALL) {
|
||||
d.connectState = RS_PEER_CONNECTSTATE_TRYING_UDP;
|
||||
|
||||
std::ostringstream str;
|
||||
str << rs_inet_ntoa(pcs.currentConnAddrAttempt.addr.sin_addr) << ":" << ntohs(pcs.currentConnAddrAttempt.addr.sin_port);
|
||||
d.connectStateString = str.str();
|
||||
}
|
||||
}
|
||||
else if (pcs.state & RS_PEER_S_CONNECTED)
|
||||
{
|
||||
if (pcs.connecttype == RS_NET_CONN_TCP_ALL)
|
||||
{
|
||||
autostr << "Connected: TCP";
|
||||
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TCP;
|
||||
}
|
||||
else if (pcs.connecttype == RS_NET_CONN_UDP_ALL)
|
||||
{
|
||||
autostr << "Connected: UDP";
|
||||
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_UDP;
|
||||
}
|
||||
else if (pcs.connecttype == RS_NET_CONN_TUNNEL)
|
||||
{
|
||||
autostr << "Connected: Tunnel";
|
||||
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TUNNEL;
|
||||
}
|
||||
else
|
||||
{
|
||||
autostr << "Connected: Unknown";
|
||||
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
autostr << RsPeerStateString(pcs.state);
|
||||
}
|
||||
|
||||
d.autoconnect = autostr.str();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1314,7 +1277,7 @@ RsPeerDetails::RsPeerDetails()
|
||||
trustLvl(0), validLvl(0),ownsign(false),
|
||||
hasSignedMe(false),accept_connection(false),
|
||||
state(0),localAddr(""),localPort(0),extAddr(""),extPort(0),netMode(0),visState(0),
|
||||
lastConnect(0),autoconnect(""),connectPeriod(0)
|
||||
lastConnect(0),connectState(0),connectStateString(""),connectPeriod(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -572,10 +572,10 @@ void MessengerWindow::insertPeers()
|
||||
}
|
||||
#endif // MINIMAL_RSGUI
|
||||
if (sCustomString.isEmpty()) {
|
||||
sslItem -> setText( COLUMN_NAME, tr("location") + " : " + QString::fromStdString(sslDetail.location) + " " + QString::fromStdString(sslDetail.autoconnect));
|
||||
sslItem -> setText( COLUMN_NAME, tr("location") + " : " + QString::fromStdString(sslDetail.location) + " " + StatusDefs::connectStateString(sslDetail));
|
||||
sslItem -> setToolTip( COLUMN_NAME, tr("location") + " : " + QString::fromStdString(sslDetail.location));
|
||||
} else {
|
||||
sslItem -> setText( COLUMN_NAME, tr("location") + " : " + QString::fromStdString(sslDetail.location) + " " + QString::fromStdString(sslDetail.autoconnect) );
|
||||
sslItem -> setText( COLUMN_NAME, tr("location") + " : " + QString::fromStdString(sslDetail.location) + " " + StatusDefs::connectStateString(sslDetail));
|
||||
sslItem -> setToolTip( COLUMN_NAME, tr("location") + " : " + QString::fromStdString(sslDetail.location) + " - " + sCustomString);
|
||||
|
||||
/* store custom state string */
|
||||
@ -613,11 +613,17 @@ void MessengerWindow::insertPeers()
|
||||
sslItem->setHidden(hideOfflineFriends);
|
||||
gpg_online = true;
|
||||
|
||||
if (sslDetail.connectState) {
|
||||
sslIcon = QIcon(":/images/connect_creating.png");
|
||||
} else {
|
||||
sslIcon = QIcon(":/images/connect_no.png");
|
||||
}
|
||||
|
||||
sslFont.setBold(true);
|
||||
sslColor = Qt::black;
|
||||
} else {
|
||||
sslItem->setHidden(hideOfflineFriends);
|
||||
if (sslDetail.autoconnect !="Offline") {
|
||||
if (sslDetail.connectState) {
|
||||
sslIcon = QIcon(":/images/connect_creating.png");
|
||||
} else {
|
||||
sslIcon = QIcon(":/images/connect_no.png");
|
||||
@ -794,7 +800,7 @@ void MessengerWindow::insertPeers()
|
||||
gpg_item->setHidden(hideOfflineFriends);
|
||||
gpg_item->setText(COLUMN_NAME, QString::fromStdString(detail.name));
|
||||
gpgIcon = QIcon(IMAGE_AVAIBLE);
|
||||
gpg_item->setData(COLUMN_NAME, ROLE_SORT, BuildStateSortString(sortState, gpg_item->text(COLUMN_NAME), PEER_STATE_ONLINE));
|
||||
gpg_item->setData(COLUMN_NAME, ROLE_SORT, BuildStateSortString(sortState, gpg_item->text(COLUMN_NAME), PEER_STATE_AVAILABLE));
|
||||
QFont font;
|
||||
font.setBold(true);
|
||||
for(i = 0; i < COLUMN_COUNT; i++) {
|
||||
|
@ -910,18 +910,18 @@ void PeersDialog::insertPeers()
|
||||
if (customStateString.isEmpty() == false) {
|
||||
sText += " - " + customStateString;
|
||||
}
|
||||
if (sslDetail.autoconnect.empty() == false) {
|
||||
if (useStatusColumn) {
|
||||
sslItem->setText(COLUMN_STATE, QString::fromStdString(sslDetail.autoconnect));
|
||||
} else if (showState) {
|
||||
sText += " [" + QString::fromStdString(sslDetail.autoconnect) + "]";
|
||||
}
|
||||
|
||||
QString connectStateString = StatusDefs::connectStateString(sslDetail);
|
||||
if (useStatusColumn) {
|
||||
sslItem->setText(COLUMN_STATE, connectStateString);
|
||||
} else if (showState && connectStateString.isEmpty() == false) {
|
||||
sText += " [" + StatusDefs::connectStateString(sslDetail) + "]";
|
||||
}
|
||||
sslItem->setText( COLUMN_NAME, sText);
|
||||
|
||||
if (useStatusColumn == false && showState == false) {
|
||||
/* Show the state as tooltip */
|
||||
sslItem->setToolTip(COLUMN_NAME, QString::fromStdString(sslDetail.autoconnect));
|
||||
sslItem->setToolTip(COLUMN_NAME, connectStateString);
|
||||
} else {
|
||||
sslItem->setToolTip(COLUMN_NAME, "");
|
||||
}
|
||||
@ -945,11 +945,17 @@ void PeersDialog::insertPeers()
|
||||
sslItem->setHidden(hideUnconnected);
|
||||
gpg_online = true;
|
||||
|
||||
if (sslDetail.connectState) {
|
||||
sslIcon = QIcon(":/images/connect_creating.png");
|
||||
} else {
|
||||
sslIcon = QIcon(":/images/connect_no.png");
|
||||
}
|
||||
|
||||
sslFont.setBold(true);
|
||||
sslColor = Qt::black;
|
||||
} else {
|
||||
sslItem->setHidden(hideUnconnected);
|
||||
if (sslDetail.autoconnect != "Offline") {
|
||||
if (sslDetail.connectState) {
|
||||
sslIcon = QIcon(":/images/connect_creating.png");
|
||||
} else {
|
||||
sslIcon = QIcon(":/images/connect_no.png");
|
||||
|
@ -25,117 +25,181 @@
|
||||
|
||||
#include "StatusDefs.h"
|
||||
|
||||
const QString StatusDefs::name(const unsigned int status)
|
||||
QString StatusDefs::name(unsigned int status)
|
||||
{
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
return qApp->translate("StatusDefs", "Offline");
|
||||
case RS_STATUS_AWAY:
|
||||
return qApp->translate("StatusDefs", "Away");
|
||||
case RS_STATUS_BUSY:
|
||||
return qApp->translate("StatusDefs", "Busy");
|
||||
case RS_STATUS_ONLINE:
|
||||
return qApp->translate("StatusDefs", "Online");
|
||||
case RS_STATUS_INACTIVE:
|
||||
return qApp->translate("StatusDefs", "Idle");
|
||||
}
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
return qApp->translate("StatusDefs", "Offline");
|
||||
case RS_STATUS_AWAY:
|
||||
return qApp->translate("StatusDefs", "Away");
|
||||
case RS_STATUS_BUSY:
|
||||
return qApp->translate("StatusDefs", "Busy");
|
||||
case RS_STATUS_ONLINE:
|
||||
return qApp->translate("StatusDefs", "Online");
|
||||
case RS_STATUS_INACTIVE:
|
||||
return qApp->translate("StatusDefs", "Idle");
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::name: Unknown status requested " << status;
|
||||
return "";
|
||||
std::cerr << "StatusDefs::name: Unknown status requested " << status;
|
||||
return "";
|
||||
}
|
||||
|
||||
const char *StatusDefs::imageIM(const unsigned int status)
|
||||
const char *StatusDefs::imageIM(unsigned int status)
|
||||
{
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
return ":/images/im-user-offline.png";
|
||||
case RS_STATUS_AWAY:
|
||||
return ":/images/im-user-away.png";
|
||||
case RS_STATUS_BUSY:
|
||||
return ":/images/im-user-busy.png";
|
||||
case RS_STATUS_ONLINE:
|
||||
return ":/images/im-user.png";
|
||||
case RS_STATUS_INACTIVE:
|
||||
return ":/images/im-user-inactive.png";
|
||||
}
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
return ":/images/im-user-offline.png";
|
||||
case RS_STATUS_AWAY:
|
||||
return ":/images/im-user-away.png";
|
||||
case RS_STATUS_BUSY:
|
||||
return ":/images/im-user-busy.png";
|
||||
case RS_STATUS_ONLINE:
|
||||
return ":/images/im-user.png";
|
||||
case RS_STATUS_INACTIVE:
|
||||
return ":/images/im-user-inactive.png";
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::imageIM: Unknown status requested " << status;
|
||||
return "";
|
||||
std::cerr << "StatusDefs::imageIM: Unknown status requested " << status;
|
||||
return "";
|
||||
}
|
||||
|
||||
const char *StatusDefs::imageUser(const unsigned int status)
|
||||
const char *StatusDefs::imageUser(unsigned int status)
|
||||
{
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
return ":/images/user/identityoffline24.png";
|
||||
case RS_STATUS_AWAY:
|
||||
return ":/images/user/identity24away.png";
|
||||
case RS_STATUS_BUSY:
|
||||
return ":/images/user/identity24busy.png";
|
||||
case RS_STATUS_ONLINE:
|
||||
return ":/images/user/identity24.png";
|
||||
case RS_STATUS_INACTIVE:
|
||||
return ":/images/user/identity24idle.png";
|
||||
}
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
return ":/images/user/identityoffline24.png";
|
||||
case RS_STATUS_AWAY:
|
||||
return ":/images/user/identity24away.png";
|
||||
case RS_STATUS_BUSY:
|
||||
return ":/images/user/identity24busy.png";
|
||||
case RS_STATUS_ONLINE:
|
||||
return ":/images/user/identity24.png";
|
||||
case RS_STATUS_INACTIVE:
|
||||
return ":/images/user/identity24idle.png";
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::imageUser: Unknown status requested " << status;
|
||||
return "";
|
||||
std::cerr << "StatusDefs::imageUser: Unknown status requested " << status;
|
||||
return "";
|
||||
}
|
||||
|
||||
const QString StatusDefs::tooltip(const unsigned int status)
|
||||
QString StatusDefs::tooltip(unsigned int status)
|
||||
{
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
return qApp->translate("StatusDefs", "Friend is offline");
|
||||
case RS_STATUS_AWAY:
|
||||
return qApp->translate("StatusDefs", "Friend is away");
|
||||
case RS_STATUS_BUSY:
|
||||
return qApp->translate("StatusDefs", "Friend is busy");
|
||||
case RS_STATUS_ONLINE:
|
||||
return qApp->translate("StatusDefs", "Friend is online");
|
||||
case RS_STATUS_INACTIVE:
|
||||
return qApp->translate("StatusDefs", "Friend is idle");
|
||||
}
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
return qApp->translate("StatusDefs", "Friend is offline");
|
||||
case RS_STATUS_AWAY:
|
||||
return qApp->translate("StatusDefs", "Friend is away");
|
||||
case RS_STATUS_BUSY:
|
||||
return qApp->translate("StatusDefs", "Friend is busy");
|
||||
case RS_STATUS_ONLINE:
|
||||
return qApp->translate("StatusDefs", "Friend is online");
|
||||
case RS_STATUS_INACTIVE:
|
||||
return qApp->translate("StatusDefs", "Friend is idle");
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::tooltip: Unknown status requested " << status;
|
||||
return "";
|
||||
std::cerr << "StatusDefs::tooltip: Unknown status requested " << status;
|
||||
return "";
|
||||
}
|
||||
|
||||
const QColor StatusDefs::textColor(const unsigned int status)
|
||||
QColor StatusDefs::textColor(unsigned int status)
|
||||
{
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
return Qt::black;
|
||||
case RS_STATUS_AWAY:
|
||||
return Qt::gray;
|
||||
case RS_STATUS_BUSY:
|
||||
return Qt::gray;
|
||||
case RS_STATUS_ONLINE:
|
||||
return Qt::darkBlue;
|
||||
case RS_STATUS_INACTIVE:
|
||||
return Qt::gray;
|
||||
}
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
return Qt::black;
|
||||
case RS_STATUS_AWAY:
|
||||
return Qt::gray;
|
||||
case RS_STATUS_BUSY:
|
||||
return Qt::gray;
|
||||
case RS_STATUS_ONLINE:
|
||||
return Qt::darkBlue;
|
||||
case RS_STATUS_INACTIVE:
|
||||
return Qt::gray;
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::textColor: Unknown status requested " << status;
|
||||
return Qt::black;
|
||||
std::cerr << "StatusDefs::textColor: Unknown status requested " << status;
|
||||
return Qt::black;
|
||||
}
|
||||
|
||||
const QFont StatusDefs::font(const unsigned int status)
|
||||
QFont StatusDefs::font(unsigned int status)
|
||||
{
|
||||
QFont font;
|
||||
QFont font;
|
||||
|
||||
switch (status) {
|
||||
case RS_STATUS_AWAY:
|
||||
case RS_STATUS_BUSY:
|
||||
case RS_STATUS_ONLINE:
|
||||
case RS_STATUS_INACTIVE:
|
||||
font.setBold(true);
|
||||
return font;
|
||||
case RS_STATUS_OFFLINE:
|
||||
font.setBold(false);
|
||||
return font;
|
||||
}
|
||||
switch (status) {
|
||||
case RS_STATUS_AWAY:
|
||||
case RS_STATUS_BUSY:
|
||||
case RS_STATUS_ONLINE:
|
||||
case RS_STATUS_INACTIVE:
|
||||
font.setBold(true);
|
||||
return font;
|
||||
case RS_STATUS_OFFLINE:
|
||||
font.setBold(false);
|
||||
return font;
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::font: Unknown status requested " << status;
|
||||
return font;
|
||||
std::cerr << "StatusDefs::font: Unknown status requested " << status;
|
||||
return font;
|
||||
}
|
||||
|
||||
QString StatusDefs::peerStateString(int peerState)
|
||||
{
|
||||
if (peerState & RS_PEER_STATE_CONNECTED) {
|
||||
return qApp->translate("StatusDefs", "Connected");
|
||||
} else if (peerState & RS_PEER_STATE_UNREACHABLE) {
|
||||
return qApp->translate("StatusDefs", "Unreachable");
|
||||
} else if (peerState & RS_PEER_STATE_ONLINE) {
|
||||
return qApp->translate("StatusDefs", "Available");
|
||||
} else if (peerState & RS_PEER_STATE_FRIEND) {
|
||||
return qApp->translate("StatusDefs", "Offline");
|
||||
}
|
||||
|
||||
return qApp->translate("StatusDefs", "Neighbour");
|
||||
}
|
||||
|
||||
QString StatusDefs::connectStateString(RsPeerDetails &details)
|
||||
{
|
||||
QString stateString;
|
||||
|
||||
switch (details.connectState) {
|
||||
case 0:
|
||||
stateString = peerStateString(details.state);
|
||||
break;
|
||||
case RS_PEER_CONNECTSTATE_TRYING_TUNNEL:
|
||||
stateString = qApp->translate("StatusDefs", "Trying tunnel connection");
|
||||
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:
|
||||
stateString = qApp->translate("StatusDefs", "Connected: TCP");
|
||||
break;
|
||||
case RS_PEER_CONNECTSTATE_CONNECTED_UDP:
|
||||
stateString = qApp->translate("StatusDefs", "Connected: UDP");
|
||||
break;
|
||||
case RS_PEER_CONNECTSTATE_CONNECTED_TUNNEL:
|
||||
stateString = qApp->translate("StatusDefs", "Connected: Tunnel");
|
||||
break;
|
||||
case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN:
|
||||
stateString = qApp->translate("StatusDefs", "Connected: Unknown");
|
||||
break;
|
||||
}
|
||||
|
||||
if (details.connectStateString.empty() == false) {
|
||||
if (stateString.isEmpty() == false) {
|
||||
stateString += ": ";
|
||||
}
|
||||
stateString += QString::fromStdString(details.connectStateString);
|
||||
}
|
||||
|
||||
/* HACK to display DHT Status info too */
|
||||
if (details.foundDHT) {
|
||||
if (stateString.isEmpty() == false) {
|
||||
stateString += ", ";
|
||||
}
|
||||
stateString += qApp->translate("StatusDefs", "DHT: Contact");
|
||||
}
|
||||
|
||||
return stateString;
|
||||
}
|
||||
|
@ -26,16 +26,21 @@
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
|
||||
class RsPeerDetails;
|
||||
|
||||
class StatusDefs
|
||||
{
|
||||
public:
|
||||
static const QString name(const unsigned int status);
|
||||
static const char* imageIM(const unsigned int status);
|
||||
static const char* imageUser(const unsigned int status);
|
||||
static const QString tooltip(const unsigned int status);
|
||||
static QString name(unsigned int status);
|
||||
static const char* imageIM(unsigned int status);
|
||||
static const char* imageUser(unsigned int status);
|
||||
static QString tooltip(unsigned int status);
|
||||
|
||||
static const QColor textColor(const unsigned int status);
|
||||
static const QFont font(const unsigned int status);
|
||||
static QColor textColor(unsigned int status);
|
||||
static QFont font(unsigned int status);
|
||||
|
||||
static QString peerStateString(int peerState);
|
||||
static QString connectStateString(RsPeerDetails &details);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "gui/help/browser/helpbrowser.h"
|
||||
#include "gui/common/PeerDefs.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "gui/common/StatusDefs.h"
|
||||
|
||||
static QMap<std::string, ConfCertDialog*> instances;
|
||||
|
||||
@ -159,8 +160,8 @@ void ConfCertDialog::load()
|
||||
ui.extPort -> setValue(detail.extPort);
|
||||
|
||||
ui.dynDNS->setText(QString::fromStdString(detail.dyndns));
|
||||
|
||||
ui.statusline->setText(QString::fromStdString(detail.autoconnect));
|
||||
|
||||
ui.statusline->setText(StatusDefs::connectStateString(detail));
|
||||
|
||||
ui.ipAddressList->clear();
|
||||
for(std::list<std::string>::const_iterator it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it)
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "FeedHolder.h"
|
||||
#include "../RsAutoUpdatePage.h"
|
||||
#include "gui/msgs/MessageComposer.h"
|
||||
#include "gui/common/StatusDefs.h"
|
||||
|
||||
#include "gui/notifyqt.h"
|
||||
|
||||
@ -178,7 +179,7 @@ void PeerItem::updateItem()
|
||||
}
|
||||
|
||||
/* top Level info */
|
||||
QString status = QString::fromStdString(RsPeerStateString(details.state));
|
||||
QString status = StatusDefs::peerStateString(details.state);
|
||||
|
||||
#if 0
|
||||
/* Append additional status info from status service */
|
||||
@ -201,7 +202,7 @@ void PeerItem::updateItem()
|
||||
ipLabel->setText(QString::fromStdString(out.str()));
|
||||
}
|
||||
|
||||
connLabel->setText(QString::fromStdString(details.autoconnect));
|
||||
connLabel->setText(StatusDefs::connectStateString(details));
|
||||
|
||||
/* do buttons */
|
||||
chatButton->setEnabled(details.state & RS_PEER_STATE_CONNECTED);
|
||||
|
Binary file not shown.
@ -1016,12 +1016,12 @@ p, li { white-space: pre-wrap; }
|
||||
<translation>Hinzufügen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+79"/>
|
||||
<location line="+73"/>
|
||||
<source>Display</source>
|
||||
<translation type="unfinished">Anzeige</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+275"/>
|
||||
<location line="+269"/>
|
||||
<source>Set all to read</source>
|
||||
<translation>Alle als gelesen markieren</translation>
|
||||
</message>
|
||||
@ -1071,7 +1071,7 @@ p, li { white-space: pre-wrap; }
|
||||
<translation>Andere Kanäle</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/ChannelFeed.ui" line="-174"/>
|
||||
<location filename="../gui/ChannelFeed.ui" line="-168"/>
|
||||
<location filename="../gui/ChannelFeed.cpp" line="+50"/>
|
||||
<source>Post to Channel</source>
|
||||
<translation>Kanalbeitrag erstellen</translation>
|
||||
@ -1516,7 +1516,7 @@ p, li { white-space: pre-wrap; }
|
||||
<translation>Übernehmen und Schliessen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/connect/ConfCertDialog.cpp" line="+127"/>
|
||||
<location filename="../gui/connect/ConfCertDialog.cpp" line="+128"/>
|
||||
<location line="+201"/>
|
||||
<source>RetroShare</source>
|
||||
<translation></translation>
|
||||
@ -3644,7 +3644,7 @@ p, li { white-space: pre-wrap; }
|
||||
<translation>Hinzufügen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+47"/>
|
||||
<location line="+41"/>
|
||||
<source>Start new Thread for Selected Forum</source>
|
||||
<translation>Starte ein neues Thema im ausgewählten Forum</translation>
|
||||
</message>
|
||||
@ -3654,7 +3654,7 @@ p, li { white-space: pre-wrap; }
|
||||
<translation type="unfinished">Anzeige</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+100"/>
|
||||
<location line="+94"/>
|
||||
<source><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
@ -7134,7 +7134,7 @@ p, li { white-space: pre-wrap; }
|
||||
</message>
|
||||
<message>
|
||||
<location line="-20"/>
|
||||
<location filename="../gui/feeds/PeerItem.cpp" line="+246"/>
|
||||
<location filename="../gui/feeds/PeerItem.cpp" line="+247"/>
|
||||
<source>Expand</source>
|
||||
<translation>Erweitern</translation>
|
||||
</message>
|
||||
@ -10600,11 +10600,12 @@ Bist Du sicher?</translation>
|
||||
<name>StatusDefs</name>
|
||||
<message>
|
||||
<location filename="../gui/common/StatusDefs.cpp" line="+32"/>
|
||||
<location line="+120"/>
|
||||
<source>Offline</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+2"/>
|
||||
<location line="-118"/>
|
||||
<source>Away</source>
|
||||
<translation>Abwesend</translation>
|
||||
</message>
|
||||
@ -10648,6 +10649,66 @@ Bist Du sicher?</translation>
|
||||
<source>Friend is idle</source>
|
||||
<translation>Freund ist untätig</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+49"/>
|
||||
<source>Connected</source>
|
||||
<translation>Verbunden</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+2"/>
|
||||
<source>Unreachable</source>
|
||||
<translation>Unerreichbar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+2"/>
|
||||
<source>Available</source>
|
||||
<translation>Verfügbar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>Neighbour</source>
|
||||
<translation>Nachbar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+12"/>
|
||||
<source>Trying tunnel connection</source>
|
||||
<translation>Versuche Tunnelverbindung</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Trying TCP</source>
|
||||
<translation>Versuche TCP</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Trying UDP</source>
|
||||
<translation>Versuche UDP</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Connected: TCP</source>
|
||||
<translation>Verbunden: TCP</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Connected: UDP</source>
|
||||
<translation>Verbunden: UDP</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Connected: Tunnel</source>
|
||||
<translation>Verbunden: Tunnel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Connected: Unknown</source>
|
||||
<translation>Verbunden: Unbekannt</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+16"/>
|
||||
<source>DHT: Contact</source>
|
||||
<translation>DHT: Kontakt</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StatusMessage</name>
|
||||
|
Loading…
Reference in New Issue
Block a user