Esempio n. 1
0
QString StatusDefs::connectStateIpString(RsPeerDetails &details)
{
    QString stateString = QString("");

	switch (details.connectState) {
	case 0:
		stateString = peerStateString(details.state);
		break;
	case RS_PEER_CONNECTSTATE_TRYING_TCP:
	case RS_PEER_CONNECTSTATE_CONNECTED_TCP:
		stateString += QString(details.actAsServer ? qApp->translate("StatusDefs", "TCP-in") : qApp->translate("StatusDefs", "TCP-out"));
		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 += QString(details.actAsServer ? qApp->translate("StatusDefs", "Tor-in") : qApp->translate("StatusDefs", "Tor-out"));
		break;
	case RS_PEER_CONNECTSTATE_CONNECTED_I2P:
		stateString += QString(details.actAsServer ? qApp->translate("StatusDefs", "I2P-in") : qApp->translate("StatusDefs", "I2P-out"));
		break;
	case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN:
		stateString += qApp->translate("StatusDefs", "unkown");
		break;
	}
    stateString += QString(" : ");

    stateString += QString(details.connectAddr.c_str()) ;

	return stateString;
}
Esempio n. 2
0
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_I2P:
	case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN:
		stateString = qApp->translate("StatusDefs", "Connected");
		break;
	}

	return stateString;
}
Esempio n. 3
0
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;
}
Esempio n. 4
0
QString StatusDefs::connectStateString(RsPeerDetails &details)
{
	QString stateString;
	bool isConnected = false;

	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:
		stateString = qApp->translate("StatusDefs", "Connected: TCP");
		isConnected = true;
		break;
	case RS_PEER_CONNECTSTATE_CONNECTED_UDP:
		stateString = qApp->translate("StatusDefs", "Connected: UDP");
		isConnected = true;
		break;
	case RS_PEER_CONNECTSTATE_CONNECTED_TOR:
		stateString = qApp->translate("StatusDefs", "Connected: Tor");
		isConnected = true;
		break;
	case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN:
		stateString = qApp->translate("StatusDefs", "Connected: Unknown");
		isConnected = true;
		break;
	}

	if(isConnected) {
		stateString += " ";
		if(details.actAsServer)
			stateString += qApp->translate("StatusDefs", "inbound connection");
		else
			stateString += qApp->translate("StatusDefs", "outbound connection");
	}

	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;
}