[libcalamaresui] Change return type of loadedInstanceKeys()
- Replace stringlist with a stronger-typed list of InstanceKey objects - Move smashing-that-to-stringlist into consumers of the list (just one, the debug window)
This commit is contained in:
parent
c482990bc5
commit
fed0c46612
@ -113,7 +113,13 @@ DebugWindow::DebugWindow()
|
||||
} );
|
||||
|
||||
// Modules page
|
||||
QStringListModel* modulesModel = new QStringListModel( ModuleManager::instance()->loadedInstanceKeys() );
|
||||
QStringList modulesKeys;
|
||||
for ( const auto& m : ModuleManager::instance()->loadedInstanceKeys() )
|
||||
{
|
||||
modulesKeys << m.toString();
|
||||
}
|
||||
|
||||
QStringListModel* modulesModel = new QStringListModel( modulesKeys );
|
||||
m_ui->modulesListView->setModel( modulesModel );
|
||||
m_ui->modulesListView->setSelectionMode( QAbstractItemView::SingleSelection );
|
||||
|
||||
|
@ -95,16 +95,12 @@ ModuleManager::doInit()
|
||||
QFileInfo descriptorFileInfo( currentDir.absoluteFilePath( QLatin1String( "module.desc" ) ) );
|
||||
if ( !descriptorFileInfo.exists() )
|
||||
{
|
||||
cDebug() << bad_descriptor
|
||||
<< descriptorFileInfo.absoluteFilePath()
|
||||
<< "(missing)";
|
||||
cDebug() << bad_descriptor << descriptorFileInfo.absoluteFilePath() << "(missing)";
|
||||
continue;
|
||||
}
|
||||
if ( !descriptorFileInfo.isReadable() )
|
||||
{
|
||||
cDebug() << bad_descriptor
|
||||
<< descriptorFileInfo.absoluteFilePath()
|
||||
<< "(unreadable)";
|
||||
cDebug() << bad_descriptor << descriptorFileInfo.absoluteFilePath() << "(unreadable)";
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -131,24 +127,18 @@ ModuleManager::doInit()
|
||||
cDebug() << "ModuleManager module search path does not exist:" << path;
|
||||
}
|
||||
}
|
||||
// At this point m_availableDescriptorsByModuleName is filled with
|
||||
// At this point m_availableDescriptorsByModuleName is filled with
|
||||
// the modules that were found in the search paths.
|
||||
cDebug() << "Found"
|
||||
<< m_availableDescriptorsByModuleName.count() << "modules"
|
||||
<< m_moduleDirectoriesByModuleName.count() << "names";
|
||||
cDebug() << "Found" << m_availableDescriptorsByModuleName.count() << "modules"
|
||||
<< m_moduleDirectoriesByModuleName.count() << "names";
|
||||
emit initDone();
|
||||
}
|
||||
|
||||
|
||||
QStringList
|
||||
QList< ModuleSystem::InstanceKey >
|
||||
ModuleManager::loadedInstanceKeys()
|
||||
{
|
||||
QStringList l;
|
||||
for ( const auto& m : m_loadedModulesByInstanceKey.keys() )
|
||||
{
|
||||
l << m.toString();
|
||||
}
|
||||
return l;
|
||||
return m_loadedModulesByInstanceKey.keys();
|
||||
}
|
||||
|
||||
|
||||
@ -188,15 +178,14 @@ findCustomInstance( const Settings::InstanceDescriptionList& customInstances, co
|
||||
void
|
||||
ModuleManager::loadModules()
|
||||
{
|
||||
if (checkDependencies())
|
||||
if ( checkDependencies() )
|
||||
{
|
||||
cWarning() << "Some installed modules have unmet dependencies.";
|
||||
}
|
||||
Settings::InstanceDescriptionList customInstances = Settings::instance()->customModuleInstances();
|
||||
|
||||
QStringList failedModules;
|
||||
const auto modulesSequence
|
||||
= Settings::instance()->modulesSequence() ;
|
||||
const auto modulesSequence = Settings::instance()->modulesSequence();
|
||||
for ( const auto& modulePhase : modulesSequence )
|
||||
{
|
||||
ModuleSystem::Action currentAction = modulePhase.first;
|
||||
@ -213,10 +202,10 @@ ModuleManager::loadModules()
|
||||
|
||||
|
||||
if ( !m_availableDescriptorsByModuleName.contains( instanceKey.module() )
|
||||
|| m_availableDescriptorsByModuleName.value( instanceKey.module() ).isEmpty() )
|
||||
|| m_availableDescriptorsByModuleName.value( instanceKey.module() ).isEmpty() )
|
||||
{
|
||||
cError() << "Module" << instanceKey.toString() << "not found in module search paths."
|
||||
<< Logger::DebugList( m_paths );
|
||||
<< Logger::DebugList( m_paths );
|
||||
failedModules.append( instanceKey.toString() );
|
||||
continue;
|
||||
}
|
||||
@ -264,12 +253,13 @@ ModuleManager::loadModules()
|
||||
else
|
||||
{
|
||||
thisModule = Module::fromDescriptor( m_availableDescriptorsByModuleName.value( instanceKey.module() ),
|
||||
instanceKey.id(),
|
||||
configFileName,
|
||||
m_moduleDirectoriesByModuleName.value( instanceKey.module() ) );
|
||||
instanceKey.id(),
|
||||
configFileName,
|
||||
m_moduleDirectoriesByModuleName.value( instanceKey.module() ) );
|
||||
if ( !thisModule )
|
||||
{
|
||||
cError() << "Module" << instanceKey.toString() << "cannot be created from descriptor" << configFileName;
|
||||
cError() << "Module" << instanceKey.toString() << "cannot be created from descriptor"
|
||||
<< configFileName;
|
||||
failedModules.append( instanceKey.toString() );
|
||||
continue;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
* modules.
|
||||
* @return a QStringList with the instance keys.
|
||||
*/
|
||||
QStringList loadedInstanceKeys();
|
||||
QList< ModuleSystem::InstanceKey > loadedInstanceKeys();
|
||||
|
||||
/**
|
||||
* @brief moduleDescriptor returns the module descriptor structure for a given module.
|
||||
|
Loading…
Reference in New Issue
Block a user