TaskProgress: Add setHalfLifeTimePerTask()

Make it possible to specify expected half-life time per task.
Make TaskProgress more fluent (50 Hz).
Use exponential interpolation for TaskProgress.
Set 30 seconds half-life time for UpdateInfoPlugin.

Change-Id: I1b8a147f259caf6a11fbe06afd8cfe6d4606bb02
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-12-04 08:10:55 +01:00
parent 88728a414c
commit b009eff301
4 changed files with 14 additions and 9 deletions

View File

@@ -24,7 +24,7 @@ int interpolateLinear(int x, int x1, int x2, int y1, int y2)
return y2;
const int numerator = (y2 - y1) * x + x2 * y1 - x1 * y2;
const int denominator = x2 - x1;
return qRound((double)numerator / denominator);
return qRound(double(numerator) / denominator);
}
/*!
@@ -39,7 +39,7 @@ int interpolateTangential(int x, int xHalfLife, int y1, int y2)
return y1;
if (y1 == y2)
return y1;
const double angle = atan2((double)x, (double)xHalfLife);
const double angle = atan2(double(x), double(xHalfLife));
const double result = y1 + (y2 - y1) * angle * 2 / M_PI;
return qRound(result);
}
@@ -56,7 +56,7 @@ int interpolateExponential(int x, int xHalfLife, int y1, int y2)
return y1;
if (y1 == y2)
return y1;
const double exponent = pow(0.5, (double)x / xHalfLife);
const double exponent = pow(0.5, double(x) / xHalfLife);
const double result = y1 + (y2 - y1) * (1.0 - exponent);
return qRound(result);
}