Skip to content

feat: add seeding time column to torrent list and details tab#712

Open
floydcohen wants to merge 5 commits into
equeim:masterfrom
floydcohen:feature/seeding-time-column
Open

feat: add seeding time column to torrent list and details tab#712
floydcohen wants to merge 5 commits into
equeim:masterfrom
floydcohen:feature/seeding-time-column

Conversation

@floydcohen

Copy link
Copy Markdown

Added a Seeding Time column to the main view and the properties Details tab

@equeim equeim left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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));

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, call formatElapsedTime with value_or(QString{}) to set empty text in case of negative seconds.

Comment thread src/ui/screens/torrentproperties/torrentpropertieswidget.cpp Outdated
Comment thread src/formatutils.cpp
return formatRatio(static_cast<double>(uploaded) / static_cast<double>(downloaded));
}

std::optional<QString> formatElapsedTime(int seconds) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants