From 3f7376f26bcb8613d262ef54bf52c3c39ffc3052 Mon Sep 17 00:00:00 2001 From: summer <79678786+summerqB@users.noreply.github.com> Date: Tue, 19 Jul 2022 03:14:45 +0000 Subject: [PATCH] Add transfer list refresh interval settings to WebUI Specially useful for qbt-nox users PR #16713. Co-authored-by: An0n <79678786+an0n666@users.noreply.github.com> --- src/gui/advancedsettings.cpp | 5 +++-- src/webui/api/appcontroller.cpp | 5 +++++ src/webui/www/private/views/preferences.html | 10 ++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/gui/advancedsettings.cpp b/src/gui/advancedsettings.cpp index 18203761c..1f2dda5f5 100644 --- a/src/gui/advancedsettings.cpp +++ b/src/gui/advancedsettings.cpp @@ -638,12 +638,13 @@ void AdvancedSettings::loadAdvancedSettings() // Recheck completed torrents m_checkBoxRecheckCompleted.setChecked(pref->recheckTorrentsOnCompletion()); addRow(RECHECK_COMPLETED, tr("Recheck torrents on completion"), &m_checkBoxRecheckCompleted); - // Transfer list refresh interval + // Refresh interval m_spinBoxListRefresh.setMinimum(30); m_spinBoxListRefresh.setMaximum(99999); m_spinBoxListRefresh.setValue(session->refreshInterval()); m_spinBoxListRefresh.setSuffix(tr(" ms", " milliseconds")); - addRow(LIST_REFRESH, tr("Transfer list refresh interval"), &m_spinBoxListRefresh); + m_spinBoxListRefresh.setToolTip(tr("It controls the internal state update interval which in turn will affect UI updates")); + addRow(LIST_REFRESH, tr("Refresh interval"), &m_spinBoxListRefresh); // Resolve Peer countries m_checkBoxResolveCountries.setChecked(pref->resolvePeerCountries()); addRow(RESOLVE_COUNTRIES, tr("Resolve peer countries"), &m_checkBoxResolveCountries); diff --git a/src/webui/api/appcontroller.cpp b/src/webui/api/appcontroller.cpp index 660b0e83b..f678831d5 100644 --- a/src/webui/api/appcontroller.cpp +++ b/src/webui/api/appcontroller.cpp @@ -303,6 +303,8 @@ void AppController::preferencesAction() data[u"save_resume_data_interval"_qs] = session->saveResumeDataInterval(); // Recheck completed torrents data[u"recheck_completed_torrents"_qs] = pref->recheckTorrentsOnCompletion(); + // Refresh interval + data[u"refresh_interval"_qs] = session->refreshInterval(); // Resolve peer countries data[u"resolve_peer_countries"_qs] = pref->resolvePeerCountries(); // Reannounce to all trackers when ip/port changed @@ -788,6 +790,9 @@ void AppController::setPreferencesAction() // Recheck completed torrents if (hasKey(u"recheck_completed_torrents"_qs)) pref->recheckTorrentsOnCompletion(it.value().toBool()); + // Refresh interval + if (hasKey(u"refresh_interval"_qs)) + session->setRefreshInterval(it.value().toInt()); // Resolve peer countries if (hasKey(u"resolve_peer_countries"_qs)) pref->resolvePeerCountries(it.value().toBool()); diff --git a/src/webui/www/private/views/preferences.html b/src/webui/www/private/views/preferences.html index cdf3f1f4b..25717ead8 100644 --- a/src/webui/www/private/views/preferences.html +++ b/src/webui/www/private/views/preferences.html @@ -953,6 +953,14 @@ + + + + + +   QBT_TR(ms)QBT_TR[CONTEXT=OptionsDialog] + + @@ -2007,6 +2015,7 @@ updateInterfaceAddresses(pref.current_network_interface, pref.current_interface_address); $('saveResumeDataInterval').setProperty('value', pref.save_resume_data_interval); $('recheckTorrentsOnCompletion').setProperty('checked', pref.recheck_completed_torrents); + $('refreshInterval').setProperty('value', pref.refresh_interval); $('resolvePeerCountries').setProperty('checked', pref.resolve_peer_countries); $('reannounceWhenAddressChanged').setProperty('checked', pref.reannounce_when_address_changed); // libtorrent section @@ -2413,6 +2422,7 @@ settings.set('current_interface_address', $('optionalIPAddressToBind').getProperty('value')); settings.set('save_resume_data_interval', $('saveResumeDataInterval').getProperty('value')); settings.set('recheck_completed_torrents', $('recheckTorrentsOnCompletion').getProperty('checked')); + settings.set('refresh_interval', $('refreshInterval').getProperty('value')); settings.set('resolve_peer_countries', $('resolvePeerCountries').getProperty('checked')); settings.set('reannounce_when_address_changed', $('reannounceWhenAddressChanged').getProperty('checked'));