Show a readable Date, no Timestamp in Network Tab.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@734 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
notdefine 2008-09-21 22:04:49 +00:00
parent 5b2e6b2d62
commit 21cf471f6c

View File

@ -294,7 +294,22 @@ void NetworkDialog::insertConnect()
/* (3) Last Connect */ /* (3) Last Connect */
{ {
std::ostringstream out; std::ostringstream out;
out << detail.lastConnect; // Show anouncement if a friend never was connected.
if (detail.lastConnect==0 ) {
if(detail.state & RS_PEER_STATE_FRIEND) {
out << "Friend never seen";
} else {
out << "0"; // Is zero
}
} else {
// Dont Show a timestamp in RS calculate the day
time_t seconds;
seconds=detail.lastConnect;
struct tm *tmnow= localtime(&seconds);
out << setfill ("0");
out << tmnow->tm_hour << ":" << tmnow->tm_min << ":" << tmnow->tm_sec << " ";
out << tmnow->tm_mday << "." << tmnow->tm_mon + 1 << "." << tmnow->tm_year + 1900;
}
item -> setText(3, QString::fromStdString(out.str())); item -> setText(3, QString::fromStdString(out.str()));
} }
@ -328,55 +343,44 @@ void NetworkDialog::insertConnect()
/* change background */ /* change background */
int i; int i;
if (detail.state & RS_PEER_STATE_FRIEND)
// I dont know why the setBackground and Icon functions called 10 times,
// but this loop dont needed to be implemented in every single switch.
for(i = 1; i <10; i++)
{ {
if (detail.lastConnect < 10000) /* 3 hours? */ if (detail.state & RS_PEER_STATE_FRIEND)
{ {
/* bright green */ if (detail.lastConnect < 10000) /* 3 hours? */
for(i = 1; i <10; i++)
{ {
item -> setBackground(i,QBrush(Qt::darkGreen)); /* bright green */
item -> setIcon(0,(QIcon(IMAGE_AUTHED))); item -> setBackground(i,QBrush(Qt::darkGreen));
item -> setIcon(0,(QIcon(IMAGE_AUTHED)));
}
else
{
item -> setBackground(i,QBrush(Qt::darkGreen));
item -> setIcon(0,(QIcon(IMAGE_AUTHED)));
} }
} }
else else
{ {
for(i = 1; i < 10; i++) if (detail.trustLvl > RS_TRUST_LVL_MARGINAL)
{ {
item -> setBackground(i,QBrush(Qt::darkGreen)); item -> setBackground(i,QBrush(Qt::cyan));
item -> setIcon(0,(QIcon(IMAGE_AUTHED))); item -> setIcon(0,(QIcon(IMAGE_DENIED)));
} }
} else if (detail.lastConnect < 10000) /* 3 hours? */
{
item -> setBackground(i,QBrush(Qt::yellow));
item -> setIcon(0,(QIcon(IMAGE_DENIED)));
}
else
{
item -> setBackground(i,QBrush(Qt::gray));
item -> setIcon(0,(QIcon(IMAGE_DENIED)));
}
}
} }
else
{
if (detail.trustLvl > RS_TRUST_LVL_MARGINAL)
{
for(i = 1; i < 10; i++)
{
item -> setBackground(i,QBrush(Qt::cyan));
item -> setIcon(0,(QIcon(IMAGE_DENIED)));
}
}
else if (detail.lastConnect < 10000) /* 3 hours? */
{
for(i = 1; i < 10; i++)
{
item -> setBackground(i,QBrush(Qt::yellow));
item -> setIcon(0,(QIcon(IMAGE_DENIED)));
}
}
else
{
for(i = 1; i < 10; i++)
{
item -> setBackground(i,QBrush(Qt::gray));
item -> setIcon(0,(QIcon(IMAGE_DENIED)));
}
}
}
/* add to the list */ /* add to the list */
items.append(item); items.append(item);
} }