feat: add seeding time column to torrent list and details tab#712
feat: add seeding time column to torrent list and details tab#712floydcohen wants to merge 5 commits into
Conversation
equeim
left a comment
There was a problem hiding this comment.
Thanks for your work, sorry for the delayed review
| const auto m = (secs % 3600) / 60; | ||
| const auto s = secs % 60; | ||
| //: Torrents list column data, seeding time | ||
| return qApp->translate("tremotesf", "%1d, %2h, %3m, %4s").arg(d).arg(h).arg(m).arg(s); |
There was a problem hiding this comment.
I think it would be better to use formatutils::formatEta here. Better yet, move its logic from there to the new formatElapsedTime function that returns std::optional<QString> if seconds are negative. Then formatEta would just delegate to that and return u221E in case of empty optional. And in here we would call formatElapsedTime and just not do anything in that case (and fall back to return {} at the bottom).
| const auto h = (secs % 86400) / 3600; | ||
| const auto m = (secs % 3600) / 60; | ||
| const auto s = secs % 60; | ||
| seedingTimeLabel->setText(qApp->translate("tremotesf", "%1d, %2h, %3m, %4s").arg(d).arg(h).arg(m).arg(s)); |
There was a problem hiding this comment.
Same here, call formatElapsedTime with value_or(QString{}) to set empty text in case of negative seconds.
| return formatRatio(static_cast<double>(uploaded) / static_cast<double>(downloaded)); | ||
| } | ||
|
|
||
| std::optional<QString> formatElapsedTime(int seconds) { |
There was a problem hiding this comment.
It should use the same formatting as formatEta (I don't think there is any point in making them different) and formatEta should call this function, transforming nullopt to "\u221E"
Added a Seeding Time column to the main view and the properties Details tab