mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Merge pull request #5227 from ngosang/addtrackers
[WebUI] Expose Add trackers feature
This commit is contained in:
commit
00b5d52eab
@ -143,6 +143,9 @@ QByteArray prefjson::getPreferences()
|
|||||||
data["max_ratio_enabled"] = (pref->getGlobalMaxRatio() >= 0.);
|
data["max_ratio_enabled"] = (pref->getGlobalMaxRatio() >= 0.);
|
||||||
data["max_ratio"] = pref->getGlobalMaxRatio();
|
data["max_ratio"] = pref->getGlobalMaxRatio();
|
||||||
data["max_ratio_act"] = BitTorrent::Session::instance()->maxRatioAction();
|
data["max_ratio_act"] = BitTorrent::Session::instance()->maxRatioAction();
|
||||||
|
// Add trackers
|
||||||
|
data["add_trackers_enabled"] = pref->isAddTrackersEnabled();
|
||||||
|
data["add_trackers"] = pref->getTrackersList();
|
||||||
|
|
||||||
// Web UI
|
// Web UI
|
||||||
// Language
|
// Language
|
||||||
@ -356,6 +359,9 @@ void prefjson::setPreferences(const QString& json)
|
|||||||
if (m.contains("max_ratio_act"))
|
if (m.contains("max_ratio_act"))
|
||||||
BitTorrent::Session::instance()->setMaxRatioAction(
|
BitTorrent::Session::instance()->setMaxRatioAction(
|
||||||
static_cast<MaxRatioAction>(m["max_ratio_act"].toInt()));
|
static_cast<MaxRatioAction>(m["max_ratio_act"].toInt()));
|
||||||
|
// Add trackers
|
||||||
|
pref->setAddTrackersEnabled(m["add_trackers_enabled"].toBool());
|
||||||
|
pref->setTrackersList(m["add_trackers"].toString());
|
||||||
|
|
||||||
// Web UI
|
// Web UI
|
||||||
// Language
|
// Language
|
||||||
|
@ -309,6 +309,12 @@
|
|||||||
<option value="1">QBT_TR(Remove them)QBT_TR</option>
|
<option value="1">QBT_TR(Remove them)QBT_TR</option>
|
||||||
</select>
|
</select>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset class="settings">
|
||||||
|
<legend><input type="checkbox" id="add_trackers_checkbox" onclick="updateAddTrackersEnabled();"/>
|
||||||
|
<label for="add_trackers_checkbox">QBT_TR(Automatically add these trackers to new downloads:)QBT_TR</label></legend>
|
||||||
|
<textarea id="add_trackers_textarea" rows="5" cols="70"></textarea>
|
||||||
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="WebUITab" class="PrefTab invisible">
|
<div id="WebUITab" class="PrefTab invisible">
|
||||||
@ -714,6 +720,14 @@ updateMaxRatioEnabled = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateAddTrackersEnabled = function() {
|
||||||
|
if($('add_trackers_checkbox').getProperty('checked')) {
|
||||||
|
$('add_trackers_textarea').setProperty('disabled', false);
|
||||||
|
} else {
|
||||||
|
$('add_trackers_textarea').setProperty('disabled', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Web UI tab
|
// Web UI tab
|
||||||
updateHttpsSettings = function() {
|
updateHttpsSettings = function() {
|
||||||
if($('use_https_checkbox').getProperty('checked')) {
|
if($('use_https_checkbox').getProperty('checked')) {
|
||||||
@ -973,6 +987,11 @@ loadPreferences = function() {
|
|||||||
$('max_ratio_act').getChildren('option')[max_ratio_act].setAttribute('selected', '');
|
$('max_ratio_act').getChildren('option')[max_ratio_act].setAttribute('selected', '');
|
||||||
updateMaxRatioEnabled();
|
updateMaxRatioEnabled();
|
||||||
|
|
||||||
|
// Add trackers
|
||||||
|
$('add_trackers_checkbox').setProperty('checked', pref.add_trackers_enabled);
|
||||||
|
$('add_trackers_textarea').setProperty('value', pref.add_trackers);
|
||||||
|
updateAddTrackersEnabled();
|
||||||
|
|
||||||
// Web UI tab
|
// Web UI tab
|
||||||
// Language
|
// Language
|
||||||
$('locale_select').setProperty('value', pref.locale);
|
$('locale_select').setProperty('value', pref.locale);
|
||||||
@ -1223,6 +1242,10 @@ applyPreferences = function() {
|
|||||||
settings.set('max_ratio', max_ratio);
|
settings.set('max_ratio', max_ratio);
|
||||||
settings.set('max_ratio_act', $('max_ratio_act').getProperty('value').toInt());
|
settings.set('max_ratio_act', $('max_ratio_act').getProperty('value').toInt());
|
||||||
|
|
||||||
|
// Add trackers
|
||||||
|
settings.set('add_trackers_enabled', $('add_trackers_checkbox').getProperty('checked'));
|
||||||
|
settings.set('add_trackers', $('add_trackers_textarea').getProperty('value'));
|
||||||
|
|
||||||
// Web UI tab
|
// Web UI tab
|
||||||
// Language
|
// Language
|
||||||
settings.set('locale', $('locale_select').getProperty('value'));
|
settings.set('locale', $('locale_select').getProperty('value'));
|
||||||
|
Loading…
Reference in New Issue
Block a user