[partition] Distinguish jobs with updatePreview()

main
Adriaan de Groot 5 years ago
parent 62579e0f42
commit 20b477d063

@ -50,6 +50,7 @@
#include "partition/PartitionIterator.h" #include "partition/PartitionIterator.h"
#include "partition/PartitionQuery.h" #include "partition/PartitionQuery.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/Traits.h"
#include "utils/Variant.h" #include "utils/Variant.h"
// KPMcore // KPMcore
@ -106,6 +107,26 @@ private:
//- DeviceInfo --------------------------------------------- //- DeviceInfo ---------------------------------------------
// Some jobs have an updatePreview some don't
DECLARE_HAS_METHOD(updatePreview)
template< typename Job >
void updatePreview( Job* job, const std::true_type& )
{
job->updatePreview();
}
template< typename Job >
void updatePreview( Job* job, const std::false_type& )
{
}
template< typename Job >
void updatePreview( Job* job )
{
updatePreview(job, has_updatePreview<Job>{});
}
/** /**
* Owns the Device, PartitionModel and the jobs * Owns the Device, PartitionModel and the jobs
*/ */
@ -129,7 +150,7 @@ struct PartitionCoreModule::DeviceInfo
Calamares::Job* makeJob(Args... a) Calamares::Job* makeJob(Args... a)
{ {
auto* job = new Job( device.get(), a... ); auto* job = new Job( device.get(), a... );
job->updatePreview(); updatePreview( job );
m_jobs << Calamares::job_ptr( job ); m_jobs << Calamares::job_ptr( job );
return job; return job;
} }

Loading…
Cancel
Save