add PITranslator

begin localization "ru"
This commit is contained in:
2024-11-02 18:43:30 +03:00
parent df75efe881
commit 9a928f6feb
14 changed files with 305 additions and 407 deletions

View File

@@ -20,6 +20,7 @@
#include "pidiagnostics.h"
#include "piliterals_time.h"
#include "pitranslator.h"
/** \class PIDiagnostics
@@ -40,7 +41,7 @@
PIDiagnostics::State::State() {
receive_speed = send_speed = PIString::readableSize(0) + "/s";
receive_speed = send_speed = PIString::readableSize(0) + PITranslator::tr("/s", "PIDiag");
}
@@ -152,14 +153,15 @@ void PIDiagnostics::sended(int size) {
void PIDiagnostics::tick(int) {
mutex_state.lock();
auto speed_sec = PITranslator::tr("/s", "PIDiag");
// piCoutObj << "lock";
int tcnt_recv = 0;
int tcnt_send = 0;
Entry send = calcHistory(history_send, tcnt_send);
Entry recv = calcHistory(history_rec, tcnt_recv);
float itr = disconn_.toSeconds() * (float(tcnt_recv) / history_rec.size());
float its = disconn_.toSeconds() * (float(tcnt_send) / history_send.size());
float hz = 1. / interval().toSeconds();
int tcnt_recv = 0;
int tcnt_send = 0;
Entry send = calcHistory(history_send, tcnt_send);
Entry recv = calcHistory(history_rec, tcnt_recv);
float itr = disconn_.toSeconds() * (float(tcnt_recv) / history_rec.size());
float its = disconn_.toSeconds() * (float(tcnt_send) / history_send.size());
float hz = 1. / interval().toSeconds();
if (tcnt_recv == 0) {
cur_state.integral_freq = cur_state.immediate_freq = 0;
cur_state.received_packets_per_sec = cur_state.received_bytes_per_sec = 0;
@@ -176,8 +178,8 @@ void PIDiagnostics::tick(int) {
cur_state.sended_bytes_per_sec = ullong(double(send.bytes_ok) / its);
}
// piCoutObj << "tick" << recv.cnt_ok << send.cnt_ok;
cur_state.receive_speed = PIString::readableSize(cur_state.received_bytes_per_sec) + "/s";
cur_state.send_speed = PIString::readableSize(cur_state.sended_bytes_per_sec) + "/s";
cur_state.receive_speed = PIString::readableSize(cur_state.received_bytes_per_sec) + speed_sec;
cur_state.send_speed = PIString::readableSize(cur_state.sended_bytes_per_sec) + speed_sec;
int arc = recv.cnt_ok + recv.cnt_fail;
float good_percents = 0.f;
if (arc > 0) good_percents = (float)recv.cnt_ok / arc * 100.f;