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> <fieldset>
<legend>$_('Allocation')</legend> <legend>$_('Allocation')</legend>
<label class="fluid"> <label class="fluid">
<input type="radio" name="allocation" /> <input type="radio" name="compact_allocation" value="false" />
$_('Full') $_('Full')
</label><br /> </label><br />
<label class="fluid"> <label class="fluid">
<input type="radio" name="allocation" /> <input type="radio" name="compact_allocation" value="true" />
$_('Compact') $_('Compact')
</label> </label>
</fieldset> </fieldset>
@ -14,16 +14,16 @@
<legend>$_('Bandwidth')</legend> <legend>$_('Bandwidth')</legend>
<label>$_('Max Down Speed'):</label> <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> <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> <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> <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>
<fieldset> <fieldset>
<legend>$_('General')</legend> <legend>$_('General')</legend>
@ -32,7 +32,7 @@
$_('Add in Paused State') $_('Add in Paused State')
</label><br/> </label><br/>
<label class="fluid"> <label class="fluid">
<input type="checkbox" /> <input type="checkbox" name="prioritize_first_last_pieces" />
$_('Prioritize First/Last Pieces') $_('Prioritize First/Last Pieces')
</label> </label>
</fieldset> </fieldset>

View File

@ -287,6 +287,42 @@ Deluge.Widgets.AddTorrent.OptionsTab = new Class({
onLoad: function(e) { onLoad: function(e) {
this.form = this.element.getElement('form'); 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() { getDefaults: function() {
@ -301,10 +337,24 @@ Deluge.Widgets.AddTorrent.OptionsTab = new Class({
'prioritize_first_last_pieces' 'prioritize_first_last_pieces'
] ]
Deluge.Client.get_config_values(keys, { Deluge.Client.get_config_values(keys, {
onSuccess: function(config) { onSuccess: this.onGetConfigSuccess.bindWithEvent(this)
alert(JSON.encode(config)); });
},
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']);
} }
}); });