[libcalamares] Drop alternate-config handling for GeoIP

- Dealing with legacy formats and alternate configurations
   is something that consumers should do (and then hand off
   to the 3-string constructor) instead.
This commit is contained in:
Adriaan de Groot 2019-05-03 11:21:01 -04:00
parent fc76313ea6
commit 44cbb0d374
2 changed files with 6 additions and 15 deletions

View File

@ -74,19 +74,10 @@ Handler::Handler( const QString& implementation, const QString& url, const QStri
} }
} }
static QString
getMapAlternates( const QVariantMap& config, const QString& key1, const QString& key2 )
{
QString r = CalamaresUtils::getString( config, key1 );
if ( r.isEmpty() )
r = CalamaresUtils::getString( config, key2 );
return r;
}
Handler::Handler( const QVariantMap& config ) Handler::Handler( const QVariantMap& config )
: Handler( getMapAlternates( config, QStringLiteral( "style" ), QStringLiteral( "geoipStyle" ) ), : Handler( CalamaresUtils::getString( config, QStringLiteral( "style" ) ),
getMapAlternates( config, QStringLiteral( "url" ), QStringLiteral( "geoipUrl" ) ), CalamaresUtils::getString( config, QStringLiteral( "url" ) ),
getMapAlternates( config, QStringLiteral( "selector" ), QStringLiteral( "geoipSelector" ) ) ) CalamaresUtils::getString( config, QStringLiteral( "selector" ) ) )
{ {
} }

View File

@ -61,9 +61,9 @@ public:
* This is like the 3-QString Handler constructor, except the strings * This is like the 3-QString Handler constructor, except the strings
* are extracted from the map, which is typically part of the configuration * are extracted from the map, which is typically part of the configuration
* of a Calamares module. The strings are fetched from these keys: * of a Calamares module. The strings are fetched from these keys:
* - implementation from "style" or "geoipStyle" (if the first does not exist) * - implementation from "style"
* - url from "url" or "geoipUrl" (if the first does not exist) * - url from "url"
* - selector from "selector" or "geoipSelector" (if the first does not exist) * - selector from "selector"
*/ */
Handler( const QVariantMap& config ); Handler( const QVariantMap& config );