Changed the display of the location in the gpg item in MessengerWindow to the state string - Online, Away, Busy, Idle

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3461 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-09-08 22:32:11 +00:00
parent cb1bee3318
commit a66816ff33

View File

@ -763,10 +763,13 @@ void MessengerWindow::insertPeers()
QFont font; QFont font;
font.setBold(true); font.setBold(true);
QString stateString;
switch (bestPeerState) { switch (bestPeerState) {
case PEER_STATE_INACTIVE: case PEER_STATE_INACTIVE:
gpgIcon = QIcon(IMAGE_INACTIVE); gpgIcon = QIcon(IMAGE_INACTIVE);
gpg_item -> setToolTip(COLUMN_NAME, tr("Peer Idle")); gpg_item -> setToolTip(COLUMN_NAME, tr("Peer Idle"));
stateString = tr("Idle");
for(i = 0; i < COLUMN_COUNT; i++) { for(i = 0; i < COLUMN_COUNT; i++) {
gpg_item -> setTextColor(i,(Qt::gray)); gpg_item -> setTextColor(i,(Qt::gray));
@ -777,6 +780,7 @@ void MessengerWindow::insertPeers()
case PEER_STATE_ONLINE: case PEER_STATE_ONLINE:
gpgIcon = QIcon(IMAGE_ONLINE); gpgIcon = QIcon(IMAGE_ONLINE);
gpg_item -> setToolTip(COLUMN_NAME, tr("Peer Online")); gpg_item -> setToolTip(COLUMN_NAME, tr("Peer Online"));
stateString = tr("Online");
for(i = 0; i < COLUMN_COUNT; i++) { for(i = 0; i < COLUMN_COUNT; i++) {
gpg_item -> setTextColor(i,(Qt::darkBlue)); gpg_item -> setTextColor(i,(Qt::darkBlue));
@ -787,6 +791,7 @@ void MessengerWindow::insertPeers()
case PEER_STATE_AWAY: case PEER_STATE_AWAY:
gpgIcon = QIcon(IMAGE_AWAY); gpgIcon = QIcon(IMAGE_AWAY);
gpg_item -> setToolTip(COLUMN_NAME, tr("Peer Away")); gpg_item -> setToolTip(COLUMN_NAME, tr("Peer Away"));
stateString = tr("Away");
for(i = 0; i < COLUMN_COUNT; i++) { for(i = 0; i < COLUMN_COUNT; i++) {
gpg_item -> setTextColor(i,(Qt::gray)); gpg_item -> setTextColor(i,(Qt::gray));
@ -797,6 +802,7 @@ void MessengerWindow::insertPeers()
case PEER_STATE_BUSY: case PEER_STATE_BUSY:
gpgIcon = QIcon(IMAGE_BUSY); gpgIcon = QIcon(IMAGE_BUSY);
gpg_item -> setToolTip(COLUMN_NAME, tr("Peer Busy")); gpg_item -> setToolTip(COLUMN_NAME, tr("Peer Busy"));
stateString = tr("Busy");
for(i = 0; i < COLUMN_COUNT; i++) { for(i = 0; i < COLUMN_COUNT; i++) {
gpg_item -> setTextColor(i,(Qt::gray)); gpg_item -> setTextColor(i,(Qt::gray));
@ -808,13 +814,22 @@ void MessengerWindow::insertPeers()
std::map<std::string, QString>::iterator customStateString = sslCustomStateStrings.find(bestSslId); std::map<std::string, QString>::iterator customStateString = sslCustomStateStrings.find(bestSslId);
if (customStateString == sslCustomStateStrings.end()) { if (customStateString == sslCustomStateStrings.end()) {
std::map<std::string, std::string>::iterator location = sslLocations.find(bestSslId); // std::map<std::string, std::string>::iterator location = sslLocations.find(bestSslId);
if (location == sslLocations.end()) { // if (location == sslLocations.end()) {
// /* show only the name */
// gpg_item->setText(COLUMN_NAME, QString::fromStdString(detail.name));
// } else {
// /* show the name with location */
// gpg_item->setText(COLUMN_NAME, QString::fromStdString(detail.name) + "\n" + QString::fromStdString(location->second));
// }
/* use state string for location */
if (stateString.isEmpty()) {
/* show only the name */ /* show only the name */
gpg_item->setText(COLUMN_NAME, QString::fromStdString(detail.name)); gpg_item->setText(COLUMN_NAME, QString::fromStdString(detail.name));
} else { } else {
/* show the name with location */ /* show the name with location */
gpg_item->setText(COLUMN_NAME, QString::fromStdString(detail.name) + "\n" + QString::fromStdString(location->second)); gpg_item->setText(COLUMN_NAME, QString::fromStdString(detail.name) + "\n" + stateString);
} }
} else { } else {
/* show the name with custom state string */ /* show the name with custom state string */