feat(network): Ability to change speed unit text (B/s) (#2068)

New config option `speed-unit = B/s` will be used to suffix the upload and download speeds.

* mod::network: udspeed-unit to set network speed unit suffix

* Changed udspeed-unit to speed-unit
This commit is contained in:
Thibaut CHARLES
2020-11-29 14:15:27 +01:00
committed by GitHub
parent 52eee95bf8
commit 50d8a1ba06
4 changed files with 15 additions and 13 deletions

View File

@ -21,6 +21,7 @@ namespace modules {
m_accumulate = m_conf.get(name(), "accumulate-stats", m_accumulate);
m_interval = m_conf.get<decltype(m_interval)>(name(), "interval", 1s);
m_unknown_up = m_conf.get<bool>(name(), "unknown-as-up", false);
m_udspeed_unit = m_conf.get<string>(name(), "speed-unit", m_udspeed_unit);
m_conf.warn_deprecated(name(), "udspeed-minwidth", "%downspeed:min:max% and %upspeed:min:max%");
@ -109,8 +110,8 @@ namespace modules {
m_counter = 0;
}
auto upspeed = network->upspeed(m_udspeed_minwidth);
auto downspeed = network->downspeed(m_udspeed_minwidth);
auto upspeed = network->upspeed(m_udspeed_minwidth, m_udspeed_unit);
auto downspeed = network->downspeed(m_udspeed_minwidth, m_udspeed_unit);
// Update label contents
const auto replace_tokens = [&](label_t& label) {