[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;
|
||||
}
|
||||
|
||||
@ -133,22 +129,16 @@ ModuleManager::doInit()
|
||||
}
|
||||
// At this point m_availableDescriptorsByModuleName is filled with
|
||||
// the modules that were found in the search paths.
|
||||
cDebug() << "Found"
|
||||
<< m_availableDescriptorsByModuleName.count() << "modules"
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@ -195,8 +185,7 @@ ModuleManager::loadModules()
|
||||
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;
|
||||
@ -269,7 +258,8 @@ ModuleManager::loadModules()
|
||||
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