Update Network Tab.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@738 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
notdefine 2008-09-27 15:10:55 +00:00
parent 58cf788d6d
commit 82bd565f4c

View File

@ -325,7 +325,7 @@ void NetworkDialog::insertConnect()
out << detail.extPort; out << detail.extPort;
} else { } else {
// No Trust => no IP Information // No Trust => no IP Information
out << ""; out << "0.0.0.0:0/0.0.0.0:0";
} }
item -> setText(5, QString::fromStdString(out.str())); item -> setText(5, QString::fromStdString(out.str()));
} }
@ -345,24 +345,22 @@ void NetworkDialog::insertConnect()
//item -> setText(10, QString::fromStdString(detail.authcode)); //item -> setText(10, QString::fromStdString(detail.authcode));
/* change background */ /**
int i; * Determinated the Background Color
*/
QColor backgrndcolor;
// 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.state & RS_PEER_STATE_FRIEND) if (detail.state & RS_PEER_STATE_FRIEND)
{ {
if (detail.lastConnect < 10000) /* 3 hours? */ if (detail.lastConnect < 10000) /* 3 hours? */
{ {
/* bright green */ /* bright green */
item -> setBackground(i,QBrush(Qt::darkGreen)); backgrndcolor=Qt::darkGreen;
item -> setIcon(0,(QIcon(IMAGE_AUTHED))); item -> setIcon(0,(QIcon(IMAGE_AUTHED)));
} }
else else
{ {
item -> setBackground(i,QBrush(Qt::darkGreen)); backgrndcolor=Qt::darkGreen;
item -> setIcon(0,(QIcon(IMAGE_AUTHED))); item -> setIcon(0,(QIcon(IMAGE_AUTHED)));
} }
} }
@ -370,20 +368,26 @@ void NetworkDialog::insertConnect()
{ {
if (detail.trustLvl > RS_TRUST_LVL_MARGINAL) if (detail.trustLvl > RS_TRUST_LVL_MARGINAL)
{ {
item -> setBackground(i,QBrush(Qt::cyan)); backgrndcolor=Qt::cyan;
item -> setIcon(0,(QIcon(IMAGE_DENIED))); item -> setIcon(0,(QIcon(IMAGE_DENIED)));
} }
else if (detail.lastConnect < 10000) /* 3 hours? */ else if (detail.lastConnect < 10000) /* 3 hours? */
{ {
item -> setBackground(i,QBrush(Qt::yellow)); backgrndcolor=Qt::yellow;
item -> setIcon(0,(QIcon(IMAGE_DENIED))); item -> setIcon(0,(QIcon(IMAGE_DENIED)));
} }
else else
{ {
item -> setBackground(i,QBrush(Qt::gray)); backgrndcolor=Qt::gray;
item -> setIcon(0,(QIcon(IMAGE_DENIED))); item -> setIcon(0,(QIcon(IMAGE_DENIED)));
} }
} }
// Color each Background column in the Network Tab except the first one => 1-9
// whith the determinated color
for(int i = 1; i <10; i++)
{
item -> setBackground(i,QBrush(backgrndcolor));
} }
/* add to the list */ /* add to the list */
items.append(item); items.append(item);
@ -408,6 +412,7 @@ void NetworkDialog::insertConnect()
self_item->setText(8, QString::fromStdString(pd.email)); self_item->setText(8, QString::fromStdString(pd.email));
self_item->setText(9, QString::fromStdString(pd.id)); self_item->setText(9, QString::fromStdString(pd.id));
// Color each Background column in the Network Tab except the first one => 1-9
for(int i=1;i<10;++i) for(int i=1;i<10;++i)
{ {
self_item->setBackground(i,QBrush(Qt::darkGreen)); self_item->setBackground(i,QBrush(Qt::darkGreen));