fix for #17 Default central server flag seems not to work in server GUI

This commit is contained in:
Volker Fischer 2014-02-23 18:17:46 +00:00
parent 17b5bb6dd9
commit 4dca2d1c93
2 changed files with 13 additions and 8 deletions

View file

@ -34,7 +34,7 @@ CServerListManager::CServerListManager ( const quint16 iNPortNum,
CProtocol* pNConLProt ) CProtocol* pNConLProt )
: iPortNumber ( iNPortNum ), : iPortNumber ( iNPortNum ),
iNumPredefinedServers ( 0 ), iNumPredefinedServers ( 0 ),
bUseDefaultCentralServerAddress ( false ), bUseDefaultCentralServerAddress ( false ), // must be false for the "no GUI" case
bCentServPingServerInList ( bNCentServPingServerInList ), bCentServPingServerInList ( bNCentServPingServerInList ),
pConnLessProtocol ( pNConLProt ) pConnLessProtocol ( pNConLProt )
{ {
@ -178,8 +178,11 @@ void CServerListManager::SetCentralServerAddress ( const QString sNCentServAddr
if ( !strCentralServerAddress.isEmpty() ) if ( !strCentralServerAddress.isEmpty() )
{ {
bIsCentralServer = bIsCentralServer =
( !strCentralServerAddress.toLower().compare ( "localhost" ) || (
!strCentralServerAddress.compare ( "127.0.0.1" ) ); ( !strCentralServerAddress.toLower().compare ( "localhost" ) ||
!strCentralServerAddress.compare ( "127.0.0.1" ) ) &&
( !bUseDefaultCentralServerAddress )
);
bEnabled = true; bEnabled = true;
} }

View file

@ -284,16 +284,18 @@ void CSettings::Load()
{ {
// server: // server:
// central server address // use default central server address flag (note that it is important
pServer->SetServerListCentralServerAddress ( // to set this setting prior to the "central server address")
GetIniSetting ( IniXMLDocument, "server", "centralservaddr" ) );
// use default central server address flag
if ( GetFlagIniSet ( IniXMLDocument, "server", "defcentservaddr", bValue ) ) if ( GetFlagIniSet ( IniXMLDocument, "server", "defcentservaddr", bValue ) )
{ {
pServer->SetUseDefaultCentralServerAddress ( bValue ); pServer->SetUseDefaultCentralServerAddress ( bValue );
} }
// central server address (to be set after the "use default central
// server address)
pServer->SetServerListCentralServerAddress (
GetIniSetting ( IniXMLDocument, "server", "centralservaddr" ) );
// server list enabled flag // server list enabled flag
if ( GetFlagIniSet ( IniXMLDocument, "server", "servlistenabled", bValue ) ) if ( GetFlagIniSet ( IniXMLDocument, "server", "servlistenabled", bValue ) )
{ {