create function for getting the central server address (default or custom)

This commit is contained in:
Volker Fischer 2011-05-09 18:26:26 +00:00
parent 4ca03d9244
commit 49b67e193d
5 changed files with 13 additions and 36 deletions

View file

@ -528,15 +528,9 @@ void CClientSettingsDlg::UpdateCentralServerDependency()
// fire signals when we update the text.
edtCentralServerAddress->blockSignals ( true );
{
if ( bCurUseDefCentServAddr )
{
edtCentralServerAddress->setText ( DEFAULT_SERVER_ADDRESS );
}
else
{
edtCentralServerAddress->setText (
pClient->GetServerListCentralServerAddress() );
}
edtCentralServerAddress->setText (
SELECT_SERVER_ADDRESS ( bCurUseDefCentServAddr,
pClient->GetServerListCentralServerAddress() ) );
}
edtCentralServerAddress->blockSignals ( false );

View file

@ -75,6 +75,7 @@ LED bar: lbr
// default server address
#define DEFAULT_SERVER_ADDRESS "llcon.dyndns.org"
#define SELECT_SERVER_ADDRESS(a, b) ((a) ? (DEFAULT_SERVER_ADDRESS) : (b))
// download URL
#define LLCON_DOWNLOAD_URL "http://sourceforge.net/projects/llcon/files"

View file

@ -711,15 +711,9 @@ void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart )
if ( bDoStart )
{
// get the central server address string
QString strCurCentServAddr;
if ( pClient->GetUseDefaultCentralServerAddress() )
{
strCurCentServAddr = DEFAULT_SERVER_ADDRESS;
}
else
{
strCurCentServAddr = pClient->GetServerListCentralServerAddress();
}
const QString strCurCentServAddr =
SELECT_SERVER_ADDRESS ( pClient->GetUseDefaultCentralServerAddress(),
pClient->GetServerListCentralServerAddress() );
// init the connect dialog and execute it (modal dialog)
ConnectDlg.Init ( strCurCentServAddr, pClient->vstrIPAddress );

View file

@ -479,15 +479,9 @@ void CLlconServerDlg::UpdateGUIDependencies()
// fire signals when we update the text.
edtCentralServerAddress->blockSignals ( true );
{
if ( bCurUseDefCentServAddr )
{
edtCentralServerAddress->setText ( DEFAULT_SERVER_ADDRESS );
}
else
{
edtCentralServerAddress->setText (
pServer->GetServerListCentralServerAddress() );
}
edtCentralServerAddress->setText (
SELECT_SERVER_ADDRESS ( bCurUseDefCentServAddr,
pServer->GetServerListCentralServerAddress() ) );
}
edtCentralServerAddress->blockSignals ( false );

View file

@ -399,15 +399,9 @@ void CServerListManager::SlaveServerRegisterServer ( const bool bIsRegister )
QMutexLocker locker ( &Mutex );
// get the correct central server address
QString strCurCentrServAddr;
if ( bUseDefaultCentralServerAddress )
{
strCurCentrServAddr = DEFAULT_SERVER_ADDRESS;
}
else
{
strCurCentrServAddr = strCentralServerAddress;
}
const QString strCurCentrServAddr =
SELECT_SERVER_ADDRESS ( bUseDefaultCentralServerAddress,
strCentralServerAddress );
// For the slave server, the slave server properties are store in the
// very first item in the server list (which is actually no server list