qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
28.27k stars 3.97k forks source link

Zero values are always visible even when 'Hide zero and infinity" is checked #13491

Closed sakkamade closed 4 years ago

sakkamade commented 4 years ago

qBittorrent version and Operating System

4.3.0alpha1 Windows 10 version 1903

What is the problem

Hello.

I have bugs in peers window:

  1. Zero values is visible, although in settings Hide zero and infinity values checked Always.
  2. Some of Country/Region flags are broken.

scrnsht

What is the expected behavior

Hide zero values in Peers window when Hide zero and infinity values is checked. Show flags properly,

Steps to reproduce

Update qBittorrent to 4.3.0alpha1 via replacing compiled .exe and .pdb in ...\Program Files\qBittorrent folder.

Extra info

Had these problems when tried FranciscoPombal's builds either.

xavier2k6 commented 4 years ago

There's two issues in one here!!!

Hide zero values in Peers window when Hide zero and infinity values is checked.

The zero/infinity value will only be invisible if seeds/peers have 0 values ie 0(0) not like 0(4) & have 0 for download/upload speed!

your screenshot shows that qBittorrent is doing exactly what it is meant to be doing....

see my screenshots below for examples, unless you are expecting to see something different.....(you will have to be more specific)

Hide zero and infinity values checked "Example 1"

checked

Hide zero and infinity values unchecked "Example 1"

unchecked

Hide zero and infinity values checked "Example 2"

checked v2

Hide zero and infinity values unchecked "Example 2"

unchecked v2

Show flags properly,

This should be a different issue.......anyway....can you explain what you see as an issue?

sakkamade commented 4 years ago

@xavier2k6 I meant since Actions in FranciscoPombal's fork

FranciscoPombal commented 4 years ago

I can reproduce this; tested using the latest experimental Windows build targeting the master branch at the time of writing on Windows 10: https://github.com/qbittorrent/qBittorrent/actions/runs/297092787 (@roshiajin-kunai please use builds from https://github.com/qbittorrent/qBittorrent/actions for testing from now on, not the ones from my personal fork/branches and mention the commit/specific action run when indicating the version). I have not tested on other OSes.

In the most recent build:

In both 4.2.5 and the most recent build, when Hide zero and infinity values is checked:

sakkamade commented 4 years ago

@xavier2k6 Problem is that in Peers window I see 0 B/s in speeds and 0 B in downloaded/uploaded.

While Hide is checked.

sakkamade commented 4 years ago

@FranciscoPombal Yes, I'm building from source for some time already.

Hong Kong's flag too, as I remember.

xavier2k6 commented 4 years ago

@FranciscoPombal @roshiajin-kunai apologies, I see what you mean now.

I think the portugal flag might have an issue too...

Build I'm using, is my own compiled version with Qt5.15.1

xavier2k6 commented 4 years ago

@FranciscoPombal download limit/upload limit don't hide infinity symbol either in transfer list

xavier2k6 commented 4 years ago

the flags issue is probably related to "GeoDB"??

FranciscoPombal commented 4 years ago

the flags issue is probably related to "GeoDB"??

Could also be a bug/change in qt5-svg.

thalieht commented 4 years ago

Looks like an accidental omission from #13157

@jagannatharjun should i make a PR with the following or you want to make one with something else (or even this if you want)?

--- a/src/gui/properties/peerlistwidget.cpp
+++ b/src/gui/properties/peerlistwidget.cpp
@@ -425,16 +425,21 @@ void PeerListWidget::updatePeer(const BitTorrent::TorrentHandle *torrent, const
     }

     const int row = (*itemIter)->row();
+    const bool hideValues = Preferences::instance()->getHideZeroValues();

     setModelData(row, PeerListColumns::CONNECTION, peer.connectionType(), peer.connectionType());
     setModelData(row, PeerListColumns::FLAGS, peer.flags(), peer.flags(), {}, peer.flagsDescription());
     const QString client = peer.client().toHtmlEscaped();
     setModelData(row, PeerListColumns::CLIENT, client, client);
     setModelData(row, PeerListColumns::PROGRESS, (Utils::String::fromDouble(peer.progress() * 100, 1) + '%'), peer.progress(), intDataTextAlignment);
-    setModelData(row, PeerListColumns::DOWN_SPEED, Utils::Misc::friendlyUnit(peer.payloadDownSpeed(), 1), peer.payloadDownSpeed(), intDataTextAlignment);
-    setModelData(row, PeerListColumns::UP_SPEED, Utils::Misc::friendlyUnit(peer.payloadUpSpeed(), true), peer.payloadUpSpeed(), intDataTextAlignment);
-    setModelData(row, PeerListColumns::TOT_DOWN, Utils::Misc::friendlyUnit(peer.totalDownload()), peer.totalDownload(), intDataTextAlignment);
-    setModelData(row, PeerListColumns::TOT_UP, Utils::Misc::friendlyUnit(peer.totalUpload()), peer.totalUpload(), intDataTextAlignment);
+    const QString downSpeed = ((peer.payloadDownSpeed() <= 0) && hideValues) ? QString {} : Utils::Misc::friendlyUnit(peer.payloadDownSpeed(), true);
+    setModelData(row, PeerListColumns::DOWN_SPEED, downSpeed, peer.payloadDownSpeed(), intDataTextAlignment);
+    const QString upSpeed = ((peer.payloadUpSpeed() <= 0) && hideValues) ? QString {} : Utils::Misc::friendlyUnit(peer.payloadUpSpeed(), true);
+    setModelData(row, PeerListColumns::UP_SPEED, upSpeed, peer.payloadUpSpeed(), intDataTextAlignment);
+    const QString totalDown = ((peer.totalDownload() <= 0) && hideValues) ? QString {} : Utils::Misc::friendlyUnit(peer.totalDownload());
+    setModelData(row, PeerListColumns::TOT_DOWN, totalDown, peer.totalDownload(), intDataTextAlignment);
+    const QString totalUp = ((peer.totalUpload() <= 0) && hideValues) ? QString {} : Utils::Misc::friendlyUnit(peer.totalUpload());
+    setModelData(row, PeerListColumns::TOT_UP, totalUp, peer.totalUpload(), intDataTextAlignment);
     setModelData(row, PeerListColumns::RELEVANCE, (Utils::String::fromDouble(peer.relevance() * 100, 1) + '%'), peer.relevance(), intDataTextAlignment);

     const QStringList downloadingFiles {torrent->info().filesForPiece(peer.downloadingPieceIndex())};

download limit/upload limit don't hide infinity symbol either in transfer list

Maybe it was considered the same as ETA which unfortunately was a conscious decision https://github.com/qbittorrent/qBittorrent/pull/4675#issuecomment-174940336

jagannatharjun commented 4 years ago

@jagannatharjun should i make a PR

👍

xavier2k6 commented 4 years ago

download limit/upload limit don't hide infinity symbol either in transfer list

Maybe it was considered the same as ETA which unfortunately was a conscious decision #4675 (comment)

Ah, maybe so........perhaps the other dev's can confirm/have their say on whether it should stay as is or be changed...(so it can be more clearer)

FranciscoPombal commented 4 years ago

The part about the flags has been separated into its own issue report: https://github.com/qbittorrent/qBittorrent/issues/13497. @roshiajin-kunai next time please follow the one specific issue per submission rule please.

sakkamade commented 4 years ago

Compiled with https://github.com/qbittorrent/qBittorrent/pull/13495 - merged. Zero values hides properly. Issue is fixed.

Thank you.