only show servers if we get a ping from them, added some test code

This commit is contained in:
Volker Fischer 2011-04-17 21:01:24 +00:00
parent 375a9f2908
commit b39576d8d6
2 changed files with 17 additions and 2 deletions

View file

@ -115,6 +115,10 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr,
QTreeWidgetItem* pNewListViewItem =
new QTreeWidgetItem ( ListViewServers );
// make the entry invisible (will be set to visible on successful ping
// result)
pNewListViewItem->setHidden ( true );
// server name
pNewListViewItem->setText ( 0, vecServerInfo[iIdx].strName );
@ -188,8 +192,19 @@ void CConnectDlg::SetPingTimeResult ( CHostAddress& InetAddr,
data ( 0, Qt::UserRole ).toString().
compare ( InetAddr.toString() ) )
{
// a ping time was received, set item to visible
ListViewServers->topLevelItem ( iIdx )->setHidden ( false );
// TEST
QFont test = ListViewServers->topLevelItem ( iIdx )->font( 3 );
test.setBold ( true );
ListViewServers->topLevelItem ( iIdx )->setFont ( 3, test );
ListViewServers->topLevelItem ( iIdx )->setTextColor ( 3, Qt::red );
// update ping text
ListViewServers->topLevelItem ( iIdx )->
setText ( 3, QString().setNum ( iPingTime ) );
setText ( 3, QString().setNum ( iPingTime ) + " ms" );
}
}
}

View file

@ -44,7 +44,7 @@
</column>
<column>
<property name="text" >
<string>Ping Time/ms</string>
<string>Ping Time</string>
</property>
</column>
</widget>