fixed bug: #25 No client list in connection dialog for server which is full
This commit is contained in:
parent
5096e3208a
commit
600d5f6832
1 changed files with 17 additions and 3 deletions
|
@ -92,10 +92,18 @@ CConnectDlg::CConnectDlg ( const bool bNewShowCompleteRegList,
|
|||
lvwServers->clear();
|
||||
|
||||
// add invisible columns which are used for sorting the list and storing
|
||||
// the maximum number of clients
|
||||
lvwServers->setColumnCount ( 6 );
|
||||
// the current/maximum number of clients
|
||||
// 0: server name
|
||||
// 1: ping time
|
||||
// 2: number of musicians (including additional strings like " (full)")
|
||||
// 3: location
|
||||
// 4: minimum ping time (invisible)
|
||||
// 5: maximum number of clients (invisible)
|
||||
// 6: number of musicians (just the number, invisible)
|
||||
lvwServers->setColumnCount ( 7 );
|
||||
lvwServers->hideColumn ( 4 );
|
||||
lvwServers->hideColumn ( 5 );
|
||||
lvwServers->hideColumn ( 6 );
|
||||
|
||||
// per default the root shall not be decorated (to save space)
|
||||
lvwServers->setRootIsDecorated ( false );
|
||||
|
@ -310,6 +318,9 @@ strLocation += ", " + vecServerInfo[iIdx].HostAddr.InetAddr.toString() +
|
|||
// store the maximum number of clients
|
||||
pNewListViewItem->setText ( 5, QString().setNum ( vecServerInfo[iIdx].iMaxNumClients ) );
|
||||
|
||||
// initialize the current number of connected clients
|
||||
pNewListViewItem->setText ( 6, QString().setNum ( 0 ) );
|
||||
|
||||
// store host address
|
||||
pNewListViewItem->setData ( 0, Qt::UserRole,
|
||||
CurHostAddress.toString() );
|
||||
|
@ -495,7 +506,7 @@ void CConnectDlg::OnTimerPing()
|
|||
|
||||
// check if the number of child list items matches the number of
|
||||
// connected clients, if not then request the client names
|
||||
if ( lvwServers->topLevelItem ( iIdx )->text ( 2 ).toInt() !=
|
||||
if ( lvwServers->topLevelItem ( iIdx )->text ( 6 ).toInt() !=
|
||||
lvwServers->topLevelItem ( iIdx )->childCount() )
|
||||
{
|
||||
emit CreateCLServerListReqConnClientsListMes ( CurServerAddress );
|
||||
|
@ -554,6 +565,9 @@ void CConnectDlg::SetPingTimeAndNumClientsResult ( CHostAddress&
|
|||
setText ( 2, QString().setNum ( iNumClients ) );
|
||||
}
|
||||
|
||||
// update number of clients value (hidden)
|
||||
pCurListViewItem->setText ( 6, QString().setNum ( iNumClients ) );
|
||||
|
||||
// a ping time was received, set item to visible (note that we have
|
||||
// to check if the item is hidden, otherwise we get a lot of CPU
|
||||
// usage by calling "setHidden(false)" even if the item was already
|
||||
|
|
Loading…
Reference in a new issue