diff --git a/src/libcalamares/Settings.cpp b/src/libcalamares/Settings.cpp index a05474216..3252e706f 100644 --- a/src/libcalamares/Settings.cpp +++ b/src/libcalamares/Settings.cpp @@ -210,7 +210,13 @@ interpretSequence( const YAML::Node& node, Settings::ModuleSequence& moduleSeque } QStringList thisActionRoster = sequenceVListItem.toMap().value( thisActionS ).toStringList(); - moduleSequence.append( qMakePair( thisAction, thisActionRoster ) ); + Calamares::ModuleSystem::InstanceKeyList roster; + roster.reserve( thisActionRoster.count() ); + std::transform( thisActionRoster.constBegin(), + thisActionRoster.constEnd(), + std::back_inserter( roster ), + []( const QString& s ) { return Calamares::ModuleSystem::InstanceKey::fromString( s ); } ); + moduleSequence.append( qMakePair( thisAction, roster ) ); } } else @@ -262,24 +268,23 @@ Settings::validateSequence() // Check the sequence against the existing instances (which so far are only custom) for ( const auto& step : m_modulesSequence ) { - for ( const auto& instance : step.second ) + for ( const auto& instanceKey : step.second ) { - Calamares::ModuleSystem::InstanceKey k = Calamares::ModuleSystem::InstanceKey::fromString( instance ); - if ( !k.isValid() ) + if ( !instanceKey.isValid() ) { - cWarning() << "Invalid instance key in *sequence*," << instance; + cWarning() << "Invalid instance key in *sequence*," << instanceKey; continue; } - targetKey = k; + targetKey = instanceKey; const auto it = std::find_if( m_moduleInstances.constBegin(), m_moduleInstances.constEnd(), moduleFinder ); if ( it == m_moduleInstances.constEnd() ) { - if ( k.isCustom() ) + if ( instanceKey.isCustom() ) { - cWarning() << "Custom instance key" << instance << "is not listed in the *instances*"; + cWarning() << "Custom instance key" << instanceKey << "is not listed in the *instances*"; } - m_moduleInstances.append( InstanceDescription( k ) ); + m_moduleInstances.append( InstanceDescription( instanceKey ) ); } } } diff --git a/src/libcalamares/Settings.h b/src/libcalamares/Settings.h index d06a97716..6ebccfb43 100644 --- a/src/libcalamares/Settings.h +++ b/src/libcalamares/Settings.h @@ -110,7 +110,7 @@ public: */ InstanceDescriptionList moduleInstances() const; - using ModuleSequence = QList< QPair< ModuleSystem::Action, QStringList > >; + using ModuleSequence = QList< QPair< ModuleSystem::Action, Calamares::ModuleSystem::InstanceKeyList > >; /** @brief Representation of *sequence* of execution * * Each "section" of the *sequence* key in `settings.conf` gets an diff --git a/src/libcalamares/modulesystem/InstanceKey.h b/src/libcalamares/modulesystem/InstanceKey.h index 0bfa636f1..074743bf3 100644 --- a/src/libcalamares/modulesystem/InstanceKey.h +++ b/src/libcalamares/modulesystem/InstanceKey.h @@ -22,6 +22,7 @@ #define MODULESYSTEM_INSTANCEKEY_H #include +#include #include #include @@ -96,6 +97,8 @@ private: } }; +using InstanceKeyList = QList< InstanceKey >; + QDebug& operator<<( QDebug& s, const Calamares::ModuleSystem::InstanceKey& i ); } // namespace ModuleSystem