diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index 0cfd80af..5e821ccb 100755 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -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 ); diff --git a/src/global.h b/src/global.h index f934a064..2d8b9d84 100755 --- a/src/global.h +++ b/src/global.h @@ -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" diff --git a/src/llconclientdlg.cpp b/src/llconclientdlg.cpp index d1561791..233fbeed 100755 --- a/src/llconclientdlg.cpp +++ b/src/llconclientdlg.cpp @@ -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 ); diff --git a/src/llconserverdlg.cpp b/src/llconserverdlg.cpp index 5a17b54c..ff5acec7 100755 --- a/src/llconserverdlg.cpp +++ b/src/llconserverdlg.cpp @@ -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 ); diff --git a/src/serverlist.cpp b/src/serverlist.cpp index 4f0bcbd0..e08f526c 100755 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -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