Browse Source

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>
adaptive-webui-19844
summer 2 years ago committed by GitHub
parent
commit
3f7376f26b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/gui/advancedsettings.cpp
  2. 5
      src/webui/api/appcontroller.cpp
  3. 10
      src/webui/www/private/views/preferences.html

5
src/gui/advancedsettings.cpp

@ -638,12 +638,13 @@ void AdvancedSettings::loadAdvancedSettings() @@ -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);

5
src/webui/api/appcontroller.cpp

@ -303,6 +303,8 @@ void AppController::preferencesAction() @@ -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() @@ -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());

10
src/webui/www/private/views/preferences.html

@ -953,6 +953,14 @@ @@ -953,6 +953,14 @@
<input type="checkbox" id="recheckTorrentsOnCompletion">
</td>
</tr>
<tr>
<td>
<label for="refreshInterval">QBT_TR(Refresh interval:)QBT_TR[CONTEXT=OptionsDialog]</label>
</td>
<td>
<input type="text" id="refreshInterval" style="width: 15em;" title="QBT_TR(It controls the internal state update interval which in turn will affect UI updates)QBT_TR[CONTEXT=OptionsDialog]">&nbsp;&nbsp;QBT_TR(ms)QBT_TR[CONTEXT=OptionsDialog]
</td>
</tr>
<tr>
<td>
<label for="resolvePeerCountries">QBT_TR(Resolve peer countries:)QBT_TR[CONTEXT=OptionsDialog]</label>
@ -2007,6 +2015,7 @@ @@ -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 @@ @@ -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'));

Loading…
Cancel
Save