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 - 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 - bug fix: ping time measurement may be invalid for the Linux OS

View file

@ -89,9 +89,11 @@ CConnectDlg::CConnectDlg ( const bool bNewShowCompleteRegList,
#endif #endif
lvwServers->clear(); lvwServers->clear();
// add invisible column which is used for sorting the list // add invisible columns which are used for sorting the list and storing
lvwServers->setColumnCount ( 5 ); // the maximum number of clients
lvwServers->setColumnCount ( 6 );
lvwServers->hideColumn ( 4 ); lvwServers->hideColumn ( 4 );
lvwServers->hideColumn ( 5 );
// per default the root shall not be decorated (to save space) // per default the root shall not be decorated (to save space)
lvwServers->setRootIsDecorated ( false ); lvwServers->setRootIsDecorated ( false );
@ -267,7 +269,7 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr,
} }
// the ping time shall be shown in bold font // the ping time shall be shown in bold font
QFont CurPingTimeFont = pNewListViewItem->font( 3 ); QFont CurPingTimeFont = pNewListViewItem->font ( 3 );
CurPingTimeFont.setBold ( true ); CurPingTimeFont.setBold ( true );
pNewListViewItem->setFont ( 1, CurPingTimeFont ); pNewListViewItem->setFont ( 1, CurPingTimeFont );
@ -297,6 +299,9 @@ strLocation += ", " + vecServerInfo[iIdx].HostAddr.InetAddr.toString() +
// must fit in an integer type) // must fit in an integer type)
pNewListViewItem->setText ( 4, "99999999" ); pNewListViewItem->setText ( 4, "99999999" );
// store the maximum number of clients
pNewListViewItem->setText ( 5, QString().setNum ( vecServerInfo[iIdx].iMaxNumClients ) );
// store host address // store host address
pNewListViewItem->setData ( 0, Qt::UserRole, pNewListViewItem->setData ( 0, Qt::UserRole,
CurHostAddress.toString() ); CurHostAddress.toString() );
@ -530,8 +535,16 @@ void CConnectDlg::SetPingTimeAndNumClientsResult ( CHostAddress&
} }
// update number of clients text // update number of clients text
if ( iNumClients >= pCurListViewItem->text ( 5 ).toInt() )
{
pCurListViewItem->
setText ( 2, QString().setNum ( iNumClients ) + " (full)" );
}
else
{
pCurListViewItem-> pCurListViewItem->
setText ( 2, QString().setNum ( iNumClients ) ); setText ( 2, QString().setNum ( iNumClients ) );
}
// a ping time was received, set item to visible (note that we have // 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 // 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 // never be deleted
ServerList.clear(); 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 // 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(), CServerListEntry ThisServerListEntry ( CHostAddress(),
iPortNumber, iPortNumber,
"", "",
@ -68,7 +69,7 @@ CServerListManager::CServerListManager ( const quint16 iNPortNum,
QLocale::system().country(), QLocale::system().country(),
"", "",
iNumChannels, iNumChannels,
true ); GetIsCentralServer() );
// parse the server info string according to definition: // parse the server info string according to definition:
// [this server name];[this server city]; ... // [this server name];[this server city]; ...
@ -107,7 +108,8 @@ CServerListManager::CServerListManager ( const quint16 iNPortNum,
while ( ( iServInfoNumSplitItems - iCurUsedServInfoSplitItems >= 4 ) && while ( ( iServInfoNumSplitItems - iCurUsedServInfoSplitItems >= 4 ) &&
( iNumPredefinedServers <= MAX_NUM_SERVERS_IN_SERVER_LIST ) ) ( 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(), CServerListEntry NewServerListEntry ( CHostAddress(),
0, // port number not used 0, // port number not used
"", "",