Public Member Functions | |
long double | estimatedTimeUntilArrival () const |
In seconds. More... | |
qint64 | expectedDataSize () const |
long double | getSpeed () const |
In bytes per second. More... | |
qint64 | lastRegisterAttemptedDataAmount () const |
Last amount of data that was passed to registerDataAmount() More... | |
qint64 | lastRegisteredDataAmount () const |
Last amount of data registered through registerDataAmount() method. More... | |
void | registerDataAmount (qint64 totalAmountOfArrivedData) |
Register new total amount of data. More... | |
void | setExpectedDataSize (qint64 size) |
Maximum expected size of the data. More... | |
void | start () |
Clears all values. Prepares SpeedCalculator for new speed measure. More... | |
Definition at line 29 of file speedcalculator.h.
long double SpeedCalculator::estimatedTimeUntilArrival | ( | ) | const |
In seconds.
Definition at line 31 of file speedcalculator.cpp.
long double SpeedCalculator::getSpeed | ( | ) | const |
In bytes per second.
Definition at line 52 of file speedcalculator.cpp.
|
inline |
Last amount of data that was passed to registerDataAmount()
It doesn't matter whether the data was actually registered for the speed calculation or not.
Definition at line 67 of file speedcalculator.h.
qint64 SpeedCalculator::lastRegisteredDataAmount | ( | ) | const |
Last amount of data registered through registerDataAmount() method.
If SpeedCalculator is used properly this will equal to total amount of downloaded data.
Definition at line 74 of file speedcalculator.cpp.
void SpeedCalculator::registerDataAmount | ( | qint64 | totalAmountOfArrivedData | ) |
Register new total amount of data.
This will be used to calculate speed and ETA. Internally this will store data only once per second. It is not a problem to call this method more often as in such case it will change no data inside the object of this class.
Definition at line 84 of file speedcalculator.cpp.
void SpeedCalculator::setExpectedDataSize | ( | qint64 | size | ) |
Maximum expected size of the data.
This value is used to calculate ETA.
Definition at line 109 of file speedcalculator.cpp.
void SpeedCalculator::start | ( | ) |
Clears all values. Prepares SpeedCalculator for new speed measure.
This will clear arrivalData and dataSizeExpected variables and restart the clock.
Definition at line 114 of file speedcalculator.cpp.