CHANGE(client): Display lost packages instead of received ones

In the server browser, the tooltip for the different entries shows the
packet loss. It is displayed as a percentage and as a x/y stat. The
latter currently displays <received>/<sent> which is very confusing,
given that the title for that row is "Packet loss" implying x would
describe the lost packages instead of the received ones.

Thus this commit changes this to the expected behavior. Furthermore it
makes sure that <lost> is always <= <sent>.
This commit is contained in:
Robert Adam 2021-11-17 09:40:08 +01:00
parent b681d4d033
commit be41c0b921

View File

@ -506,8 +506,10 @@ QVariant ServerItem::data(int column, int role) const {
if (uiSent > 0) {
qs += QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>")
.arg(ConnectDialog::tr("Packet loss"),
QString::fromLatin1("%1% (%2/%3)").arg(ploss, 0, 'f', 1).arg(uiRecv).arg(uiSent));
.arg(ConnectDialog::tr("Packet loss"), QString::fromLatin1("%1% (%2/%3)")
.arg(ploss, 0, 'f', 1)
.arg(uiSent - std::min(uiRecv, uiSent))
.arg(uiSent));
if (uiRecv > 0) {
qs += QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>")
.arg(ConnectDialog::tr("Ping (80%)"),