From 5a24e45e3b1522e4f9239ff1a12a4a08c37fe4fc Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 7 Sep 2019 15:58:56 +0200 Subject: [PATCH] [locale] Factor out a simple lambda - If this was handed to an algorithm it would make more sense as a lambda --- src/modules/locale/LocalePage.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/modules/locale/LocalePage.cpp b/src/modules/locale/LocalePage.cpp index ecca8ca28..d3829aad3 100644 --- a/src/modules/locale/LocalePage.cpp +++ b/src/modules/locale/LocalePage.cpp @@ -127,6 +127,18 @@ LocalePage::updateLocaleLabels() m_formatsLabel->setText( labels.second ); } +static inline bool +containsLocation( const QList< LocaleGlobal::Location >& locations, const QString& zone ) +{ + for ( const LocaleGlobal::Location& location : locations ) + { + if ( location.zone == zone ) + { + return true; + } + } + return false; +} void LocalePage::init( const QString& initialRegion, const QString& initialZone, const QString& localeGenPath ) @@ -150,18 +162,6 @@ LocalePage::init( const QString& initialRegion, const QString& initialZone, cons m_regionCombo->currentIndexChanged( m_regionCombo->currentIndex() ); - // Default location - auto containsLocation = []( const QList< LocaleGlobal::Location >& locations, const QString& zone ) -> bool { - for ( const LocaleGlobal::Location& location : locations ) - { - if ( location.zone == zone ) - { - return true; - } - } - return false; - }; - if ( keys.contains( initialRegion ) && containsLocation( regions.value( initialRegion ), initialZone ) ) { m_tzWidget->setCurrentLocation( initialRegion, initialZone );