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

@ -527,16 +527,10 @@ void CClientSettingsDlg::UpdateCentralServerDependency()
// the default server and is not editable. Make sure the line edit does not // the default server and is not editable. Make sure the line edit does not
// fire signals when we update the text. // fire signals when we update the text.
edtCentralServerAddress->blockSignals ( true ); edtCentralServerAddress->blockSignals ( true );
{
if ( bCurUseDefCentServAddr )
{
edtCentralServerAddress->setText ( DEFAULT_SERVER_ADDRESS );
}
else
{ {
edtCentralServerAddress->setText ( edtCentralServerAddress->setText (
pClient->GetServerListCentralServerAddress() ); SELECT_SERVER_ADDRESS ( bCurUseDefCentServAddr,
} pClient->GetServerListCentralServerAddress() ) );
} }
edtCentralServerAddress->blockSignals ( false ); edtCentralServerAddress->blockSignals ( false );

View file

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

View file

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

View file

@ -478,16 +478,10 @@ void CLlconServerDlg::UpdateGUIDependencies()
// the default server and is not editable. Make sure the line edit does not // the default server and is not editable. Make sure the line edit does not
// fire signals when we update the text. // fire signals when we update the text.
edtCentralServerAddress->blockSignals ( true ); edtCentralServerAddress->blockSignals ( true );
{
if ( bCurUseDefCentServAddr )
{
edtCentralServerAddress->setText ( DEFAULT_SERVER_ADDRESS );
}
else
{ {
edtCentralServerAddress->setText ( edtCentralServerAddress->setText (
pServer->GetServerListCentralServerAddress() ); SELECT_SERVER_ADDRESS ( bCurUseDefCentServAddr,
} pServer->GetServerListCentralServerAddress() ) );
} }
edtCentralServerAddress->blockSignals ( false ); edtCentralServerAddress->blockSignals ( false );

View file

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