-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Add "% Selected" column to transfer list #22131
base: master
Are you sure you want to change the base?
Changes from 2 commits
3d8d163
25238ee
765963c
0234ec8
3618b0f
c203d18
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -208,6 +208,7 @@ int TransferListSortModel::compare(const QModelIndex &left, const QModelIndex &r | |
case TransferListModel::TR_RATIO: | ||
case TransferListModel::TR_RATIO_LIMIT: | ||
case TransferListModel::TR_POPULARITY: | ||
case TransferListModel::TR_PERCENT_SELECTED: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should put it at the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or perhaps you should calculate it in floating point instead of integer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed it so that we |
||
return customCompare(leftValue.toReal(), rightValue.toReal()); | ||
|
||
case TransferListModel::TR_STATUS: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,6 +107,12 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent) | |
: (QDateTime::currentSecsSinceEpoch() - timeSinceActivity); | ||
}; | ||
|
||
const auto getSelectedPercentage = [&torrent]() -> QString | ||
{ | ||
auto percent = ((torrent.wantedSize() * 100)/torrent.totalSize()); | ||
thalieht marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return QString::number(percent) + u'%'; | ||
}; | ||
|
||
return { | ||
{KEY_TORRENT_ID, torrent.id().toString()}, | ||
{KEY_TORRENT_INFOHASHV1, torrent.infoHash().v1().toString()}, | ||
|
@@ -166,6 +172,7 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent) | |
{KEY_TORRENT_COMMENT, torrent.comment()}, | ||
{KEY_TORRENT_PRIVATE, (torrent.hasMetadata() ? torrent.isPrivate() : QVariant())}, | ||
{KEY_TORRENT_TOTAL_SIZE, torrent.totalSize()}, | ||
{KEY_TORRENT_HAS_METADATA, torrent.hasMetadata()} | ||
{KEY_TORRENT_HAS_METADATA, torrent.hasMetadata()}, | ||
{KEY_TORRENT_PERCENT_SELECTED, getSelectedPercentage()} | ||
Chocobo1 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Furthermore, it seems you shouldn't add this field. The percentage can already be calculated from existing data. Just do the calculation with existing data in WebUI. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I cannot find an example of a similar column, and my attempts to add a calculated column result in an empty column and non-executing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm not defending the extra field but the same can be said about ETA, popularity and amount_left... |
||
}; | ||
} |
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.
Don't know about others but for me, what comes to mind is percentage of files selected not percentage of size.
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.
I can see where the confusion comes from, but I'm not sure how exactly to call it in order to make it clearer.
Changed it to
% Selected Data
, but I accept other suggestions that make it clearer.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.
I would return “% Selected” or even leave just “%” to minimize the column width as much as possible since there is a tooltip.
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.
As advised, I've changed the text to the shortest version
%
.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.
Use the tooltip for this column.
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.
A plain "%" as column header is completely unacceptable IMO.
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 any other case, the column content will always be smaller than the column header, can minimize the column header as much as possible and use a tooltip.
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.
That will be the case regardless of the header's string length.
Take for example the # (queue column) there are many issues complaining how the torrent's "index" or something like that column is gone or whatever. Who knows how many people actually don't know that it's the queue position.