From b39576d8d6f8328c12e4bc6ea59151b789c8f86d Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 17 Apr 2011 21:01:24 +0000 Subject: [PATCH] only show servers if we get a ping from them, added some test code --- src/connectdlg.cpp | 17 ++++++++++++++++- src/connectdlgbase.ui | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index d337b8c6..b950c16c 100755 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -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" ); } } } diff --git a/src/connectdlgbase.ui b/src/connectdlgbase.ui index 207849e9..39fe2810 100755 --- a/src/connectdlgbase.ui +++ b/src/connectdlgbase.ui @@ -44,7 +44,7 @@ - Ping Time/ms + Ping Time