From 42f5ed5d4138b1e3682df4a7b5ce1da587d0f511 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 23 Apr 2018 10:47:25 -0400 Subject: [PATCH] [welcome] Fix build, reduce redundancy - constexpr isn't applicable because of non-trivial destructor - May as well only create " (%1)" once. FIXES #938 --- CMakeLists.txt | 2 ++ src/modules/welcome/WelcomePage.cpp | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e8075c857..3071f626a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,8 @@ if(NOT CMAKE_VERSION VERSION_LESS "3.10.0") ) endif() + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall" ) + if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) message( STATUS "Found Clang ${CMAKE_CXX_COMPILER_VERSION}, setting up Clang-specific compiler flags." ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall" ) diff --git a/src/modules/welcome/WelcomePage.cpp b/src/modules/welcome/WelcomePage.cpp index 5d47e2150..16e44d72e 100644 --- a/src/modules/welcome/WelcomePage.cpp +++ b/src/modules/welcome/WelcomePage.cpp @@ -143,12 +143,13 @@ struct LocaleLabel if ( locale.contains( '_' ) && QLocale::countriesForLanguage( m_locale.language() ).count() > 2 ) { - sortKey.append( QString( " (%1)" ) - .arg( QLocale::countryToString( m_locale.country() ) ) ); + QLatin1Literal countrySuffix( " (%1)" ); + + sortKey.append( QString( countrySuffix ).arg( QLocale::countryToString( m_locale.country() ) ) ); // If the language name is RTL, make this parenthetical addition RTL as well. QString countryFormat = label.isRightToLeft() ? QString( QChar( 0x202B ) ) : QString(); - countryFormat.append( QLatin1String( " (%1)" ) ); + countryFormat.append( countrySuffix ); label.append( countryFormat.arg( m_locale.nativeCountryName() ) ); } @@ -179,7 +180,7 @@ struct LocaleLabel * en_US and en (American English) is defined as English. The Queen's * English -- proper English -- is relegated to non-English status. */ - constexpr bool isEnglish() const + bool isEnglish() const { return m_localeId == QLatin1Literal( "en_US" ) || m_localeId == QLatin1Literal( "en" ); }