From 63ebc28a182db63820dffdc8bf4a895844456417 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Mon, 20 Jul 2020 15:44:00 +0200 Subject: [PATCH] if network name/address contains spaces, they are removed now, coded by dingodoppelt (#462) --- ChangeLog | 3 +++ src/clientsettingsdlg.cpp | 2 +- src/connectdlg.cpp | 3 +-- src/main.cpp | 2 +- src/util.cpp | 6 ++++++ src/util.h | 1 + 6 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0e16d225..ef5149ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ - do not change the server list order if the mouse is over the table to avoid selecting an incorrect server on a mouse double click (#293) +- if network name/address contains spaces, they are removed now, + coded by dingodoppelt (#462) + TODO improve compact channels: smaller font size of name is too long diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index 1e3e6215..048345de 100755 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -676,7 +676,7 @@ void CClientSettingsDlg::OnCentralServerAddressEditingFinished() { // store new setting in the client pClient->SetServerListCentralServerAddress ( - edtCentralServerAddress->text() ); + NetworkUtil::FixAddress ( edtCentralServerAddress->text() ) ); } void CClientSettingsDlg::OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button ) diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index 71ac9be7..cbe015f2 100755 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -658,8 +658,7 @@ void CConnectDlg::OnConnectClicked() } else { - // remove all spaces from the parsed string in the the combo box - strSelectedAddress = cbxServerAddr->currentText().simplified().replace ( " ", "" ); + strSelectedAddress = NetworkUtil::FixAddress ( cbxServerAddr->currentText() ); } // tell the parent window that the connection shall be initiated diff --git a/src/main.cpp b/src/main.cpp index 1684700f..1f3674d3 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -462,7 +462,7 @@ int main ( int argc, char** argv ) "--connect", strArgument ) ) { - strConnOnStartupAddress = strArgument.simplified().replace( " ", "" ); + strConnOnStartupAddress = NetworkUtil::FixAddress ( strArgument ); tsConsole << "- connect on startup to address: " << strConnOnStartupAddress << endl; continue; } diff --git a/src/util.cpp b/src/util.cpp index d0154552..0ee137ed 100755 --- a/src/util.cpp +++ b/src/util.cpp @@ -1061,6 +1061,12 @@ QString NetworkUtil::GetCentralServerAddress ( const ECSAddType eCentralServerAd } } +QString NetworkUtil::FixAddress ( const QString& strAddress ) +{ + // remove all spaces from the address string + return strAddress.simplified().replace ( " ", "" ); +} + // Instrument picture data base ------------------------------------------------ CVector& CInstPictures::GetTable ( const bool bReGenerateTable ) diff --git a/src/util.h b/src/util.h index d279d89d..e6423010 100755 --- a/src/util.h +++ b/src/util.h @@ -1112,6 +1112,7 @@ public: static bool ParseNetworkAddress ( QString strAddress, CHostAddress& HostAddress ); + static QString FixAddress ( const QString& strAddress ); static CHostAddress GetLocalAddress(); static QString GetCentralServerAddress ( const ECSAddType eCentralServerAddressType, const QString& strCentralServerAddress );