[libcalamaresui] Support noconfig setting

- look up the descriptor and use its noconfig value
 - return empty QString if noconfig is set; this does not
   apply to custom instances
This commit is contained in:
Adriaan de Groot 2020-01-21 19:45:47 +01:00
parent 649eb94d24
commit 58931d99fa

View File

@ -182,7 +182,8 @@ findCustomInstance( const Settings::InstanceDescriptionList& customInstances, co
*/ */
static QString static QString
getConfigFileName( const Settings::InstanceDescriptionList& customInstances, getConfigFileName( const Settings::InstanceDescriptionList& customInstances,
const ModuleSystem::InstanceKey& instanceKey ) const ModuleSystem::InstanceKey& instanceKey,
const ModuleManager::ModuleDescriptor& descriptor )
{ {
if ( instanceKey.isCustom() ) if ( instanceKey.isCustom() )
{ {
@ -198,6 +199,14 @@ getConfigFileName( const Settings::InstanceDescriptionList& customInstances,
} }
else else
{ {
if ( descriptor.value( "noconfig", false ).toBool() )
{
// Explicitly set to no-configuration. This doesn't apply
// to custom instances (above) since the only reason to
// **have** a custom instance is to specify a different
// config file for more than one module.
return QString();
}
return QString( "%1.conf" ).arg( instanceKey.module() ); return QString( "%1.conf" ).arg( instanceKey.module() );
} }
} }
@ -237,8 +246,9 @@ ModuleManager::loadModules()
} }
} }
if ( !m_availableDescriptorsByModuleName.contains( instanceKey.module() ) ModuleDescriptor descriptor
|| m_availableDescriptorsByModuleName.value( instanceKey.module() ).isEmpty() ) = m_availableDescriptorsByModuleName.value( instanceKey.module(), ModuleDescriptor() );
if ( descriptor.isEmpty() )
{ {
cError() << "Module" << instanceKey.toString() << "not found in module search paths." cError() << "Module" << instanceKey.toString() << "not found in module search paths."
<< Logger::DebugList( m_paths ); << Logger::DebugList( m_paths );
@ -246,7 +256,7 @@ ModuleManager::loadModules()
continue; continue;
} }
QString configFileName = getConfigFileName( customInstances, instanceKey ); QString configFileName = getConfigFileName( customInstances, instanceKey, descriptor );
// So now we can assume that the module entry is at least valid, // So now we can assume that the module entry is at least valid,
// that we have a descriptor on hand (and therefore that the // that we have a descriptor on hand (and therefore that the