the Musicians value in the server list shows a warning if the server is full

This commit is contained in:
Volker Fischer 2016-02-09 15:05:06 +00:00
parent 8e33e34350
commit 9ab7164d05
3 changed files with 26 additions and 9 deletions

View File

@ -7,6 +7,8 @@
- avoid a single jitter buffer for the auto detection
- the Musicians value in the server list shows a warning if the server is full
- bug fix: ping time measurement may be invalid for the Linux OS

View File

@ -89,9 +89,11 @@ CConnectDlg::CConnectDlg ( const bool bNewShowCompleteRegList,
#endif
lvwServers->clear();
// add invisible column which is used for sorting the list
lvwServers->setColumnCount ( 5 );
// add invisible columns which are used for sorting the list and storing
// the maximum number of clients
lvwServers->setColumnCount ( 6 );
lvwServers->hideColumn ( 4 );
lvwServers->hideColumn ( 5 );
// per default the root shall not be decorated (to save space)
lvwServers->setRootIsDecorated ( false );
@ -267,7 +269,7 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr,
}
// the ping time shall be shown in bold font
QFont CurPingTimeFont = pNewListViewItem->font( 3 );
QFont CurPingTimeFont = pNewListViewItem->font ( 3 );
CurPingTimeFont.setBold ( true );
pNewListViewItem->setFont ( 1, CurPingTimeFont );
@ -297,6 +299,9 @@ strLocation += ", " + vecServerInfo[iIdx].HostAddr.InetAddr.toString() +
// must fit in an integer type)
pNewListViewItem->setText ( 4, "99999999" );
// store the maximum number of clients
pNewListViewItem->setText ( 5, QString().setNum ( vecServerInfo[iIdx].iMaxNumClients ) );
// store host address
pNewListViewItem->setData ( 0, Qt::UserRole,
CurHostAddress.toString() );
@ -530,8 +535,16 @@ void CConnectDlg::SetPingTimeAndNumClientsResult ( CHostAddress&
}
// update number of clients text
pCurListViewItem->
setText ( 2, QString().setNum ( iNumClients ) );
if ( iNumClients >= pCurListViewItem->text ( 5 ).toInt() )
{
pCurListViewItem->
setText ( 2, QString().setNum ( iNumClients ) + " (full)" );
}
else
{
pCurListViewItem->
setText ( 2, 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

View File

@ -58,9 +58,10 @@ CServerListManager::CServerListManager ( const quint16 iNPortNum,
// never be deleted
ServerList.clear();
// init server list entry (server info for this server) with defaults, per
// Init server list entry (server info for this server) with defaults. Per
// definition the client substitudes the IP address of the central server
// itself for his server list
// itself for his server list. If we are the central server, we assume that
// we have a permanent server.
CServerListEntry ThisServerListEntry ( CHostAddress(),
iPortNumber,
"",
@ -68,7 +69,7 @@ CServerListManager::CServerListManager ( const quint16 iNPortNum,
QLocale::system().country(),
"",
iNumChannels,
true );
GetIsCentralServer() );
// parse the server info string according to definition:
// [this server name];[this server city]; ...
@ -107,7 +108,8 @@ CServerListManager::CServerListManager ( const quint16 iNPortNum,
while ( ( iServInfoNumSplitItems - iCurUsedServInfoSplitItems >= 4 ) &&
( iNumPredefinedServers <= MAX_NUM_SERVERS_IN_SERVER_LIST ) )
{
// create a new server list entry
// create a new server list entry, we assume that servers which are
// registered via the command line are permanent servers
CServerListEntry NewServerListEntry ( CHostAddress(),
0, // port number not used
"",