-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show downloading files in peers list. Attempt #2 #4867
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning to our discussion about the right design...
Instead to create a logical for external code
QStringList PeerInfo::downloadingFiles()
method, you put in the interfaceint PeerInfo::downloadingPieceIndex()
method which nobody wants and which in this case can be attributed to the implementation details (let me remind you again that our classes are not wrappers around thelibtorrent
classes). Because of this mistake you move part of the logic in the calling code:, although it should contain only following:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree and will change the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, not everything looks good after some thinking. Here is the problem:
TorrentInfo::filesForPiece()
is good function (and I need it for another similar feature, highlighting of the downloading files and listing them in the tooltip for the torrent progress bars, not submitted yet). Thus should we implementPeerInfo::downloadingFiles()
we either need to pass a reference toTorrentInfo
instance there (currently it haslibtorrent::peer_info
or to duplicate code ( 👎 ). At the same time the current solution seems to be normalized (in terms of relational DB normalization). I guess the libtorrent authors arrived to the current design not unintentionally.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case we should store TorrentHandle pointer inside PerrInfo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PeerInfo::downloadingFiles()
is not enough for it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the main difference between the
TorrentHandle
andTorrentInfo
classes from your point of view? Could you tell me, please?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does that have to this issue? And what about my point of view? They do not depend on it.
TorrentInfo is some static torrent data (metadata and other such things are usually stored in the torrent file). TorrentHandle is a dynamic torrent data (i.e. its current downloading/seeding state etc.) and provides a management interface. TorrentHandle also includes static torrent information and provides some wrappers to it for convenience.
But why do you ask that? I just wish you hadn't used low-level features in the GUI code.
This is reminiscent of the following situation (I like to make Parallels with real life):
You come in the cafe and want to eat, say, a cheeseburger. But the waiter brings you all the ingredients separately and you have to cook himself a cheeseburger.
Kitchen should prepare, and the client has to get his cheeseburger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the answers!
This has to do with the second use case. The use case of the progress bar. There I show piece contents and file extension over pieces in the torrent progress bars. There are no peers in that case. There might be no downloading process either. I need just static information about the torrent layout. Needed functions come from the
torrent_info
class and I added an utility function to theTorrentInfo
class.From the answer you gave me I see now that this is in agreement with your view too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Let's postpone this question for now. As I said, it's hard for me to discuss something I have not seen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it is: #4936