more improvements to the options tab

This commit is contained in:
Damien Churchill 2009-01-07 18:13:05 +00:00
parent ed03ea52db
commit c48707a654
2 changed files with 59 additions and 9 deletions

View File

@ -2,11 +2,11 @@
<fieldset>
<legend>$_('Allocation')</legend>
<label class="fluid">
<input type="radio" name="allocation" />
<input type="radio" name="compact_allocation" value="false" />
$_('Full')
</label><br />
<label class="fluid">
<input type="radio" name="allocation" />
<input type="radio" name="compact_allocation" value="true" />
$_('Compact')
</label>
</fieldset>
@ -14,16 +14,16 @@
<legend>$_('Bandwidth')</legend>
<label>$_('Max Down Speed'):</label>
<input type="text" name="max_download_speed" class="moouiSpinner" /><br/>
<input type="text" name="max_download_speed_per_torrent" class="moouiSpinner" /><br/>
<label>$_('Max Up Speed'):</label>
<input type="text" name="max_upload_speed" class="moouiSpinner" /><br/>
<input type="text" name="max_upload_speed_per_torrent" class="moouiSpinner" /><br/>
<label>$_('Max Connections'):</label>
<input type="text" name="max_connections" class="moouiSpinner" /><br/>
<input type="text" name="max_connections_per_torrent" class="moouiSpinner" /><br/>
<label>$_('Max Upload Slots'):</label>
<input type="text" name="max_upload_slots" class="moouiSpinner" />
<input type="text" name="max_upload_slots_per_torrent" class="moouiSpinner" />
</fieldset>
<fieldset>
<legend>$_('General')</legend>
@ -32,7 +32,7 @@
$_('Add in Paused State')
</label><br/>
<label class="fluid">
<input type="checkbox" />
<input type="checkbox" name="prioritize_first_last_pieces" />
$_('Prioritize First/Last Pieces')
</label>
</fieldset>

View File

@ -287,6 +287,42 @@ Deluge.Widgets.AddTorrent.OptionsTab = new Class({
onLoad: function(e) {
this.form = this.element.getElement('form');
new Widgets.Spinner(this.form.max_download_speed_per_torrent, {
step: 10,
precision: 1,
limit: {
high: null,
low: -1
}
});
new Widgets.Spinner(this.form.max_upload_speed_per_torrent, {
step: 10,
precision: 1,
limit: {
high: null,
low: -1
}
});
new Widgets.Spinner(this.form.max_connections_per_torrent, {
step: 1,
precision: 0,
limit: {
high: null,
low: -1
}
});
new Widgets.Spinner(this.form.max_upload_slots_per_torrent, {
step: 1,
precision: 0,
limit: {
high: null,
low: -1
}
});
},
getDefaults: function() {
@ -301,10 +337,24 @@ Deluge.Widgets.AddTorrent.OptionsTab = new Class({
'prioritize_first_last_pieces'
]
Deluge.Client.get_config_values(keys, {
onSuccess: function(config) {
alert(JSON.encode(config));
onSuccess: this.onGetConfigSuccess.bindWithEvent(this)
});
},
onGetConfigSuccess: function(config) {
this.form.add_paused.checked = config['add_paused'];
$each(this.form.compact_allocation, function(el) {
if (el.value == config['compact_allocation'].toString()) {
el.checked = true;
} else {
el.checked = false;
}
});
this.form.prioritize_first_last_pieces.checked = config['prioritize_first_last_pieces'];
$$W(this.form.max_download_speed_per_torrent).setValue(config['max_download_speed_per_torrent']);
$$W(this.form.max_upload_speed_per_torrent).setValue(config['max_upload_speed_per_torrent']);
$$W(this.form.max_connections_per_torrent).setValue(config['max_connections_per_torrent']);
$$W(this.form.max_upload_slots_per_torrent).setValue(config['max_upload_slots_per_torrent']);
}
});