This commit is contained in:
simplepad 2024-05-09 16:33:17 +00:00 committed by GitHub
commit f2dd9f00fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 402 additions and 53 deletions

View File

@ -213,12 +213,14 @@ The 'source' column here corresponds to the data structure there.
| `bandwidthPriority` | number | tr_priority_t
| `comment` | string | tr_torrent_view
| `corruptEver`| number | tr_stat
| `corruptThisSession`| number | tr_stat
| `creator`| string | tr_torrent_view
| `dateCreated`| number| tr_torrent_view
| `desiredAvailable`| number| tr_stat
| `doneDate`| number | tr_stat
| `downloadDir` | string | tr_torrent
| `downloadedEver` | number | tr_stat
| `downloadedThisSession` | number | tr_stat
| `downloadLimit` | number | tr_torrent
| `downloadLimited` | boolean | tr_torrent
| `editDate` | number | tr_stat
@ -278,6 +280,7 @@ The 'source' column here corresponds to the data structure there.
| `totalSize`| number| tr_torrent_view
| `torrentFile`| string| tr_info
| `uploadedEver`| number| tr_stat
| `uploadedThisSession`| number| tr_stat
| `uploadLimit`| number| tr_torrent
| `uploadLimited`| boolean| tr_torrent
| `uploadRatio`| double| tr_stat
@ -1026,4 +1029,7 @@ Transmission 4.1.0 (`rpc-version-semver` 5.4.0, `rpc-version`: 18)
| `torrent-set` | new arg `sequentialDownload`
| `torrent-get` | new arg `files.beginPiece`
| `torrent-get` | new arg `files.endPiece`
| `torrent-get` | new arg `corruptThisSession`
| `torrent-get` | new arg `downloadedThisSession`
| `torrent-get` | new arg `uploadedThisSession`
| `port-test` | new arg `ipProtocol`

View File

@ -157,7 +157,9 @@ private:
Gtk::Label* state_lb_ = nullptr;
Gtk::Label* have_lb_ = nullptr;
Gtk::Label* dl_lb_ = nullptr;
Gtk::Label* dl_ts_lb_ = nullptr;
Gtk::Label* ul_lb_ = nullptr;
Gtk::Label* ul_ts_lb_ = nullptr;
Gtk::Label* error_lb_ = nullptr;
Gtk::Label* date_started_lb_ = nullptr;
Gtk::Label* eta_lb_ = nullptr;
@ -995,6 +997,40 @@ void DetailsDialog::Impl::refreshInfo(std::vector<tr_torrent*> const& torrents)
dl_lb_->set_text(str);
// dl_ts_lb
if (stats.empty())
{
str = no_torrent;
}
else
{
auto const downloaded_str = tr_strlsize(std::accumulate(
std::begin(stats),
std::end(stats),
uint64_t{ 0 },
[](auto sum, auto const* st) { return sum + st->downloadedThisSession; }));
auto const failed = std::accumulate(
std::begin(stats),
std::end(stats),
uint64_t{ 0 },
[](auto sum, auto const* st) { return sum + st->corruptThisSession; });
if (failed != 0)
{
str = fmt::format(
_("{downloaded_size} verified (+{discarded_size} discarded after failed checksum)"),
fmt::arg("downloaded_size", downloaded_str),
fmt::arg("discarded_size", tr_strlsize(failed)));
}
else
{
str = downloaded_str;
}
}
dl_ts_lb_->set_text(str);
/* ul_lb */
if (stats.empty())
{
@ -1020,6 +1056,23 @@ void DetailsDialog::Impl::refreshInfo(std::vector<tr_torrent*> const& torrents)
ul_lb_->set_text(str);
/* ul_ts_lb */
if (stats.empty())
{
str = no_torrent;
}
else
{
auto const uploaded = std::accumulate(
std::begin(stats),
std::end(stats),
uint64_t{},
[](auto sum, auto const* st) { return sum + st->uploadedThisSession; });
str = tr_strlsize(uploaded);
}
ul_ts_lb_->set_text(str);
/* hash_lb */
if (infos.empty())
{
@ -2555,7 +2608,9 @@ DetailsDialog::Impl::Impl(DetailsDialog& dialog, Glib::RefPtr<Gtk::Builder> cons
, state_lb_(gtr_get_widget<Gtk::Label>(builder, "state_value_label"))
, have_lb_(gtr_get_widget<Gtk::Label>(builder, "have_value_label"))
, dl_lb_(gtr_get_widget<Gtk::Label>(builder, "downloaded_value_label"))
, dl_ts_lb_(gtr_get_widget<Gtk::Label>(builder, "downloaded_this_session_value_label"))
, ul_lb_(gtr_get_widget<Gtk::Label>(builder, "uploaded_value_label"))
, ul_ts_lb_(gtr_get_widget<Gtk::Label>(builder, "uploaded_this_session_value_label"))
, error_lb_(gtr_get_widget<Gtk::Label>(builder, "error_value_label"))
, date_started_lb_(gtr_get_widget<Gtk::Label>(builder, "running_time_value_label"))
, eta_lb_(gtr_get_widget<Gtk::Label>(builder, "remaining_time_value_label"))

View File

@ -66,7 +66,7 @@
</packing>
</child>
<child>
<!-- n-columns=2 n-rows=9 -->
<!-- n-columns=2 n-rows=11 -->
<object class="GtkGrid" id="activity_section_layout">
<property name="visible">True</property>
<property name="can-focus">False</property>
@ -109,6 +109,18 @@
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="uploaded_this_session_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Uploaded this session:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="downloaded_label">
<property name="visible">True</property>
@ -118,7 +130,19 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="downloaded_this_session_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Downloaded this session:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
@ -130,7 +154,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
@ -142,7 +166,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">5</property>
<property name="top-attach">7</property>
</packing>
</child>
<child>
@ -154,7 +178,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">6</property>
<property name="top-attach">8</property>
</packing>
</child>
<child>
@ -166,7 +190,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">7</property>
<property name="top-attach">9</property>
</packing>
</child>
<child>
@ -179,7 +203,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">8</property>
<property name="top-attach">10</property>
</packing>
</child>
<child>
@ -222,7 +246,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="downloaded_value_label">
<object class="GtkLabel" id="uploaded_this_session_value_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
@ -235,7 +259,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="state_value_label">
<object class="GtkLabel" id="downloaded_value_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
@ -248,7 +272,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="running_time_value_label">
<object class="GtkLabel" id="downloaded_this_session_value_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
@ -261,7 +285,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="remaining_time_value_label">
<object class="GtkLabel" id="state_value_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
@ -274,7 +298,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="last_activity_value_label">
<object class="GtkLabel" id="running_time_value_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
@ -286,6 +310,32 @@
<property name="top-attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="remaining_time_value_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="label">...</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">8</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="last_activity_value_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="label">...</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">9</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="error_value_label">
<property name="visible">True</property>
@ -300,7 +350,7 @@
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">8</property>
<property name="top-attach">10</property>
</packing>
</child>
</object>
@ -1200,7 +1250,9 @@
<widget name="torrent_size_label"/>
<widget name="have_label"/>
<widget name="uploaded_label"/>
<widget name="uploaded_this_session_label"/>
<widget name="downloaded_label"/>
<widget name="downloaded_this_session_label"/>
<widget name="state_label"/>
<widget name="running_time_label"/>
<widget name="remaining_time_label"/>

View File

@ -64,13 +64,33 @@
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="uploaded_this_session_label">
<property name="label" translatable="1">Uploaded this session:</property>
<property name="xalign">0</property>
<layout>
<property name="column">0</property>
<property name="row">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="downloaded_label">
<property name="label" translatable="1">Downloaded:</property>
<property name="xalign">0</property>
<layout>
<property name="column">0</property>
<property name="row">3</property>
<property name="row">4</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="downloaded_this_session_label">
<property name="label" translatable="1">Downloaded this session:</property>
<property name="xalign">0</property>
<layout>
<property name="column">0</property>
<property name="row">5</property>
</layout>
</object>
</child>
@ -80,7 +100,7 @@
<property name="xalign">0</property>
<layout>
<property name="column">0</property>
<property name="row">4</property>
<property name="row">6</property>
</layout>
</object>
</child>
@ -90,7 +110,7 @@
<property name="xalign">0</property>
<layout>
<property name="column">0</property>
<property name="row">5</property>
<property name="row">7</property>
</layout>
</object>
</child>
@ -100,7 +120,7 @@
<property name="xalign">0</property>
<layout>
<property name="column">0</property>
<property name="row">6</property>
<property name="row">8</property>
</layout>
</object>
</child>
@ -110,7 +130,7 @@
<property name="xalign">0</property>
<layout>
<property name="column">0</property>
<property name="row">7</property>
<property name="row">9</property>
</layout>
</object>
</child>
@ -121,7 +141,7 @@
<property name="yalign">0</property>
<layout>
<property name="column">0</property>
<property name="row">8</property>
<property name="row">10</property>
</layout>
</object>
</child>
@ -159,7 +179,7 @@
</object>
</child>
<child>
<object class="GtkLabel" id="downloaded_value_label">
<object class="GtkLabel" id="uploaded_this_session_value_label">
<property name="hexpand">1</property>
<property name="label">...</property>
<property name="xalign">0</property>
@ -170,7 +190,7 @@
</object>
</child>
<child>
<object class="GtkLabel" id="state_value_label">
<object class="GtkLabel" id="downloaded_value_label">
<property name="hexpand">1</property>
<property name="label">...</property>
<property name="xalign">0</property>
@ -181,7 +201,7 @@
</object>
</child>
<child>
<object class="GtkLabel" id="running_time_value_label">
<object class="GtkLabel" id="downloaded_this_session_value_label">
<property name="hexpand">1</property>
<property name="label">...</property>
<property name="xalign">0</property>
@ -192,7 +212,7 @@
</object>
</child>
<child>
<object class="GtkLabel" id="remaining_time_value_label">
<object class="GtkLabel" id="state_value_label">
<property name="hexpand">1</property>
<property name="label">...</property>
<property name="xalign">0</property>
@ -203,7 +223,7 @@
</object>
</child>
<child>
<object class="GtkLabel" id="last_activity_value_label">
<object class="GtkLabel" id="running_time_value_label">
<property name="hexpand">1</property>
<property name="label">...</property>
<property name="xalign">0</property>
@ -213,6 +233,28 @@
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="remaining_time_value_label">
<property name="hexpand">1</property>
<property name="label">...</property>
<property name="xalign">0</property>
<layout>
<property name="column">1</property>
<property name="row">8</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="last_activity_value_label">
<property name="hexpand">1</property>
<property name="label">...</property>
<property name="xalign">0</property>
<layout>
<property name="column">1</property>
<property name="row">9</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="error_value_label">
<property name="hexpand">1</property>
@ -225,7 +267,7 @@
<property name="xalign">0</property>
<layout>
<property name="column">1</property>
<property name="row">8</property>
<property name="row">10</property>
</layout>
</object>
</child>
@ -856,7 +898,9 @@
<widget name="torrent_size_label"/>
<widget name="have_label"/>
<widget name="uploaded_label"/>
<widget name="uploaded_this_session_label"/>
<widget name="downloaded_label"/>
<widget name="downloaded_this_session_label"/>
<widget name="state_label"/>
<widget name="running_time_label"/>
<widget name="remaining_time_label"/>

View File

@ -72,6 +72,7 @@ auto constexpr MyStatic = std::array<std::string_view, TR_N_KEYS>{
"cookies"sv,
"corrupt"sv,
"corruptEver"sv,
"corruptThisSession"sv,
"created by"sv,
"created by.utf-8"sv,
"creation date"sv,
@ -103,6 +104,7 @@ auto constexpr MyStatic = std::array<std::string_view, TR_N_KEYS>{
"downloaded-bytes"sv,
"downloadedBytes"sv,
"downloadedEver"sv,
"downloadedThisSession"sv,
"downloaders"sv,
"downloading-time-seconds"sv,
"dropped"sv,
@ -411,6 +413,7 @@ auto constexpr MyStatic = std::array<std::string_view, TR_N_KEYS>{
"uploaded-bytes"sv,
"uploadedBytes"sv,
"uploadedEver"sv,
"uploadedThisSession"sv,
"url-list"sv,
"use-global-speed-limit"sv,
"use-speed-limit"sv,

View File

@ -73,6 +73,7 @@ enum
TR_KEY_cookies,
TR_KEY_corrupt,
TR_KEY_corruptEver,
TR_KEY_corruptThisSession,
TR_KEY_created_by,
TR_KEY_created_by_utf_8,
TR_KEY_creation_date,
@ -104,6 +105,7 @@ enum
TR_KEY_downloaded_bytes,
TR_KEY_downloadedBytes,
TR_KEY_downloadedEver,
TR_KEY_downloadedThisSession,
TR_KEY_downloaders,
TR_KEY_downloading_time_seconds,
TR_KEY_dropped,
@ -412,6 +414,7 @@ enum
TR_KEY_uploaded_bytes,
TR_KEY_uploadedBytes,
TR_KEY_uploadedEver,
TR_KEY_uploadedThisSession,
TR_KEY_url_list,
TR_KEY_use_global_speed_limit,
TR_KEY_use_speed_limit,

View File

@ -508,6 +508,7 @@ namespace make_torrent_field_helpers
case TR_KEY_bandwidthPriority:
case TR_KEY_comment:
case TR_KEY_corruptEver:
case TR_KEY_corruptThisSession:
case TR_KEY_creator:
case TR_KEY_dateCreated:
case TR_KEY_desiredAvailable:
@ -516,6 +517,7 @@ namespace make_torrent_field_helpers
case TR_KEY_downloadLimit:
case TR_KEY_downloadLimited:
case TR_KEY_downloadedEver:
case TR_KEY_downloadedThisSession:
case TR_KEY_editDate:
case TR_KEY_error:
case TR_KEY_errorString:
@ -577,6 +579,7 @@ namespace make_torrent_field_helpers
case TR_KEY_uploadLimited:
case TR_KEY_uploadRatio:
case TR_KEY_uploadedEver:
case TR_KEY_uploadedThisSession:
case TR_KEY_wanted:
case TR_KEY_webseeds:
case TR_KEY_webseedsSendingToUs:
@ -602,6 +605,7 @@ namespace make_torrent_field_helpers
case TR_KEY_bandwidthPriority: return tor.get_priority();
case TR_KEY_comment: return tor.comment();
case TR_KEY_corruptEver: return st.corruptEver;
case TR_KEY_corruptThisSession: return st.corruptThisSession;
case TR_KEY_creator: return tor.creator();
case TR_KEY_dateCreated: return tor.date_created();
case TR_KEY_desiredAvailable: return st.desiredAvailable;
@ -610,6 +614,7 @@ namespace make_torrent_field_helpers
case TR_KEY_downloadLimit: return tr_torrentGetSpeedLimit_KBps(&tor, TR_DOWN);
case TR_KEY_downloadLimited: return tor.uses_speed_limit(TR_DOWN);
case TR_KEY_downloadedEver: return st.downloadedEver;
case TR_KEY_downloadedThisSession: return st.downloadedThisSession;
case TR_KEY_editDate: return st.editDate;
case TR_KEY_error: return st.error;
case TR_KEY_errorString: return st.errorString;
@ -671,6 +676,7 @@ namespace make_torrent_field_helpers
case TR_KEY_uploadLimited: return tor.uses_speed_limit(TR_UP);
case TR_KEY_uploadRatio: return st.ratio;
case TR_KEY_uploadedEver: return st.uploadedEver;
case TR_KEY_uploadedThisSession: return st.uploadedThisSession;
case TR_KEY_wanted: return make_file_wanted_vec(tor);
case TR_KEY_webseeds: return make_webseed_vec(tor);
case TR_KEY_webseedsSendingToUs: return st.webseedsSendingToUs;

View File

@ -1337,8 +1337,11 @@ tr_stat tr_torrent::stats() const
stats.secondsDownloading = this->seconds_downloading(now_sec);
stats.corruptEver = this->bytes_corrupt_.ever();
stats.corruptThisSession = this->bytes_corrupt_.during_this_session();
stats.downloadedEver = this->bytes_downloaded_.ever();
stats.downloadedThisSession = this->bytes_downloaded_.during_this_session();
stats.uploadedEver = this->bytes_uploaded_.ever();
stats.uploadedThisSession = this->bytes_uploaded_.during_this_session();
stats.haveValid = this->completion_.has_valid();
stats.haveUnchecked = this->has_total() - stats.haveValid;
stats.desiredAvailable = tr_peerMgrGetDesiredAvailable(this);

View File

@ -1442,14 +1442,27 @@ struct tr_stat
grow very large. */
uint64_t corruptEver;
/** Byte count of all the corrupt data you've downloaded during this session for
this torrent. If you're on a poisoned torrent, this number can
grow very large. */
uint64_t corruptThisSession;
/** Byte count of all data you've ever uploaded for this torrent. */
uint64_t uploadedEver;
/** Byte count of all data you've uploaded during this session for this torrent. */
uint64_t uploadedThisSession;
/** Byte count of all the non-corrupt data you've ever downloaded
for this torrent. If you deleted the files and downloaded a second
time, this will be `2*totalSize`.. */
uint64_t downloadedEver;
/** Byte count of all the non-corrupt data you've downloaded during this session
for this torrent. If you deleted the files and downloaded a second
time, this will be `2*totalSize`.. */
uint64_t downloadedThisSession;
/** Byte count of all the checksum-verified data we have for this torrent.
*/
uint64_t haveValid;

View File

@ -652,6 +652,37 @@ void DetailsDialog::refreshUI()
ui_.downloadedValueLabel->setText(string);
// myDownloadedThisSessionLabel
if (torrents.empty())
{
string = none;
}
else
{
auto d = uint64_t{};
auto f = uint64_t{};
for (Torrent const* const t : torrents)
{
d += t->downloadedThisSession();
f += t->failedThisSession();
}
QString const dstr = Formatter::storage_to_string(d);
if (f != 0)
{
QString const fstr = Formatter::storage_to_string(f);
string = tr("%1 (+%2 discarded after failed checksum)").arg(dstr).arg(fstr);
}
else
{
string = dstr;
}
}
ui_.downloadedThisSessionValueLabel->setText(string);
// myUploadedLabel
if (torrents.empty())
{
@ -675,6 +706,25 @@ void DetailsDialog::refreshUI()
ui_.uploadedValueLabel->setText(string);
// myUploadedThisSessionLabel
if (torrents.empty())
{
string = none;
}
else
{
auto uploaded_this_session = uint64_t{};
for (Torrent const* const t : torrents)
{
uploaded_this_session += t->uploadedThisSession();
}
string = Formatter::storage_to_string(uploaded_this_session);
}
ui_.uploadedThisSessionValueLabel->setText(string);
// myRunTimeLabel
if (torrents.empty())
{

View File

@ -133,17 +133,17 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="downloadedLabel">
<widget class="QLabel" name="uploadedThisSessionLabel">
<property name="text">
<string>Downloaded:</string>
<string>Uploaded this session:</string>
</property>
<property name="buddy">
<cstring>downloadedValueLabel</cstring>
<cstring>uploadedThisSessionValueLabel</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="SqueezeLabel" name="downloadedValueLabel">
<widget class="SqueezeLabel" name="uploadedThisSessionValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -165,17 +165,17 @@
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="stateLabel">
<widget class="QLabel" name="downloadedLabel">
<property name="text">
<string>State:</string>
<string>Downloaded:</string>
</property>
<property name="buddy">
<cstring>stateValueLabel</cstring>
<cstring>downloadedValueLabel</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="SqueezeLabel" name="stateValueLabel">
<widget class="SqueezeLabel" name="downloadedValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -197,17 +197,17 @@
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="runningTimeLabel">
<widget class="QLabel" name="downloadedThisSessionLabel">
<property name="text">
<string>Running time:</string>
<string>Downloaded this session:</string>
</property>
<property name="buddy">
<cstring>runningTimeValueLabel</cstring>
<cstring>downloadedThisSessionValueLabel</cstring>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="SqueezeLabel" name="runningTimeValueLabel">
<widget class="SqueezeLabel" name="downloadedThisSessionValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -229,17 +229,17 @@
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="remainingTimeLabel">
<widget class="QLabel" name="stateLabel">
<property name="text">
<string>Remaining time:</string>
<string>State:</string>
</property>
<property name="buddy">
<cstring>remainingTimeValueLabel</cstring>
<cstring>stateValueLabel</cstring>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="SqueezeLabel" name="remainingTimeValueLabel">
<widget class="SqueezeLabel" name="stateValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -261,17 +261,17 @@
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="lastActivityLabel">
<widget class="QLabel" name="runningTimeLabel">
<property name="text">
<string>Last activity:</string>
<string>Running time:</string>
</property>
<property name="buddy">
<cstring>lastActivityValueLabel</cstring>
<cstring>runningTimeValueLabel</cstring>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="SqueezeLabel" name="lastActivityValueLabel">
<widget class="SqueezeLabel" name="runningTimeValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -293,6 +293,70 @@
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="remainingTimeLabel">
<property name="text">
<string>Remaining time:</string>
</property>
<property name="buddy">
<cstring>remainingTimeValueLabel</cstring>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="SqueezeLabel" name="remainingTimeValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="lastActivityLabel">
<property name="text">
<string>Last activity:</string>
</property>
<property name="buddy">
<cstring>lastActivityValueLabel</cstring>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="SqueezeLabel" name="lastActivityValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="errorLabel">
<property name="text">
<string>Error:</string>
@ -302,7 +366,7 @@
</property>
</widget>
</item>
<item row="8" column="1">
<item row="10" column="1">
<widget class="SqueezeLabel" name="errorValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">

View File

@ -536,8 +536,9 @@ std::set<std::string_view> const& Session::getKeyNames(TorrentProperties props)
};
// changing fields needed by the main window
static auto constexpr MainStatKeys = std::array<tr_quark, 25>{
static auto constexpr MainStatKeys = std::array<tr_quark, 27>{
TR_KEY_downloadedEver,
TR_KEY_downloadedThisSession,
TR_KEY_editDate,
TR_KEY_error,
TR_KEY_errorString,
@ -561,6 +562,7 @@ std::set<std::string_view> const& Session::getKeyNames(TorrentProperties props)
TR_KEY_sizeWhenDone,
TR_KEY_status,
TR_KEY_uploadedEver,
TR_KEY_uploadedThisSession,
TR_KEY_webseedsSendingToUs,
};
@ -579,10 +581,11 @@ std::set<std::string_view> const& Session::getKeyNames(TorrentProperties props)
};
// changing fields needed by the details dialog
static auto constexpr DetailStatKeys = std::array<tr_quark, 18>{
static auto constexpr DetailStatKeys = std::array<tr_quark, 19>{
TR_KEY_activityDate, //
TR_KEY_bandwidthPriority, //
TR_KEY_corruptEver, //
TR_KEY_corruptThisSession, //
TR_KEY_desiredAvailable, //
TR_KEY_downloadedEver, //
TR_KEY_downloadLimit, //

View File

@ -184,11 +184,13 @@ Torrent::fields_t Torrent::update(tr_quark const* keys, tr_variant const* const*
HANDLE_KEY(addedDate, added_date, ADDED_DATE)
HANDLE_KEY(bandwidthPriority, bandwidth_priority, BANDWIDTH_PRIORITY)
HANDLE_KEY(corruptEver, failed_ever, FAILED_EVER)
HANDLE_KEY(corruptThisSession, failed_this_session, FAILED_THIS_SESSION)
HANDLE_KEY(dateCreated, date_created, DATE_CREATED)
HANDLE_KEY(desiredAvailable, desired_available, DESIRED_AVAILABLE)
HANDLE_KEY(downloadLimit, download_limit, DOWNLOAD_LIMIT) // KB/s
HANDLE_KEY(downloadLimited, download_limited, DOWNLOAD_LIMITED)
HANDLE_KEY(downloadedEver, downloaded_ever, DOWNLOADED_EVER)
HANDLE_KEY(downloadedThisSession, downloaded_this_session, DOWNLOADED_THIS_SESSION)
HANDLE_KEY(editDate, edit_date, EDIT_DATE)
HANDLE_KEY(error, error, TORRENT_ERROR)
HANDLE_KEY(eta, eta, ETA)
@ -234,6 +236,7 @@ Torrent::fields_t Torrent::update(tr_quark const* keys, tr_variant const* const*
HANDLE_KEY(uploadLimit, upload_limit, UPLOAD_LIMIT) // KB/s
HANDLE_KEY(uploadLimited, upload_limited, UPLOAD_LIMITED)
HANDLE_KEY(uploadedEver, uploaded_ever, UPLOADED_EVER)
HANDLE_KEY(uploadedThisSession, uploaded_this_session, UPLOADED_THIS_SESSION)
HANDLE_KEY(webseedsSendingToUs, webseeds_sending_to_us, WEBSEEDS_SENDING_TO_US)
#undef HANDLE_KEY

View File

@ -296,11 +296,21 @@ public:
return downloaded_ever_;
}
[[nodiscard]] constexpr auto downloadedThisSession() const noexcept
{
return downloaded_this_session_;
}
[[nodiscard]] constexpr auto uploadedEver() const noexcept
{
return uploaded_ever_;
}
[[nodiscard]] constexpr auto uploadedThisSession() const noexcept
{
return uploaded_this_session_;
}
[[nodiscard]] constexpr auto ratio() const noexcept
{
auto const numerator = static_cast<double>(uploadedEver());
@ -325,6 +335,11 @@ public:
return failed_ever_;
}
[[nodiscard]] constexpr auto failedThisSession() const noexcept
{
return failed_this_session_;
}
int compareSeedProgress(Torrent const&) const;
int compareRatio(Torrent const&) const;
int compareETA(Torrent const&) const;
@ -575,6 +590,7 @@ public:
DATE_CREATED,
DESIRED_AVAILABLE,
DOWNLOADED_EVER,
DOWNLOADED_THIS_SESSION,
DOWNLOAD_DIR,
DOWNLOAD_LIMIT,
DOWNLOAD_LIMITED,
@ -584,6 +600,7 @@ public:
TORRENT_ERROR_STRING,
ETA,
FAILED_EVER,
FAILED_THIS_SESSION,
FILE_COUNT,
FILES,
HASH,
@ -621,6 +638,7 @@ public:
TRACKER_STATS,
TRACKER_LIST,
UPLOADED_EVER,
UPLOADED_THIS_SESSION,
UPLOAD_LIMIT,
UPLOAD_LIMITED,
UPLOAD_SPEED,
@ -667,7 +685,9 @@ private:
uint64_t desired_available_ = {};
uint64_t download_limit_ = {};
uint64_t downloaded_ever_ = {};
uint64_t downloaded_this_session_ = {};
uint64_t failed_ever_ = {};
uint64_t failed_this_session_ = {};
uint64_t file_count_ = {};
uint64_t have_unchecked_ = {};
uint64_t have_verified_ = {};
@ -677,6 +697,7 @@ private:
uint64_t total_size_ = {};
uint64_t upload_limit_ = {};
uint64_t uploaded_ever_ = {};
uint64_t uploaded_this_session_ = {};
double metadata_percent_complete_ = {};
double percent_done_ = {};

View File

@ -194,8 +194,8 @@ QString TorrentDelegate::progressString(Torrent const& tor)
//: %2 is the torrent's total size,
//: %3 is a percentage of the two,
//: %4 is how much we've uploaded,
//: %5 is our upload-to-download ratio,
//: %6 is the ratio we want to reach before we stop uploading
//: %5 is the ratio we want to reach before we stop uploading
//: %6 is our upload-to-download ratio,
str = tr("%1 of %2 (%3%), uploaded %4 (Ratio: %5 Goal: %6)")
.arg(Formatter::storage_to_string(have_total))
.arg(Formatter::storage_to_string(tor.totalSize()))
@ -227,8 +227,8 @@ QString TorrentDelegate::progressString(Torrent const& tor)
//: First part of torrent progress string,
//: %1 is the torrent's total size,
//: %2 is how much we've uploaded,
//: %3 is our upload-to-download ratio,
//: %4 is the ratio we want to reach before we stop uploading
//: %3 is the ratio we want to reach before we stop uploading
//: %4 is our upload-to-download ratio,
str = tr("%1, uploaded %2 (Ratio: %3 Goal: %4)")
.arg(Formatter::storage_to_string(have_total))
.arg(Formatter::storage_to_string(tor.uploadedEver()))

View File

@ -704,18 +704,20 @@ auto constexpr FilesKeys = std::array<tr_quark, 4>{
TR_KEY_wanted,
};
auto constexpr DetailsKeys = std::array<tr_quark, 53>{
auto constexpr DetailsKeys = std::array<tr_quark, 56>{
TR_KEY_activityDate,
TR_KEY_addedDate,
TR_KEY_bandwidthPriority,
TR_KEY_comment,
TR_KEY_corruptEver,
TR_KEY_corruptThisSession,
TR_KEY_creator,
TR_KEY_dateCreated,
TR_KEY_desiredAvailable,
TR_KEY_doneDate,
TR_KEY_downloadDir,
TR_KEY_downloadedEver,
TR_KEY_downloadedThisSession,
TR_KEY_downloadLimit,
TR_KEY_downloadLimited,
TR_KEY_error,
@ -753,6 +755,7 @@ auto constexpr DetailsKeys = std::array<tr_quark, 53>{
TR_KEY_status,
TR_KEY_totalSize,
TR_KEY_uploadedEver,
TR_KEY_uploadedThisSession,
TR_KEY_uploadLimit,
TR_KEY_uploadLimited,
TR_KEY_uploadRatio,
@ -1020,6 +1023,21 @@ void printDetails(tr_variant* top)
}
}
if (tr_variantDictFindInt(t, TR_KEY_downloadedThisSession, &i))
{
if (auto corrupt = int64_t{}; tr_variantDictFindInt(t, TR_KEY_corruptThisSession, &corrupt) && corrupt != 0)
{
fmt::print(
" Downloaded this session: {:s} (+{:s} discarded after failed checksum)\n",
strlsize(i),
strlsize(corrupt));
}
else
{
fmt::print(" Downloaded this session: {:s}\n", strlsize(i));
}
}
if (tr_variantDictFindInt(t, TR_KEY_downloadedEver, &i))
{
if (auto corrupt = int64_t{}; tr_variantDictFindInt(t, TR_KEY_corruptEver, &corrupt) && corrupt != 0)
@ -1032,6 +1050,11 @@ void printDetails(tr_variant* top)
}
}
if (tr_variantDictFindInt(t, TR_KEY_uploadedThisSession, &i))
{
fmt::print(" Uploaded this session: {:s}\n", strlsize(i));
}
if (tr_variantDictFindInt(t, TR_KEY_uploadedEver, &i))
{
fmt::print(" Uploaded: {:s}\n", strlsize(i));