From 8fd59dd93f399b1657e68fcc2e37bbf5d2f23796 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 12 Apr 2020 14:54:28 +0200 Subject: [PATCH] split country names by upper case latters by inserting a space --- ChangeLog | 7 ++++--- src/connectdlg.cpp | 27 +++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9bca467c..02cec880 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,7 +3,8 @@ 3.4.8git -TODO split country names by upper case latters by inserting a space + * refresh server list if the Central Server address type is changed + TODO fix UpdateCurLevel() for new 64 samples frame size @@ -16,10 +17,10 @@ TODO for different frame sizes (64/128) the start value of 6 for the jitter buff TODO offer the Jamulus ASIO settingspanel in case of an ASIO ERROR to fix, e.g., incorrect sample rate (https://sourceforge.net/p/llcon/discussion/533517/thread/777663cf94/#035f) TODO client: larger sound card buffers are managed by conversion buffer, not in processintern for loop (note iSndCrdFrameSizeFactor!) - -TODO should LHostAddr be QHostAddress instead of CHostAddress? + maybe let the use select all possible sound card buffer sizes, this should solve Ticket #53 TODO store Central Server jamulus.server start scripts on the Repo (one for Central Server, one for Central Server North America) +TODO should LHostAddr be QHostAddress instead of CHostAddress? See https://github.com/corrados/jamulus/pull/48#issuecomment-612594981 diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index 6c773421..88d788d2 100755 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -115,6 +115,12 @@ CConnectDlg::CConnectDlg ( const bool bNewShowCompleteRegList, // make sure the connect button has the focus butConnect->setFocus(); + // for "show all servers" mode make sort by click on header possible + if ( bShowCompleteRegList ) + { + lvwServers->setSortingEnabled ( true ); + } + #ifdef ANDROID // for the android version maximize the window setWindowState ( Qt::WindowMaximized ); @@ -288,7 +294,7 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr, // in case of all servers shown, add the registration number at the beginning if ( bShowCompleteRegList ) { - pNewListViewItem->setText ( 0, QString ( "%1: " ).arg ( 1 + iIdx ) + pNewListViewItem->text ( 0 ) ); + pNewListViewItem->setText ( 0, QString ( "%1: " ).arg ( 1 + iIdx, 3 ) + pNewListViewItem->text ( 0 ) ); } // show server name in bold font if it is a permanent server @@ -309,9 +315,26 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr, { strLocation += ", "; } + if ( vecServerInfo[iIdx].eCountry != QLocale::AnyCountry ) { - strLocation += QLocale::countryToString ( vecServerInfo[iIdx].eCountry ); + QString strCountryToString = QLocale::countryToString ( vecServerInfo[iIdx].eCountry ); + + // Qt countryToString does not use spaces in between country name + // parts but they use upper case letters which we can detect and + // insert spaces as a post processing + if ( !strCountryToString.contains ( " " ) ) + { + QRegularExpressionMatchIterator reMatchIt = QRegularExpression ( "[A-Z][^A-Z]*" ).globalMatch ( strCountryToString ); + QStringList slNames; + while ( reMatchIt.hasNext() ) + { + slNames << reMatchIt.next().capturedTexts(); + } + strCountryToString = slNames.join ( " " ); + } + + strLocation += strCountryToString; } pNewListViewItem->setText ( 3, strLocation );