Enable customizing the save statistics time interval

This change extends the Advanced section of the Preferences menu with a new field, allowing changing the time statistics save interval. A zero value will prevent recurrent saving.

This aims to provide the feature requested in issue #21285.

PR #21291.
This commit is contained in:
Burnerelu 2024-09-16 12:16:59 +03:00 committed by GitHub
parent 0ea35c54a3
commit e06b7f8f4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 50 additions and 5 deletions

View file

@ -364,6 +364,8 @@ void AppController::preferencesAction()
data[u"current_interface_address"_s] = session->networkInterfaceAddress();
// Save resume data interval
data[u"save_resume_data_interval"_s] = session->saveResumeDataInterval();
// Save statistics interval
data[u"save_statistics_interval"_s] = static_cast<int>(session->saveStatisticsInterval().count());
// .torrent file size limit
data[u"torrent_file_size_limit"_s] = pref->getTorrentFileSizeLimit();
// Recheck completed torrents
@ -969,6 +971,9 @@ void AppController::setPreferencesAction()
// Save resume data interval
if (hasKey(u"save_resume_data_interval"_s))
session->setSaveResumeDataInterval(it.value().toInt());
// Save statistics interval
if (hasKey(u"save_statistics_interval"_s))
session->setSaveStatisticsInterval(std::chrono::minutes(it.value().toInt()));
// .torrent file size limit
if (hasKey(u"torrent_file_size_limit"_s))
pref->setTorrentFileSizeLimit(it.value().toLongLong());