From a91ef65a37f366324444acabdcd84cc6e8939e23 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 12 Aug 2020 16:08:37 +0200 Subject: [PATCH] [libcalamares] Make job weights integers --- src/libcalamares/Job.cpp | 6 +++--- src/libcalamares/Job.h | 10 ++++++++-- src/libcalamares/PythonJob.cpp | 6 ------ src/libcalamares/PythonJob.h | 2 -- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/libcalamares/Job.cpp b/src/libcalamares/Job.cpp index 95339f349..a7e67b5f6 100644 --- a/src/libcalamares/Job.cpp +++ b/src/libcalamares/Job.cpp @@ -1,5 +1,5 @@ /* === This file is part of Calamares - === - * + * * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac * * Calamares is free software: you can redistribute it and/or modify @@ -101,10 +101,10 @@ Job::Job( QObject* parent ) Job::~Job() {} -qreal +int Job::getJobWeight() const { - return qreal( 1.0 ); + return 1; } diff --git a/src/libcalamares/Job.h b/src/libcalamares/Job.h index 41674cfff..dd13f8608 100644 --- a/src/libcalamares/Job.h +++ b/src/libcalamares/Job.h @@ -100,13 +100,19 @@ public: /** @brief The job's (relative) weight. * - * The default implementation returns 1.0, which gives all jobs + * The default implementation returns 1, which gives all jobs * the same weight, so they advance the overall progress the same * amount. This is nonsense, since some jobs take much longer than * others; it's up to the individual jobs to say something about * how much work is (relatively) done. + * + * Since jobs are caused by **modules** from the sequence, the + * overall weight of the module is taken into account: its weight + * is divided among the jobs based on each jobs relative weight. + * This can be used in a module that runs a bunch of jobs to indicate + * which of the jobs is "heavy" and which is not. */ - virtual qreal getJobWeight() const; + virtual int getJobWeight() const; /** @brief The human-readable name of this job * * This should be a very short statement of what the job does. diff --git a/src/libcalamares/PythonJob.cpp b/src/libcalamares/PythonJob.cpp index 87091101e..c1cfbbc1c 100644 --- a/src/libcalamares/PythonJob.cpp +++ b/src/libcalamares/PythonJob.cpp @@ -190,12 +190,6 @@ PythonJob::PythonJob( const ModuleSystem::InstanceKey& instance, PythonJob::~PythonJob() {} -qreal -PythonJob::getJobWeight() const -{ - return 1.0; -} - QString PythonJob::prettyName() const { diff --git a/src/libcalamares/PythonJob.h b/src/libcalamares/PythonJob.h index 6efc45e7f..b34b40b0b 100644 --- a/src/libcalamares/PythonJob.h +++ b/src/libcalamares/PythonJob.h @@ -55,8 +55,6 @@ public: QString prettyStatusMessage() const override; JobResult exec() override; - virtual qreal getJobWeight() const override; - private: struct Private;