mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-28 09:55:37 -04:00
[keyboard] Simplify config-loading
The machinery in `setConfigurationMap()` was just duplicating checks already in place in the `getString()` and `getBool()` methods, and there's no special need for efficiency here, so prefer the more readable and short code. ("efficiency" here means "we're saving one method call in case the configuration is not set")
This commit is contained in:
parent
e7b39303e4
commit
b191f39bdf
1 changed files with 6 additions and 29 deletions
|
@ -528,37 +528,14 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
|||
{
|
||||
using namespace CalamaresUtils;
|
||||
|
||||
if ( configurationMap.contains( "xOrgConfFileName" )
|
||||
&& configurationMap.value( "xOrgConfFileName" ).type() == QVariant::String
|
||||
&& !getString( configurationMap, "xOrgConfFileName" ).isEmpty() )
|
||||
const auto xorgConfDefault = QStringLiteral( "00-keyboard.conf" );
|
||||
m_xOrgConfFileName = getString( configurationMap, "xOrgConfFileName", xorgConfDefault );
|
||||
if ( m_xOrgConfFileName.isEmpty() )
|
||||
{
|
||||
m_xOrgConfFileName = getString( configurationMap, "xOrgConfFileName" );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_xOrgConfFileName = "00-keyboard.conf";
|
||||
}
|
||||
|
||||
if ( configurationMap.contains( "convertedKeymapPath" )
|
||||
&& configurationMap.value( "convertedKeymapPath" ).type() == QVariant::String
|
||||
&& !getString( configurationMap, "convertedKeymapPath" ).isEmpty() )
|
||||
{
|
||||
m_convertedKeymapPath = getString( configurationMap, "convertedKeymapPath" );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_convertedKeymapPath = QString();
|
||||
}
|
||||
|
||||
if ( configurationMap.contains( "writeEtcDefaultKeyboard" )
|
||||
&& configurationMap.value( "writeEtcDefaultKeyboard" ).type() == QVariant::Bool )
|
||||
{
|
||||
m_writeEtcDefaultKeyboard = getBool( configurationMap, "writeEtcDefaultKeyboard", true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_writeEtcDefaultKeyboard = true;
|
||||
m_xOrgConfFileName = xorgConfDefault;
|
||||
}
|
||||
m_convertedKeymapPath = getString( configurationMap, "convertedKeymapPath" );
|
||||
m_writeEtcDefaultKeyboard = getBool( configurationMap, "writeEtcDefaultKeyboard", true );
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue