From c48707a654b6ab11fd5dbaa24d95e10942803901 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Wed, 7 Jan 2009 18:13:05 +0000 Subject: [PATCH] more improvements to the options tab --- .../ajax/render/html/add_torrent_options.html | 14 ++--- .../templates/ajax/static/js/deluge-add.js | 54 ++++++++++++++++++- 2 files changed, 59 insertions(+), 9 deletions(-) diff --git a/deluge/ui/webui/templates/ajax/render/html/add_torrent_options.html b/deluge/ui/webui/templates/ajax/render/html/add_torrent_options.html index e20bf27f2..846f8a40d 100644 --- a/deluge/ui/webui/templates/ajax/render/html/add_torrent_options.html +++ b/deluge/ui/webui/templates/ajax/render/html/add_torrent_options.html @@ -2,11 +2,11 @@
$_('Allocation')
@@ -14,16 +14,16 @@ $_('Bandwidth') -
+
-
+
-
+
- +
$_('General') @@ -32,7 +32,7 @@ $_('Add in Paused State')
diff --git a/deluge/ui/webui/templates/ajax/static/js/deluge-add.js b/deluge/ui/webui/templates/ajax/static/js/deluge-add.js index ed543bdc5..3d0b9527a 100644 --- a/deluge/ui/webui/templates/ajax/static/js/deluge-add.js +++ b/deluge/ui/webui/templates/ajax/static/js/deluge-add.js @@ -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']); } });