History log of /haiku/src/kits/shared/StringForRate.cpp
Revision Date Author Comments
# 28b96e10 21-Apr-2024 Máximo Castañeda <antiswen@yahoo.es>

IK, libshared: fix string formatting of size and rate

- Out of bounds index for values that would use a bigger unit than
available.
- Jumping from bytes to MiB, without using KiB despite being better.
- Wrong catalog key for base units.
- BSizeColumn showing incorrect values for sizes less than 1 MiB.
- Extraction of catalog messages for BSizeColumn.

Fixes: #18892
Change-Id: Ib36a30a29b425654ab569537b11c8c56093ddc2e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7626
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 1f5daef0 27-Feb-2024 Emir SARI <bitigchi@me.com>

ActivityMonitor: use BNumberFormat for i18n

Change-Id: I3179f84cbaee25624c2f4a7b092a28b5281a5f16
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7480
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>


# e54f86aa 01-Sep-2018 Augustin Cavalier <waddlesplash@gmail.com>

libshared: Change string_for_rate to use KiB/s instead of Kbps.

string_for_size uses KiB, etc., and so when the two are combined (e.g.
pkgman's progress display), it looked especially strange to have two
different units.


# eca55496 04-Feb-2015 Adrien Destugues <pulkomandy@gmail.com>

StringForRate: change the threshold for unit change.

We would show "1Mbps" for 1.0 to 1.9 actual speed, which made this not
so helpful. Instead, switch to Mbps when reaching 10000 Kbps. So we show
"1000 Kbps" or 1900Kbps" in the mentionned situation, and up to "9999
Kbps" (note this is still only 4 digits, so it stays readable). We then
switch to "10 Mbps", which is still only withing 12% of the actual speed
(but better than the previous error of up to 50%).

Fixes #11821.

Also use uppercase for the SI prefixes as it should be, and use %d
instead of %f for the bps rating as it is an integer.


# 8d87f2b4 25-Jun-2012 Philippe Saint-Pierre <stpere@gmail.com>

StringForRate()

Introduce a function to generate the string representation of a bitrate
(kbps, mbps, gbps, etc..)

* Factor out the code from MediaPlayer InfoWindow
* Allow different bases (/1000 or /1024)


# eca5549602dc9d51fb4ac0c3273033285bb1372b 04-Feb-2015 Adrien Destugues <pulkomandy@gmail.com>

StringForRate: change the threshold for unit change.

We would show "1Mbps" for 1.0 to 1.9 actual speed, which made this not
so helpful. Instead, switch to Mbps when reaching 10000 Kbps. So we show
"1000 Kbps" or 1900Kbps" in the mentionned situation, and up to "9999
Kbps" (note this is still only 4 digits, so it stays readable). We then
switch to "10 Mbps", which is still only withing 12% of the actual speed
(but better than the previous error of up to 50%).

Fixes #11821.

Also use uppercase for the SI prefixes as it should be, and use %d
instead of %f for the bps rating as it is an integer.


# 8d87f2b43afbba4bdeb052163cee6b70dba8974d 25-Jun-2012 Philippe Saint-Pierre <stpere@gmail.com>

StringForRate()

Introduce a function to generate the string representation of a bitrate
(kbps, mbps, gbps, etc..)

* Factor out the code from MediaPlayer InfoWindow
* Allow different bases (/1000 or /1024)