[libcalamaresui] Swap out unstructured string for structured data

This commit is contained in:
Adriaan de Groot 2020-08-04 01:31:22 +02:00
parent b5c0158ec2
commit ea709aab59
6 changed files with 11 additions and 10 deletions

View File

@ -193,7 +193,7 @@ DebugWindow::DebugWindow()
#endif #endif
] { ] {
QString moduleName = m_ui->modulesListView->currentIndex().data().toString(); QString moduleName = m_ui->modulesListView->currentIndex().data().toString();
Module* module = ModuleManager::instance()->moduleInstance( moduleName ); Module* module = ModuleManager::instance()->moduleInstance( ModuleSystem::InstanceKey::fromString( moduleName ) );
if ( module ) if ( module )
{ {
m_module = module->configurationMap(); m_module = module->configurationMap();

View File

@ -217,7 +217,7 @@ ExecViewModule::loadSelf()
auto* viewStep = new Calamares::ExecutionViewStep(); auto* viewStep = new Calamares::ExecutionViewStep();
viewStep->setModuleInstanceKey( instanceKey() ); viewStep->setModuleInstanceKey( instanceKey() );
viewStep->setConfigurationMap( m_configurationMap ); viewStep->setConfigurationMap( m_configurationMap );
viewStep->appendJobModuleInstanceKey( instanceKey().toString() ); viewStep->appendJobModuleInstanceKey( instanceKey() );
Calamares::ViewManager::instance()->addViewStep( viewStep ); Calamares::ViewManager::instance()->addViewStep( viewStep );
m_loaded = true; m_loaded = true;
} }

View File

@ -151,9 +151,9 @@ ModuleManager::moduleDescriptor( const QString& name )
} }
Module* Module*
ModuleManager::moduleInstance( const QString& instanceKey ) ModuleManager::moduleInstance( const ModuleSystem::InstanceKey& instanceKey )
{ {
return m_loadedModulesByInstanceKey.value( ModuleSystem::InstanceKey::fromString( instanceKey ) ); return m_loadedModulesByInstanceKey.value( instanceKey );
} }
@ -320,7 +320,7 @@ ModuleManager::loadModules()
ViewManager::instance()->addViewStep( evs ); ViewManager::instance()->addViewStep( evs );
} }
evs->appendJobModuleInstanceKey( instanceKey.toString() ); evs->appendJobModuleInstanceKey( instanceKey );
} }
} }
} }

View File

@ -76,7 +76,7 @@ public:
* @param instanceKey the instance key for a module instance. * @param instanceKey the instance key for a module instance.
* @return a pointer to an object of a subtype of Module. * @return a pointer to an object of a subtype of Module.
*/ */
Module* moduleInstance( const QString& instanceKey ); Module* moduleInstance( const ModuleSystem::InstanceKey& instanceKey );
/** /**
* @brief loadModules does all of the module loading operation. * @brief loadModules does all of the module loading operation.

View File

@ -147,7 +147,7 @@ ExecutionViewStep::onActivate()
m_slideshow->changeSlideShowState( Slideshow::Start ); m_slideshow->changeSlideShowState( Slideshow::Start );
JobQueue* queue = JobQueue::instance(); JobQueue* queue = JobQueue::instance();
foreach ( const QString& instanceKey, m_jobInstanceKeys ) for( const auto& instanceKey : m_jobInstanceKeys )
{ {
Calamares::Module* module = Calamares::ModuleManager::instance()->moduleInstance( instanceKey ); Calamares::Module* module = Calamares::ModuleManager::instance()->moduleInstance( instanceKey );
if ( module ) if ( module )
@ -176,7 +176,7 @@ ExecutionViewStep::jobs() const
void void
ExecutionViewStep::appendJobModuleInstanceKey( const QString& instanceKey ) ExecutionViewStep::appendJobModuleInstanceKey( const ModuleSystem::InstanceKey& instanceKey )
{ {
m_jobInstanceKeys.append( instanceKey ); m_jobInstanceKeys.append( instanceKey );
} }

View File

@ -21,6 +21,7 @@
#define EXECUTIONVIEWSTEP_H #define EXECUTIONVIEWSTEP_H
#include "ViewStep.h" #include "ViewStep.h"
#include "modulesystem/InstanceKey.h"
#include <QStringList> #include <QStringList>
@ -57,7 +58,7 @@ public:
JobList jobs() const override; JobList jobs() const override;
void appendJobModuleInstanceKey( const QString& instanceKey ); void appendJobModuleInstanceKey( const ModuleSystem::InstanceKey& instanceKey );
private: private:
QWidget* m_widget; QWidget* m_widget;
@ -65,7 +66,7 @@ private:
QLabel* m_label; QLabel* m_label;
Slideshow* m_slideshow; Slideshow* m_slideshow;
QStringList m_jobInstanceKeys; QList< ModuleSystem::InstanceKey > m_jobInstanceKeys;
void updateFromJobQueue( qreal percent, const QString& message ); void updateFromJobQueue( qreal percent, const QString& message );
}; };